[BACK]Return to natm.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / netnatm

Annotation of src/sys/netnatm/natm.h, Revision 1.14

1.14    ! rtr         1: /*     $NetBSD: natm.h,v 1.13 2014/05/19 02:51:25 rmind Exp $  */
1.1       chuck       2:
                      3: /*
                      4:  * Copyright (c) 1996 Charles D. Cranor and Washington University.
                      5:  * All rights reserved.
                      6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
                     15:  *
                     16:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     17:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     18:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     19:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     20:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     21:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     22:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     23:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     24:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
                     25:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     26:  */
                     27:
1.3       sommerfe   28: #ifndef _NETNATM_NATM_H_
                     29: #define _NETNATM_NATM_H_
                     30:
1.1       chuck      31: /*
                     32:  * natm.h: native mode atm
                     33:  */
                     34:
                     35:
                     36: /*
                     37:  * supported protocols
                     38:  */
                     39:
                     40: #define PROTO_NATMAAL0         1
1.7       perry      41: #define PROTO_NATMAAL5         2
1.1       chuck      42:
                     43: /*
                     44:  * sockaddr_natm
                     45:  */
                     46:
                     47: struct sockaddr_natm {
                     48:   u_int8_t     snatm_len;              /* length */
                     49:   u_int8_t     snatm_family;           /* AF_NATM */
                     50:   char         snatm_if[IFNAMSIZ];     /* interface name */
                     51:   u_int16_t    snatm_vci;              /* vci */
                     52:   u_int8_t     snatm_vpi;              /* vpi */
                     53: };
                     54:
                     55:
                     56: #if defined(__FreeBSD__) && defined(KERNEL)
                     57:
                     58: #ifndef _KERNEL
                     59: #define _KERNEL
                     60: #endif
                     61:
                     62: #define SPLSOFTNET() splnet()
                     63:
                     64: #elif defined(__NetBSD__) || defined(__OpenBSD__)
                     65:
                     66: #define SPLSOFTNET() splsoftnet()
                     67:
                     68: #endif
                     69:
                     70: #ifdef _KERNEL
                     71:
                     72: /*
                     73:  * natm protocol control block
                     74:  */
                     75:
                     76: struct natmpcb {
                     77:   LIST_ENTRY(natmpcb) pcblist;         /* list pointers */
                     78:   u_int        npcb_inq;                       /* # of our pkts in proto q */
                     79:   struct socket        *npcb_socket;           /* backpointer to socket */
                     80:   struct ifnet *npcb_ifp;              /* pointer to hardware */
1.2       chuck      81:   struct in_addr ipaddr;               /* remote IP address, if NPCB_IP */
1.1       chuck      82:   u_int16_t npcb_vci;                  /* VCI */
                     83:   u_int8_t npcb_vpi;                   /* VPI */
                     84:   u_int8_t npcb_flags;                 /* flags */
                     85: };
                     86:
                     87: /* flags */
                     88: #define NPCB_FREE      0x01            /* free (not on any list) */
                     89: #define NPCB_CONNECTED 0x02            /* connected */
                     90: #define NPCB_IP                0x04            /* used by IP */
                     91: #define NPCB_DRAIN     0x08            /* destory as soon as inq == 0 */
                     92: #define NPCB_RAW       0x10            /* in 'raw' mode? */
                     93:
                     94: /* flag arg to npcb_free */
                     95: #define NPCB_REMOVE    0               /* remove from global list */
                     96: #define NPCB_DESTROY   1               /* destroy and be free */
                     97:
                     98: /*
1.7       perry      99:  * NPCB_RAWCC is a hack which applies to connections in 'raw' mode.   it
                    100:  * is used to override the sbspace() macro when you *really* don't want
1.1       chuck     101:  * to drop rcv data.   the recv socket buffer size is raised to this value.
                    102:  *
                    103:  * XXX: socket buffering needs to be looked at.
                    104:  */
                    105:
                    106: #define NPCB_RAWCC (1024*1024)         /* 1MB */
                    107:
                    108: LIST_HEAD(npcblist, natmpcb);
                    109:
                    110: /* global data structures */
                    111:
1.6       matt      112: extern struct npcblist natm_pcbs;      /* global list of pcbs */
1.1       chuck     113: extern struct ifqueue natmintrq;       /* natm packet input queue */
                    114: #define        NATM_STAT
                    115: #ifdef NATM_STAT
                    116: extern u_int natm_sodropcnt,
                    117:                natm_sodropbytes;       /* account of droppage */
                    118: extern u_int natm_sookcnt,
                    119:                natm_sookbytes;         /* account of ok */
                    120: #endif
                    121:
1.12      rmind     122: extern const struct pr_usrreqs natm_usrreqs;
                    123:
1.1       chuck     124: /* atm_rawioctl: kernel's version of SIOCRAWATM [for internal use only!] */
                    125: struct atm_rawioctl {
                    126:   struct natmpcb *npcb;
                    127:   int rawvalue;
1.7       perry     128: };
1.1       chuck     129: #define SIOCXRAWATM     _IOWR('a', 125, struct atm_rawioctl)
                    130:
                    131: /* external functions */
                    132:
                    133: /* natm_pcb.c */
1.13      rmind     134: struct natmpcb *npcb_alloc(bool);
1.10      dsl       135: void   npcb_free(struct natmpcb *, int);
1.14    ! rtr       136: struct natmpcb *npcb_add(struct natmpcb *, struct ifnet *, u_int16_t, u_int8_t);
1.1       chuck     137:
                    138: /* natm.c */
1.10      dsl       139: int    natm0_sysctl(int *, u_int, void *, size_t *, void *, size_t);
                    140: int    natm5_sysctl(int *, u_int, void *, size_t *, void *, size_t);
                    141: void   natmintr(void);
1.1       chuck     142:
                    143: #endif
1.3       sommerfe  144:
1.8       elad      145: #endif /* !_NETNATM_NATM_H_ */

CVSweb <webmaster@jp.NetBSD.org>