[457] | 1 | /*
|
---|
| 2 | * lcp.h - Link Control Protocol definitions.
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
|
---|
| 5 | *
|
---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
---|
| 7 | * modification, are permitted provided that the following conditions
|
---|
| 8 | * are met:
|
---|
| 9 | *
|
---|
| 10 | * 1. Redistributions of source code must retain the above copyright
|
---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
---|
| 12 | *
|
---|
| 13 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
| 14 | * notice, this list of conditions and the following disclaimer in
|
---|
| 15 | * the documentation and/or other materials provided with the
|
---|
| 16 | * distribution.
|
---|
| 17 | *
|
---|
| 18 | * 3. The name "Carnegie Mellon University" must not be used to
|
---|
| 19 | * endorse or promote products derived from this software without
|
---|
| 20 | * prior written permission. For permission or any legal
|
---|
| 21 | * details, please contact
|
---|
| 22 | * Office of Technology Transfer
|
---|
| 23 | * Carnegie Mellon University
|
---|
| 24 | * 5000 Forbes Avenue
|
---|
| 25 | * Pittsburgh, PA 15213-3890
|
---|
| 26 | * (412) 268-4387, fax: (412) 268-7395
|
---|
| 27 | * tech-transfer@andrew.cmu.edu
|
---|
| 28 | *
|
---|
| 29 | * 4. Redistributions of any form whatsoever must retain the following
|
---|
| 30 | * acknowledgment:
|
---|
| 31 | * "This product includes software developed by Computing Services
|
---|
| 32 | * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
|
---|
| 33 | *
|
---|
| 34 | * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
---|
| 35 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
---|
| 36 | * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
|
---|
| 37 | * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
---|
| 38 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
---|
| 39 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
---|
| 40 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
---|
| 41 | *
|
---|
| 42 | * $Id$
|
---|
| 43 | */
|
---|
| 44 |
|
---|
| 45 | #include "netif/ppp/ppp_opts.h"
|
---|
| 46 | #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
---|
| 47 |
|
---|
| 48 | #ifndef LCP_H
|
---|
| 49 | #define LCP_H
|
---|
| 50 |
|
---|
| 51 | #include "ppp.h"
|
---|
| 52 |
|
---|
| 53 | #ifdef __cplusplus
|
---|
| 54 | extern "C" {
|
---|
| 55 | #endif
|
---|
| 56 |
|
---|
| 57 | /*
|
---|
| 58 | * Options.
|
---|
| 59 | */
|
---|
| 60 | #define CI_VENDOR 0 /* Vendor Specific */
|
---|
| 61 | #define CI_MRU 1 /* Maximum Receive Unit */
|
---|
| 62 | #define CI_ASYNCMAP 2 /* Async Control Character Map */
|
---|
| 63 | #define CI_AUTHTYPE 3 /* Authentication Type */
|
---|
| 64 | #define CI_QUALITY 4 /* Quality Protocol */
|
---|
| 65 | #define CI_MAGICNUMBER 5 /* Magic Number */
|
---|
| 66 | #define CI_PCOMPRESSION 7 /* Protocol Field Compression */
|
---|
| 67 | #define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */
|
---|
| 68 | #define CI_FCSALTERN 9 /* FCS-Alternatives */
|
---|
| 69 | #define CI_SDP 10 /* Self-Describing-Pad */
|
---|
| 70 | #define CI_NUMBERED 11 /* Numbered-Mode */
|
---|
| 71 | #define CI_CALLBACK 13 /* callback */
|
---|
| 72 | #define CI_MRRU 17 /* max reconstructed receive unit; multilink */
|
---|
| 73 | #define CI_SSNHF 18 /* short sequence numbers for multilink */
|
---|
| 74 | #define CI_EPDISC 19 /* endpoint discriminator */
|
---|
| 75 | #define CI_MPPLUS 22 /* Multi-Link-Plus-Procedure */
|
---|
| 76 | #define CI_LDISC 23 /* Link-Discriminator */
|
---|
| 77 | #define CI_LCPAUTH 24 /* LCP Authentication */
|
---|
| 78 | #define CI_COBS 25 /* Consistent Overhead Byte Stuffing */
|
---|
| 79 | #define CI_PREFELIS 26 /* Prefix Elision */
|
---|
| 80 | #define CI_MPHDRFMT 27 /* MP Header Format */
|
---|
| 81 | #define CI_I18N 28 /* Internationalization */
|
---|
| 82 | #define CI_SDL 29 /* Simple Data Link */
|
---|
| 83 |
|
---|
| 84 | /*
|
---|
| 85 | * LCP-specific packet types (code numbers).
|
---|
| 86 | */
|
---|
| 87 | #define PROTREJ 8 /* Protocol Reject */
|
---|
| 88 | #define ECHOREQ 9 /* Echo Request */
|
---|
| 89 | #define ECHOREP 10 /* Echo Reply */
|
---|
| 90 | #define DISCREQ 11 /* Discard Request */
|
---|
| 91 | #define IDENTIF 12 /* Identification */
|
---|
| 92 | #define TIMEREM 13 /* Time Remaining */
|
---|
| 93 |
|
---|
| 94 | /* Value used as data for CI_CALLBACK option */
|
---|
| 95 | #define CBCP_OPT 6 /* Use callback control protocol */
|
---|
| 96 |
|
---|
| 97 | #if 0 /* moved to ppp_opts.h */
|
---|
| 98 | #define DEFMRU 1500 /* Try for this */
|
---|
| 99 | #define MINMRU 128 /* No MRUs below this */
|
---|
| 100 | #define MAXMRU 16384 /* Normally limit MRU to this */
|
---|
| 101 | #endif /* moved to ppp_opts.h */
|
---|
| 102 |
|
---|
| 103 | /* An endpoint discriminator, used with multilink. */
|
---|
| 104 | #define MAX_ENDP_LEN 20 /* maximum length of discriminator value */
|
---|
| 105 | struct epdisc {
|
---|
| 106 | unsigned char class_; /* -- The word "class" is reserved in C++. */
|
---|
| 107 | unsigned char length;
|
---|
| 108 | unsigned char value[MAX_ENDP_LEN];
|
---|
| 109 | };
|
---|
| 110 |
|
---|
| 111 | /*
|
---|
| 112 | * The state of options is described by an lcp_options structure.
|
---|
| 113 | */
|
---|
| 114 | typedef struct lcp_options {
|
---|
| 115 | unsigned int passive :1; /* Don't die if we don't get a response */
|
---|
| 116 | unsigned int silent :1; /* Wait for the other end to start first */
|
---|
| 117 | #if 0 /* UNUSED */
|
---|
| 118 | unsigned int restart :1; /* Restart vs. exit after close */
|
---|
| 119 | #endif /* UNUSED */
|
---|
| 120 | unsigned int neg_mru :1; /* Negotiate the MRU? */
|
---|
| 121 | unsigned int neg_asyncmap :1; /* Negotiate the async map? */
|
---|
| 122 | #if PAP_SUPPORT
|
---|
| 123 | unsigned int neg_upap :1; /* Ask for UPAP authentication? */
|
---|
| 124 | #endif /* PAP_SUPPORT */
|
---|
| 125 | #if CHAP_SUPPORT
|
---|
| 126 | unsigned int neg_chap :1; /* Ask for CHAP authentication? */
|
---|
| 127 | #endif /* CHAP_SUPPORT */
|
---|
| 128 | #if EAP_SUPPORT
|
---|
| 129 | unsigned int neg_eap :1; /* Ask for EAP authentication? */
|
---|
| 130 | #endif /* EAP_SUPPORT */
|
---|
| 131 | unsigned int neg_magicnumber :1; /* Ask for magic number? */
|
---|
| 132 | unsigned int neg_pcompression :1; /* HDLC Protocol Field Compression? */
|
---|
| 133 | unsigned int neg_accompression :1; /* HDLC Address/Control Field Compression? */
|
---|
| 134 | #if LQR_SUPPORT
|
---|
| 135 | unsigned int neg_lqr :1; /* Negotiate use of Link Quality Reports */
|
---|
| 136 | #endif /* LQR_SUPPORT */
|
---|
| 137 | unsigned int neg_cbcp :1; /* Negotiate use of CBCP */
|
---|
| 138 | #ifdef HAVE_MULTILINK
|
---|
| 139 | unsigned int neg_mrru :1; /* negotiate multilink MRRU */
|
---|
| 140 | #endif /* HAVE_MULTILINK */
|
---|
| 141 | unsigned int neg_ssnhf :1; /* negotiate short sequence numbers */
|
---|
| 142 | unsigned int neg_endpoint :1; /* negotiate endpoint discriminator */
|
---|
| 143 |
|
---|
| 144 | u16_t mru; /* Value of MRU */
|
---|
| 145 | #ifdef HAVE_MULTILINK
|
---|
| 146 | u16_t mrru; /* Value of MRRU, and multilink enable */
|
---|
| 147 | #endif /* MULTILINK */
|
---|
| 148 | #if CHAP_SUPPORT
|
---|
| 149 | u8_t chap_mdtype; /* which MD types (hashing algorithm) */
|
---|
| 150 | #endif /* CHAP_SUPPORT */
|
---|
| 151 | u32_t asyncmap; /* Value of async map */
|
---|
| 152 | u32_t magicnumber;
|
---|
| 153 | u8_t numloops; /* Number of loops during magic number neg. */
|
---|
| 154 | #if LQR_SUPPORT
|
---|
| 155 | u32_t lqr_period; /* Reporting period for LQR 1/100ths second */
|
---|
| 156 | #endif /* LQR_SUPPORT */
|
---|
| 157 | struct epdisc endpoint; /* endpoint discriminator */
|
---|
| 158 | } lcp_options;
|
---|
| 159 |
|
---|
| 160 | void lcp_open(ppp_pcb *pcb);
|
---|
| 161 | void lcp_close(ppp_pcb *pcb, const char *reason);
|
---|
| 162 | void lcp_lowerup(ppp_pcb *pcb);
|
---|
| 163 | void lcp_lowerdown(ppp_pcb *pcb);
|
---|
| 164 | void lcp_sprotrej(ppp_pcb *pcb, u_char *p, int len); /* send protocol reject */
|
---|
| 165 |
|
---|
| 166 | extern const struct protent lcp_protent;
|
---|
| 167 |
|
---|
| 168 | #if 0 /* moved to ppp_opts.h */
|
---|
| 169 | /* Default number of times we receive our magic number from the peer
|
---|
| 170 | before deciding the link is looped-back. */
|
---|
| 171 | #define DEFLOOPBACKFAIL 10
|
---|
| 172 | #endif /* moved to ppp_opts.h */
|
---|
| 173 |
|
---|
| 174 | #ifdef __cplusplus
|
---|
| 175 | }
|
---|
| 176 | #endif
|
---|
| 177 |
|
---|
| 178 | #endif /* LCP_H */
|
---|
| 179 | #endif /* PPP_SUPPORT */
|
---|