Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / sys / netgraph / ppp / ng_ppp.h
1
2 /*
3  * ng_ppp.h
4  *
5  * Copyright (c) 1996-2000 Whistle Communications, Inc.
6  * All rights reserved.
7  * 
8  * Subject to the following obligations and disclaimer of warranty, use and
9  * redistribution of this software, in source or object code forms, with or
10  * without modifications are expressly permitted by Whistle Communications;
11  * provided, however, that:
12  * 1. Any and all reproductions of the source or object code must include the
13  *    copyright notice above and the following disclaimer of warranties; and
14  * 2. No rights are granted, in any manner or form, to use Whistle
15  *    Communications, Inc. trademarks, including the mark "WHISTLE
16  *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
17  *    such appears in the above copyright notice or in the software.
18  * 
19  * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
20  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
21  * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
22  * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
24  * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
25  * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
26  * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
27  * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
28  * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
29  * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
30  * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
31  * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34  * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35  * OF SUCH DAMAGE.
36  *
37  * Author: Archie Cobbs <archie@freebsd.org>
38  *
39  * $FreeBSD: src/sys/netgraph/ng_ppp.h,v 1.5.2.4 2002/07/02 23:44:03 archie Exp $
40  * $DragonFly: src/sys/netgraph/ppp/ng_ppp.h,v 1.2 2003/06/17 04:28:51 dillon Exp $
41  * $Whistle: ng_ppp.h,v 1.8 1999/01/25 02:40:02 archie Exp $
42  */
43
44 #ifndef _NETGRAPH_PPP_H_
45 #define _NETGRAPH_PPP_H_
46
47 /* Node type name and magic cookie */
48 #define NG_PPP_NODE_TYPE        "ppp"
49 #define NGM_PPP_COOKIE          940897795
50
51 /* Maximum number of supported links */
52 #define NG_PPP_MAX_LINKS        16
53
54 /* Pseudo-link number representing the multi-link bundle */
55 #define NG_PPP_BUNDLE_LINKNUM   0xffff
56
57 /* Max allowable link latency (miliseconds) and bandwidth (bytes/second/10) */
58 #define NG_PPP_MAX_LATENCY      1000            /* 1 second */
59 #define NG_PPP_MAX_BANDWIDTH    125000          /* 10 Mbits / second */
60
61 /* Hook names */
62 #define NG_PPP_HOOK_BYPASS      "bypass"        /* unknown protocols */
63 #define NG_PPP_HOOK_COMPRESS    "compress"      /* outgoing compression */
64 #define NG_PPP_HOOK_DECOMPRESS  "decompress"    /* incoming decompression */
65 #define NG_PPP_HOOK_ENCRYPT     "encrypt"       /* outgoing encryption */
66 #define NG_PPP_HOOK_DECRYPT     "decrypt"       /* incoming decryption */
67 #define NG_PPP_HOOK_VJC_IP      "vjc_ip"        /* VJC raw IP */
68 #define NG_PPP_HOOK_VJC_COMP    "vjc_vjcomp"    /* VJC compressed TCP */
69 #define NG_PPP_HOOK_VJC_UNCOMP  "vjc_vjuncomp"  /* VJC uncompressed TCP */
70 #define NG_PPP_HOOK_VJC_VJIP    "vjc_vjip"      /* VJC uncompressed IP */
71 #define NG_PPP_HOOK_INET        "inet"          /* IP packet data */
72 #define NG_PPP_HOOK_ATALK       "atalk"         /* AppleTalk packet data */
73 #define NG_PPP_HOOK_IPX         "ipx"           /* IPX packet data */
74 #define NG_PPP_HOOK_IPV6        "ipv6"          /* IPv6 packet data */
75
76 #define NG_PPP_HOOK_LINK_PREFIX "link"          /* append decimal link number */
77
78 /* Netgraph commands */
79 enum {
80         NGM_PPP_SET_CONFIG = 1,         /* takes struct ng_ppp_node_conf */
81         NGM_PPP_GET_CONFIG,             /* returns ng_ppp_node_conf */
82         NGM_PPP_GET_MP_STATE,           /* returns ng_ppp_mp_state */
83         NGM_PPP_GET_LINK_STATS,         /* takes link #, returns stats struct */
84         NGM_PPP_CLR_LINK_STATS,         /* takes link #, clears link stats */
85         NGM_PPP_GETCLR_LINK_STATS,      /* takes link #, returns & clrs stats */
86 };
87
88 /* Multi-link sequence number state (for debugging) */
89 struct ng_ppp_mp_state {
90         int32_t         rseq[NG_PPP_MAX_LINKS]; /* highest rec'd MP seq # */
91         int32_t         mseq;                   /* min rseq[i] */
92         int32_t         xseq;                   /* next xmit MP seq # */
93 };
94
95 /* Keep this in sync with the above structure definition */
96 #define NG_PPP_MP_STATE_TYPE_INFO(atype)        {               \
97           { "rseq",     (atype)                 },              \
98           { "mseq",     &ng_parse_hint32_type   },              \
99           { "xseq",     &ng_parse_hint32_type   },              \
100           { NULL }                                              \
101 }
102
103 /* Per-link config structure */
104 struct ng_ppp_link_conf {
105         u_char          enableLink;     /* enable this link */
106         u_char          enableProtoComp;/* enable protocol field compression */
107         u_char          enableACFComp;  /* enable addr/ctrl field compression */
108         u_int16_t       mru;            /* peer MRU */
109         u_int32_t       latency;        /* link latency (in milliseconds) */
110         u_int32_t       bandwidth;      /* link bandwidth (in bytes/second) */
111 };
112
113 /* Keep this in sync with the above structure definition */
114 #define NG_PPP_LINK_TYPE_INFO   {                               \
115           { "enableLink",       &ng_parse_uint8_type    },      \
116           { "enableProtoComp",  &ng_parse_uint8_type    },      \
117           { "enableACFComp",    &ng_parse_uint8_type    },      \
118           { "mru",              &ng_parse_uint16_type   },      \
119           { "latency",          &ng_parse_uint32_type   },      \
120           { "bandwidth",        &ng_parse_uint32_type   },      \
121           { NULL }                                              \
122 }
123
124 /* Bundle config structure */
125 struct ng_ppp_bund_conf {
126         u_int16_t       mrru;                   /* multilink peer MRRU */
127         u_char          enableMultilink;        /* enable multilink */
128         u_char          recvShortSeq;           /* recv multilink short seq # */
129         u_char          xmitShortSeq;           /* xmit multilink short seq # */
130         u_char          enableRoundRobin;       /* xmit whole packets */
131         u_char          enableIP;               /* enable IP data flow */
132         u_char          enableIPv6;             /* enable IPv6 data flow */
133         u_char          enableAtalk;            /* enable AppleTalk data flow */
134         u_char          enableIPX;              /* enable IPX data flow */
135         u_char          enableCompression;      /* enable PPP compression */
136         u_char          enableDecompression;    /* enable PPP decompression */
137         u_char          enableEncryption;       /* enable PPP encryption */
138         u_char          enableDecryption;       /* enable PPP decryption */
139         u_char          enableVJCompression;    /* enable VJ compression */
140         u_char          enableVJDecompression;  /* enable VJ decompression */
141 };
142
143 /* Keep this in sync with the above structure definition */
144 #define NG_PPP_BUND_TYPE_INFO   {                                       \
145           { "mrru",                     &ng_parse_uint16_type   },      \
146           { "enableMultilink",          &ng_parse_uint8_type    },      \
147           { "recvShortSeq",             &ng_parse_uint8_type    },      \
148           { "xmitShortSeq",             &ng_parse_uint8_type    },      \
149           { "enableRoundRobin",         &ng_parse_uint8_type    },      \
150           { "enableIP",                 &ng_parse_uint8_type    },      \
151           { "enableIPv6",               &ng_parse_uint8_type    },      \
152           { "enableAtalk",              &ng_parse_uint8_type    },      \
153           { "enableIPX",                &ng_parse_uint8_type    },      \
154           { "enableCompression",        &ng_parse_uint8_type    },      \
155           { "enableDecompression",      &ng_parse_uint8_type    },      \
156           { "enableEncryption",         &ng_parse_uint8_type    },      \
157           { "enableDecryption",         &ng_parse_uint8_type    },      \
158           { "enableVJCompression",      &ng_parse_uint8_type    },      \
159           { "enableVJDecompression",    &ng_parse_uint8_type    },      \
160           { NULL }                                                      \
161 }
162
163 /* Total node config structure */
164 struct ng_ppp_node_conf {
165         struct ng_ppp_bund_conf bund;
166         struct ng_ppp_link_conf links[NG_PPP_MAX_LINKS];
167 };
168
169 /* Keep this in sync with the above structure definition */
170 #define NG_PPP_CONFIG_TYPE_INFO(bctype, arytype)        {       \
171           { "bund",             (bctype)        },              \
172           { "links",            (arytype)       },              \
173           { NULL }                                              \
174 }
175
176 /* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */
177 struct ng_ppp_link_stat {
178         u_int32_t xmitFrames;           /* xmit frames on link */
179         u_int32_t xmitOctets;           /* xmit octets on link */
180         u_int32_t recvFrames;           /* recv frames on link */
181         u_int32_t recvOctets;           /* recv octets on link */
182         u_int32_t badProtos;            /* frames rec'd with bogus protocol */
183         u_int32_t runts;                /* Too short MP fragments */
184         u_int32_t dupFragments;         /* MP frames with duplicate seq # */
185         u_int32_t dropFragments;        /* MP fragments we had to drop */
186 };
187
188 /* Keep this in sync with the above structure definition */
189 #define NG_PPP_STATS_TYPE_INFO  {                               \
190           { "xmitFrames",       &ng_parse_uint32_type   },      \
191           { "xmitOctets",       &ng_parse_uint32_type   },      \
192           { "recvFrames",       &ng_parse_uint32_type   },      \
193           { "recvOctets",       &ng_parse_uint32_type   },      \
194           { "badProtos",        &ng_parse_uint32_type   },      \
195           { "runts",            &ng_parse_uint32_type   },      \
196           { "dupFragments",     &ng_parse_uint32_type   },      \
197           { "dropFragments",    &ng_parse_uint32_type   },      \
198           { NULL }                                              \
199 }
200
201 #endif /* _NETGRAPH_PPP_H_ */