The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386/include/i4b_isppp.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Defines for synchronous PPP/Cisco link level subroutines.
    3  *
    4  * Copyright (C) 1994 Cronyx Ltd.
    5  * Author: Serge Vakulenko, <vak@cronyx.ru>
    6  *
    7  * Heavily revamped to conform to RFC 1661.
    8  * Copyright (C) 1997, Joerg Wunsch.
    9  *
   10  * This software is distributed with NO WARRANTIES, not even the implied
   11  * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   12  *
   13  * Authors grant any other persons or organizations permission to use
   14  * or modify this software as long as this message is kept with the software,
   15  * all derivative works or modified versions.
   16  *
   17  * From: Version 2.0, Fri Oct  6 20:39:21 MSK 1995
   18  *
   19  * From: if_sppp.h,v 1.14 1999/03/30 13:28:26 phk Exp
   20  *
   21  * $Id: i4b_isppp.h,v 1.5 2000/07/18 15:05:37 hm Exp $
   22  *
   23  * $FreeBSD$
   24  */
   25 
   26 #ifndef _I4B_ISPPP_H_
   27 #define _I4B_ISPPP_H_
   28 
   29 #define SPPP_VJ                 /* use VJ compression */
   30 
   31 
   32 #ifdef SPPP_VJ
   33 #if !(defined (KERNEL) || defined (_KERNEL))
   34 #ifdef __FreeBSD__
   35 #if 0
   36 /*
   37  * this is needed on FreeBSD to make /usr/src/usr.bin/kdump and
   38  * /usr/src/usr.bin/truss compile.
   39  */
   40 #include <sys/mbuf.h>
   41 #endif
   42 #include <netinet/in_systm.h>
   43 #include <netinet/ip.h>
   44 #include <net/slcompress.h>
   45 #endif
   46 #endif
   47 #endif
   48 
   49 #define IDX_LCP 0               /* idx into state table */
   50 
   51 struct slcp {
   52         u_long  opts;           /* LCP options to send (bitfield) */
   53         u_long  magic;          /* local magic number */
   54         u_long  mru;            /* our max receive unit */
   55         u_long  their_mru;      /* their max receive unit */
   56         u_long  protos;         /* bitmask of protos that are started */
   57         u_char  echoid;         /* id of last keepalive echo request */
   58         /* restart max values, see RFC 1661 */
   59         int     timeout;
   60         int     max_terminate;
   61         int     max_configure;
   62         int     max_failure;
   63 };
   64 
   65 #define IDX_IPCP 1              /* idx into state table */
   66 
   67 struct sipcp {
   68         u_long  opts;           /* IPCP options to send (bitfield) */
   69         u_int   flags;
   70 #define IPCP_HISADDR_SEEN 1     /* have seen his address already */
   71 #define IPCP_MYADDR_DYN   2     /* my address is dynamically assigned */
   72 #define IPCP_MYADDR_SEEN  4     /* have seen his address already */
   73 #define IPCP_VJ           8     /* We can use VJ compression */
   74         int     max_state;      /* Max-Slot-Id */
   75         int     compress_cid;   /* Comp-Slot-Id */
   76 };
   77 
   78 #define AUTHNAMELEN     42
   79 #define AUTHKEYLEN      16
   80 
   81 struct sauth {
   82         u_short proto;                  /* authentication protocol to use */
   83         u_short flags;
   84 #define AUTHFLAG_NOCALLOUT      1       /* do not require authentication on */
   85                                         /* callouts */
   86 #define AUTHFLAG_NORECHALLENGE  2       /* do not re-challenge CHAP */
   87         u_char  name[AUTHNAMELEN];      /* system identification name */
   88         u_char  secret[AUTHKEYLEN];     /* secret password */
   89         u_char  challenge[AUTHKEYLEN];  /* random challenge */
   90 };
   91 
   92 #define IDX_PAP         2
   93 #define IDX_CHAP        3
   94 
   95 #define IDX_COUNT (IDX_CHAP + 1) /* bump this when adding cp's! */
   96 
   97 /*
   98  * Don't change the order of this.  Ordering the phases this way allows
   99  * for a comparision of ``pp_phase >= PHASE_AUTHENTICATE'' in order to
  100  * know whether LCP is up.
  101  */
  102 enum ppp_phase {
  103         PHASE_DEAD, PHASE_ESTABLISH, PHASE_TERMINATE,
  104         PHASE_AUTHENTICATE, PHASE_NETWORK
  105 };
  106 
  107 struct sppp {
  108         /* NB: pp_if _must_ be first */
  109         struct  ifnet pp_if;    /* network interface data */
  110         struct  ifqueue pp_fastq; /* fast output queue */
  111         struct  ifqueue pp_cpq; /* PPP control protocol queue */
  112         struct  sppp *pp_next;  /* next interface in keepalive list */
  113         u_int   pp_mode;        /* major protocol modes (cisco/ppp/...) */
  114         u_int   pp_flags;       /* sub modes */
  115         u_short pp_alivecnt;    /* keepalive packets counter */
  116         u_short pp_loopcnt;     /* loopback detection counter */
  117         u_long  pp_seq;         /* local sequence number */
  118         u_long  pp_rseq;        /* remote sequence number */
  119         time_t  pp_last_sent;
  120         time_t  pp_last_recv;
  121         enum ppp_phase pp_phase;        /* phase we're currently in */
  122         int     state[IDX_COUNT];       /* state machine */
  123         u_char  confid[IDX_COUNT];      /* id of last configuration request */
  124         int     rst_counter[IDX_COUNT]; /* restart counter */
  125         int     fail_counter[IDX_COUNT]; /* negotiation failure counter */
  126 #if defined(__FreeBSD__) && __FreeBSD__ >= 3
  127         struct callout_handle ch[IDX_COUNT]; /* per-proto and if callouts */
  128         struct callout_handle pap_my_to_ch; /* PAP needs one more... */
  129 #endif
  130         struct slcp lcp;                /* LCP params */
  131         struct sipcp ipcp;              /* IPCP params */
  132         struct sauth myauth;            /* auth params, i'm peer */
  133         struct sauth hisauth;           /* auth params, i'm authenticator */
  134 #ifdef SPPP_VJ
  135         int enable_vj;                  /* enable VJ negotiation */
  136         struct slcompress pp_comp;      /* for VJ compression */
  137 #endif
  138         /*
  139          * These functions are filled in by sppp_attach(), and are
  140          * expected to be used by the lower layer (hardware) drivers
  141          * in order to communicate the (un)availability of the
  142          * communication link.  Lower layer drivers that are always
  143          * ready to communicate (like hardware HDLC) can shortcut
  144          * pp_up from pp_tls, and pp_down from pp_tlf.
  145          */
  146         void    (*pp_up)(struct sppp *sp);
  147         void    (*pp_down)(struct sppp *sp);
  148         /*
  149          * These functions need to be filled in by the lower layer
  150          * (hardware) drivers if they request notification from the
  151          * PPP layer whether the link is actually required.  They
  152          * correspond to the tls and tlf actions.
  153          */
  154         void    (*pp_tls)(struct sppp *sp);
  155         void    (*pp_tlf)(struct sppp *sp);
  156         /*
  157          * These (optional) functions may be filled by the hardware
  158          * driver if any notification of established connections
  159          * (currently: IPCP up) is desired (pp_con) or any internal
  160          * state change of the interface state machine should be
  161          * signaled for monitoring purposes (pp_chg).
  162          */
  163         void    (*pp_con)(struct sppp *sp);
  164         void    (*pp_chg)(struct sppp *sp, int new_state);
  165         /* These two fields are for use by the lower layer */
  166         void    *pp_lowerp;
  167         int     pp_loweri;
  168 };
  169 
  170 #define PP_KEEPALIVE    0x01    /* use keepalive protocol */
  171 #define PP_CALLIN       0x08    /* we are being called */
  172 #define PP_NEEDAUTH     0x10    /* remote requested authentication */
  173 
  174 
  175 #define PP_MTU          1500    /* default/minimal MRU */
  176 #define PP_MAX_MRU      2048    /* maximal MRU we want to negotiate */
  177 
  178 /*
  179  * Definitions to pass struct sppp data down into the kernel using the
  180  * SIOC[SG]IFGENERIC ioctl interface.
  181  *
  182  * In order to use this, create a struct spppreq, fill in the cmd
  183  * field with SPPPIOGDEFS, and put the address of this structure into
  184  * the ifr_data portion of a struct ifreq.  Pass this struct to a
  185  * SIOCGIFGENERIC ioctl.  Then replace the cmd field by SPPPIOCDEFS,
  186  * modify the defs field as desired, and pass the struct ifreq now
  187  * to a SIOCSIFGENERIC ioctl.
  188  */
  189 
  190 #define SPPPIOGDEFS  ((caddr_t)(('S' << 24) + (1 << 16) + sizeof(struct sppp)))
  191 #define SPPPIOSDEFS  ((caddr_t)(('S' << 24) + (2 << 16) + sizeof(struct sppp)))
  192 
  193 struct spppreq {
  194         u_long  cmd;
  195         struct sppp defs;
  196 };
  197 
  198 #ifndef SIOCSIFGENERIC
  199 #define SIOCSIFGENERIC   _IOW('i', 57, struct ifreq)    /* generic IF set op */
  200 #endif
  201 
  202 #ifndef SIOCGIFGENERIC
  203 #define SIOCGIFGENERIC  _IOWR('i', 58, struct ifreq)    /* generic IF get op */
  204 #endif
  205 
  206 #if defined(KERNEL) || defined(_KERNEL)
  207 
  208 #ifndef USE_ISPPP
  209 
  210 void sppp_attach (struct ifnet *ifp);
  211 void sppp_detach (struct ifnet *ifp);
  212 void sppp_input (struct ifnet *ifp, struct mbuf *m);
  213 
  214 #if defined(__FreeBSD_version) && __FreeBSD_version >= 300003
  215 int sppp_ioctl (struct ifnet *ifp, u_long cmd, void *data);
  216 #else
  217 #ifdef __FreeBSD__
  218 int sppp_ioctl (struct ifnet *ifp, int cmd, void *data);
  219 #else
  220 int sppp_ioctl (struct ifnet *ifp, u_long cmd, void *data);
  221 #endif
  222 #endif
  223 
  224 struct mbuf *sppp_dequeue (struct ifnet *ifp);
  225 struct mbuf *sppp_pick(struct ifnet *ifp);
  226 int sppp_isempty (struct ifnet *ifp);
  227 void sppp_flush (struct ifnet *ifp);
  228 
  229 #else /* USE_ISPPP */
  230 
  231 void isppp_attach (struct ifnet *ifp);
  232 void isppp_detach (struct ifnet *ifp);
  233 void isppp_input (struct ifnet *ifp, struct mbuf *m);
  234 
  235 #if defined(__FreeBSD_version) && __FreeBSD_version >= 300003
  236 int isppp_ioctl (struct ifnet *ifp, u_long cmd, void *data);
  237 #else
  238 #ifdef __FreeBSD__
  239 int isppp_ioctl (struct ifnet *ifp, int cmd, void *data);
  240 #else
  241 int isppp_ioctl (struct ifnet *ifp, u_long cmd, void *data);
  242 #endif
  243 #endif
  244 
  245 struct mbuf *isppp_dequeue (struct ifnet *ifp);
  246 struct mbuf *isppp_pick(struct ifnet *ifp);
  247 int isppp_isempty (struct ifnet *ifp);
  248 void isppp_flush (struct ifnet *ifp);
  249 #endif /* USE_ISPPP */
  250 
  251 #endif /* KERNEL */
  252 
  253 #endif /* _I4B_ISPPP_H_ */

Cache object: 411e37c915a9f39b650620fb7e68219a


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.