kernel - swapcache - Fix snocache and cache flags propagation, fix PG_NOTMETA
[dragonfly.git] / usr.sbin / ppp / ipcp.h
blob48c3ea264cec96ff6877bd2e054c4559dcf284e4
1 /*-
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)
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
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
26 * SUCH DAMAGE.
28 * $FreeBSD: src/usr.sbin/ppp/ipcp.h,v 1.30.2.5 2002/09/01 02:12:27 brian Exp $
29 * $DragonFly: src/usr.sbin/ppp/ipcp.h,v 1.2 2003/06/17 04:30:00 dillon Exp $
32 #define IPCP_MAXCODE CODE_CODEREJ
34 #define TY_IPADDRS 1
35 #define TY_COMPPROTO 2
36 #define TY_IPADDR 3
38 /* Domain NameServer and NetBIOS NameServer options */
40 #define TY_PRIMARY_DNS 129
41 #define TY_PRIMARY_NBNS 130
42 #define TY_SECONDARY_DNS 131
43 #define TY_SECONDARY_NBNS 132
44 #define TY_ADJUST_NS 119 /* subtract from NS val for REJECT bit */
46 struct ipcp {
47 struct fsm fsm; /* The finite state machine */
49 struct {
50 struct {
51 int slots; /* Maximum VJ slots */
52 unsigned slotcomp : 1; /* Slot compression */
53 unsigned neg : 2; /* VJ negotiation */
54 } vj;
56 struct ncprange my_range; /* MYADDR spec */
57 struct in_addr netmask; /* Iface netmask (unused by most OSs) */
58 struct ncprange peer_range; /* HISADDR spec */
59 struct iplist peer_list; /* Ranges of HISADDR values */
61 struct in_addr TriggerAddress; /* Address to suggest in REQ */
62 unsigned HaveTriggerAddress : 1; /* Trigger address specified */
64 struct {
65 struct in_addr dns[2]; /* DNS addresses offered */
66 unsigned dns_neg : 2; /* dns negotiation */
67 struct in_addr nbns[2]; /* NetBIOS NS addresses offered */
68 } ns;
70 struct fsm_retry fsm; /* frequency to resend requests */
71 } cfg;
73 struct {
74 struct slcompress cslc; /* VJ state */
75 struct slstat slstat; /* VJ statistics */
76 } vj;
78 struct {
79 unsigned resolver : 1; /* Found resolv.conf ? */
80 unsigned writable : 1; /* Can write resolv.conf ? */
81 struct in_addr dns[2]; /* Current DNS addresses */
82 char *resolv; /* Contents of resolv.conf */
83 char *resolv_nons; /* Contents of resolv.conf without ns */
84 } ns;
86 unsigned heis1172 : 1; /* True if he is speaking rfc1172 */
88 unsigned peer_req : 1; /* Any TY_IPADDR REQs from the peer ? */
89 struct in_addr peer_ip; /* IP address he's willing to use */
90 u_int32_t peer_compproto; /* VJ params he's willing to use */
92 struct in_addr ifmask; /* Interface netmask */
94 struct in_addr my_ip; /* IP address I'm willing to use */
95 u_int32_t my_compproto; /* VJ params I'm willing to use */
97 u_int32_t peer_reject; /* Request codes rejected by peer */
98 u_int32_t my_reject; /* Request codes I have rejected */
100 struct pppThroughput throughput; /* throughput statistics */
101 struct mqueue Queue[3]; /* Output packet queues */
104 #define fsm2ipcp(fp) (fp->proto == PROTO_IPCP ? (struct ipcp *)fp : NULL)
105 #define IPCP_QUEUES(ipcp) (sizeof ipcp->Queue / sizeof ipcp->Queue[0])
107 struct bundle;
108 struct link;
109 struct cmdargs;
110 struct iface_addr;
112 extern void ipcp_Init(struct ipcp *, struct bundle *, struct link *,
113 const struct fsm_parent *);
114 extern void ipcp_Destroy(struct ipcp *);
115 extern void ipcp_Setup(struct ipcp *, u_int32_t);
116 extern void ipcp_SetLink(struct ipcp *, struct link *);
118 extern int ipcp_Show(struct cmdargs const *);
119 extern struct mbuf *ipcp_Input(struct bundle *, struct link *, struct mbuf *);
120 extern void ipcp_AddInOctets(struct ipcp *, int);
121 extern void ipcp_AddOutOctets(struct ipcp *, int);
122 extern int ipcp_UseHisIPaddr(struct bundle *, struct in_addr);
123 extern int ipcp_UseHisaddr(struct bundle *, const char *, int);
124 extern int ipcp_vjset(struct cmdargs const *);
125 extern void ipcp_IfaceAddrAdded(struct ipcp *, const struct iface_addr *);
126 extern void ipcp_IfaceAddrDeleted(struct ipcp *, const struct iface_addr *);
127 extern int ipcp_InterfaceUp(struct ipcp *);
128 extern struct in_addr addr2mask(struct in_addr);
129 extern int ipcp_WriteDNS(struct ipcp *);
130 extern void ipcp_RestoreDNS(struct ipcp *);
131 extern void ipcp_LoadDNS(struct ipcp *);
132 extern size_t ipcp_QueueLen(struct ipcp *);
133 extern int ipcp_PushPacket(struct ipcp *, struct link *);