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