ipcp.h revision 43313
1285SN/A/*
2396SN/A *	    Written by Toshiharu OHNO (tony-o@iij.ad.jp)
3285SN/A *
4285SN/A *   Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
5285SN/A *
6285SN/A * Redistribution and use in source and binary forms are permitted
7285SN/A * provided that the above copyright notice and this paragraph are
8285SN/A * duplicated in all such forms and that any documentation,
9285SN/A * advertising materials, and other materials related to such
10285SN/A * distribution and use acknowledge that the software was developed
11285SN/A * by the Internet Initiative Japan.  The name of the
12285SN/A * IIJ may not be used to endorse or promote products derived
13285SN/A * from this software without specific prior written permission.
14285SN/A * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15285SN/A * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16285SN/A * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17285SN/A *
18285SN/A * $Id: ipcp.h,v 1.22 1998/10/26 19:07:39 brian Exp $
19285SN/A *
20285SN/A *	TODO:
21285SN/A */
22285SN/A
23285SN/A#define	IPCP_MAXCODE	CODE_CODEREJ
24285SN/A
25285SN/A#define	TY_IPADDRS	1
26367SN/A#define	TY_COMPPROTO	2
27367SN/A#define	TY_IPADDR	3
28285SN/A
29285SN/A/* Domain NameServer and NetBIOS NameServer options */
30285SN/A
31285SN/A#define TY_PRIMARY_DNS		129
32285SN/A#define TY_PRIMARY_NBNS		130
33285SN/A#define TY_SECONDARY_DNS	131
34285SN/A#define TY_SECONDARY_NBNS	132
35285SN/A#define TY_ADJUST_NS		119 /* subtract from NS val for REJECT bit */
36285SN/A
37285SN/A#define addr2mask(addr) (			\
38285SN/A  IN_CLASSA(addr) ?				\
39285SN/A    htonl(IN_CLASSA_NET) :			\
40285SN/A  IN_CLASSB(addr) ?				\
41285SN/A    htonl(IN_CLASSB_NET) : htonl(IN_CLASSC_NET)	\
42285SN/A)
43285SN/A
44285SN/A
45285SN/Astruct sticky_route;
46285SN/A
47285SN/Astruct in_range {
48285SN/A  struct in_addr ipaddr;
49285SN/A  struct in_addr mask;
50285SN/A  int width;
51285SN/A};
52285SN/A
53285SN/Astruct ipcp {
54285SN/A  struct fsm fsm;			/* The finite state machine */
55285SN/A
56285SN/A  struct {
57285SN/A    struct {
58285SN/A      int slots;			/* Maximum VJ slots */
59285SN/A      unsigned slotcomp : 1;		/* Slot compression */
60285SN/A      unsigned neg : 2;			/* VJ negotiation */
61285SN/A    } vj;
62285SN/A
63285SN/A    struct in_range  my_range;		/* MYADDR spec */
64285SN/A    struct in_addr   netmask;		/* Iface netmask (unused by most OSs) */
65285SN/A    struct in_range  peer_range;	/* HISADDR spec */
66285SN/A    struct iplist    peer_list;		/* Ranges of HISADDR values */
67285SN/A
68285SN/A    u_long sendpipe;			/* route sendpipe size */
69285SN/A    u_long recvpipe;			/* route recvpipe size */
70285SN/A
71285SN/A    struct in_addr   TriggerAddress;	/* Address to suggest in REQ */
72285SN/A    unsigned HaveTriggerAddress : 1;	/* Trigger address specified */
73285SN/A
74285SN/A    struct {
75285SN/A      struct in_addr dns[2];		/* DNS addresses offered */
76285SN/A      unsigned dns_neg : 2;		/* dns negotiation */
77285SN/A      struct in_addr nbns[2];		/* NetBIOS NS addresses offered */
78285SN/A    } ns;
79285SN/A
80285SN/A    u_int fsmretry;			/* FSM retry frequency */
81285SN/A  } cfg;
82285SN/A
83396SN/A  struct {
84396SN/A    struct slcompress cslc;		/* VJ state */
85285SN/A    struct slstat slstat;		/* VJ statistics */
86285SN/A  } vj;
87285SN/A
88285SN/A  struct sticky_route *route;		/* List of dynamic routes */
89285SN/A
90285SN/A  unsigned heis1172 : 1;		/* True if he is speaking rfc1172 */
91285SN/A
92285SN/A  struct in_addr peer_ip;		/* IP address he's willing to use */
93285SN/A  u_int32_t peer_compproto;		/* VJ params he's willing to use */
94285SN/A
95285SN/A  struct in_addr ifmask;		/* Interface netmask */
96285SN/A
97  struct in_addr my_ip;			/* IP address I'm willing to use */
98  u_int32_t my_compproto;		/* VJ params I'm willing to use */
99
100  u_int32_t peer_reject;		/* Request codes rejected by peer */
101  u_int32_t my_reject;			/* Request codes I have rejected */
102
103  struct pppThroughput throughput;	/* throughput statistics */
104  struct mqueue Queue[PRI_FAST + 1];	/* Output packet queues */
105};
106
107#define fsm2ipcp(fp) (fp->proto == PROTO_IPCP ? (struct ipcp *)fp : NULL)
108
109struct bundle;
110struct link;
111struct cmdargs;
112
113extern void ipcp_Init(struct ipcp *, struct bundle *, struct link *,
114                      const struct fsm_parent *);
115extern void ipcp_Setup(struct ipcp *, u_int32_t);
116extern void ipcp_SetLink(struct ipcp *, struct link *);
117
118extern int  ipcp_Show(struct cmdargs const *);
119extern void ipcp_Input(struct ipcp *, struct bundle *, struct mbuf *);
120extern void ipcp_AddInOctets(struct ipcp *, int);
121extern void ipcp_AddOutOctets(struct ipcp *, int);
122extern int  ipcp_UseHisIPaddr(struct bundle *, struct in_addr);
123extern int  ipcp_UseHisaddr(struct bundle *, const char *, int);
124extern int  ipcp_vjset(struct cmdargs const *);
125extern void ipcp_CleanInterface(struct ipcp *);
126extern int  ipcp_InterfaceUp(struct ipcp *);
127