1 /* $OpenBSD: lcp.h,v 1.8 2024/08/09 05:16:13 deraadt Exp $ */ 2 3 /* 4 * lcp.h - Link Control Protocol definitions. 5 * 6 * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in 17 * the documentation and/or other materials provided with the 18 * distribution. 19 * 20 * 3. The name "Carnegie Mellon University" must not be used to 21 * endorse or promote products derived from this software without 22 * prior written permission. For permission or any legal 23 * details, please contact 24 * Office of Technology Transfer 25 * Carnegie Mellon University 26 * 5000 Forbes Avenue 27 * Pittsburgh, PA 15213-3890 28 * (412) 268-4387, fax: (412) 268-7395 29 * tech-transfer@andrew.cmu.edu 30 * 31 * 4. Redistributions of any form whatsoever must retain the following 32 * acknowledgment: 33 * "This product includes software developed by Computing Services 34 * at Carnegie Mellon University (http://www.cmu.edu/computing/)." 35 * 36 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO 37 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 38 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE 39 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 40 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 41 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 42 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 43 */ 44 45 /* 46 * Options. 47 */ 48 #define CI_MRU 1 /* Maximum Receive Unit */ 49 #define CI_ASYNCMAP 2 /* Async Control Character Map */ 50 #define CI_AUTHTYPE 3 /* Authentication Type */ 51 #define CI_QUALITY 4 /* Quality Protocol */ 52 #define CI_MAGICNUMBER 5 /* Magic Number */ 53 #define CI_PCOMPRESSION 7 /* Protocol Field Compression */ 54 #define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */ 55 #define CI_CALLBACK 13 /* callback */ 56 57 /* 58 * LCP-specific packet types. 59 */ 60 #define PROTREJ 8 /* Protocol Reject */ 61 #define ECHOREQ 9 /* Echo Request */ 62 #define ECHOREP 10 /* Echo Reply */ 63 #define DISCREQ 11 /* Discard Request */ 64 #define CBCP_OPT 6 /* Use callback control protocol */ 65 66 /* 67 * The state of options is described by an lcp_options structure. 68 */ 69 typedef struct lcp_options { 70 u_int passive : 1; /* Don't die if we don't get a response */ 71 u_int silent : 1; /* Wait for the other end to start first */ 72 u_int restart : 1; /* Restart vs. exit after close */ 73 u_int neg_mru : 1; /* Negotiate the MRU? */ 74 u_int neg_asyncmap : 1; /* Negotiate the async map? */ 75 u_int neg_upap : 1; /* Ask for UPAP authentication? */ 76 u_int neg_chap : 1; /* Ask for CHAP authentication? */ 77 u_int neg_magicnumber : 1; /* Ask for magic number? */ 78 u_int neg_pcompression : 1; /* HDLC Protocol Field Compression? */ 79 u_int neg_accompression : 1; /* HDLC Address/Control Field Compression? */ 80 u_int neg_lqr : 1; /* Negotiate use of Link Quality Reports */ 81 u_int neg_cbcp : 1; /* Negotiate use of CBCP */ 82 u_short mru; /* Value of MRU */ 83 u_char chap_mdtype; /* which MD type (hashing algorithm) */ 84 u_int32_t asyncmap; /* Value of async map */ 85 u_int32_t magicnumber; 86 int numloops; /* Number of loops during magic number neg. */ 87 u_int32_t lqr_period; /* Reporting period for LQR 1/100ths second */ 88 } lcp_options; 89 90 extern fsm lcp_fsm[]; 91 extern lcp_options lcp_wantoptions[]; 92 extern lcp_options lcp_gotoptions[]; 93 extern lcp_options lcp_allowoptions[]; 94 extern lcp_options lcp_hisoptions[]; 95 extern u_int32_t xmit_accm[][8]; 96 97 #define DEFMRU 1500 /* Try for this */ 98 #define MINMRU 128 /* No MRUs below this */ 99 #define MAXMRU 16384 /* Normally limit MRU to this */ 100 101 void lcp_open(int); 102 void lcp_close(int, char *); 103 void lcp_lowerup(int); 104 void lcp_lowerdown(int); 105 void lcp_sprotrej(int, u_char *, int); /* send protocol reject */ 106 107 extern struct protent lcp_protent; 108 109 /* Default number of times we receive our magic number from the peer 110 before deciding the link is looped-back. */ 111 #define DEFLOOPBACKFAIL 10 112