source: rtems/cpukit/libnetworking/net/if_pppvar.h @ 41ff670

4.104.114.84.95
Last change on this file since 41ff670 was 41ff670, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/08/05 at 01:51:07

2005-02-08 Ralf Corsepius <ralf.corsepius@…>

  • libnetworking/net/if_ppp.c, libnetworking/net/if_pppvar.h: Ansification, cosmetics from FreeBSD.
  • Property mode set to 100644
File size: 5.8 KB
Line 
1/*  $Id$ */
2/*
3 * if_pppvar.h - private structures and declarations for PPP.
4 *
5 * Copyright (c) 1994 The Australian National University.
6 * All rights reserved.
7 *
8 * Permission to use, copy, modify, and distribute this software and its
9 * documentation is hereby granted, provided that the above copyright
10 * notice appears in all copies.  This software is provided without any
11 * warranty, express or implied. The Australian National University
12 * makes no representations about the suitability of this software for
13 * any purpose.
14 *
15 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
16 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
17 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
18 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
19 * OF SUCH DAMAGE.
20 *
21 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
22 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
24 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
25 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
26 * OR MODIFICATIONS.
27 *
28 * Copyright (c) 1989 Carnegie Mellon University.
29 * All rights reserved.
30 *
31 * Redistribution and use in source and binary forms are permitted
32 * provided that the above copyright notice and this paragraph are
33 * duplicated in all such forms and that any documentation,
34 * advertising materials, and other materials related to such
35 * distribution and use acknowledge that the software was developed
36 * by Carnegie Mellon University.  The name of the
37 * University may not be used to endorse or promote products derived
38 * from this software without specific prior written permission.
39 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
40 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
41 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
42 */
43
44/*
45 * Supported network protocols.  These values are used for
46 * indexing sc_npmode.
47 */
48#define NP_IP                 0 /* Internet Protocol */
49#define NUM_NP                1 /* Number of NPs. */
50#define NUM_MBUFQ            64
51
52
53/*
54 * Structure describing each ppp unit.
55 */
56struct ppp_softc {
57        struct  ifnet sc_if;            /* network-visible interface */
58        u_int   sc_flags;               /* control/status bits; see if_ppp.h */
59        void    *sc_devp;               /* pointer to device-dep structure */
60        void    (*sc_start)(struct ppp_softc *);        /* start output proc */
61        void    (*sc_ctlp)(struct ppp_softc *); /* rcvd control pkt */
62        void    (*sc_relinq)(struct ppp_softc *); /* relinquish ifunit */
63        short   sc_mru;                 /* max receive unit */
64        pid_t   sc_xfer;                /* used in transferring unit */
65        struct  ifqueue sc_rawq;        /* received packets */
66        struct  ifqueue sc_inq;         /* queue of input packets for daemon */
67        struct  ifqueue sc_fastq;       /* interactive output packet q */
68        struct  mbuf *sc_npqueue;       /* output packets not to be sent yet */
69        struct  mbuf **sc_npqtail;      /* ptr to last next ptr in npqueue */
70        struct  pppstat sc_stats;       /* count of bytes/pkts sent/rcvd */
71        caddr_t sc_bpf;                 /* hook for BPF */
72        enum    NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
73        struct  compressor *sc_xcomp;   /* transmit compressor */
74        void    *sc_xc_state;           /* transmit compressor state */
75        struct  compressor *sc_rcomp;   /* receive decompressor */
76        void    *sc_rc_state;           /* receive decompressor state */
77        time_t  sc_last_sent;           /* time (secs) last NP pkt sent */
78        time_t  sc_last_recv;           /* time (secs) last NP pkt rcvd */
79#ifdef PPP_FILTER
80        struct  bpf_program sc_pass_filt;   /* filter for packets to pass */
81        struct  bpf_program sc_active_filt; /* filter for "non-idle" packets */
82#endif /* PPP_FILTER */
83#ifdef  VJC
84        struct  vjcompress *sc_comp;    /* vjc control buffer */
85#endif
86
87        /* Device-dependent part for async lines. */
88        ext_accm sc_asyncmap;                /* async control character map */
89        u_long  sc_rasyncmap;                /* receive async control char map */
90        struct  mbuf *sc_outm;               /* mbuf chain currently being output */
91        struct  mbuf *sc_outmc;              /* mbuf currently being output */
92        struct  mbuf *sc_m;                  /* pointer to input mbuf chain */
93        struct  mbuf *sc_mc;                 /* pointer to current input mbuf */
94        char    *sc_mp;                      /* ptr to next char in input mbuf */
95        short   sc_ilen;                     /* length of input packet so far */
96        u_short sc_fcs;                      /* FCS so far (input) */
97        u_short sc_outfcs;                   /* FCS so far for output packet */
98        u_char  sc_rawin[16];                /* chars as received */
99        int     sc_rawin_count;              /* # in sc_rawin */
100
101        struct  ifqueue sc_freeq;            /* free packets */
102        short   sc_outoff;                   /* output packet byte offset */
103        short   sc_outflag;                  /* output status flag */
104        short   sc_outlen;                   /* length of output packet */
105        short   sc_outfcslen;                /* length of output fcs data */
106        u_char  sc_outfcsbuf[8];             /* output packet fcs buffer */
107        u_char *sc_outbuf;                   /* pointer to output data */
108        u_char  sc_outchar;
109
110        rtems_id sc_rxtask;
111        rtems_id sc_txtask;
112        rtems_id sc_pppdtask;
113};
114
115struct  ppp_softc ppp_softc[NPPP];
116
117struct  ppp_softc *pppalloc(pid_t pid);
118void    pppdealloc(struct ppp_softc *sc);
119int     pppoutput(struct ifnet *, struct mbuf *,
120                       struct sockaddr *, struct rtentry *);
121int     pppioctl(struct ppp_softc *sc, int cmd, caddr_t data,
122                      int flag, struct proc *p);
123struct  mbuf *ppp_dequeue(struct ppp_softc *sc);
124u_short pppfcs(u_short fcs, u_char *cp, int len);
125void    pppallocmbuf(struct ppp_softc *sc, struct mbuf **mp);
126
127
128/* define event values */
129#define RX_PACKET    RTEMS_EVENT_1
130#define RX_MBUF      RTEMS_EVENT_2
131#define RX_EMPTY     RTEMS_EVENT_3
132#define TX_PACKET    RTEMS_EVENT_1
133#define TX_TRANSMIT  RTEMS_EVENT_2
134#define PPPD_EVENT   RTEMS_EVENT_31
135
136/* define out flag values */
137#define SC_TX_BUSY      0x0001
138#define SC_TX_FCS       0x0002
139#define SC_TX_ESCAPE    0x0004
140#define SC_TX_LASTCHAR  0x0008
141#define SC_TX_PENDING   0x0010
Note: See TracBrowser for help on using the repository browser.