Merge from vendor branch HOSTAPD:
[dragonfly.git] / sys / netproto / atm / spans / spans_xdr.x
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/spans/spans_xdr.x,v 1.3 1999/11/18 08:18:13 peter Exp $
27 % *     @(#) $DragonFly: src/sys/netproto/atm/spans/spans_xdr.x,v 1.2 2003/06/17 04:28:49 dillon Exp $
28 % *
29 % */
30 %
31 /*
32  * SPANS Signalling Manager
33  * ---------------------------
34  *
35  * SPANS Protocol Message XDR Specification
36  *
37  */
38
39 #ifdef RPC_HDR
40 %/*
41 % * SPANS Signalling Manager
42 % * ---------------------------
43 % *
44 % * SPANS Protocol Message Definitions
45 % *
46 % */
47 %
48 %#ifndef _SPANS_SPANS_XDR_H
49 %#define _SPANS_SPANS_XDR_H
50 %
51 %#include <rpc/types.h>
52 %
53 #endif
54
55 #ifdef RPC_XDR
56 %/*
57 % * SPANS Signalling Manager
58 % * ---------------------------
59 % *
60 % * SPANS Protocol Message XDR Routines
61 % *
62 % */
63 %
64 %#ifndef lint
65 %static const char RCSid[] = "@(#) $FreeBSD: src/sys/netatm/spans/spans_xdr.x,v 1.3 1999/11/18 08:18:13 peter Exp $";
66 %#endif
67 %
68 #endif
69
70
71 /*
72  * SPANS Signalling
73  */
74 const   SPANS_SIG_VPI = 0;              /* Signalling VPI */
75 const   SPANS_SIG_VCI = 15;             /* Signalling VCI */
76 const   SPANS_CLS_VPI = 0;              /* Connectionless VPI */
77 const   SPANS_CLS_VCI = 14;             /* Connectionless VCI */
78
79 const   SPANS_MIN_VCI = 32;             /* Lowest VCI to allocate */
80 const   SPANS_MAX_VCI = 1023;           /* Highest VCI to allocate */
81 const   SPANS_VPI = 0;                  /* Only VPI to allocate */
82
83 /*
84  * SPANS Protocol Version
85  *
86  *      Major_version * 256 + Minor_version
87  */
88 typedef u_int   spans_version;
89
90 const   SPANS_VERS_1_0 = 0x0100;        /* Version 1.0 */
91
92
93 /*
94  * VPI/VCI
95  *
96  * Format:
97  *      4 bits - unused
98  *      12 bits - VPI value
99  *      16 bits - VCI value
100  */
101 typedef u_int   spans_vpvc;             /* VPI/VCI value */
102
103 #ifdef RPC_HDR
104 %#define        SPANS_EXTRACT_VPI(p)    (((p) >> 16) & 0x0FFF)
105 %#define        SPANS_EXTRACT_VCI(p)    ((p) & 0x0FFFF)
106 %#define        SPANS_PACK_VPIVCI(p, c) ((((p) & 0x0FFF) << 16) | ((c) & 0x0FFFF))
107 #endif
108
109
110 /*
111  * VPI/VCI Preference
112  */
113 struct spans_vpvc_pref {
114         bool            vpf_valid;      /* VPI/VCI values valid */
115         spans_vpvc      vpf_vpvc;       /* VPI/VCI value */
116 };
117
118
119 /*
120  * SPANS ATM Address
121  */
122 struct spans_addr {
123         opaque          addr[8];        /* SPANS ATM address */
124 };
125
126
127 /*
128  * Service Access Point (SAP)
129  */
130 typedef u_int   spans_sap;              /* SAP value */
131
132 const   SPANS_SAP_IP = 1025;            /* TCP/IP */
133 const   SPANS_SAP_EPHEMERAL = 2048;     /* Start of ephemeral SAPs*/
134
135
136 /*
137  * ATM Connection Identifier
138  */
139 struct spans_atm_conn {
140         spans_addr      con_dst;        /* Destination ATM address */
141         spans_addr      con_src;        /* Source ATM address */
142         spans_sap       con_dsap;       /* Destination SAP */
143         spans_sap       con_ssap;       /* Source SAP */
144 };
145
146
147 /*
148  * Connection Resources
149  */
150 struct spans_resrc {
151         u_int           rsc_peak;       /* Peak bandwidth (Kbps) */
152         u_int           rsc_mean;       /* Mean bandwidth (Kbps) */
153         u_int           rsc_burst;      /* Mean burst (Kb) */
154 };
155
156
157 /*
158  * ATM Adaptation Layer (AAL) Types
159  */
160 enum spans_aal {
161         SPANS_AAL0 = 0,                 /* NULL AAL */
162         SPANS_AAL1 = 1,                 /* AAL 1 */
163         SPANS_AAL2 = 2,                 /* AAL 2 */
164         SPANS_AAL3 = 3,                 /* AAL 3 */
165         SPANS_AAL4 = 4,                 /* AAL 4 */
166         SPANS_AAL5 = 5                  /* AAL 5 */
167 };
168
169
170 /*
171  * Result Codes
172  */
173 enum spans_result {
174         SPANS_OK = 0,                   /* Success */
175         SPANS_FAIL = 1,                 /* Failure */
176         SPANS_NOVPVC = 2,               /* No VP/VC */
177         SPANS_NORSC = 3,                /* No resources */
178         SPANS_BADDEST = 4               /* Bad destination */
179 };
180
181
182 /*
183  * Message Types
184  */
185 enum spans_msgtype {
186         /*
187          * SPANS UNI message types
188          */
189         SPANS_STAT_REQ = 0,             /* Status request */
190         SPANS_STAT_IND = 1,             /* Status indication */
191         SPANS_STAT_RSP = 2,             /* Status response */
192         SPANS_OPEN_REQ = 3,             /* Open request */
193         SPANS_OPEN_IND = 4,             /* Open indication */
194         SPANS_OPEN_RSP = 5,             /* Open response */
195         SPANS_OPEN_CNF = 6,             /* Open confirmation */
196         SPANS_CLOSE_REQ = 7,            /* Close request */
197         SPANS_CLOSE_IND = 8,            /* Close indication */
198         SPANS_CLOSE_RSP = 9,            /* Close response */
199         SPANS_CLOSE_CNF = 10,           /* Close confirmation */
200         SPANS_RCLOSE_REQ = 11,          /* Reverse close request */
201         SPANS_RCLOSE_IND = 12,          /* Reverse close indication */
202         SPANS_RCLOSE_RSP = 13,          /* Reverse close response */
203         SPANS_RCLOSE_CNF = 14,          /* Reverse close confirmation */
204         SPANS_MULTI_REQ = 15,           /* Multicast request */
205         SPANS_MULTI_IND = 16,           /* Multicast indication */
206         SPANS_MULTI_RSP = 17,           /* Multicast response */
207         SPANS_MULTI_CNF = 18,           /* Multicast confirmation */
208         SPANS_ADD_REQ = 19,             /* Add request */
209         SPANS_ADD_IND = 20,             /* Add indication */
210         SPANS_ADD_RSP = 21,             /* Add response */
211         SPANS_ADD_CNF = 22,             /* Add confirmation */
212         SPANS_JOIN_REQ = 23,            /* Join request */
213         SPANS_JOIN_CNF = 24,            /* Join confirmation */
214         SPANS_LEAVE_REQ = 25,           /* Leave request */
215         SPANS_LEAVE_CNF = 26,           /* Leave confirmation */
216
217         /*
218          * SPANS NNI message types
219          */
220         SPANS_NSAP_IND = 99,            /* NSAP routing message */
221         SPANS_MAP_IND = 100,            /* Topology message */
222         SPANS_SETUP_REQ = 101,          /* Setup request */
223         SPANS_SETUP_RSP = 102,          /* Setup response */
224         SPANS_CHANGE_REQ = 103,         /* Change request */
225         SPANS_CHANGE_RSP = 104,         /* Change response */
226         SPANS_RELOC_REQ = 105,          /* Relocation request */
227         SPANS_RELOC_RSP = 106,          /* Relocation response */
228         SPANS_HELLO_IND = 107,          /* Hello message */
229
230         SPANS_VCIR_IND = 108,           /* VCI range indication */
231         SPANS_QUERY_REQ = 110,          /* Conn. state query request */
232         SPANS_QUERY_RSP = 111           /* Conn. state query response */
233 };
234
235
236 /*
237  * Query types
238  */
239 enum spans_query_type {
240         SPANS_QUERY_NORMAL,             /* Normal--respond */
241         SPANS_QUERY_DEBUG,              /* Debug--respond with state */
242         SPANS_QUERY_END_TO_END          /* Not implemented */
243 };
244
245
246 /*
247  * SPANS connection states
248  */
249 enum spans_conn_state {
250         SPANS_CONN_OPEN,                /* Connection is open */
251         SPANS_CONN_OPEN_PEND,           /* Connection is being opened */
252         SPANS_CONN_CLOSE_PEND,          /* Connection is being closed */
253         SPANS_CONN_CLOSED               /* Connection does not exist */
254 };
255
256
257 /*
258  * Message Parameters
259  *
260  * There is a separate message parameter structure for each 
261  * message type.
262  */
263 struct spans_parm_stat_req {
264         u_long          streq_es_epoch; /* End system epoch */
265 };
266
267 struct spans_parm_stat_ind {
268         u_long          stind_sw_epoch; /* Switch epoch */
269         spans_addr      stind_es_addr;  /* End system ATM address */
270         spans_addr      stind_sw_addr;  /* Switch ATM address */
271 };
272
273 struct spans_parm_stat_rsp {
274         u_long          strsp_es_epoch; /* End system epoch */
275         spans_addr      strsp_es_addr;  /* End system ATM address */
276 };
277
278 struct spans_parm_open_req {
279         spans_atm_conn  opreq_conn;     /* Connection identity */
280         spans_aal       opreq_aal;      /* AAL type */
281         spans_resrc     opreq_desrsrc;  /* Desired resources */
282         spans_resrc     opreq_minrsrc;  /* Minimum resources */
283         spans_vpvc_pref opreq_vpvc;     /* VPI/VCI preference */
284 };
285
286 struct spans_parm_open_ind {
287         spans_atm_conn  opind_conn;     /* Connection identity */
288         spans_aal       opind_aal;      /* AAL type */
289         spans_resrc     opind_desrsrc;  /* Desired resources */
290         spans_resrc     opind_minrsrc;  /* Minimum resources */
291         spans_vpvc_pref opind_vpvc;     /* VPI/VCI preference */
292 };
293
294 struct spans_parm_open_rsp {
295         spans_atm_conn  oprsp_conn;     /* Connection identity */
296         spans_result    oprsp_result;   /* Open result */
297         spans_resrc     oprsp_rsrc;     /* Allocated resources */
298         spans_vpvc      oprsp_vpvc;     /* Allocated VPI/VCI */
299 };
300
301 struct spans_parm_open_cnf {
302         spans_atm_conn  opcnf_conn;     /* Connection identity */
303         spans_result    opcnf_result;   /* Open result */
304         spans_resrc     opcnf_rsrc;     /* Allocated resources */
305         spans_vpvc      opcnf_vpvc;     /* Allocated VPI/VCI */
306 };
307
308 struct spans_parm_close_req {
309         spans_atm_conn  clreq_conn;     /* Connection identity */
310 };
311
312 struct spans_parm_close_ind {
313         spans_atm_conn  clind_conn;     /* Connection identity */
314 };
315
316 struct spans_parm_close_rsp {
317         spans_atm_conn  clrsp_conn;     /* Connection identity */
318         spans_result    clrsp_result;   /* Close result */
319 };
320
321 struct spans_parm_close_cnf {
322         spans_atm_conn  clcnf_conn;     /* Connection identity */
323         spans_result    clcnf_result;   /* Close result */
324 };
325
326 struct spans_parm_rclose_req {
327         spans_atm_conn  rcreq_conn;     /* Connection identity */
328 };
329
330 struct spans_parm_rclose_ind {
331         spans_atm_conn  rcind_conn;     /* Connection identity */
332 };
333
334 struct spans_parm_rclose_rsp {
335         spans_atm_conn  rcrsp_conn;     /* Connection identity */
336         spans_result    rcrsp_result;   /* Rclose result */
337 };
338
339 struct spans_parm_rclose_cnf {
340         spans_atm_conn  rccnf_conn;     /* Connection identity */
341         spans_result    rccnf_result;   /* Rclose result */
342 };
343
344 struct spans_parm_multi_req {
345         spans_atm_conn  mureq_conn;     /* Connection identity */
346         spans_aal       mureq_aal;      /* AAL type */
347         spans_resrc     mureq_desrsrc;  /* Desired resources */
348         spans_resrc     mureq_minrsrc;  /* Minimum resources */
349         spans_vpvc      mureq_vpvc;     /* VPI/VCI preference */
350 };
351
352 struct spans_parm_multi_ind {
353         spans_atm_conn  muind_conn;     /* Connection identity */
354         spans_aal       muind_aal;      /* AAL type */
355         spans_resrc     muind_desrsrc;  /* Desired resources */
356         spans_resrc     muind_minrsrc;  /* Minimum resources */
357         spans_vpvc      muind_vpvc;     /* VPI/VCI preference */
358 };
359
360 struct spans_parm_multi_rsp {
361         spans_atm_conn  mursp_conn;     /* Connection identity */
362         spans_result    mursp_result;   /* Multi result */
363         spans_resrc     mursp_rsrc;     /* Allocated resources */
364         spans_vpvc      mursp_vpvc;     /* Allocated VPI/VCI */
365 };
366
367 struct spans_parm_multi_cnf {
368         spans_atm_conn  mucnf_conn;     /* Connection identity */
369         spans_result    mucnf_result;   /* Multi result */
370         spans_resrc     mucnf_rsrc;     /* Allocated resources */
371         spans_vpvc      mucnf_vpvc;     /* Allocated VPI/VCI */
372 };
373
374 struct spans_parm_add_req {
375         spans_atm_conn  adreq_desconn;  /* Desired connection identity */
376         spans_atm_conn  adreq_xstconn;  /* Existing connection identity */
377 };
378
379 struct spans_parm_add_ind {
380         spans_atm_conn  adind_desconn;  /* Desired connection identity */
381         spans_atm_conn  adind_xstconn;  /* Existing connection identity */
382 };
383
384 struct spans_parm_add_rsp {
385         spans_atm_conn  adrsp_conn;     /* Connection identity */
386         spans_result    adrsp_result;   /* Add result */
387         spans_resrc     adrsp_rsrc;     /* Allocated resources */
388 };
389
390 struct spans_parm_add_cnf {
391         spans_atm_conn  adcnf_conn;     /* Connection identity */
392         spans_result    adcnf_result;   /* Add result */
393         spans_resrc     adcnf_rsrc;     /* Allocated resources */
394 };
395
396 struct spans_parm_join_req {
397         spans_addr      jnreq_addr;     /* Group address */
398 };
399
400 struct spans_parm_join_cnf {
401         spans_addr      jncnf_addr;     /* Group address */
402         spans_result    jncnf_result;   /* Join result */
403 };
404
405 struct spans_parm_leave_req {
406         spans_addr      lvreq_addr;     /* Group address */
407 };
408
409 struct spans_parm_leave_cnf {
410         spans_addr      lvcnf_addr;     /* Group address */
411         spans_result    lvcnf_result;   /* Leave result */
412 };
413
414 struct spans_parm_vcir_ind {
415         u_int           vrind_min;      /* Lowest VCI available */
416         u_int           vrind_max;      /* Highest VCI available */
417 };
418
419 struct spans_parm_query_req {
420         spans_atm_conn  qyreq_conn;     /* Conn. being queried */
421         spans_query_type        qyreq_type;     /* Query type */
422 };
423
424 struct spans_parm_query_rsp {
425         spans_atm_conn  qyrsp_conn;     /* Conn. being queried */
426         spans_query_type        qyrsp_type;     /* Query type */
427         spans_conn_state        qyrsp_state;    /* Conn. state */
428         u_int           qyrsp_data;     /* Extra state data */
429 };
430
431
432 /*
433  * Message Body
434  */
435 union spans_msgbody switch (spans_msgtype mb_type) {
436
437 case SPANS_STAT_REQ:            spans_parm_stat_req     mb_stat_req;
438 case SPANS_STAT_IND:            spans_parm_stat_ind     mb_stat_ind;
439 case SPANS_STAT_RSP:            spans_parm_stat_rsp     mb_stat_rsp;
440 case SPANS_OPEN_REQ:            spans_parm_open_req     mb_open_req;
441 case SPANS_OPEN_IND:            spans_parm_open_ind     mb_open_ind;
442 case SPANS_OPEN_RSP:            spans_parm_open_rsp     mb_open_rsp;
443 case SPANS_OPEN_CNF:            spans_parm_open_cnf     mb_open_cnf;
444 case SPANS_CLOSE_REQ:           spans_parm_close_req    mb_close_req;
445 case SPANS_CLOSE_IND:           spans_parm_close_ind    mb_close_ind;
446 case SPANS_CLOSE_RSP:           spans_parm_close_rsp    mb_close_rsp;
447 case SPANS_CLOSE_CNF:           spans_parm_close_cnf    mb_close_cnf;
448 case SPANS_RCLOSE_REQ:          spans_parm_rclose_req   mb_rclose_req;
449 case SPANS_RCLOSE_IND:          spans_parm_rclose_ind   mb_rclose_ind;
450 case SPANS_RCLOSE_RSP:          spans_parm_rclose_rsp   mb_rclose_rsp;
451 case SPANS_RCLOSE_CNF:          spans_parm_rclose_cnf   mb_rclose_cnf;
452 case SPANS_MULTI_REQ:           spans_parm_multi_req    mb_multi_req;
453 case SPANS_MULTI_IND:           spans_parm_multi_ind    mb_multi_ind;
454 case SPANS_MULTI_RSP:           spans_parm_multi_rsp    mb_multi_rsp;
455 case SPANS_MULTI_CNF:           spans_parm_multi_cnf    mb_multi_cnf;
456 case SPANS_ADD_REQ:             spans_parm_add_req      mb_add_req;
457 case SPANS_ADD_IND:             spans_parm_add_ind      mb_add_ind;
458 case SPANS_ADD_RSP:             spans_parm_add_rsp      mb_add_rsp;
459 case SPANS_ADD_CNF:             spans_parm_add_cnf      mb_add_cnf;
460 case SPANS_JOIN_REQ:            spans_parm_join_req     mb_join_req;
461 case SPANS_JOIN_CNF:            spans_parm_join_cnf     mb_join_cnf;
462 case SPANS_LEAVE_REQ:           spans_parm_leave_req    mb_leave_req;
463 case SPANS_LEAVE_CNF:           spans_parm_leave_cnf    mb_leave_cnf;
464 case SPANS_VCIR_IND:            spans_parm_vcir_ind     mb_vcir_ind;
465 case SPANS_QUERY_REQ:           spans_parm_query_req    mb_query_req;
466 case SPANS_QUERY_RSP:           spans_parm_query_rsp    mb_query_rsp;
467 };
468
469
470 /*
471  * Message Format
472  */
473 struct spans_msg {
474         spans_version           sm_vers;
475         spans_msgbody           sm_body;
476 };
477
478 #ifdef RPC_HDR
479 %#define        sm_type         sm_body.mb_type
480 %#define        sm_stat_req     sm_body.spans_msgbody_u.mb_stat_req
481 %#define        sm_stat_ind     sm_body.spans_msgbody_u.mb_stat_ind
482 %#define        sm_stat_rsp     sm_body.spans_msgbody_u.mb_stat_rsp
483 %#define        sm_open_req     sm_body.spans_msgbody_u.mb_open_req
484 %#define        sm_open_ind     sm_body.spans_msgbody_u.mb_open_ind
485 %#define        sm_open_rsp     sm_body.spans_msgbody_u.mb_open_rsp
486 %#define        sm_open_cnf     sm_body.spans_msgbody_u.mb_open_cnf
487 %#define        sm_close_req    sm_body.spans_msgbody_u.mb_close_req
488 %#define        sm_close_ind    sm_body.spans_msgbody_u.mb_close_ind
489 %#define        sm_close_rsp    sm_body.spans_msgbody_u.mb_close_rsp
490 %#define        sm_close_cnf    sm_body.spans_msgbody_u.mb_close_cnf
491 %#define        sm_rclose_req   sm_body.spans_msgbody_u.mb_rclose_req
492 %#define        sm_rclose_ind   sm_body.spans_msgbody_u.mb_rclose_ind
493 %#define        sm_rclose_rsp   sm_body.spans_msgbody_u.mb_rclose_rsp
494 %#define        sm_rclose_cnf   sm_body.spans_msgbody_u.mb_rclose_cnf
495 %#define        sm_multi_req    sm_body.spans_msgbody_u.mb_multi_req
496 %#define        sm_multi_ind    sm_body.spans_msgbody_u.mb_multi_ind
497 %#define        sm_multi_rsp    sm_body.spans_msgbody_u.mb_multi_rsp
498 %#define        sm_multi_cnf    sm_body.spans_msgbody_u.mb_multi_cnf
499 %#define        sm_add_req      sm_body.spans_msgbody_u.mb_add_req
500 %#define        sm_add_ind      sm_body.spans_msgbody_u.mb_add_ind
501 %#define        sm_add_rsp      sm_body.spans_msgbody_u.mb_add_rsp
502 %#define        sm_add_cnf      sm_body.spans_msgbody_u.mb_add_cnf
503 %#define        sm_join_req     sm_body.spans_msgbody_u.mb_join_req
504 %#define        sm_join_cnf     sm_body.spans_msgbody_u.mb_join_cnf
505 %#define        sm_leave_req    sm_body.spans_msgbody_u.mb_leave_req
506 %#define        sm_leave_cnf    sm_body.spans_msgbody_u.mb_leave_cnf
507 %#define        sm_vcir_ind     sm_body.spans_msgbody_u.mb_vcir_ind
508 %#define        sm_query_req    sm_body.spans_msgbody_u.mb_query_req
509 %#define        sm_query_rsp    sm_body.spans_msgbody_u.mb_query_rsp
510 #endif
511
512 #ifdef RPC_HDR
513 %#endif /* _SPANS_SPANS_XDR_H */
514 #endif