2 * lib/slip_ac.c This file contains the activation for the
3 * SLIP line disciplines, called from activate_ld().
5 * Version: $Id: slip_ac.c,v 1.3 1998/11/15 20:12:20 freitag Exp $
7 * Author: Bernd 'eckes' Eckenfels
8 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
9 * Copyright 1993 MicroWalt Corporation
11 * Modified by Alan Cox, May 94 to cover NET-3
13 * This program is free software; you can redistribute it
14 * and/or modify it under the terms of the GNU General
15 * Public License as published by the Free Software
16 * Foundation; either version 2 of the License, or (at
17 * your option) any later version.
23 #include <sys/types.h>
24 #include <sys/ioctl.h>
25 #include <sys/socket.h>
26 #include <net/if_arp.h>
35 #include "net-support.h"
36 #include "pathnames.h"
39 /* Set the line discipline of a terminal line. */
40 static int SLIP_set_disc(int fd
, int disc
)
42 if (ioctl(fd
, TIOCSETD
, &disc
) < 0) {
43 fprintf(stderr
, "SLIP_set_disc(%d): %s\n", disc
, strerror(errno
));
50 /* Set the encapsulation type of a terminal line. */
51 static int SLIP_set_encap(int fd
, int encap
)
53 if (ioctl(fd
, SIOCSIFENCAP
, &encap
) < 0) {
54 fprintf(stderr
, "SLIP_set_encap(%d): %s\n", encap
, strerror(errno
));
61 /* Start the SLIP encapsulation on the file descriptor. */
62 int SLIP_activate(int fd
)
64 if (SLIP_set_disc(fd
, N_SLIP
) < 0)
66 if (SLIP_set_encap(fd
, 0) < 0)
72 /* Start the VJ-SLIP encapsulation on the file descriptor. */
73 int CSLIP_activate(int fd
)
75 if (SLIP_set_disc(fd
, N_SLIP
) < 0)
77 if (SLIP_set_encap(fd
, 1) < 0)
83 /* Start the SLIP-6 encapsulation on the file descriptor. */
84 int SLIP6_activate(int fd
)
86 if (SLIP_set_disc(fd
, N_SLIP
) < 0)
88 if (SLIP_set_encap(fd
, 2) < 0)
94 /* Start the VJ-SLIP-6 encapsulation on the file descriptor. */
95 int CSLIP6_activate(int fd
)
97 if (SLIP_set_disc(fd
, N_SLIP
) < 0)
99 if (SLIP_set_encap(fd
, 3) < 0)
105 /* Start adaptive encapsulation on the file descriptor. */
106 int ADAPTIVE_activate(int fd
)
108 if (SLIP_set_disc(fd
, N_SLIP
) < 0)
110 if (SLIP_set_encap(fd
, 8) < 0)
114 #endif /* HAVE_HWSLIP */