xref: /freebsd/usr.sbin/ppp/ipcp.h (revision 2764b86afdc99a30f4b1a4da2c04db8aa7aa785d)
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  * $Id: ipcp.h,v 1.18.2.19 1998/04/05 19:02:42 brian Exp $
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 
36 struct in_range {
37   struct in_addr ipaddr;
38   struct in_addr mask;
39   int width;
40 };
41 
42 struct ipcp {
43   struct fsm fsm;			/* The finite state machine */
44 
45   struct {
46     int VJInitSlots;			/* Maximum VJ slots */
47     unsigned VJInitComp : 1;		/* Slot compression */
48 
49     struct in_range  my_range;		/* MYADDR spec */
50     struct in_addr   netmask;		/* netmask (unused by most OSs) */
51     struct in_range  peer_range;	/* HISADDR spec */
52     struct iplist    peer_list;		/* Ranges of HISADDR values */
53 
54     struct in_addr   TriggerAddress;	/* Address to suggest in REQ */
55     unsigned HaveTriggerAddress : 1;	/* Trigger address specified */
56 
57 #ifndef NOMSEXT
58     struct in_addr ns_entries[2];	/* DNS addresses offered */
59     struct in_addr nbns_entries[2];	/* NetBIOS NS addresses offered */
60 #endif
61     u_int fsmretry;			/* FSM retry frequency */
62   } cfg;
63 
64   struct {
65     struct slcompress cslc;		/* VJ state */
66     struct slstat slstat;		/* VJ statistics */
67   } vj;
68 
69 
70   unsigned heis1172 : 1;		/* True if he is speaking rfc1172 */
71 
72   struct in_addr peer_ip;		/* IP address he's willing to use */
73   u_int32_t peer_compproto;		/* VJ params he's willing to use */
74 
75   struct in_addr my_ip;			/* IP address I'm willing to use */
76   u_int32_t my_compproto;		/* VJ params I'm willing to use */
77 
78   u_int32_t peer_reject;		/* Request codes rejected by peer */
79   u_int32_t my_reject;			/* Request codes I have rejected */
80 
81   struct in_addr my_ifip;		/* My configured interface address */
82   struct in_addr peer_ifip;		/* My congigured destination address */
83 
84   struct pppThroughput throughput;	/* throughput statistics */
85 };
86 
87 #define fsm2ipcp(fp) (fp->proto == PROTO_IPCP ? (struct ipcp *)fp : NULL)
88 
89 struct bundle;
90 struct link;
91 struct cmdargs;
92 
93 extern void ipcp_Init(struct ipcp *, struct bundle *, struct link *l,
94                       const struct fsm_parent *);
95 extern void ipcp_Setup(struct ipcp *);
96 
97 extern int  ReportIpcpStatus(struct cmdargs const *);
98 extern void IpcpInput(struct ipcp *, struct mbuf *);
99 extern void ipcp_AddInOctets(struct ipcp *, int);
100 extern void ipcp_AddOutOctets(struct ipcp *, int);
101 extern int  UseHisaddr(struct bundle *, const char *, int);
102 extern int  SetInitVJ(struct cmdargs const *);
103 extern void IpcpCleanInterface(struct fsm *);
104