if_sppp.h revision 29681
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 1.7, Wed Jun 7 22:12:02 MSD 1995 18 * 19 * $Id: if_sppp.h,v 1.6 1997/05/22 22:15:39 joerg Exp $ 20 */ 21 22#ifndef _NET_IF_HDLC_H_ 23#define _NET_IF_HDLC_H_ 1 24 25#define IDX_LCP 0 /* idx into state table */ 26 27struct slcp { 28 u_long opts; /* LCP options to send (bitfield) */ 29 u_long magic; /* local magic number */ 30 u_long mru; /* our max receive unit */ 31 u_long their_mru; /* their max receive unit */ 32 u_long protos; /* bitmask of protos that are started */ 33 u_char echoid; /* id of last keepalive echo request */ 34 /* restart max values, see RFC 1661 */ 35 int timeout; 36 int max_terminate; 37 int max_configure; 38 int max_failure; 39}; 40 41#define IDX_IPCP 1 /* idx into state table */ 42 43struct sipcp { 44 u_long opts; /* IPCP options to send (bitfield) */ 45 u_int flags; 46#define IPCP_HISADDR_SEEN 1 /* have seen his address already */ 47#define IPCP_MYADDR_DYN 2 /* my address is dynamically assigned */ 48}; 49 50#define IDX_COUNT (IDX_IPCP + 1) /* bump this when adding cp's! */ 51 52/* 53 * Don't change the order of this. Ordering the phases this way allows 54 * for a comparision of ``pp_phase >= PHASE_AUTHENTICATE'' in order to 55 * know whether LCP is up. 56 */ 57enum ppp_phase { 58 PHASE_DEAD, PHASE_ESTABLISH, PHASE_TERMINATE, 59 PHASE_AUTHENTICATE, PHASE_NETWORK 60}; 61 62struct sppp { 63 /* NB: pp_if _must_ be first */ 64 struct ifnet pp_if; /* network interface data */ 65 struct ifqueue pp_fastq; /* fast output queue */ 66 struct ifqueue pp_cpq; /* PPP control protocol queue */ 67 struct sppp *pp_next; /* next interface in keepalive list */ 68 u_int pp_flags; /* use Cisco protocol instead of PPP */ 69 u_short pp_alivecnt; /* keepalive packets counter */ 70 u_short pp_loopcnt; /* loopback detection counter */ 71 u_long pp_seq; /* local sequence number */ 72 u_long pp_rseq; /* remote sequence number */ 73 enum ppp_phase pp_phase; /* phase we're currently in */ 74 int state[IDX_COUNT]; /* state machine */ 75 u_char confid[IDX_COUNT]; /* id of last configuration request */ 76 int rst_counter[IDX_COUNT]; /* restart counter */ 77 int fail_counter[IDX_COUNT]; /* negotiation failure counter */ 78 struct callout_handle ch[IDX_COUNT]; 79 struct slcp lcp; /* LCP params */ 80 struct sipcp ipcp; /* IPCP params */ 81 /* 82 * These functions are filled in by sppp_attach(), and are 83 * expected to be used by the lower layer (hardware) drivers 84 * in order to communicate the (un)availability of the 85 * communication link. Lower layer drivers that are always 86 * ready to communicate (like hardware HDLC) can shortcut 87 * pp_up from pp_tls, and pp_down from pp_tlf. 88 */ 89 void (*pp_up)(struct sppp *sp); 90 void (*pp_down)(struct sppp *sp); 91 /* 92 * These functions need to be filled in by the lower layer 93 * (hardware) drivers if they request notification from the 94 * PPP layer whether the link is actually required. They 95 * correspond to the tls and tlf actions. 96 */ 97 void (*pp_tls)(struct sppp *sp); 98 void (*pp_tlf)(struct sppp *sp); 99}; 100 101#define PP_KEEPALIVE 0x01 /* use keepalive protocol */ 102#define PP_CISCO 0x02 /* use Cisco protocol instead of PPP */ 103 104#define PP_MTU 1500 /* default/minimal MRU */ 105#define PP_MAX_MRU 2048 /* maximal MRU we want to negotiate */ 106 107#ifdef KERNEL 108void sppp_attach (struct ifnet *ifp); 109void sppp_detach (struct ifnet *ifp); 110void sppp_input (struct ifnet *ifp, struct mbuf *m); 111int sppp_ioctl (struct ifnet *ifp, int cmd, void *data); 112struct mbuf *sppp_dequeue (struct ifnet *ifp); 113int sppp_isempty (struct ifnet *ifp); 114void sppp_flush (struct ifnet *ifp); 115#endif 116 117#endif /* _NET_IF_HDLC_H_ */ 118