more debug output
[linux-2.4.git] / include / net / syncppp.h
1 /*
2  * Defines for synchronous PPP/Cisco link level subroutines.
3  *
4  * Copyright (C) 1994 Cronyx Ltd.
5  * Author: Serge Vakulenko, <vak@zebub.msk.su>
6  *
7  * This software is distributed with NO WARRANTIES, not even the implied
8  * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9  *
10  * Authors grant any other persons or organizations permission to use
11  * or modify this software as long as this message is kept with the software,
12  * all derivative works or modified versions.
13  *
14  * Version 1.7, Wed Jun  7 22:12:02 MSD 1995
15  *
16  *
17  *
18  */
19
20 #ifndef _SYNCPPP_H_
21 #define _SYNCPPP_H_ 1
22
23 #ifdef __KERNEL__
24 struct slcp {
25         u16     state;          /* state machine */
26         u32     magic;          /* local magic number */
27         u_char  echoid;         /* id of last keepalive echo request */
28         u_char  confid;         /* id of last configuration request */
29 };
30
31 struct sipcp {
32         u16     state;          /* state machine */
33         u_char  confid;         /* id of last configuration request */
34 };
35
36 struct sppp 
37 {
38         struct sppp *   pp_next;        /* next interface in keepalive list */
39         u32             pp_flags;       /* use Cisco protocol instead of PPP */
40         u16             pp_alivecnt;    /* keepalive packets counter */
41         u16             pp_loopcnt;     /* loopback detection counter */
42         u32             pp_seq;         /* local sequence number */
43         u32             pp_rseq;        /* remote sequence number */
44         struct slcp     lcp;            /* LCP params */
45         struct sipcp    ipcp;           /* IPCP params */
46         u32             ibytes,obytes;  /* Bytes in/out */
47         u32             ipkts,opkts;    /* Packets in/out */
48         struct timer_list       pp_timer;
49         struct net_device       *pp_if;
50         char            pp_link_state;  /* Link status */
51 };
52
53 struct ppp_device
54 {       
55         struct net_device *dev; /* Network device pointer */
56         struct sppp sppp;       /* Synchronous PPP */
57 };
58
59 #define sppp_of(dev)    \
60             (&((struct ppp_device *)(*(unsigned long *)((dev)->priv)))->sppp)
61
62 #define PP_KEEPALIVE    0x01    /* use keepalive protocol */
63 #define PP_CISCO        0x02    /* use Cisco protocol instead of PPP */
64 #define PP_TIMO         0x04    /* cp_timeout routine active */
65 #define PP_DEBUG        0x08
66
67 #define PPP_MTU          1500    /* max. transmit unit */
68
69 #define LCP_STATE_CLOSED        0       /* LCP state: closed (conf-req sent) */
70 #define LCP_STATE_ACK_RCVD      1       /* LCP state: conf-ack received */
71 #define LCP_STATE_ACK_SENT      2       /* LCP state: conf-ack sent */
72 #define LCP_STATE_OPENED        3       /* LCP state: opened */
73
74 #define IPCP_STATE_CLOSED       0       /* IPCP state: closed (conf-req sent) */
75 #define IPCP_STATE_ACK_RCVD     1       /* IPCP state: conf-ack received */
76 #define IPCP_STATE_ACK_SENT     2       /* IPCP state: conf-ack sent */
77 #define IPCP_STATE_OPENED       3       /* IPCP state: opened */
78
79 #define SPPP_LINK_DOWN          0       /* link down - no keepalive */
80 #define SPPP_LINK_UP            1       /* link is up - keepalive ok */
81
82 void sppp_attach (struct ppp_device *pd);
83 void sppp_detach (struct net_device *dev);
84 void sppp_input (struct net_device *dev, struct sk_buff *m);
85 int sppp_do_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd);
86 struct sk_buff *sppp_dequeue (struct net_device *dev);
87 int sppp_isempty (struct net_device *dev);
88 void sppp_flush (struct net_device *dev);
89 int sppp_open (struct net_device *dev);
90 int sppp_reopen (struct net_device *dev);
91 int sppp_close (struct net_device *dev);
92 #endif
93
94 #define SPPPIOCCISCO    (SIOCDEVPRIVATE)
95 #define SPPPIOCPPP      (SIOCDEVPRIVATE+1)
96 #define SPPPIOCDEBUG    (SIOCDEVPRIVATE+2)
97 #define SPPPIOCSFLAGS   (SIOCDEVPRIVATE+3)
98 #define SPPPIOCGFLAGS   (SIOCDEVPRIVATE+4)
99
100 #endif /* _SYNCPPP_H_ */