Move around some #ifdefs to silence warnings.
[dragonfly.git] / sys / netproto / atm / atm_ioctl.h
1 /*
2  *
3  * ===================================
4  * HARP  |  Host ATM Research Platform
5  * ===================================
6  *
7  *
8  * This Host ATM Research Platform ("HARP") file (the "Software") is
9  * made available by Network Computing Services, Inc. ("NetworkCS")
10  * "AS IS".  NetworkCS does not provide maintenance, improvements or
11  * support of any kind.
12  *
13  * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14  * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15  * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16  * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17  * In no event shall NetworkCS be responsible for any damages, including
18  * but not limited to consequential damages, arising from or relating to
19  * any use of the Software or related support.
20  *
21  * Copyright 1994-1998 Network Computing Services, Inc.
22  *
23  * Copies of this Software may be made, however, the above copyright
24  * notice must be reproduced on all copies.
25  *
26  *      @(#) $FreeBSD: src/sys/netatm/atm_ioctl.h,v 1.3 1999/08/28 00:48:36 peter Exp $
27  *      @(#) $DragonFly: src/sys/netproto/atm/atm_ioctl.h,v 1.2 2003/06/17 04:28:49 dillon Exp $
28  *
29  */
30
31 /*
32  * Core ATM Services
33  * -----------------
34  *
35  * PF_ATM socket ioctl definitions
36  *
37  */
38
39 #ifndef _NETATM_ATM_IOCTL_H
40 #define _NETATM_ATM_IOCTL_H
41
42
43 /*
44  * Structure for PF_ATM configure (AIOCCFG) socket ioctls
45  */
46 struct atmcfgreq {
47         int             acr_opcode;             /* Sub-operation */
48         union {
49                 struct {
50                         /* Configure - attach */
51                         char    acru_att_intf[IFNAMSIZ];/* Interface name */
52                         u_char  acru_att_proto; /* Signalling protocol */
53                 } acru_att;
54                 struct {
55                         /* Configure - detach */
56                         char    acru_det_intf[IFNAMSIZ];/* Interface name */
57                 } acru_det;
58         } acr_u;
59 };
60 #define acr_att_intf    acr_u.acru_att.acru_att_intf
61 #define acr_att_proto   acr_u.acru_att.acru_att_proto
62 #define acr_det_intf    acr_u.acru_det.acru_det_intf
63
64
65 /*
66  * Structure for PF_ATM set (AIOCSET) socket ioctls
67  */
68 struct atmsetreq {
69         int             asr_opcode;             /* Sub-operation */
70         union {
71                 /* ARP server */
72                 struct {
73                         char    asru_arp_intf[IFNAMSIZ];/* Interface name */
74                         Atm_addr        asru_arp_addr;  /* ARP srvr address */
75                         Atm_addr        asru_arp_subaddr;/* ARP srvr subaddr */
76                         caddr_t         asru_arp_pbuf;  /* Prefix buffer addr */
77                         int             asru_arp_plen;  /* Prefix buffer len */
78                 } asru_asrvr;
79                 /* MAC address */
80                 struct {
81                         char    asru_mac_intf[IFNAMSIZ];/* Interface name */
82                         struct mac_addr asru_mac_addr;  /* MAC address */
83                 } asru_mac;
84                 /* Network interface */
85                 struct {
86                         char    asru_nif_intf[IFNAMSIZ];/* Interface name */
87                         char    asru_nif_pref[IFNAMSIZ];/* I/f prefix name */
88                         int     asru_nif_cnt;           /* Number of i/fs */
89                 } asru_nif;
90                 /* NSAP prefix */
91                 struct {
92                         char    asru_prf_intf[IFNAMSIZ];/* Interface name */
93                         u_char  asru_prf_pref[13];      /* NSAP prefix */
94                 } asru_prf;
95         } asr_u;
96 };
97 #define asr_arp_intf    asr_u.asru_asrvr.asru_arp_intf
98 #define asr_arp_addr    asr_u.asru_asrvr.asru_arp_addr
99 #define asr_arp_pbuf    asr_u.asru_asrvr.asru_arp_pbuf
100 #define asr_arp_plen    asr_u.asru_asrvr.asru_arp_plen
101 #define asr_arp_subaddr asr_u.asru_asrvr.asru_arp_subaddr
102 #define asr_mac_intf    asr_u.asru_mac.asru_mac_intf
103 #define asr_mac_addr    asr_u.asru_mac.asru_mac_addr
104 #define asr_nif_intf    asr_u.asru_nif.asru_nif_intf
105 #define asr_nif_pref    asr_u.asru_nif.asru_nif_pref
106 #define asr_nif_cnt     asr_u.asru_nif.asru_nif_cnt
107 #define asr_prf_intf    asr_u.asru_prf.asru_prf_intf
108 #define asr_prf_pref    asr_u.asru_prf.asru_prf_pref
109
110
111 /*
112  * Structure for PF_ATM add (AIOCADD) socket ioctls
113  */
114 struct atmaddreq {
115         int             aar_opcode;             /* Sub-operation */
116         union {
117                 /* Add PVC */
118                 struct {
119                         char    aaru_pvc_intf[IFNAMSIZ];/* Interface name */
120                         u_short aaru_pvc_vpi;           /* VPI value */
121                         u_short aaru_pvc_vci;           /* VCI value */
122                         struct sockaddr aaru_pvc_dst;   /* Destination addr */
123                         Sap_t   aaru_pvc_sap;           /* Endpoint SAP */
124                         Aal_t   aaru_pvc_aal;           /* AAL */
125                         Encaps_t aaru_pvc_encaps;       /* Encapsulation */
126                         u_char  aaru_pvc_flags;         /* Flags (see below) */
127                 } aaru_add_pvc;
128
129                 /* Add ARP table entry */
130                 struct {
131                         char    aaru_arp_intf[IFNAMSIZ];/* Interface name */
132                         struct sockaddr aaru_arp_dst;   /* IP addr */
133                         Atm_addr        aaru_arp_addr;  /* ATM addr */
134                         u_char  aaru_arp_origin;        /* Entry origin */
135                 } aaru_add_arp;
136         } aar_u;
137 };
138 #define aar_pvc_intf    aar_u.aaru_add_pvc.aaru_pvc_intf
139 #define aar_pvc_vpi     aar_u.aaru_add_pvc.aaru_pvc_vpi
140 #define aar_pvc_vci     aar_u.aaru_add_pvc.aaru_pvc_vci
141 #define aar_pvc_dst     aar_u.aaru_add_pvc.aaru_pvc_dst
142 #define aar_pvc_sap     aar_u.aaru_add_pvc.aaru_pvc_sap
143 #define aar_pvc_aal     aar_u.aaru_add_pvc.aaru_pvc_aal
144 #define aar_pvc_encaps  aar_u.aaru_add_pvc.aaru_pvc_encaps
145 #define aar_pvc_flags   aar_u.aaru_add_pvc.aaru_pvc_flags
146 #define aar_arp_intf    aar_u.aaru_add_arp.aaru_arp_intf
147 #define aar_arp_dst     aar_u.aaru_add_arp.aaru_arp_dst
148 #define aar_arp_addr    aar_u.aaru_add_arp.aaru_arp_addr
149 #define aar_arp_origin  aar_u.aaru_add_arp.aaru_arp_origin
150
151 /* PVC flags */
152 #define PVC_DYN         0x01                    /* Dest addr is dynamic */
153
154
155 /*
156  * Structure for PF_ATM delete (AIOCDEL) socket ioctls
157  */
158 struct atmdelreq {
159         int             adr_opcode;             /* Sub-operation */
160         union {
161                 /* Delete PVC */
162                 struct {
163                         char    adru_pvc_intf[IFNAMSIZ];/* Interface name */
164                         u_short adru_pvc_vpi;           /* VPI value */
165                         u_short adru_pvc_vci;           /* VCI value */
166                 } adru_del_pvc;
167
168                 /* Delete SVC */
169                 struct {
170                         char    adru_svc_intf[IFNAMSIZ];/* Interface name */
171                         u_short adru_svc_vpi;           /* VPI value */
172                         u_short adru_svc_vci;           /* VCI value */
173                 } adru_del_svc;
174
175                 /* Delete ARP table entry */
176                 struct {
177                         char    adru_arp_intf[IFNAMSIZ];/* Interface name */
178                         struct sockaddr adru_arp_dst;   /* IP addr */
179                 } adru_del_arp;
180         } adr_u;
181 };
182 #define adr_pvc_intf    adr_u.adru_del_pvc.adru_pvc_intf
183 #define adr_pvc_vpi     adr_u.adru_del_pvc.adru_pvc_vpi
184 #define adr_pvc_vci     adr_u.adru_del_pvc.adru_pvc_vci
185 #define adr_svc_intf    adr_u.adru_del_svc.adru_svc_intf
186 #define adr_svc_vpi     adr_u.adru_del_svc.adru_svc_vpi
187 #define adr_svc_vci     adr_u.adru_del_svc.adru_svc_vci
188 #define adr_arp_intf    adr_u.adru_del_arp.adru_arp_intf
189 #define adr_arp_dst     adr_u.adru_del_arp.adru_arp_dst
190
191
192 /*
193  * Structure for PF_ATM information (AIOCINFO) socket ioctls
194  */
195 struct atminfreq {
196         int             air_opcode;             /* Sub-operation */
197         caddr_t         air_buf_addr;           /* Buffer for returned info */
198         int             air_buf_len;            /* Buffer length */
199         union {
200                 /* Vendor info */
201                 char            airu_vinfo_intf[IFNAMSIZ];/* Interface name */
202                 /* IP VCC */
203                 struct sockaddr airu_ip_addr;           /* Destination host */
204                 /* ARP table */
205                 struct {
206                         struct sockaddr airu_arp_addr;  /* Destination host */
207                         u_char          airu_arp_flags; /* Flags (see below) */
208                 } airu_arp;
209                 /* ARP server */
210                 char            airu_asrv_intf[IFNAMSIZ];/* Interface name */
211                 /* Interface */
212                 char            airu_int_intf[IFNAMSIZ];/* Interface name */
213                 /* VCC */
214                 char            airu_vcc_intf[IFNAMSIZ];/* Interface name */
215                 /* Configuration */
216                 char            airu_cfg_intf[IFNAMSIZ];/* Interface name */
217                 /* Network interface */
218                 char            airu_netif_intf[IFNAMSIZ];/* Interface name */
219                 /* Physical interface statistics */
220                 char            airu_physt_intf[IFNAMSIZ];/* Interface name */
221         } air_u;
222 };
223 #define air_vinfo_intf          air_u.airu_vinfo_intf
224 #define air_ip_addr             air_u.airu_ip_addr
225 #define air_arp_addr            air_u.airu_arp.airu_arp_addr
226 #define air_arp_flags           air_u.airu_arp.airu_arp_flags
227 #define air_asrv_intf           air_u.airu_asrv_intf
228 #define air_int_intf            air_u.airu_int_intf
229 #define air_vcc_intf            air_u.airu_vcc_intf
230 #define air_cfg_intf            air_u.airu_cfg_intf
231 #define air_netif_intf          air_u.airu_netif_intf
232 #define air_physt_intf          air_u.airu_physt_intf
233
234 /* ARP table info flags */
235 #define ARP_RESET_REF   0x01                    /* Reset refresh status */
236
237
238 /*
239  * Structures returned by information requests
240  */
241
242 /*
243  * Vendor-specific interface information
244  */
245 struct air_vinfo_rsp {
246         char            avsp_intf[IFNAMSIZ];    /* Interface name */
247         int             avsp_len;               /* Length of returned
248                                                         Vendor Info block */
249                                                 /* Vendor info ... */
250 };
251
252
253 /*
254  * ARP table information
255  */
256 struct air_arp_rsp {
257         struct sockaddr aap_arp_addr;           /* Destination host */
258         char            aap_intf[IFNAMSIZ];     /* Interface name */
259         u_char          aap_flags;              /* Flags (see below) */
260         u_char          aap_origin;             /* Entry origin (see below) */
261         u_char          aap_age;                /* Aging timeout (minutes) */
262         Atm_addr        aap_addr;               /* ATM address */
263         Atm_addr        aap_subaddr;            /* ATM subaddress */
264 };
265
266 /*
267  * ARP entry flags
268  */
269 #define ARPF_VALID      0x01                    /* Entry is valid */
270 #define ARPF_REFRESH    0x02                    /* Entry has been refreshed */
271
272 /*
273  * ARP entry origin
274  */
275 #define ARP_ORIG_PERM   50                      /* Permanent entry */
276
277 /*
278  * IP VCC information
279  */
280 struct air_ip_vcc_rsp {
281         struct sockaddr aip_dst_addr;           /* Destination host */
282         char            aip_intf[IFNAMSIZ];     /* Interface name */
283         u_short         aip_vpi;                /* VPI value */
284         u_short         aip_vci;                /* VCI value */
285         u_char          aip_sig_proto;          /* Signalling protocol */
286         u_char          aip_flags;              /* Flags (IVF_*) */
287         u_char          aip_state;              /* IP VCC state */
288 };
289
290 /*
291  * ARP server information
292  */
293 struct air_asrv_rsp {
294         char            asp_intf[IFNAMSIZ];     /* Interface name */
295         Atm_addr        asp_addr;               /* Server ATM address */
296         Atm_addr        asp_subaddr;            /* Server ATM subaddress */
297         int             asp_state;              /* Server state */
298         int             asp_nprefix;            /* Number of prefix entries */
299 };
300
301 /*
302  * Interface information
303  */
304 struct air_int_rsp {
305         char            anp_intf[IFNAMSIZ];     /* Interface name */
306         Atm_addr        anp_addr;               /* ATM address */
307         Atm_addr        anp_subaddr;            /* ATM subaddress */
308         u_char          anp_sig_proto;          /* Signalling protocol */
309         u_char          anp_sig_state;          /* Signalling protocol state */
310         char            anp_nif_pref[IFNAMSIZ]; /* Netif prefix */
311         int             anp_nif_cnt;            /* No. of netifs */
312 };
313
314 /*
315  * Network interface information
316  */
317 struct air_netif_rsp {
318         char            anp_intf[IFNAMSIZ];     /* Interface name */
319         struct sockaddr anp_proto_addr;         /* Protocol address */
320         char            anp_phy_intf[IFNAMSIZ]; /* Interface name */
321 };
322
323 /*
324  * VCC information
325  */
326 #define O_CNT           8
327 struct air_vcc_rsp {
328         char            avp_intf[IFNAMSIZ];     /* Interface name */
329         u_short         avp_vpi;                /* VPI value */
330         u_short         avp_vci;                /* VCI value */
331         u_char          avp_type;               /* Type (SVC or PVC) */
332         u_char          avp_aal;                /* AAL */
333         u_char          avp_sig_proto;          /* Signalling protocol */
334         Encaps_t        avp_encaps;             /* Encapsulation */
335         u_char          avp_state;              /* State (sig mgr specific) */
336         char            avp_owners[(T_ATM_APP_NAME_LEN+1)*O_CNT];/* VCC users */
337         Atm_addr        avp_daddr;              /* Address of far end */
338         Atm_addr        avp_dsubaddr;           /* Subaddress of far end */
339         long            avp_ipdus;              /* PDUs received from VCC */
340         long            avp_opdus;              /* PDUs sent to VCC */
341         long            avp_ibytes;             /* Bytes received from VCC */
342         long            avp_obytes;             /* Bytes sent to VCC */
343         long            avp_ierrors;            /* Errors receiving from VCC */
344         long            avp_oerrors;            /* Errors sending to VCC */
345         time_t          avp_tstamp;             /* State transition timestamp */
346 };
347
348 /*
349  * Adapter configuration information
350  */
351 struct air_cfg_rsp {
352         char            acp_intf[IFNAMSIZ];     /* Interface name */
353         Atm_config      acp_cfg;                /* Config info */
354 };
355 #define acp_vendor      acp_cfg.ac_vendor
356 #define acp_vendapi     acp_cfg.ac_vendapi
357 #define acp_device      acp_cfg.ac_device
358 #define acp_media       acp_cfg.ac_media
359 #define acp_serial      acp_cfg.ac_serial
360 #define acp_bustype     acp_cfg.ac_bustype
361 #define acp_busslot     acp_cfg.ac_busslot
362 #define acp_ram         acp_cfg.ac_ram
363 #define acp_ramsize     acp_cfg.ac_ramsize
364 #define acp_macaddr     acp_cfg.ac_macaddr
365 #define acp_hard_vers   acp_cfg.ac_hard_vers
366 #define acp_firm_vers   acp_cfg.ac_firm_vers
367
368 /*
369  * Version information
370  */
371 struct air_version_rsp {
372         int             avp_version;            /* Software version */
373 };
374
375 /*
376  * Physical interface statistics
377  */
378 struct air_phy_stat_rsp {
379         char            app_intf[IFNAMSIZ];     /* Interface name */
380         long            app_ipdus;              /* PDUs received from I/F */
381         long            app_opdus;              /* PDUs sent to I/F */
382         long            app_ibytes;             /* Bytes received from I/F */
383         long            app_obytes;             /* Bytes sent to I/F */
384         long            app_ierrors;            /* Errors receiving from I/F */
385         long            app_oerrors;            /* Errors sending to I/F */
386         long            app_cmderrors;          /* I/F command errors */
387 };
388
389
390 /*
391  * PF_ATM sub-operation codes
392  */
393 #define AIOCS_CFG_ATT   1
394 #define AIOCS_CFG_DET   2
395 #define AIOCS_ADD_PVC   32
396 #define AIOCS_ADD_ARP   33
397 #define AIOCS_DEL_PVC   64
398 #define AIOCS_DEL_SVC   65
399 #define AIOCS_DEL_ARP   66
400 #define AIOCS_SET_ASV   96
401 #define AIOCS_SET_NIF   97
402 #define AIOCS_SET_PRF   98
403 #define AIOCS_SET_MAC   99
404 #define AIOCS_INF_VST   160
405 #define AIOCS_INF_IPM   161
406 #define AIOCS_INF_ARP   162
407 #define AIOCS_INF_ASV   163
408 #define AIOCS_INF_INT   164
409 #define AIOCS_INF_VCC   165
410 #define AIOCS_INF_CFG   166
411 #define AIOCS_INF_NIF   167
412 #define AIOCS_INF_PIS   168
413 #define AIOCS_INF_VER   169
414
415
416 /*
417  * PF_ATM ioctls
418  */
419 #if defined(sun) && !defined(__GNUC__)
420 #define AIOCCFG         _IOW(A, 128, struct atmcfgreq)  /* Configure i/f */
421 #define AIOCADD         _IOW(A, 129, struct atmaddreq)  /* Add (e.g. PVC) */
422 #define AIOCDEL         _IOW(A, 130, struct atmdelreq)  /* Delete */
423 #define AIOCSET         _IOW(A, 132, struct atmsetreq)  /* Set (e.g. net i/f) */
424 #define AIOCINFO        _IOWR(A, 133, struct atminfreq) /* Show kernel info */
425 #else
426 #define AIOCCFG         _IOW('A', 128, struct atmcfgreq)/* Configure i/f */
427 #define AIOCADD         _IOW('A', 129, struct atmaddreq)/* Add (e.g. PVC) */
428 #define AIOCDEL         _IOW('A', 130, struct atmdelreq)/* Delete */
429 #define AIOCSET         _IOW('A', 132, struct atmsetreq)/* Set (e.g. net i/f) */
430 #define AIOCINFO        _IOWR('A', 133, struct atminfreq)/* Show kernel info */
431 #endif
432
433 #endif  /* _NETATM_ATM_IOCTL_H */