Deleted Added
full compact
ipcp.h (58044) ipcp.h (61430)
1/*
2 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
3 *
4 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
5 *
6 * Redistribution and use in source and binary forms are permitted
7 * provided that the above copyright notice and this paragraph are
8 * duplicated in all such forms and that any documentation,
9 * advertising materials, and other materials related to such
10 * distribution and use acknowledge that the software was developed
11 * by the Internet Initiative Japan. The name of the
12 * IIJ may not be used to endorse or promote products derived
13 * from this software without specific prior written permission.
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 *
1/*
2 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
3 *
4 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
5 *
6 * Redistribution and use in source and binary forms are permitted
7 * provided that the above copyright notice and this paragraph are
8 * duplicated in all such forms and that any documentation,
9 * advertising materials, and other materials related to such
10 * distribution and use acknowledge that the software was developed
11 * by the Internet Initiative Japan. The name of the
12 * IIJ may not be used to endorse or promote products derived
13 * from this software without specific prior written permission.
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 *
18 * $FreeBSD: head/usr.sbin/ppp/ipcp.h 58044 2000-03-14 01:47:27Z brian $
18 * $FreeBSD: head/usr.sbin/ppp/ipcp.h 61430 2000-06-08 20:07:48Z brian $
19 *
20 * TODO:
21 */
22
23#define IPCP_MAXCODE CODE_CODEREJ
24
25#define TY_IPADDRS 1
26#define TY_COMPPROTO 2
27#define TY_IPADDR 3
28
29/* Domain NameServer and NetBIOS NameServer options */
30
31#define TY_PRIMARY_DNS 129
32#define TY_PRIMARY_NBNS 130
33#define TY_SECONDARY_DNS 131
34#define TY_SECONDARY_NBNS 132
35#define TY_ADJUST_NS 119 /* subtract from NS val for REJECT bit */
36
37struct sticky_route;
38
39struct in_range {
40 struct in_addr ipaddr;
41 struct in_addr mask;
42 int width;
43};
44
45struct port_range {
46 unsigned nports; /* How many ports */
47 unsigned maxports; /* How many allocated (malloc) ports */
48 u_short *port; /* The actual ports */
49};
50
51struct ipcp {
52 struct fsm fsm; /* The finite state machine */
53
54 struct {
55 struct {
56 int slots; /* Maximum VJ slots */
57 unsigned slotcomp : 1; /* Slot compression */
58 unsigned neg : 2; /* VJ negotiation */
59 } vj;
60
61 struct in_range my_range; /* MYADDR spec */
62 struct in_addr netmask; /* Iface netmask (unused by most OSs) */
63 struct in_range peer_range; /* HISADDR spec */
64 struct iplist peer_list; /* Ranges of HISADDR values */
65
66 u_long sendpipe; /* route sendpipe size */
67 u_long recvpipe; /* route recvpipe size */
68
69 struct in_addr TriggerAddress; /* Address to suggest in REQ */
70 unsigned HaveTriggerAddress : 1; /* Trigger address specified */
71
72 struct {
73 struct in_addr dns[2]; /* DNS addresses offered */
74 unsigned dns_neg : 2; /* dns negotiation */
75 struct in_addr nbns[2]; /* NetBIOS NS addresses offered */
76 } ns;
77
78 struct {
79 struct port_range tcp, udp; /* The range of urgent ports */
19 *
20 * TODO:
21 */
22
23#define IPCP_MAXCODE CODE_CODEREJ
24
25#define TY_IPADDRS 1
26#define TY_COMPPROTO 2
27#define TY_IPADDR 3
28
29/* Domain NameServer and NetBIOS NameServer options */
30
31#define TY_PRIMARY_DNS 129
32#define TY_PRIMARY_NBNS 130
33#define TY_SECONDARY_DNS 131
34#define TY_SECONDARY_NBNS 132
35#define TY_ADJUST_NS 119 /* subtract from NS val for REJECT bit */
36
37struct sticky_route;
38
39struct in_range {
40 struct in_addr ipaddr;
41 struct in_addr mask;
42 int width;
43};
44
45struct port_range {
46 unsigned nports; /* How many ports */
47 unsigned maxports; /* How many allocated (malloc) ports */
48 u_short *port; /* The actual ports */
49};
50
51struct ipcp {
52 struct fsm fsm; /* The finite state machine */
53
54 struct {
55 struct {
56 int slots; /* Maximum VJ slots */
57 unsigned slotcomp : 1; /* Slot compression */
58 unsigned neg : 2; /* VJ negotiation */
59 } vj;
60
61 struct in_range my_range; /* MYADDR spec */
62 struct in_addr netmask; /* Iface netmask (unused by most OSs) */
63 struct in_range peer_range; /* HISADDR spec */
64 struct iplist peer_list; /* Ranges of HISADDR values */
65
66 u_long sendpipe; /* route sendpipe size */
67 u_long recvpipe; /* route recvpipe size */
68
69 struct in_addr TriggerAddress; /* Address to suggest in REQ */
70 unsigned HaveTriggerAddress : 1; /* Trigger address specified */
71
72 struct {
73 struct in_addr dns[2]; /* DNS addresses offered */
74 unsigned dns_neg : 2; /* dns negotiation */
75 struct in_addr nbns[2]; /* NetBIOS NS addresses offered */
76 } ns;
77
78 struct {
79 struct port_range tcp, udp; /* The range of urgent ports */
80 unsigned tos : 1; /* Urgent IPTOS_LOWDELAY packets ? */
80 } urgent;
81
82 struct fsm_retry fsm; /* How often/frequently to resend requests */
83 } cfg;
84
85 struct {
86 struct slcompress cslc; /* VJ state */
87 struct slstat slstat; /* VJ statistics */
88 } vj;
89
90 struct {
91 unsigned resolver : 1; /* Found resolv.conf ? */
92 unsigned writable : 1; /* Can write resolv.conf ? */
93 struct in_addr dns[2]; /* Current DNS addresses */
94 char *resolv; /* Contents of resolv.conf */
95 char *resolv_nons; /* Contents of resolv.conf without ns */
96 } ns;
97
98 struct sticky_route *route; /* List of dynamic routes */
99
100 unsigned heis1172 : 1; /* True if he is speaking rfc1172 */
101
102 struct in_addr peer_ip; /* IP address he's willing to use */
103 u_int32_t peer_compproto; /* VJ params he's willing to use */
104
105 struct in_addr ifmask; /* Interface netmask */
106
107 struct in_addr my_ip; /* IP address I'm willing to use */
108 u_int32_t my_compproto; /* VJ params I'm willing to use */
109
110 struct in_addr dns[2]; /* DNSs to REQ/ACK */
111
112 u_int32_t peer_reject; /* Request codes rejected by peer */
113 u_int32_t my_reject; /* Request codes I have rejected */
114
115 struct pppThroughput throughput; /* throughput statistics */
116 struct mqueue Queue[3]; /* Output packet queues */
117};
118
119#define fsm2ipcp(fp) (fp->proto == PROTO_IPCP ? (struct ipcp *)fp : NULL)
120#define IPCP_QUEUES(ipcp) (sizeof ipcp->Queue / sizeof ipcp->Queue[0])
121
122struct bundle;
123struct link;
124struct cmdargs;
125
126extern void ipcp_Init(struct ipcp *, struct bundle *, struct link *,
127 const struct fsm_parent *);
128extern void ipcp_Destroy(struct ipcp *);
129extern void ipcp_Setup(struct ipcp *, u_int32_t);
130extern void ipcp_SetLink(struct ipcp *, struct link *);
131
132extern int ipcp_Show(struct cmdargs const *);
133extern struct mbuf *ipcp_Input(struct bundle *, struct link *, struct mbuf *);
134extern void ipcp_AddInOctets(struct ipcp *, int);
135extern void ipcp_AddOutOctets(struct ipcp *, int);
136extern int ipcp_UseHisIPaddr(struct bundle *, struct in_addr);
137extern int ipcp_UseHisaddr(struct bundle *, const char *, int);
138extern int ipcp_vjset(struct cmdargs const *);
139extern void ipcp_CleanInterface(struct ipcp *);
140extern int ipcp_InterfaceUp(struct ipcp *);
141extern int ipcp_IsUrgentPort(struct port_range *, u_short, u_short);
142extern void ipcp_AddUrgentPort(struct port_range *, u_short);
143extern void ipcp_RemoveUrgentPort(struct port_range *, u_short);
144extern void ipcp_ClearUrgentPorts(struct port_range *);
145extern struct in_addr addr2mask(struct in_addr);
146extern int ipcp_WriteDNS(struct ipcp *);
147extern void ipcp_RestoreDNS(struct ipcp *);
148extern void ipcp_LoadDNS(struct ipcp *);
149
150#define ipcp_IsUrgentTcpPort(ipcp, p1, p2) \
151 ipcp_IsUrgentPort(&(ipcp)->cfg.urgent.tcp, p1, p2)
152#define ipcp_IsUrgentUdpPort(ipcp, p1, p2) \
153 ipcp_IsUrgentPort(&(ipcp)->cfg.urgent.udp, p1, p2)
154#define ipcp_AddUrgentTcpPort(ipcp, p) \
155 ipcp_AddUrgentPort(&(ipcp)->cfg.urgent.tcp, p)
156#define ipcp_AddUrgentUdpPort(ipcp, p) \
157 ipcp_AddUrgentPort(&(ipcp)->cfg.urgent.udp, p)
158#define ipcp_RemoveUrgentTcpPort(ipcp, p) \
159 ipcp_RemoveUrgentPort(&(ipcp)->cfg.urgent.tcp, p)
160#define ipcp_RemoveUrgentUdpPort(ipcp, p) \
161 ipcp_RemoveUrgentPort(&(ipcp)->cfg.urgent.udp, p)
162#define ipcp_ClearUrgentTcpPorts(ipcp) \
163 ipcp_ClearUrgentPorts(&(ipcp)->cfg.urgent.tcp)
164#define ipcp_ClearUrgentUdpPorts(ipcp) \
165 ipcp_ClearUrgentPorts(&(ipcp)->cfg.urgent.udp)
81 } urgent;
82
83 struct fsm_retry fsm; /* How often/frequently to resend requests */
84 } cfg;
85
86 struct {
87 struct slcompress cslc; /* VJ state */
88 struct slstat slstat; /* VJ statistics */
89 } vj;
90
91 struct {
92 unsigned resolver : 1; /* Found resolv.conf ? */
93 unsigned writable : 1; /* Can write resolv.conf ? */
94 struct in_addr dns[2]; /* Current DNS addresses */
95 char *resolv; /* Contents of resolv.conf */
96 char *resolv_nons; /* Contents of resolv.conf without ns */
97 } ns;
98
99 struct sticky_route *route; /* List of dynamic routes */
100
101 unsigned heis1172 : 1; /* True if he is speaking rfc1172 */
102
103 struct in_addr peer_ip; /* IP address he's willing to use */
104 u_int32_t peer_compproto; /* VJ params he's willing to use */
105
106 struct in_addr ifmask; /* Interface netmask */
107
108 struct in_addr my_ip; /* IP address I'm willing to use */
109 u_int32_t my_compproto; /* VJ params I'm willing to use */
110
111 struct in_addr dns[2]; /* DNSs to REQ/ACK */
112
113 u_int32_t peer_reject; /* Request codes rejected by peer */
114 u_int32_t my_reject; /* Request codes I have rejected */
115
116 struct pppThroughput throughput; /* throughput statistics */
117 struct mqueue Queue[3]; /* Output packet queues */
118};
119
120#define fsm2ipcp(fp) (fp->proto == PROTO_IPCP ? (struct ipcp *)fp : NULL)
121#define IPCP_QUEUES(ipcp) (sizeof ipcp->Queue / sizeof ipcp->Queue[0])
122
123struct bundle;
124struct link;
125struct cmdargs;
126
127extern void ipcp_Init(struct ipcp *, struct bundle *, struct link *,
128 const struct fsm_parent *);
129extern void ipcp_Destroy(struct ipcp *);
130extern void ipcp_Setup(struct ipcp *, u_int32_t);
131extern void ipcp_SetLink(struct ipcp *, struct link *);
132
133extern int ipcp_Show(struct cmdargs const *);
134extern struct mbuf *ipcp_Input(struct bundle *, struct link *, struct mbuf *);
135extern void ipcp_AddInOctets(struct ipcp *, int);
136extern void ipcp_AddOutOctets(struct ipcp *, int);
137extern int ipcp_UseHisIPaddr(struct bundle *, struct in_addr);
138extern int ipcp_UseHisaddr(struct bundle *, const char *, int);
139extern int ipcp_vjset(struct cmdargs const *);
140extern void ipcp_CleanInterface(struct ipcp *);
141extern int ipcp_InterfaceUp(struct ipcp *);
142extern int ipcp_IsUrgentPort(struct port_range *, u_short, u_short);
143extern void ipcp_AddUrgentPort(struct port_range *, u_short);
144extern void ipcp_RemoveUrgentPort(struct port_range *, u_short);
145extern void ipcp_ClearUrgentPorts(struct port_range *);
146extern struct in_addr addr2mask(struct in_addr);
147extern int ipcp_WriteDNS(struct ipcp *);
148extern void ipcp_RestoreDNS(struct ipcp *);
149extern void ipcp_LoadDNS(struct ipcp *);
150
151#define ipcp_IsUrgentTcpPort(ipcp, p1, p2) \
152 ipcp_IsUrgentPort(&(ipcp)->cfg.urgent.tcp, p1, p2)
153#define ipcp_IsUrgentUdpPort(ipcp, p1, p2) \
154 ipcp_IsUrgentPort(&(ipcp)->cfg.urgent.udp, p1, p2)
155#define ipcp_AddUrgentTcpPort(ipcp, p) \
156 ipcp_AddUrgentPort(&(ipcp)->cfg.urgent.tcp, p)
157#define ipcp_AddUrgentUdpPort(ipcp, p) \
158 ipcp_AddUrgentPort(&(ipcp)->cfg.urgent.udp, p)
159#define ipcp_RemoveUrgentTcpPort(ipcp, p) \
160 ipcp_RemoveUrgentPort(&(ipcp)->cfg.urgent.tcp, p)
161#define ipcp_RemoveUrgentUdpPort(ipcp, p) \
162 ipcp_RemoveUrgentPort(&(ipcp)->cfg.urgent.udp, p)
163#define ipcp_ClearUrgentTcpPorts(ipcp) \
164 ipcp_ClearUrgentPorts(&(ipcp)->cfg.urgent.tcp)
165#define ipcp_ClearUrgentUdpPorts(ipcp) \
166 ipcp_ClearUrgentPorts(&(ipcp)->cfg.urgent.udp)
167#define ipcp_ClearUrgentTOS(ipcp) (ipcp)->cfg.urgent.tos = 0;
168#define ipcp_SetUrgentTOS(ipcp) (ipcp)->cfg.urgent.tos = 1;