2015-09-06 09:00:59 +03:00
|
|
|
/* $NetBSD: natm.h,v 1.15 2015/09/06 06:01:01 dholland Exp $ */
|
1996-07-04 07:20:11 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1996 Charles D. Cranor and Washington University.
|
|
|
|
* 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 ``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 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.
|
|
|
|
*/
|
|
|
|
|
2000-07-03 05:19:23 +04:00
|
|
|
#ifndef _NETNATM_NATM_H_
|
|
|
|
#define _NETNATM_NATM_H_
|
|
|
|
|
1996-07-04 07:20:11 +04:00
|
|
|
/*
|
|
|
|
* natm.h: native mode atm
|
|
|
|
*/
|
|
|
|
|
2015-09-06 09:00:59 +03:00
|
|
|
#include <sys/ioccom.h>
|
|
|
|
|
1996-07-04 07:20:11 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* supported protocols
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define PROTO_NATMAAL0 1
|
2005-02-27 01:31:44 +03:00
|
|
|
#define PROTO_NATMAAL5 2
|
1996-07-04 07:20:11 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* sockaddr_natm
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct sockaddr_natm {
|
|
|
|
u_int8_t snatm_len; /* length */
|
|
|
|
u_int8_t snatm_family; /* AF_NATM */
|
|
|
|
char snatm_if[IFNAMSIZ]; /* interface name */
|
|
|
|
u_int16_t snatm_vci; /* vci */
|
|
|
|
u_int8_t snatm_vpi; /* vpi */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__) && defined(KERNEL)
|
|
|
|
|
|
|
|
#ifndef _KERNEL
|
|
|
|
#define _KERNEL
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define SPLSOFTNET() splnet()
|
|
|
|
|
|
|
|
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
|
|
|
|
|
|
|
#define SPLSOFTNET() splsoftnet()
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _KERNEL
|
|
|
|
|
|
|
|
/*
|
|
|
|
* natm protocol control block
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct natmpcb {
|
|
|
|
LIST_ENTRY(natmpcb) pcblist; /* list pointers */
|
|
|
|
u_int npcb_inq; /* # of our pkts in proto q */
|
|
|
|
struct socket *npcb_socket; /* backpointer to socket */
|
|
|
|
struct ifnet *npcb_ifp; /* pointer to hardware */
|
1997-07-20 02:51:13 +04:00
|
|
|
struct in_addr ipaddr; /* remote IP address, if NPCB_IP */
|
1996-07-04 07:20:11 +04:00
|
|
|
u_int16_t npcb_vci; /* VCI */
|
|
|
|
u_int8_t npcb_vpi; /* VPI */
|
|
|
|
u_int8_t npcb_flags; /* flags */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
#define NPCB_FREE 0x01 /* free (not on any list) */
|
|
|
|
#define NPCB_CONNECTED 0x02 /* connected */
|
|
|
|
#define NPCB_IP 0x04 /* used by IP */
|
|
|
|
#define NPCB_DRAIN 0x08 /* destory as soon as inq == 0 */
|
|
|
|
#define NPCB_RAW 0x10 /* in 'raw' mode? */
|
|
|
|
|
|
|
|
/* flag arg to npcb_free */
|
|
|
|
#define NPCB_REMOVE 0 /* remove from global list */
|
|
|
|
#define NPCB_DESTROY 1 /* destroy and be free */
|
|
|
|
|
|
|
|
/*
|
2005-02-27 01:31:44 +03:00
|
|
|
* NPCB_RAWCC is a hack which applies to connections in 'raw' mode. it
|
|
|
|
* is used to override the sbspace() macro when you *really* don't want
|
1996-07-04 07:20:11 +04:00
|
|
|
* to drop rcv data. the recv socket buffer size is raised to this value.
|
|
|
|
*
|
|
|
|
* XXX: socket buffering needs to be looked at.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define NPCB_RAWCC (1024*1024) /* 1MB */
|
|
|
|
|
|
|
|
LIST_HEAD(npcblist, natmpcb);
|
|
|
|
|
|
|
|
/* global data structures */
|
|
|
|
|
2005-01-23 21:41:56 +03:00
|
|
|
extern struct npcblist natm_pcbs; /* global list of pcbs */
|
1996-07-04 07:20:11 +04:00
|
|
|
extern struct ifqueue natmintrq; /* natm packet input queue */
|
|
|
|
#define NATM_STAT
|
|
|
|
#ifdef NATM_STAT
|
|
|
|
extern u_int natm_sodropcnt,
|
|
|
|
natm_sodropbytes; /* account of droppage */
|
|
|
|
extern u_int natm_sookcnt,
|
|
|
|
natm_sookbytes; /* account of ok */
|
|
|
|
#endif
|
|
|
|
|
2014-05-18 18:46:15 +04:00
|
|
|
extern const struct pr_usrreqs natm_usrreqs;
|
|
|
|
|
1996-07-04 07:20:11 +04:00
|
|
|
/* atm_rawioctl: kernel's version of SIOCRAWATM [for internal use only!] */
|
|
|
|
struct atm_rawioctl {
|
|
|
|
struct natmpcb *npcb;
|
|
|
|
int rawvalue;
|
2005-02-27 01:31:44 +03:00
|
|
|
};
|
1996-07-04 07:20:11 +04:00
|
|
|
#define SIOCXRAWATM _IOWR('a', 125, struct atm_rawioctl)
|
|
|
|
|
|
|
|
/* external functions */
|
|
|
|
|
|
|
|
/* natm_pcb.c */
|
2014-05-19 06:51:24 +04:00
|
|
|
struct natmpcb *npcb_alloc(bool);
|
2009-03-14 17:45:51 +03:00
|
|
|
void npcb_free(struct natmpcb *, int);
|
2014-07-06 19:44:25 +04:00
|
|
|
struct natmpcb *npcb_add(struct natmpcb *, struct ifnet *, u_int16_t, u_int8_t);
|
1996-07-04 07:20:11 +04:00
|
|
|
|
|
|
|
/* natm.c */
|
2009-03-14 17:45:51 +03:00
|
|
|
int natm0_sysctl(int *, u_int, void *, size_t *, void *, size_t);
|
|
|
|
int natm5_sysctl(int *, u_int, void *, size_t *, void *, size_t);
|
|
|
|
void natmintr(void);
|
1996-07-04 07:20:11 +04:00
|
|
|
|
|
|
|
#endif
|
2000-07-03 05:19:23 +04:00
|
|
|
|
2005-12-11 03:02:28 +03:00
|
|
|
#endif /* !_NETNATM_NATM_H_ */
|