2 * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org>
3 * based on work by Toshiharu OHNO <tony-o@iij.ad.jp>
4 * Internet Initiative Japan, Inc (IIJ)
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #define IPCP_MAXCODE CODE_CODEREJ
34 #define TY_COMPPROTO 2
37 /* Domain NameServer and NetBIOS NameServer options */
39 #define TY_PRIMARY_DNS 129
40 #define TY_PRIMARY_NBNS 130
41 #define TY_SECONDARY_DNS 131
42 #define TY_SECONDARY_NBNS 132
43 #define TY_ADJUST_NS 119 /* subtract from NS val for REJECT bit */
46 struct fsm fsm; /* The finite state machine */
50 int slots; /* Maximum VJ slots */
51 unsigned slotcomp : 1; /* Slot compression */
52 unsigned neg : 2; /* VJ negotiation */
55 struct ncprange my_range; /* MYADDR spec */
56 struct in_addr netmask; /* Iface netmask (unused by most OSs) */
57 struct ncprange peer_range; /* HISADDR spec */
58 struct iplist peer_list; /* Ranges of HISADDR values */
60 struct in_addr TriggerAddress; /* Address to suggest in REQ */
61 unsigned HaveTriggerAddress : 1; /* Trigger address specified */
64 struct in_addr dns[2]; /* DNS addresses offered */
65 unsigned dns_neg : 2; /* dns negotiation */
66 struct in_addr nbns[2]; /* NetBIOS NS addresses offered */
69 struct fsm_retry fsm; /* frequency to resend requests */
73 struct slcompress cslc; /* VJ state */
74 struct slstat slstat; /* VJ statistics */
78 unsigned resolver : 1; /* Found resolv.conf ? */
79 unsigned writable : 1; /* Can write resolv.conf ? */
80 struct in_addr dns[2]; /* Current DNS addresses */
81 char *resolv; /* Contents of resolv.conf */
82 char *resolv_nons; /* Contents of resolv.conf without ns */
85 unsigned heis1172 : 1; /* True if he is speaking rfc1172 */
87 unsigned peer_req : 1; /* Any TY_IPADDR REQs from the peer ? */
88 struct in_addr peer_ip; /* IP address he's willing to use */
89 u_int32_t peer_compproto; /* VJ params he's willing to use */
91 struct in_addr ifmask; /* Interface netmask */
93 struct in_addr my_ip; /* IP address I'm willing to use */
94 u_int32_t my_compproto; /* VJ params I'm willing to use */
96 u_int32_t peer_reject; /* Request codes rejected by peer */
97 u_int32_t my_reject; /* Request codes I have rejected */
99 struct pppThroughput throughput; /* throughput statistics */
100 struct mqueue Queue[3]; /* Output packet queues */
103 #define fsm2ipcp(fp) (fp->proto == PROTO_IPCP ? (struct ipcp *)fp : NULL)
104 #define IPCP_QUEUES(ipcp) (sizeof ipcp->Queue / sizeof ipcp->Queue[0])
111 extern void ipcp_Init(struct ipcp *, struct bundle *, struct link *,
112 const struct fsm_parent *);
113 extern void ipcp_Destroy(struct ipcp *);
114 extern void ipcp_Setup(struct ipcp *, u_int32_t);
115 extern void ipcp_SetLink(struct ipcp *, struct link *);
117 extern int ipcp_Show(struct cmdargs const *);
118 extern struct mbuf *ipcp_Input(struct bundle *, struct link *, struct mbuf *);
119 extern void ipcp_AddInOctets(struct ipcp *, int);
120 extern void ipcp_AddOutOctets(struct ipcp *, int);
121 extern int ipcp_UseHisIPaddr(struct bundle *, struct in_addr);
122 extern int ipcp_UseHisaddr(struct bundle *, const char *, int);
123 extern int ipcp_vjset(struct cmdargs const *);
124 extern void ipcp_IfaceAddrAdded(struct ipcp *, const struct iface_addr *);
125 extern void ipcp_IfaceAddrDeleted(struct ipcp *, const struct iface_addr *);
126 extern int ipcp_InterfaceUp(struct ipcp *);
127 extern struct in_addr addr2mask(struct in_addr);
128 extern int ipcp_WriteDNS(struct ipcp *);
129 extern void ipcp_RestoreDNS(struct ipcp *);
130 extern void ipcp_LoadDNS(struct ipcp *);
131 extern size_t ipcp_QueueLen(struct ipcp *);
132 extern int ipcp_PushPacket(struct ipcp *, struct link *);