Misc RSVP-TE stuff hanging out in my tree. Maybe this will be usefull
[mpls-ldp-portable.git] / rsvp-te / rsvp_struct.h
blob4ab95a043157e4fb483a09c6916b179da07944e8
1 #ifndef _RSVP_MPLS_H_
2 #define _RSVP_MPLS_H_
4 /**********************************************************************
5 RSVP Header
7 0 1 2 3
8 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
9 +---------------+---------------+---------------+---------------+
10 | Vers | Flags | Msg Type | RSVP Checksum |
11 +---------------+---------------+---------------+---------------+
12 | Send_TTL | (Reserved) | RSVP Length |
13 +---------------+---------------+---------------+---------------+
16 The fields in the common header are as follows:
18 Vers: 4 bits
20 Protocol version number. This is version 1.
22 Flags: 4 bits
24 0x01-0x08: Reserved
26 No flag bits are defined yet.
28 Msg Type: 8 bits
30 1 = Path
32 2 = Resv
34 3 = PathErr
36 4 = ResvErr
38 5 = PathTear
40 6 = ResvTear
42 7 = ResvConf
44 RSVP Checksum: 16 bits
46 The one's complement of the one's complement sum of the
47 message, with the checksum field replaced by zero for the
48 purpose of computing the checksum. An all-zero value
49 means that no checksum was transmitted.
51 Send_TTL: 8 bits
53 The IP TTL value with which the message was sent. See
54 Section 3.8.
56 RSVP Length: 16 bits
58 The total length of this RSVP message in bytes, including
59 the common header and the variable-length objects that
60 follow.
62 **********************************************************************/
64 typedef struct rsvpHeaderFlag_s {
65 BITFIELDS_ASCENDING_4(u_char version:4,
66 u_char flags:4);
67 } rsvpStyleOptions_t;
69 typedef struct rsvpHeader_s {
70 union {
71 u_char mark;
72 struct rsvpHeaderFlag_s flag;
73 } flag;
74 u_char messageType;
75 u_short checksum;
76 u_char ttl;
77 u_char resserved;
78 u_short length;
79 } rsvpHeader_t;
81 /**********************************************************************
82 RSVP Objects
84 Every object consists of one or more 32-bit words with a one-
85 word header, with the following format:
87 0 1 2 3
88 +-------------+-------------+-------------+-------------+
89 | Length (bytes) | Class-Num | C-Type |
90 +-------------+-------------+-------------+-------------+
91 | |
92 // (Object contents) //
93 | |
94 +-------------+-------------+-------------+-------------+
96 An object header has the following fields:
98 Length
100 A 16-bit field containing the total object length in
101 bytes. Must always be a multiple of 4, and at least 4.
103 Class-Num
105 Identifies the object class; values of this field are
106 defined in Appendix A. Each object class has a name,
107 which is always capitalized in this document. An RSVP
108 implementation must recognize the following classes:
110 NULL
112 A NULL object has a Class-Num of zero, and its C-Type
113 is ignored. Its length must be at least 4, but can
114 be any multiple of 4. A NULL object may appear
115 anywhere in a sequence of objects, and its contents
116 will be ignored by the receiver.
118 SESSION
120 Contains the IP destination address (DestAddress),
121 the IP protocol id, and some form of generalized
122 destination port, to define a specific session for
123 the other objects that follow. Required in every
124 RSVP message.
126 RSVP_HOP
128 Carries the IP address of the RSVP-capable node that
129 sent this message and a logical outgoing interface
130 handle (LIH; see Section 3.3). This document refers
131 to a RSVP_HOP object as a PHOP ("previous hop")
132 object for downstream messages or as a NHOP (" next
133 hop") object for upstream messages.
135 TIME_VALUES
137 Contains the value for the refresh period R used by
138 the creator of the message; see Section 3.7.
139 Required in every Path and Resv message.
141 STYLE
143 Defines the reservation style plus style-specific
144 information that is not in FLOWSPEC or FILTER_SPEC
145 objects. Required in every Resv message.
147 FLOWSPEC
149 Defines a desired QoS, in a Resv message.
151 FILTER_SPEC
153 Defines a subset of session data packets that should
154 receive the desired QoS (specified by a FLOWSPEC
155 object), in a Resv message.
157 SENDER_TEMPLATE
159 Contains a sender IP address and perhaps some
160 additional demultiplexing information to identify a
161 sender. Required in a Path message.
163 SENDER_TSPEC
165 Defines the traffic characteristics of a sender's
166 data flow. Required in a Path message.
168 ADSPEC
170 Carries OPWA data, in a Path message.
172 ERROR_SPEC
174 Specifies an error in a PathErr, ResvErr, or a
175 confirmation in a ResvConf message.
177 POLICY_DATA
179 Carries information that will allow a local policy
180 module to decide whether an associated reservation is
181 administratively permitted. May appear in Path,
182 Resv, PathErr, or ResvErr message.
184 The use of POLICY_DATA objects is not fully specified
185 at this time; a future document will fill this gap.
187 INTEGRITY
189 Carries cryptographic data to authenticate the
190 originating node and to verify the contents of this
191 RSVP message. The use of the INTEGRITY object is
192 described in [Baker96].
194 SCOPE
196 Carries an explicit list of sender hosts towards
197 which the information in the message is to be
198 forwarded. May appear in a Resv, ResvErr, or
199 ResvTear message. See Section 3.4.
201 RESV_CONFIRM
203 Carries the IP address of a receiver that requested a
204 confirmation. May appear in a Resv or ResvConf
205 message.
211 The format of a Path message is as follows:
213 <Path Message> ::= <Common Header> [ <INTEGRITY> ]
214 <SESSION> <RSVP_HOP> <TIME_VALUES>
215 [ <EXPLICIT_ROUTE> ] <LABEL_REQUEST>
216 [ <SESSION_ATTRIBUTE> ]
217 [ <POLICY_DATA> ... ]
218 <sender descriptor>
220 <sender descriptor> ::= <SENDER_TEMPLATE> <SENDER_TSPEC>
221 [ <ADSPEC> ] [ <RECORD_ROUTE> ]
223 The Resv message format is as follows:
225 <Resv Message> ::= <Common Header> [ <INTEGRITY> ]
226 <SESSION> <RSVP_HOP> <TIME_VALUES>
227 [ <RESV_CONFIRM> ] [ <SCOPE> ]
228 [ <POLICY_DATA> ... ]
229 <STYLE> <flow descriptor list>
231 <flow descriptor list> ::= <FF flow descriptor list> | <SE flow descriptor>
233 <FF flow descriptor list> ::= <FLOWSPEC> <FILTER_SPEC> <LABEL>
234 [ <RECORD_ROUTE> ] | <FF flow descriptor list>
235 <FF flow descriptor>
237 <FF flow descriptor> ::= [ <FLOWSPEC> ] <FILTER_SPEC> <LABEL>
238 [ <RECORD_ROUTE> ]
240 <SE flow descriptor> ::= <FLOWSPEC> <SE filter spec list>
242 <SE filter spec list> ::= <SE filter spec> |
243 <SE filter spec list> <SE filter spec>
245 <SE filter spec> ::= <FILTER_SPEC> <LABEL> [ <RECORD_ROUTE> ]
247 Note: LABEL and RECORD_ROUTE (if present), are bound to the
248 preceding FILTER_SPEC. No more than one LABEL and/or
249 RECORD_ROUTE may follow each FILTER_SPEC.
251 The Path Tear message format is as follows:
253 <PathTear Message> ::= <Common Header> [ <INTEGRITY> ]
254 <SESSION> <RSVP_HOP>
255 [ <sender descriptor> ]
257 <sender descriptor> ::= (see earlier definition)
260 The Resv Tear message format is as follows:
262 <ResvTear Message> ::= <Common Header> [<INTEGRITY>]
263 <SESSION> <RSVP_HOP> [ <SCOPE> ] <STYLE>
264 <flow descriptor list>
266 <flow descriptor list> ::= (see earlier definition)
270 The Path Error message format is as follows:
272 <PathErr message> ::= <Common Header> [ <INTEGRITY> ]
273 <SESSION> <ERROR_SPEC> [ <POLICY_DATA> ...]
274 [ <sender descriptor> ]
276 <sender descriptor> ::= (see earlier definition)
279 The Resv Error message format is as follows:
281 <ResvErr Message> ::= <Common Header> [ <INTEGRITY> ]
282 <SESSION> <RSVP_HOP> <ERROR_SPEC> [ <SCOPE> ]
283 [ <POLICY_DATA> ...] <STYLE>
284 [ <error flow descriptor> ]
286 o WF Style:
287 <error flow descriptor> ::= <WF flow descriptor>
289 o FF style:
290 <error flow descriptor> ::= <FF flow descriptor>
292 o SE style:
293 <error flow descriptor> ::= <SE flow descriptor>
297 The Resv Conf message format is as follows:
299 <ResvConf message> ::= <Common Header> [ <INTEGRITY> ]
300 <SESSION> <ERROR_SPEC> <RESV_CONFIRM>
301 <STYLE> <flow descriptor list>
303 <flow descriptor list> ::= (see earlier definition)
305 **********************************************************************/
307 #define RSVP_SESSION_CLASS 1
308 #define RSVP_SESSION_CTYPE_IPV4 1
309 #define RSVP_SESSION_CTYPE_IPV6 2
311 /**********************************************************************
312 RSVP SESSION Object
314 o IPv4/UDP SESSION object: Class = 1, C-Type = 1
316 0 1 2 3
317 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
318 +---------------+---------------+---------------+---------------+
319 | IPv4 DestAddress (4 bytes) |
320 +---------------+---------------+---------------+---------------+
321 | Protocol Id | Flags | DstPort |
322 +---------------+---------------+---------------+---------------+
324 o IPv6/UDP SESSION object: Class = 1, C-Type = 2
326 0 1 2 3
327 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
328 +---------------+---------------+---------------+---------------+
332 + IPv6 DestAddress (16 bytes) +
336 +---------------+---------------+---------------+---------------+
337 | Protocol Id | Flags | DstPort |
338 +---------------+---------------+---------------+---------------+
340 DestAddress
342 The IP unicast or multicast destination address of the
343 session. This field must be non-zero.
345 Protocol Id
347 The IP Protocol Identifier for the data flow. This field
348 must be non-zero.
349 Flags
351 0x01 = E_Police flag
353 The E_Police flag is used in Path messages to determine
354 the effective "edge" of the network, to control traffic
355 policing. If the sender host is not itself capable of
356 traffic policing, it will set this bit on in Path
357 messages it sends. The first node whose RSVP is capable
358 of traffic policing will do so (if appropriate to the
359 service) and turn the flag off.
361 DstPort
363 The UDP/TCP destination port for the session. Zero may be
364 used to indicate `none'.
366 Other SESSION C-Types could be defined in the future to
367 support other demultiplexing conventions in the transport-
368 layer or application layer.
370 **********************************************************************/
372 typedef struct rsvpSession4_s {
373 u_int destAddr;
374 u_char protocolId;
375 u_char flags;
376 u_short destPort;
377 } rsvpSession4_t;
379 typedef struct rsvpSession6_s {
380 u_char destAddr[16];
381 u_char protocolId;
382 u_char flags;
383 u_short destPort;
384 } rsvpSession6_t;
387 #define RSVP_HOP_CLASS 3
388 #define RSVP_HOP_CTYPE_IPV4 1
389 #define RSVP_HOP_CTYPE_IPV6 2
391 /**********************************************************************
392 RSVP HOP Object
394 o IPv4 RSVP_HOP object: Class = 3, C-Type = 1
396 0 1 2 3
397 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
399 +---------------+---------------+---------------+---------------+
400 | IPv4 Next/Previous Hop Address |
401 +---------------+---------------+---------------+---------------+
402 | Logical Interface Handle |
403 +---------------+---------------+---------------+---------------+
405 o IPv6 RSVP_HOP object: Class = 3, C-Type = 2
407 0 1 2 3
408 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
410 +---------------+---------------+---------------+---------------+
414 + IPv6 Next/Previous Hop Address +
418 +---------------+---------------+---------------+---------------+
419 | Logical Interface Handle |
420 +---------------+---------------+---------------+---------------+
422 This object carries the IP address of the interface through which
423 the last RSVP-knowledgeable hop forwarded this message. The
424 Logical Interface Handle (LIH) is used to distinguish logical
425 outgoing interfaces, as discussed in Sections 3.3 and 3.9. A node
426 receiving an LIH in a Path message saves its value and returns it
427 in the HOP objects of subsequent Resv messages sent to the node
428 that originated the LIH. The LIH should be identically zero if
429 there is no logical interface handle.
431 **********************************************************************/
433 typedef struct rsvpHop4_s {
434 u_int hopAddr;
435 u_int logicalIfHandle;
436 } rsvpHop4_t;
438 typedef struct rsvpHop6_s {
439 u_char hopAddr[16];
440 u_int logicalIfHandle;
441 } rsvpHop6_t;
443 #define RSVP_TIME_CLASS 5
444 #define RSVP_TIME_CTYPE 1
446 /**********************************************************************
447 RSVP TIME Object
449 o TIME_VALUES Object: Class = 5, C-Type = 1
451 0 1 2 3
452 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
453 +---------------+---------------+---------------+---------------+
454 | Refresh Period R |
455 +---------------+---------------+---------------+---------------+
457 Refresh Period
459 The refresh timeout period R used to generate this message;
460 in milliseconds.
462 **********************************************************************/
464 typedef struct rsvpTime_s {
465 u_int refresh;
466 } rsvpTime_t;
468 #define RSVP_ERROR_SPEC_CLASS 6
469 #define RSVP_ERROR_SPEC_CTYPE_IPV4 1
470 #define RSVP_ERROR_SPEC_CTYPE_IPV6 2
472 /**********************************************************************
473 RSVP ERROR_SPEC Object
475 o IPv4 ERROR_SPEC object: Class = 6, C-Type = 1
477 0 1 2 3
478 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
479 +---------------+---------------+---------------+---------------+
480 | IPv4 Error Node Address (4 bytes) |
481 +---------------+---------------+---------------+---------------+
482 | Flags | Error Code | Error Value |
483 +---------------+---------------+---------------+---------------+
486 o IPv6 ERROR_SPEC object: Class = 6, C-Type = 2
488 0 1 2 3
489 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
490 +---------------+---------------+---------------+---------------+
494 + IPv6 Error Node Address (16 bytes) +
498 +---------------+---------------+---------------+---------------+
499 | Flags | Error Code | Error Value |
500 +---------------+---------------+---------------+---------------+
502 Error Node Address
504 The IP address of the node in which the error was detected.
506 Flags
508 0x01 = InPlace
510 This flag is used only for an ERROR_SPEC object in a
511 ResvErr message. If it on, this flag indicates that
512 there was, and still is, a reservation in place at the
513 failure point.
515 0x02 = NotGuilty
517 This flag is used only for an ERROR_SPEC object in a
518 ResvErr message, and it is only set in the interface to
519 the receiver application. If it on, this flag indicates
520 that the FLOWSPEC that failed was strictly greater than
521 the FLOWSPEC requested by this receiver.
523 Error Code
525 A one-octet error description.
527 Error Value
529 A two-octet field containing additional information about the
530 error. Its contents depend upon the Error Type.
532 The values for Error Code and Error Value are defined in Appendix
535 ***********************************************************************/
537 typedef struct rsvpErrorSpec4_s {
538 u_int hopAddr;
539 u_char flag;
540 u_char code;
541 u_short value;
542 } rsvpErrorSpec4_t;
544 typedef struct rsvpErrorSpec6_s {
545 u_char hopAddr[16];
546 u_char flag;
547 u_char code;
548 u_short value;
549 } rsvpErrorSpec6_t;
551 #define RSVP_SCOPE_LIST_CLASS 7
552 #define RSVP_SCOPE_LIST_CTYPE_IPV4 1
553 #define RSVP_SCOPE_LIST_CTYPE_IPV6 2
555 /***********************************************************************
557 RSVP SCOPE LIST Object
559 This object contains a list of IP addresses, used for routing
560 messages with wildcard scope without loops. The addresses must be
561 listed in ascending numerical order.
563 o IPv4 SCOPE List object: Class = 7, C-Type = 1
565 0 1 2 3
566 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
567 +-------------+-------------+-------------+-------------+
568 | IPv4 Src Address (4 bytes) |
569 +-------------+-------------+-------------+-------------+
570 // //
571 +-------------+-------------+-------------+-------------+
572 | IPv4 Src Address (4 bytes) |
573 +-------------+-------------+-------------+-------------+
576 o IPv6 SCOPE list object: Class = 7, C-Type = 2
578 0 1 2 3
579 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
580 +-------------+-------------+-------------+-------------+
584 + IPv6 Src Address (16 bytes) +
588 +-------------+-------------+-------------+-------------+
589 // //
590 +-------------+-------------+-------------+-------------+
594 + IPv6 Src Address (16 bytes) +
598 +-------------+-------------+-------------+-------------+
600 ***********************************************************************/
602 typedef struct rsvpScopeList4_s {
603 u_int addr[16];
604 } rsvpScopeList4_t;
606 typedef struct rsvpScopeList6_s {
607 u_char hopAddr[16][16];
608 } rsvpScopeList6_t;
610 #define RSVP_STYLE_CLASS 8
611 #define RSVP_STYLE_CTYPE 1
613 /***********************************************************************
615 STYLE class = 8.
617 o STYLE object: Class = 8, C-Type = 1
619 0 1 2 3
620 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
621 +-------------+-------------+-------------+-------------+
622 | Flags | Option Vector |
623 +-------------+-------------+-------------+-------------+
627 Flags: 8 bits
629 (None assigned yet)
631 Option Vector: 24 bits
633 A set of bit fields giving values for the reservation
634 options. If new options are added in the future,
635 corresponding fields in the option vector will be assigned
636 from the least-significant end. If a node does not recognize
637 a style ID, it may interpret as much of the option vector as
638 it can, ignoring new fields that may have been defined.
640 The option vector bits are assigned (from the left) as
641 follows:
643 19 bits: Reserved
645 2 bits: Sharing control
647 00b: Reserved
649 01b: Distinct reservations
651 10b: Shared reservations
653 11b: Reserved
655 3 bits: Sender selection control
657 000b: Reserved
659 001b: Wildcard
661 010b: Explicit
663 011b - 111b: Reserved
665 The low order bits of the option vector are determined by the
666 style, as follows:
668 WF 10001b
669 FF 01010b
670 SE 10010b
672 ***********************************************************************/
674 typedef struct rsvpStyleOptions_s {
675 BITFIELDS_ASCENDING_4(u_int flag:8, /* flags */
676 u_short reserved:19, /* reserved */
677 u_short shareControl:2, /* sharing control */
678 u_short senderSelectionControlres:3 /* sender selection control */
679 } rsvpStyleOptions_t;
681 typedef struct rsvpStyle_s {
682 union {
683 u_int mark;
684 struct rsvpStyleOptions_s options;
685 } flag;
686 } rsvpStyle_t;
688 #define RSVP_FILTER_SPEC_CLASS 10
689 #define RSVP_FILTER_SPEC_CTYPE_IPV4 1
690 #define RSVP_FILTER_SPEC_CTYPE_IPV6 2
691 #define RSVP_FILTER_SPEC_CTYPE_FLOWLABEL 3
693 /***********************************************************************
695 FILTER_SPEC class = 10.
697 o IPv4 FILTER_SPEC object: Class = 10, C-Type = 1
699 0 1 2 3
700 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
701 +---------------+---------------+---------------+---------------+
702 | IPv4 SrcAddress (4 bytes) |
703 +---------------+---------------+---------------+---------------+
704 | ////// | ////// | SrcPort |
705 +---------------+---------------+---------------+---------------+
708 o IPv6 FILTER_SPEC object: Class = 10, C-Type = 2
710 0 1 2 3
711 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
712 +---------------+---------------+---------------+---------------+
716 + IPv6 SrcAddress (16 bytes) +
720 +---------------+---------------+---------------+---------------+
721 | ////// | ////// | SrcPort |
722 +---------------+---------------+---------------+---------------+
725 o IPv6 Flow-label FILTER_SPEC object: Class = 10, C-Type = 3
727 0 1 2 3
728 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
729 +---------------+---------------+---------------+---------------+
733 + IPv6 SrcAddress (16 bytes) +
737 +---------------+---------------+---------------+---------------+
738 | /////// | Flow Label (24 bits) |
739 +---------------+---------------+---------------+---------------+
741 SrcAddress
743 The IP source address for a sender host. Must be non-zero.
745 SrcPort
747 The UDP/TCP source port for a sender, or zero to indicate
748 `none'.
750 Flow Label
752 A 24-bit Flow Label, defined in IPv6. This value may be used
753 by the packet classifier to efficiently identify the packets
754 belonging to a particular (sender->destination) data flow.
756 ***********************************************************************/
758 typedef struct rsvpFilterSpec4_s {
759 u_char hopAddr[16];
760 u_char reserved1;
761 u_char reserved2;
762 u_short sourcePort;
763 } rsvpFilterSpec4_t;
765 typedef struct rsvpFilterSpec6_s {
766 u_char hopAddr[16];
767 u_char reserved1;
768 u_char reserved2;
769 u_short sourcePort;
770 } rsvpFilterSpec6_t;
772 typedef struct rsvpFilterSpecFlags_s {
773 BITFIELDS_ASCENDING_4(u_int reserved:8,
774 u_int flowLabel:24);
775 } rsvpFilterSpecFlags_t;
777 typedef struct rsvpFilterSpecLabel_s {
778 u_char hopAddr[16];
779 union {
780 u_int mark;
781 struct rsvpFilterSpecFlags_s flowLabel;
782 } flag;
783 } rsvpFilterSpecLabel_t;
785 #endif /* _RSVP_MPLS_H_ */