1/* 2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24#ifndef _PPP_IF_H_ 25#define _PPP_IF_H_ 26 27/* 28 * Network protocols we support. 29 */ 30#define NP_IP 0 /* Internet Protocol V4 */ 31#define NP_IPV6 1 /* Internet Protocol V6 */ 32//#define NP_IPX 2 /* IPX protocol */ 33//#define NP_AT 3 /* Appletalk protocol */ 34#define NUM_NP 2 /* Number of NPs. */ 35 36/* 37 * State of the interface. 38 */ 39#define PPP_IF_STATE_DETACHING 1 40 41struct ppp_if { 42 /* first, the ifnet structure... */ 43 ifnet_t net; /* network-visible interface */ 44 45 /* administrative info */ 46 TAILQ_ENTRY(ppp_if) next; 47 void *host; /* first client structure */ 48 u_int8_t nbclients; /* nb clients attached */ 49 u_int8_t state; /* state of the interface */ 50 lck_mtx_t *mtx; /* interface mutex */ 51 u_short unit; /* unit number (same as in ifnet_t) */ 52 53 /* ppp data */ 54 u_int16_t mru; /* max receive unit */ 55 TAILQ_HEAD(, ppp_link) link_head; /* list of links attached to this interface */ 56 u_int8_t nblinks; /* # links currently attached */ 57 mbuf_t outm; /* mbuf currently being output */ 58 time_t last_xmit; /* last proto packet sent on this interface */ 59 time_t last_recv; /* last proto packet received on this interface */ 60 u_int32_t sc_flags; /* ppp private flags */ 61 struct slcompress *vjcomp; /* vjc control buffer */ 62 enum NPmode npmode[NUM_NP]; /* what to do with each net proto */ 63 enum NPAFmode npafmode[NUM_NP];/* address filtering for each net proto */ 64 struct pppqueue sndq; /* send queue */ 65 bpf_packet_func bpf_input; /* bpf input function */ 66 bpf_packet_func bpf_output; /* bpf output function */ 67 68 /* data compression */ 69 void *xc_state; /* send compressor state */ 70 struct ppp_comp *xcomp; /* send compressor structure */ 71 void *rc_state; /* send compressor state */ 72 struct ppp_comp *rcomp; /* send compressor structure */ 73 74 /* network protocols data */ 75 int ip_attached; 76 struct in_addr ip_src; 77 struct in_addr ip_dst; 78 int ipv6_attached; 79 ifnet_t lo_ifp; /* loopback interface */ 80}; 81 82 83/* 84 * Bits in sc_flags: SC_NO_TCP_CCID, SC_CCP_OPEN, SC_CCP_UP, SC_LOOP_TRAFFIC, 85 * SC_MULTILINK, SC_MP_SHORTSEQ, SC_MP_XSHORTSEQ, SC_COMP_TCP, SC_REJ_COMP_TCP. 86 */ 87#define SC_FLAG_BITS (SC_NO_TCP_CCID|SC_CCP_OPEN|SC_CCP_UP|SC_LOOP_TRAFFIC \ 88 |SC_MULTILINK|SC_MP_SHORTSEQ|SC_MP_XSHORTSEQ \ 89 |SC_COMP_TCP|SC_REJ_COMP_TCP) 90 91 92int ppp_if_init(); 93int ppp_if_dispose(); 94int ppp_if_attach(u_short *unit); 95int ppp_if_attachclient(u_short unit, void *host, ifnet_t *ifp); 96void ppp_if_detachclient(ifnet_t ifp, void *host); 97 98int ppp_if_input(ifnet_t ifp, mbuf_t m, u_int16_t proto, u_int16_t hdrlen); 99int ppp_if_control(ifnet_t ifp, u_long cmd, void *data); 100int ppp_if_attachlink(struct ppp_link *link, int unit); 101int ppp_if_detachlink(struct ppp_link *link); 102int ppp_if_send(ifnet_t ifp, mbuf_t m); 103void ppp_if_error(ifnet_t ifp); 104int ppp_if_xmit(ifnet_t ifp, mbuf_t m); 105 106 107 108#define APPLE_PPP_NAME "ppp" 109 110 111 112#endif /* _PPP_IF_H_ */ 113