Home | History | Annotate | Line # | Download | only in pppd
      1 /*	$NetBSD: ipcp.h,v 1.6 2025/01/08 19:59:39 christos Exp $	*/
      2 
      3 /*
      4  * ipcp.h - IP 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_IPCP_H
     45 #define PPP_IPCP_H
     46 
     47 #include "pppdconf.h"
     48 
     49 #ifdef __cplusplus
     50 extern "C" {
     51 #endif
     52 
     53 /*
     54  * Options.
     55  */
     56 #define CI_ADDRS	1	/* IP Addresses */
     57 #define CI_COMPRESSTYPE	2	/* Compression Type */
     58 #define	CI_ADDR		3
     59 
     60 #define CI_MS_DNS1	129	/* Primary DNS value */
     61 #define CI_MS_WINS1	130	/* Primary WINS value */
     62 #define CI_MS_DNS2	131	/* Secondary DNS value */
     63 #define CI_MS_WINS2	132	/* Secondary WINS value */
     64 
     65 #define MAX_STATES 16		/* from slcompress.h */
     66 
     67 #define IPCP_VJMODE_OLD 1	/* "old" mode (option # = 0x0037) */
     68 #define IPCP_VJMODE_RFC1172 2	/* "old-rfc"mode (option # = 0x002d) */
     69 #define IPCP_VJMODE_RFC1332 3	/* "new-rfc"mode (option # = 0x002d, */
     70                                 /*  maxslot and slot number compression) */
     71 
     72 #define IPCP_VJ_COMP 0x002d	/* current value for VJ compression option*/
     73 #define IPCP_VJ_COMP_OLD 0x0037	/* "old" (i.e, broken) value for VJ */
     74 				/* compression option*/
     75 
     76 typedef struct ipcp_options {
     77     bool neg_addr;		/* Negotiate IP Address? */
     78     bool old_addrs;		/* Use old (IP-Addresses) option? */
     79     bool req_addr;		/* Ask peer to send IP address? */
     80     bool default_route;		/* Assign default route through interface? */
     81     bool replace_default_route;	/* Replace default route through interface? */
     82     bool proxy_arp;		/* Make proxy ARP entry for peer? */
     83     bool neg_vj;		/* Van Jacobson Compression? */
     84     bool old_vj;		/* use old (short) form of VJ option? */
     85     bool accept_local;		/* accept peer's value for ouraddr */
     86     bool accept_remote;		/* accept peer's value for hisaddr */
     87     bool req_dns1;		/* Ask peer to send primary DNS address? */
     88     bool req_dns2;		/* Ask peer to send secondary DNS address? */
     89     bool req_wins1;		/* Ask peer to send primary WINS address? */
     90     bool req_wins2;		/* Ask peer to send secondary WINS address? */
     91     int  vj_protocol;		/* protocol value to use in VJ option */
     92     int  maxslotindex;		/* values for RFC1332 VJ compression neg. */
     93     bool cflag;
     94     uint32_t ouraddr, hisaddr;	/* Addresses in NETWORK BYTE ORDER */
     95     uint32_t dnsaddr[2];	/* Primary and secondary MS DNS entries */
     96     uint32_t winsaddr[2];	/* Primary and secondary MS WINS entries */
     97 } ipcp_options;
     98 
     99 extern fsm ipcp_fsm[];
    100 extern ipcp_options ipcp_wantoptions[];
    101 extern ipcp_options ipcp_gotoptions[];
    102 extern ipcp_options ipcp_allowoptions[];
    103 extern ipcp_options ipcp_hisoptions[];
    104 
    105 char *ip_ntoa(uint32_t);
    106 
    107 extern struct protent ipcp_protent;
    108 
    109 /*
    110  * Hook for a plugin to know when IP protocol has come up
    111  */
    112 typedef void (ip_up_hook_fn)(void);
    113 extern ip_up_hook_fn *ip_up_hook;
    114 
    115 /*
    116  * Hook for a plugin to know when IP protocol has come down
    117  */
    118 typedef void (ip_down_hook_fn)(void);
    119 extern ip_down_hook_fn *ip_down_hook;
    120 
    121 /*
    122  * Hook for a plugin to choose the remote IP address
    123  */
    124 typedef void (ip_choose_hook_fn)(uint32_t *);
    125 extern ip_choose_hook_fn *ip_choose_hook;
    126 
    127 #ifdef __cplusplus
    128 }
    129 #endif
    130 
    131 #endif /* PPP_IPCP_H */
    132