No empty .Rs/.Re
[netbsd-mini2440.git] / sys / net / if_spppvar.h
blob0e0490bc16956102dc11c482545bc3c8c7fbb96d
1 /* $NetBSD: if_spppvar.h,v 1.15 2008/08/22 12:13:18 martin Exp $ */
3 #ifndef _NET_IF_SPPPVAR_H_
4 #define _NET_IF_SPPPVAR_H_
6 /*
7 * Defines for synchronous PPP/Cisco link level subroutines.
9 * Copyright (C) 1994 Cronyx Ltd.
10 * Author: Serge Vakulenko, <vak@cronyx.ru>
12 * Heavily revamped to conform to RFC 1661.
13 * Copyright (C) 1997, Joerg Wunsch.
15 * This software is distributed with NO WARRANTIES, not even the implied
16 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 * Authors grant any other persons or organizations permission to use
19 * or modify this software as long as this message is kept with the software,
20 * all derivative works or modified versions.
22 * From: Version 2.0, Fri Oct 6 20:39:21 MSK 1995
24 * From: if_sppp.h,v 1.8 1997/10/11 11:25:20 joerg Exp
26 * From: Id: if_sppp.h,v 1.7 1998/12/01 20:20:19 hm Exp
29 #define IDX_LCP 0 /* idx into state table */
31 struct slcp {
32 u_long opts; /* LCP options to send (bitfield) */
33 u_long magic; /* local magic number */
34 u_long mru; /* our max receive unit */
35 u_long their_mru; /* their max receive unit */
36 u_long protos; /* bitmask of protos that are started */
37 u_char echoid; /* id of last keepalive echo request */
38 /* restart max values, see RFC 1661 */
39 int timeout;
40 int max_terminate;
41 int max_configure;
42 int max_failure;
45 #define IDX_IPCP 1 /* idx into state table */
46 #define IDX_IPV6CP 2 /* idx into state table */
48 struct sipcp {
49 u_long opts; /* IPCP options to send (bitfield) */
50 u_int flags;
51 #define IPCP_HISADDR_SEEN 1 /* have seen his address already */
52 #define IPCP_MYADDR_SEEN 2 /* have a local address assigned already */
53 #define IPCP_MYADDR_DYN 4 /* my address is dynamically assigned */
54 #define IPCP_HISADDR_DYN 8 /* his address is dynamically assigned */
55 #ifdef notdef
56 #define IPV6CP_MYIFID_DYN 2 /* my ifid is dynamically assigned */
57 #endif
58 #define IPV6CP_MYIFID_SEEN 4 /* have seen his ifid already */
59 uint32_t saved_hisaddr;/* if hisaddr (IPv4) is dynamic, save original one here, in network byte order */
60 uint32_t req_hisaddr; /* remote address requested */
61 uint32_t req_myaddr; /* local address requested */
64 struct sauth {
65 u_short proto; /* authentication protocol to use */
66 u_short flags;
67 char *name; /* system identification name */
68 char *secret; /* secret password */
69 u_char name_len; /* no need to have a bigger size */
70 u_char secret_len; /* because proto gives size in a byte */
71 char challenge[16]; /* random challenge [don't change size! it's really hardcoded!] */
74 #define IDX_PAP 3
75 #define IDX_CHAP 4
77 #define IDX_COUNT (IDX_CHAP + 1) /* bump this when adding cp's! */
79 struct sppp {
80 /* NB: pp_if _must_ be first */
81 struct ifnet pp_if; /* network interface data */
82 struct ifqueue pp_fastq; /* fast output queue */
83 struct ifqueue pp_cpq; /* PPP control protocol queue */
84 struct sppp *pp_next; /* next interface in keepalive list */
85 u_int pp_flags; /* use Cisco protocol instead of PPP */
86 u_int pp_framebytes; /* number of bytes added by (hardware) framing */
87 u_int pp_alivecnt; /* keepalive packets counter */
88 u_int pp_loopcnt; /* loopback detection counter */
89 u_int pp_maxalive; /* number or echo req. w/o reply */
90 u_long pp_seq[IDX_COUNT]; /* local sequence number */
91 u_long pp_rseq[IDX_COUNT]; /* remote sequence number */
92 uint64_t pp_saved_mtu; /* saved MTU value */
93 time_t pp_last_receive; /* peer's last "sign of life" */
94 time_t pp_max_noreceive; /* seconds since last receive before
95 we start to worry and send echo
96 requests */
97 time_t pp_last_activity; /* second of last payload data s/r */
98 time_t pp_idle_timeout; /* idle seconds before auto-disconnect,
99 * 0 = disabled */
100 int pp_auth_failures; /* authorization failures */
101 int pp_max_auth_fail; /* max. allowed authorization failures */
102 int pp_phase; /* phase we're currently in */
103 int query_dns; /* 1 if we want to know the dns addresses */
104 uint32_t dns_addrs[2];
105 int state[IDX_COUNT]; /* state machine */
106 u_char confid[IDX_COUNT]; /* id of last configuration request */
107 int rst_counter[IDX_COUNT]; /* restart counter */
108 int fail_counter[IDX_COUNT]; /* negotiation failure counter */
109 #if defined(__NetBSD__)
110 struct callout ch[IDX_COUNT]; /* per-proto and if callouts */
111 struct callout pap_my_to_ch; /* PAP needs one more... */
112 #endif
113 #if defined(__FreeBSD__) && __FreeBSD__ >= 3
114 struct callout_handle ch[IDX_COUNT]; /* per-proto and if callouts */
115 struct callout_handle pap_my_to_ch; /* PAP needs one more... */
116 #endif
117 struct slcp lcp; /* LCP params */
118 struct sipcp ipcp; /* IPCP params */
119 struct sipcp ipv6cp; /* IPv6CP params */
120 struct sauth myauth; /* auth params, i'm peer */
121 struct sauth hisauth; /* auth params, i'm authenticator */
123 * These functions are filled in by sppp_attach(), and are
124 * expected to be used by the lower layer (hardware) drivers
125 * in order to communicate the (un)availability of the
126 * communication link. Lower layer drivers that are always
127 * ready to communicate (like hardware HDLC) can shortcut
128 * pp_up from pp_tls, and pp_down from pp_tlf.
130 void (*pp_up)(struct sppp *);
131 void (*pp_down)(struct sppp *);
133 * These functions need to be filled in by the lower layer
134 * (hardware) drivers if they request notification from the
135 * PPP layer whether the link is actually required. They
136 * correspond to the tls and tlf actions.
138 void (*pp_tls)(struct sppp *);
139 void (*pp_tlf)(struct sppp *);
141 * These (optional) functions may be filled by the hardware
142 * driver if any notification of established connections
143 * (currently: IPCP up) is desired (pp_con) or any internal
144 * state change of the interface state machine should be
145 * signaled for monitoring purposes (pp_chg).
147 void (*pp_con)(struct sppp *);
148 void (*pp_chg)(struct sppp *, int);
151 #define PP_KEEPALIVE 0x01 /* use keepalive protocol */
152 #define PP_CISCO 0x02 /* use Cisco protocol instead of PPP */
153 /* 0x04 was PP_TIMO */
154 #define PP_CALLIN 0x08 /* we are being called */
155 #define PP_NEEDAUTH 0x10 /* remote requested authentication */
156 #define PP_NOFRAMING 0x20 /* do not add/expect encapsulation
157 around PPP frames (i.e. the serial
158 HDLC like encapsulation, RFC1662) */
161 #define PP_MTU 1500 /* default/minimal MRU */
162 #define PP_MAX_MRU 2048 /* maximal MRU we want to negotiate */
164 #ifdef _KERNEL
165 void sppp_attach (struct ifnet *);
166 void sppp_detach (struct ifnet *);
167 void sppp_input (struct ifnet *, struct mbuf *);
168 int sppp_ioctl(struct ifnet *, u_long, void *);
169 struct mbuf *sppp_dequeue (struct ifnet *);
170 int sppp_isempty (struct ifnet *);
171 void sppp_flush (struct ifnet *);
172 #endif
173 #endif /* !_NET_IF_SPPPVAR_H_ */