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
28 * $FreeBSD: src/usr.sbin/ppp/lcp.h,v 1.23.2.6 2002/09/01 02:12:28 brian Exp $
29 * $DragonFly: src/usr.sbin/ppp/lcp.h,v 1.2 2003/06/17 04:30:00 dillon Exp $
32 /* callback::opmask values */
33 #define CALLBACK_AUTH (0)
34 #define CALLBACK_DIALSTRING (1) /* Don't do this */
35 #define CALLBACK_LOCATION (2) /* Don't do this */
36 #define CALLBACK_E164 (3)
37 #define CALLBACK_NAME (4) /* Don't do this */
38 #define CALLBACK_CBCP (6)
39 #define CALLBACK_NONE (14) /* No callback is ok */
41 #define CALLBACK_BIT(n) ((n) < 0 ? 0 : 1 << (n))
44 int opmask
; /* want these types of callback */
45 char msg
[SCRIPT_LEN
]; /* with this data (E.164) */
48 #define REJECTED(p, x) ((p)->his_reject & (1<<(x)))
51 struct fsm fsm
; /* The finite state machine */
52 u_int16_t his_mru
; /* Peers maximum packet size */
53 u_int16_t his_mrru
; /* Peers maximum reassembled packet size (MP) */
54 u_int32_t his_accmap
; /* Peeers async char control map */
55 u_int32_t his_magic
; /* Peers magic number */
56 u_int32_t his_lqrperiod
; /* Peers LQR frequency (100ths of seconds) */
57 u_short his_auth
; /* Peer wants this type of authentication */
58 u_char his_authtype
; /* Fifth octet of REQ/NAK/REJ */
59 struct callback his_callback
; /* Peer wants callback ? */
60 unsigned his_shortseq
: 1; /* Peer would like only 12bit seqs (MP) */
61 unsigned his_protocomp
: 1; /* Does peer do Protocol field compression */
62 unsigned his_acfcomp
: 1; /* Does peer do addr & cntrl fld compression */
63 unsigned mru_req
: 1; /* Has the peer requested an MRU */
65 u_short want_mru
; /* Our maximum packet size */
66 u_short want_mrru
; /* Our maximum reassembled packet size (MP) */
67 u_int32_t want_accmap
; /* Our async char control map */
68 u_int32_t want_magic
; /* Our magic number */
69 u_int32_t want_lqrperiod
; /* Our LQR frequency (100ths of seconds) */
70 u_short want_auth
; /* We want this type of authentication */
71 u_char want_authtype
; /* Fifth octet of REQ/NAK/REJ */
72 struct callback want_callback
;/* We want callback ? */
73 unsigned want_shortseq
: 1; /* I'd like only 12bit seqs (MP) */
74 unsigned want_protocomp
: 1; /* Do we do protocol field compression */
75 unsigned want_acfcomp
: 1; /* Do we do addr & cntrl fld compression */
77 u_int32_t his_reject
; /* Request codes rejected by peer */
78 u_int32_t my_reject
; /* Request codes I have rejected */
80 u_short auth_iwait
; /* I must authenticate to the peer */
81 u_short auth_ineed
; /* I require that the peer authenticates */
83 int LcpFailedMagic
; /* Number of `magic is same' errors */
86 u_short mru
; /* Preferred MRU value */
87 u_short max_mru
; /* Preferred MRU value */
88 u_short mtu
; /* Preferred MTU */
89 u_short max_mtu
; /* Preferred MTU */
90 u_int32_t accmap
; /* Initial ACCMAP value */
91 int openmode
; /* when to start CFG REQs */
92 u_int32_t lqrperiod
; /* LQR frequency (seconds) */
93 struct fsm_retry fsm
; /* How often/frequently to resend requests */
94 unsigned acfcomp
: 2; /* Address & Control Field Compression neg */
95 unsigned chap05
: 2; /* Challenge Handshake Authentication proto */
97 unsigned chap80nt
: 2; /* Microsoft (NT) CHAP */
98 unsigned chap80lm
: 2; /* Microsoft (LANMan) CHAP */
99 unsigned chap81
: 2; /* Microsoft CHAP v2 */
101 unsigned lqr
: 2; /* Link Quality Report */
102 unsigned pap
: 2; /* Password Authentication protocol */
103 unsigned protocomp
: 2; /* Protocol field compression */
104 char ident
[DEF_MRU
- 7]; /* SendIdentification() data */
108 #define LCP_MAXCODE CODE_IDENT
109 #define LCP_MINMPCODE CODE_CODEREJ
111 #define TY_MRU 1 /* Maximum-Receive-Unit */
112 #define TY_ACCMAP 2 /* Async-Control-Character-Map */
113 #define TY_AUTHPROTO 3 /* Authentication-Protocol */
114 #define TY_QUALPROTO 4 /* Quality-Protocol */
115 #define TY_MAGICNUM 5 /* Magic-Number */
116 #define TY_RESERVED 6 /* RESERVED */
117 #define TY_PROTOCOMP 7 /* Protocol-Field-Compression */
118 #define TY_ACFCOMP 8 /* Address-and-Control-Field-Compression */
119 #define TY_FCSALT 9 /* FCS-Alternatives */
120 #define TY_SDP 10 /* Self-Describing-Padding */
121 #define TY_CALLBACK 13 /* Callback */
122 #define TY_CFRAMES 15 /* Compound-frames */
123 #define TY_MRRU 17 /* Max Reconstructed Receive Unit (MP) */
124 #define TY_SHORTSEQ 18 /* Want short seqs (12bit) please (see mp.h) */
125 #define TY_ENDDISC 19 /* Endpoint discriminator */
132 #define fsm2lcp(fp) (fp->proto == PROTO_LCP ? (struct lcp *)fp : NULL)
134 extern void lcp_Init(struct lcp
*, struct bundle
*, struct link
*,
135 const struct fsm_parent
*);
136 extern void lcp_Setup(struct lcp
*, int);
138 extern void lcp_SendProtoRej(struct lcp
*, u_char
*, int);
139 extern int lcp_SendIdentification(struct lcp
*);
140 extern void lcp_RecvIdentification(struct lcp
*, char *);
141 extern int lcp_ReportStatus(struct cmdargs
const *);
142 extern struct mbuf
*lcp_Input(struct bundle
*, struct link
*, struct mbuf
*);
143 extern void lcp_SetupCallbacks(struct lcp
*);