1 /*
2  * ipcp.h - IP Control Protocol definitions.
3  *
4  * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  *
18  * 3. The name "Carnegie Mellon University" must not be used to
19  *    endorse or promote products derived from this software without
20  *    prior written permission. For permission or any legal
21  *    details, please contact
22  *      Office of Technology Transfer
23  *      Carnegie Mellon University
24  *      5000 Forbes Avenue
25  *      Pittsburgh, PA  15213-3890
26  *      (412) 268-4387, fax: (412) 268-7395
27  *      tech-transfer@andrew.cmu.edu
28  *
29  * 4. Redistributions of any form whatsoever must retain the following
30  *    acknowledgment:
31  *    "This product includes software developed by Computing Services
32  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
33  *
34  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
35  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
36  * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
37  * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
38  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
39  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
40  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
41  *
42  * $Id: ipcp.h,v 1.14 2002/12/04 23:03:32 paulus Exp $
43  */
44 
45 #include "netif/ppp/ppp_opts.h"
46 #if PPP_SUPPORT && PPP_IPV4_SUPPORT /* don't build if not configured for use in lwipopts.h */
47 
48 #ifndef IPCP_H
49 #define	IPCP_H
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 /*
56  * Options.
57  */
58 #define CI_ADDRS	1	/* IP Addresses */
59 #if VJ_SUPPORT
60 #define CI_COMPRESSTYPE	2	/* Compression Type */
61 #endif /* VJ_SUPPORT */
62 #define	CI_ADDR		3
63 
64 #if LWIP_DNS
65 #define CI_MS_DNS1      129	/* Primary DNS value */
66 #define CI_MS_DNS2      131     /* Secondary DNS value */
67 #endif /* LWIP_DNS */
68 #if 0 /* UNUSED - WINS */
69 #define CI_MS_WINS1     130     /* Primary WINS value */
70 #define CI_MS_WINS2     132	/* Secondary WINS value */
71 #endif /* UNUSED - WINS */
72 
73 #if VJ_SUPPORT
74 #define MAX_STATES 16		/* from slcompress.h */
75 
76 #define IPCP_VJMODE_OLD 1	/* "old" mode (option # = 0x0037) */
77 #define IPCP_VJMODE_RFC1172 2	/* "old-rfc"mode (option # = 0x002d) */
78 #define IPCP_VJMODE_RFC1332 3	/* "new-rfc"mode (option # = 0x002d, */
79                                 /*  maxslot and slot number compression) */
80 
81 #define IPCP_VJ_COMP 0x002d	/* current value for VJ compression option*/
82 #define IPCP_VJ_COMP_OLD 0x0037	/* "old" (i.e, broken) value for VJ */
83 				/* compression option*/
84 #endif /* VJ_SUPPORT */
85 
86 typedef struct ipcp_options {
87     unsigned int neg_addr               :1; /* Negotiate IP Address? */
88     unsigned int old_addrs              :1; /* Use old (IP-Addresses) option? */
89     unsigned int req_addr               :1; /* Ask peer to send IP address? */
90 #if 0 /* UNUSED */
91     unsigned int default_route          :1; /* Assign default route through interface? */
92     unsigned int replace_default_route  :1; /* Replace default route through interface? */
93 #endif /* UNUSED */
94 #if 0 /* UNUSED - PROXY ARP */
95     unsigned int proxy_arp              :1; /* Make proxy ARP entry for peer? */
96 #endif /* UNUSED - PROXY ARP */
97 #if VJ_SUPPORT
98     unsigned int neg_vj                 :1; /* Van Jacobson Compression? */
99     unsigned int old_vj                 :1; /* use old (short) form of VJ option? */
100     unsigned int cflag                  :1;
101 #endif /* VJ_SUPPORT */
102     unsigned int accept_local           :1; /* accept peer's value for ouraddr */
103     unsigned int accept_remote          :1; /* accept peer's value for hisaddr */
104 #if LWIP_DNS
105     unsigned int req_dns1               :1; /* Ask peer to send primary DNS address? */
106     unsigned int req_dns2               :1; /* Ask peer to send secondary DNS address? */
107 #endif /* LWIP_DNS */
108 
109     u32_t ouraddr, hisaddr;	/* Addresses in NETWORK BYTE ORDER */
110 #if LWIP_DNS
111     u32_t dnsaddr[2];	/* Primary and secondary MS DNS entries */
112 #endif /* LWIP_DNS */
113 #if 0 /* UNUSED - WINS */
114     u32_t winsaddr[2];	/* Primary and secondary MS WINS entries */
115 #endif /* UNUSED - WINS */
116 
117 #if VJ_SUPPORT
118     u16_t vj_protocol;		/* protocol value to use in VJ option */
119     u8_t  maxslotindex;		/* values for RFC1332 VJ compression neg. */
120 #endif /* VJ_SUPPORT */
121 } ipcp_options;
122 
123 #if 0 /* UNUSED, already defined by lwIP */
124 char *ip_ntoa (u32_t);
125 #endif /* UNUSED, already defined by lwIP */
126 
127 extern const struct protent ipcp_protent;
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #endif /* IPCP_H */
134 #endif /* PPP_SUPPORT && PPP_IPV4_SUPPORT */
135