Home | History | Annotate | Line # | Download | only in pppd
      1 /*	$NetBSD: lcp.h,v 1.6 2025/01/08 19:59:39 christos 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 (at) 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 #ifndef PPP_LCP_H
     45 #define PPP_LCP_H
     46 
     47 #include "pppdconf.h"
     48 
     49 #ifdef __cplusplus
     50 extern "C" {
     51 #endif
     52 
     53 
     54 /*
     55  * Options.
     56  */
     57 #define CI_VENDOR	0	/* Vendor Specific */
     58 #define CI_MRU		1	/* Maximum Receive Unit */
     59 #define CI_ASYNCMAP	2	/* Async Control Character Map */
     60 #define CI_AUTHTYPE	3	/* Authentication Type */
     61 #define CI_QUALITY	4	/* Quality Protocol */
     62 #define CI_MAGICNUMBER	5	/* Magic Number */
     63 #define CI_PCOMPRESSION	7	/* Protocol Field Compression */
     64 #define CI_ACCOMPRESSION 8	/* Address/Control Field Compression */
     65 #define CI_FCSALTERN	9	/* FCS-Alternatives */
     66 #define CI_SDP		10	/* Self-Describing-Pad */
     67 #define CI_NUMBERED	11	/* Numbered-Mode */
     68 #define CI_CALLBACK	13	/* callback */
     69 #define CI_MRRU		17	/* max reconstructed receive unit; multilink */
     70 #define CI_SSNHF	18	/* short sequence numbers for multilink */
     71 #define CI_EPDISC	19	/* endpoint discriminator */
     72 #define CI_MPPLUS	22	/* Multi-Link-Plus-Procedure */
     73 #define CI_LDISC	23	/* Link-Discriminator */
     74 #define CI_LCPAUTH	24	/* LCP Authentication */
     75 #define CI_COBS		25	/* Consistent Overhead Byte Stuffing */
     76 #define CI_PREFELIS	26	/* Prefix Elision */
     77 #define CI_MPHDRFMT	27	/* MP Header Format */
     78 #define CI_I18N		28	/* Internationalization */
     79 #define CI_SDL		29	/* Simple Data Link */
     80 
     81 /*
     82  * LCP-specific packet types (code numbers).
     83  */
     84 #define PROTREJ		8	/* Protocol Reject */
     85 #define ECHOREQ		9	/* Echo Request */
     86 #define ECHOREP		10	/* Echo Reply */
     87 #define DISCREQ		11	/* Discard Request */
     88 #define IDENTIF		12	/* Identification */
     89 #define TIMEREM		13	/* Time Remaining */
     90 
     91 /* Value used as data for CI_CALLBACK option */
     92 #define CBCP_OPT	6	/* Use callback control protocol */
     93 
     94 /* An endpoint discriminator, used with multilink. */
     95 #define MAX_ENDP_LEN	20	/* maximum length of discriminator value */
     96 struct epdisc {
     97     unsigned char	class;
     98     unsigned char	length;
     99     unsigned char	value[MAX_ENDP_LEN];
    100 };
    101 
    102 /*
    103  * The state of options is described by an lcp_options structure.
    104  */
    105 typedef struct lcp_options {
    106     bool passive;		/* Don't die if we don't get a response */
    107     bool silent;		/* Wait for the other end to start first */
    108     bool restart;		/* Restart vs. exit after close */
    109     bool neg_mru;		/* Negotiate the MRU? */
    110     bool neg_asyncmap;		/* Negotiate the async map? */
    111     bool neg_upap;		/* Ask for UPAP authentication? */
    112     bool neg_chap;		/* Ask for CHAP authentication? */
    113     bool neg_eap;		/* Ask for EAP authentication? */
    114     bool neg_magicnumber;	/* Ask for magic number? */
    115     bool neg_pcompression;	/* HDLC Protocol Field Compression? */
    116     bool neg_accompression;	/* HDLC Address/Control Field Compression? */
    117     bool neg_lqr;		/* Negotiate use of Link Quality Reports */
    118     bool neg_cbcp;		/* Negotiate use of CBCP */
    119     bool neg_mrru;		/* negotiate multilink MRRU */
    120     bool neg_ssnhf;		/* negotiate short sequence numbers */
    121     bool neg_endpoint;		/* negotiate endpoint discriminator */
    122     int  mru;			/* Value of MRU */
    123     int	 mrru;			/* Value of MRRU, and multilink enable */
    124     unsigned char chap_mdtype;		/* which MD types (hashing algorithm) */
    125     uint32_t asyncmap;		/* Value of async map */
    126     uint32_t magicnumber;
    127     int  numloops;		/* Number of loops during magic number neg. */
    128     uint32_t lqr_period;	/* Reporting period for LQR 1/100ths second */
    129     struct epdisc endpoint;	/* endpoint discriminator */
    130 } lcp_options;
    131 
    132 extern fsm lcp_fsm[];
    133 extern lcp_options lcp_wantoptions[];
    134 extern lcp_options lcp_gotoptions[];
    135 extern lcp_options lcp_allowoptions[];
    136 extern lcp_options lcp_hisoptions[];
    137 
    138 #define DEFMRU	1500		/* Try for this */
    139 #define MINMRU	128		/* No MRUs below this */
    140 #define MAXMRU	16384		/* Normally limit MRU to this */
    141 
    142 void lcp_open(int);
    143 void lcp_close(int, char *);
    144 void lcp_lowerup(int);
    145 void lcp_lowerdown(int);
    146 void lcp_sprotrej(int, unsigned char *, int);	/* send protocol reject */
    147 
    148 extern struct protent lcp_protent;
    149 
    150 /* Default number of times we receive our magic number from the peer
    151    before deciding the link is looped-back. */
    152 #define DEFLOOPBACKFAIL	10
    153 
    154 
    155 #ifdef __cplusplus
    156 }
    157 #endif
    158 
    159 #endif // PPP_LCP_H
    160