2 * Copyright (c) 2003 Harti Brandt.
3 * Copyright (c) 2003 Vincent Jardin.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 VATMPIF_AAL_0 = 0, /* Cell Service */
35 VATMPIF_AAL_4 = 4, /* AAL 3/4 */
36 VATMPIF_AAL_5 = 5, /* AAL 5 */
38 typedef enum vatmpif_aal Vatmpif_aal;
41 * Supported traffic type
43 enum vatmpif_traffic_type {
44 VATMPIF_TRAF_CBR = 0x01, /* Constant bit rate */
45 VATMPIF_TRAF_VBR = 0x02, /* Variable bit rate */
46 VATMPIF_TRAF_ABR = 0x03, /* Available Bit Rate */
47 VATMPIF_TRAF_UBR = 0x04, /* Unspecified bit rate */
49 typedef enum vatmpif_traffic_type Vatmpif_traffic_type;
51 typedef struct t_atm_traffic Vatmpif_traffic;
54 * Host protocol control blocks
60 * Contains the common (vv_cmn) and specific information for each VCC
61 * which is opened through a ATM PIF node.
62 * It is a virtual VCC. From the Netgraph poit of view it is a
63 * per-node's hook private data.
65 * It is a polymorph object with the instances of Cmn_vcc.
68 Cmn_vcc vv_cmn; /* Common VCC stuff */
69 Vatmpif_aal vv_aal; /* AAL */
70 Vatmpif_traffic vv_traffic; /* forward and backward ATM traffic */
71 Vatmpif_traffic_type vv_traffic_type;/* CBR, VBR, UBR, ... */
73 typedef struct vatmpif_vcc Vatmpif_vcc;
75 #define vv_next vv_cmn.cv_next
76 #define vv_toku vv_cmn.cv_toku
77 #define vv_upper vv_cmn.cv_upper
78 #define vv_connvc vv_cmn.cv_connvc
79 #define vv_state vv_cmn.cv_state
82 * The hook structure describes a virtual link
84 struct ng_vatmpif_hook {
85 hook_p hook; /* netgraph hook */
86 Vatmpif_stats stats; /* link stats */
87 uint32_t InSeq; /* last received sequence number + 1 */
88 uint32_t OutSeq; /* last sent sequence number */
89 uint32_t cur_pcr; /* slot's reserved PCR */
93 * Device Virtual Unit Structure
95 * Contains all the information for a single device (adapter).
96 * It is a virtual device. From the Netgraph point of view it is
97 * a per-node private data.
99 * It is a polymorph object with the instances of Cmn_unit.
101 struct vatmpif_unit {
102 Cmn_unit vu_cmn; /* Common unit stuff */
103 node_p node; /* netgraph node */
104 struct ng_vatmpif_hook* link; /* virtual link hoook */
105 struct ng_vatmpif_config conf; /* node configuration */
107 typedef struct vatmpif_unit Vatmpif_unit;
109 #define ng_vatmpif_private vatmpif_unit
110 typedef struct ng_vatmpif_private *priv_p;
112 #define vu_pif vu_cmn.cu_pif
113 #define vu_unit vu_cmn.cu_unit
114 #define vu_flags vu_cmn.cu_flags
115 #define vu_mtu vu_cmn.cu_mtu
116 #define vu_open_vcc vu_cmn.cu_open_vcc
117 #define vu_vcc vu_cmn.cu_vcc
118 #define vu_vcc_zone vu_cmn.cu_vcc_zone
119 #define vu_nif_zone vu_cmn.cu_nif_zone
120 #define vu_ioctl vu_cmn.cu_ioctl
121 #define vu_instvcc vu_cmn.cu_instvcc
122 #define vu_openvcc vu_cmn.cu_openvcc
123 #define vu_closevcc vu_cmn.cu_closevcc
124 #define vu_output vu_cmn.cu_output
125 #define vu_config vu_cmn.cu_config
126 #define vu_softc vu_cmn.cu_softc
128 #define vu_stats link->stats
129 #define vu_cur_pcr link->cur_pcr
132 * Netgraph to HARP API
134 int vatmpif_harp_attach(node_p node);
135 int vatmpif_harp_detach(node_p node);
137 int vatmpif_harp_recv_drain(Vatmpif_unit *vup, KBuffer *m,
138 uint8_t vpi, uint16_t vci, uint8_t pt, uint8_t clp, Vatmpif_aal aal);
141 * HARP to Netgraph API
143 int ng_atmpif_transmit(const priv_p priv, struct mbuf *m,
144 uint8_t vpi, uint16_t vci, uint8_t pt, uint8_t clp, Vatmpif_aal aal);
146 extern uma_zone_t vatmpif_nif_zone;
147 extern uma_zone_t vatmpif_vcc_zone;