freebsd-dev/usr.sbin/ppp/mbuf.h
Brian Somers 30949fd4b5 o Add ipv6 support, abstracting most NCP addresses into opaque
structures (well, they're treated as opaque).

  It's now possible to manage IPv6 interface addresses and routing
  table entries and to filter IPV6 traffic whether encapsulated or
  not.

  IPV6CP support is crude for now, and hasn't been tested against
  any other implementations.

  RADIUS and IPv6 are independent of eachother for now.

  ppp.linkup/ppp.linkdown aren't currently used by IPV6CP

o Understand all protocols(5) in filter rules rather than only a select
  few.

o Allow a mask specification for the ``delete'' command.  It's now
  possible to specifically delete one of two conflicting routes.

o When creating and deleting proxy arp entries, do it for all IPv4
  interface addresses rather than doing it just for the ``current''
  peer address.

o When iface-alias isn't in effect, don't blow away manually (via ``iface
  add'') added interface addresses.

o When listening on a tcp server (diagnostic) socket, bind so that a
  tcp46 socket is created -- allowing both IPv4 and IPv6 connections.

o When displaying ICMP traffic, don't display the icmp type twice.
  When display traffic, display at least some information about unrecognised
  traffic.

o Bump version

Inspired after filtering work by: Makoto MATSUSHITA <matusita@jp.FreeBSD.org>
2001-08-14 16:05:52 +00:00

119 lines
3.9 KiB
C

/*-
* Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org>
* based on work by Toshiharu OHNO <tony-o@iij.ad.jp>
* Internet Initiative Japan, Inc (IIJ)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
struct mbuf {
size_t m_size; /* size allocated (excluding header) */
short m_offset; /* offset from header end to start position */
size_t m_len; /* available byte count in buffer */
short m_type; /* MB_* below */
struct mbuf *m_next; /* link to next mbuf */
struct mbuf *m_nextpkt; /* link to next packet */
/* buffer space is malloc()d directly after the header */
};
struct mqueue {
struct mbuf *top;
struct mbuf *last;
size_t len;
};
#define MBUF_CTOP(bp) \
((bp) ? (u_char *)((bp)+1) + (bp)->m_offset : NULL)
#define CONST_MBUF_CTOP(bp) \
((bp) ? (const u_char *)((bp)+1) + (bp)->m_offset : NULL)
#define MB_IPIN 0
#define MB_IPOUT 1
#define MB_IPV6IN 2
#define MB_IPV6OUT 3
#define MB_NATIN 4
#define MB_NATOUT 5
#define MB_MPIN 6
#define MB_MPOUT 7
#define MB_VJIN 8
#define MB_VJOUT 9
#define MB_ICOMPDIN 10
#define MB_ICOMPDOUT 11
#define MB_COMPDIN 12
#define MB_COMPDOUT 13
#define MB_LQRIN 14
#define MB_LQROUT 15
#define MB_ECHOIN 16
#define MB_ECHOOUT 17
#define MB_PROTOIN 18
#define MB_PROTOOUT 19
#define MB_ACFIN 20
#define MB_ACFOUT 21
#define MB_SYNCIN 22
#define MB_SYNCOUT 23
#define MB_HDLCIN 24
#define MB_HDLCOUT 25
#define MB_ASYNCIN 26
#define MB_ASYNCOUT 27
#define MB_CBCPIN 28
#define MB_CBCPOUT 29
#define MB_CHAPIN 30
#define MB_CHAPOUT 31
#define MB_PAPIN 32
#define MB_PAPOUT 33
#define MB_CCPIN 34
#define MB_CCPOUT 35
#define MB_IPCPIN 36
#define MB_IPCPOUT 37
#define MB_IPV6CPIN 38
#define MB_IPV6CPOUT 39
#define MB_LCPIN 40
#define MB_LCPOUT 41
#define MB_UNKNOWN 42
#define MB_MAX MB_UNKNOWN
#define M_MAXLEN (4352 - sizeof(struct mbuf)) /* > HDLCSIZE */
struct cmdargs;
extern int m_length(struct mbuf *);
extern struct mbuf *m_get(size_t, int);
extern struct mbuf *m_free(struct mbuf *);
extern void m_freem(struct mbuf *);
extern void mbuf_Write(struct mbuf *, const void *, size_t);
extern struct mbuf *mbuf_Read(struct mbuf *, void *, size_t);
extern size_t mbuf_View(struct mbuf *, void *, size_t);
extern struct mbuf *m_prepend(struct mbuf *, const void *, size_t, size_t);
extern struct mbuf *m_adj(struct mbuf *, ssize_t);
extern struct mbuf *m_pullup(struct mbuf *);
extern void m_settype(struct mbuf *, int);
extern struct mbuf *m_append(struct mbuf *, const void *, size_t);
extern int mbuf_Show(struct cmdargs const *);
extern void m_enqueue(struct mqueue *, struct mbuf *);
extern struct mbuf *m_dequeue(struct mqueue *);