Use "strrchr()" instead of "rindex()" - "strrchr()" is the routine the
[obnox/wireshark/wip.git] / packet-rsvp.h
1 /**********************************************************************
2  *
3  * packet-rsvp.h
4  *
5  * (C) Ashok Narayanan <ashokn@cisco.com>
6  *
7  * $Id: packet-rsvp.h,v 1.7 1999/11/18 01:45:02 guy Exp $
8  *
9  * For license details, see the COPYING file with this distribution
10  *
11  **********************************************************************/
12
13 #ifndef PACKET_RSVP_H
14 #define PACKET_RSVP_H
15
16 /*
17  * RSVP message types
18  */
19 typedef enum {
20     RSVP_MSG_PATH=1, RSVP_MSG_RESV, RSVP_MSG_PERR, RSVP_MSG_RERR,
21     RSVP_MSG_PTEAR, RSVP_MSG_RTEAR, RSVP_MSG_CONFIRM, 
22     RSVP_MSG_RTEAR_CONFIRM=10
23 } rsvp_message_types;
24
25 static value_string message_type_vals[] = { 
26     {RSVP_MSG_PATH, "PATH Message"},
27     {RSVP_MSG_RESV, "RESV Message"},
28     {RSVP_MSG_PERR, "PATH ERROR Message"},
29     {RSVP_MSG_RERR, "RESV ERROR Message"},
30     {RSVP_MSG_PTEAR, "PATH TEAR Message"},
31     {RSVP_MSG_RTEAR, "RESV TEAR Message"},
32     {RSVP_MSG_CONFIRM, "CONFIRM Message"},
33     {RSVP_MSG_RTEAR_CONFIRM, "RESV TEAR CONFIRM Message"}
34 };
35
36 /* 
37  * RSVP classes
38  */
39 #define MAX_RSVP_CLASS 15
40
41 enum rsvp_classes {
42     RSVP_CLASS_NULL=0,
43     RSVP_CLASS_SESSION,
44     RSVP_CLASS_HOP=3,
45     RSVP_CLASS_INTEGRITY,
46     RSVP_CLASS_TIME_VALUES,
47     RSVP_CLASS_ERROR,
48     RSVP_CLASS_SCOPE,
49     RSVP_CLASS_STYLE,
50     RSVP_CLASS_FLOWSPEC,
51     RSVP_CLASS_FILTER_SPEC,
52     RSVP_CLASS_SENDER_TEMPLATE,
53     RSVP_CLASS_SENDER_TSPEC,
54     RSVP_CLASS_ADSPEC,
55     RSVP_CLASS_POLICY,
56     RSVP_CLASS_CONFIRM
57 };
58
59 static value_string rsvp_class_vals[] = { 
60     {RSVP_CLASS_NULL, "NULL object"},
61     {RSVP_CLASS_SESSION, "SESSION object"},
62     {RSVP_CLASS_HOP, "HOP object"},
63     {RSVP_CLASS_INTEGRITY, "INTEGRITY object"},
64     {RSVP_CLASS_TIME_VALUES, "TIME VALUES object"},
65     {RSVP_CLASS_ERROR, "ERROR object"},
66     {RSVP_CLASS_SCOPE, "SCOPE object"},
67     {RSVP_CLASS_STYLE, "STYLE object"},
68     {RSVP_CLASS_FLOWSPEC, "FLOWSPEC object"},
69     {RSVP_CLASS_FILTER_SPEC, "FILTER SPEC object"},
70     {RSVP_CLASS_SENDER_TEMPLATE, "SENDER TEMPLATE object"},
71     {RSVP_CLASS_SENDER_TSPEC, "SENDER TSPEC object"},
72     {RSVP_CLASS_ADSPEC, "ADSPEC object"},
73     {RSVP_CLASS_POLICY, "POLICY object"},
74     {RSVP_CLASS_CONFIRM, "CONFIRM object"}
75 };
76
77 /*
78  * RSVP error values
79  */
80 enum rsvp_error_types {
81     RSVP_ERROR_CONFIRM = 0,
82     RSVP_ERROR_ADMISSION,
83     RSVP_ERROR_POLICY,
84     RSVP_ERROR_NO_PATH,
85     RSVP_ERROR_NO_SENDER,
86     RSVP_ERROR_CONFLICT_RESV_STYLE,
87     RSVP_ERROR_UNKNOWN_RESV_STYLE,
88     RSVP_ERROR_CONFLICT_DEST_PORTS,
89     RSVP_ERROR_CONFLICT_SRC_PORTS,
90     RSVP_ERROR_PREEMPTED=12,
91     RSVP_ERROR_UNKNOWN_CLASS,
92     RSVP_ERROR_UNKNOWN_C_TYPE,
93     RSVP_ERROR_TRAFFIC = 21,
94     RSVP_ERROR_TRAFFIC_SYSTEM,
95     RSVP_ERROR_SYSTEM
96 };
97
98 static value_string rsvp_error_vals[] = {
99     {RSVP_ERROR_CONFIRM, "Confirmation"},
100     {RSVP_ERROR_ADMISSION, "Admission Control Failure "},
101     {RSVP_ERROR_POLICY, "Policy Control Failure"},
102     {RSVP_ERROR_NO_PATH, "No PATH information for this RESV message"},
103     {RSVP_ERROR_NO_SENDER, "No sender information for this RESV message"},
104     {RSVP_ERROR_CONFLICT_RESV_STYLE, "Conflicting reservation styles"},
105     {RSVP_ERROR_UNKNOWN_RESV_STYLE, "Unknown reservation style"},
106     {RSVP_ERROR_CONFLICT_DEST_PORTS, "Conflicting destination ports"},
107     {RSVP_ERROR_CONFLICT_SRC_PORTS, "Conflicting source ports"},
108     {RSVP_ERROR_PREEMPTED, "Service preempted"},
109     {RSVP_ERROR_UNKNOWN_CLASS, "Unknown object class"},
110     {RSVP_ERROR_UNKNOWN_C_TYPE, "Unknown object C-type"},
111     {RSVP_ERROR_TRAFFIC, "Traffic Control Error"},
112     {RSVP_ERROR_TRAFFIC_SYSTEM, "Traffic Control System Error"}
113 };
114
115 /*
116  * Defines the reservation style plus style-specific information that
117  * is not a FLOWSPEC or FILTER_SPEC object, in a RESV message.
118  */
119 #define RSVP_DISTINCT (1 << 3)
120 #define RSVP_SHARED (2 << 3)
121 #define RSVP_SHARING_MASK (RSVP_DISTINCT | RSVP_SHARED)
122
123 #define RSVP_SCOPE_WILD 1
124 #define RSVP_SCOPE_EXPLICIT 2
125 #define RSVP_SCOPE_MASK 0x07
126
127 #define RSVP_WF (RSVP_SHARED | RSVP_SCOPE_WILD)
128 #define RSVP_FF (RSVP_DISTINCT | RSVP_SCOPE_EXPLICIT)
129 #define RSVP_SE (RSVP_SHARED | RSVP_SCOPE_EXPLICIT)
130
131 static value_string style_vals[] = {
132     { RSVP_WF, "Wildcard Filter" },
133     { RSVP_FF, "Fixed Filter" },
134     { RSVP_SE, "Shared-Explicit" }
135 };
136
137 /*------------------------------*
138  * Object definitions
139  *------------------------------*/
140
141 /*
142  * Base RSVP object
143  */
144 typedef struct {
145     guint16 length;
146     guint8 class;       
147     guint8 type;
148     /* Data follows, as a sequence of bytes */
149 } rsvp_object;
150
151 /*
152  * RSVP message header
153  */
154
155 typedef struct {
156     guint8    ver_flags;                /* RSVP Version & flags */
157     guint8    message_type;             /* type of message */
158     guint16   cksum;                    /* IP Checksum */
159     guint8    sending_ttl;              /* ttl of message */
160     guint8    reserved_byte;            /* reserved */
161     guint16   rsvp_length;              /* length of RSVP data */
162     /* Objects follow, as a sequence of "rsvp_object"s */
163 } rsvp_header;
164
165 /*
166  * NULL object 
167 */
168 typedef struct {
169     rsvp_object base;
170 } rsvp_null;
171
172 /*
173  * SESSION object
174  */
175 typedef struct {
176     rsvp_object base;
177     guint32 destination;
178     guint8 protocol;
179     guint8 flags;
180     guint16 port;
181 } rsvp_session_ipv4;
182
183 typedef struct {
184     rsvp_object base;
185     struct e_in6_addr destination;
186     guint8 protocol;
187     guint8 flags;
188     guint16 port;
189 } rsvp_session_ipv6;
190
191 /*
192  * HOP object
193  * Can be a PHOP or a NHOP
194  */
195 typedef struct {
196     rsvp_object base;
197     guint32 neighbor;
198     guint32 lif_handle;
199 } rsvp_hop_ipv4;
200
201 typedef struct {
202     rsvp_object base;
203     struct e_in6_addr neighbor;
204     guint32 lif_handle;
205 } rsvp_hop_ipv6;
206
207 /*
208  * TIME_VALUES object
209  */
210 typedef struct {
211     rsvp_object base;
212     gint32 refresh_ms;
213 } rsvp_time_values;
214
215 /*
216  * ERROR object
217  */
218 typedef struct {
219     rsvp_object base;
220     guint32 error_node;
221     guint8 flags;
222     guint8 error_code;
223     guint16 error_value;
224 } rsvp_error_ipv4;
225
226 typedef struct {
227     rsvp_object base;
228     struct e_in6_addr error_node;
229     guint8 flags;
230     guint8 error_code;
231     guint16 error_value;
232 } rsvp_error_ipv6;
233
234 /*
235  * CONFIRM object
236  */
237 typedef struct {
238     rsvp_object base;
239     guint32 receiver;
240 } rsvp_confirm_ipv4;
241
242 typedef struct {
243     rsvp_object base;
244     struct e_in6_addr receiver;
245 } rsvp_confirm_ipv6;
246
247 /*
248  * SCOPE object
249  */
250 typedef struct {
251     rsvp_object base;
252     /* Source follows, as a sequence of 32-bit integers */
253 } rsvp_scope;
254
255 /*
256  * STYLE object
257  */
258 typedef struct {
259     rsvp_object base;
260     guint32 reservation_type;
261 } rsvp_style;
262
263 /*
264  * Defines a subset of session data packets that should receive the
265  * desired QoS (specified by an FLOWSPEC object), in a RESV message.
266  */
267 typedef struct {
268     rsvp_object base;
269     guint32 source;                     /* source sending data */
270     guint16 unused;
271     guint16 udp_source_port;            /* port number */
272 } rsvp_filter_ipv4;
273
274 /*
275  * Contains a sender IP address and perhaps some additional
276  * demultiplexing information to identify a sender, in a PATH
277  * message.
278  */
279 typedef struct {
280     rsvp_object base;
281     guint32 source;                     /* source sending data */
282     guint16 __reserved;
283     guint16 source_port;                /* port number */
284 } rsvp_template_ipv4;
285
286 typedef struct {
287     rsvp_object base;
288     struct e_in6_addr source;           /* source sending data */
289     guint16 __reserved;
290     guint16 source_port;                /* port number */
291 } rsvp_template_ipv6;
292
293 /*
294  * Defines a desired QoS, in a RESV message.
295  */
296 enum    qos_service_type {
297     QOS_QUALITATIVE =     128,          /* Qualitative service */
298     QOS_CONTROLLED_LOAD=    5,          /* Controlled Load Service */
299     QOS_GUARANTEED =        2,          /* Guaranteed service */
300     QOS_TSPEC =             1           /* Traffic specification */
301     };
302
303 static value_string qos_vals[] = {
304     { QOS_QUALITATIVE, "Qualitative QoS" },
305     { QOS_CONTROLLED_LOAD, "Controlled-load QoS" },
306     { QOS_GUARANTEED, "Guaranteed rate QoS" },
307     { QOS_TSPEC, "Traffic specification" },
308 };
309
310 static value_string svc_vals[] = {
311     { 127, "Token bucket TSpec" },
312     { 128, "Qualitative TSpec" },
313     { 130, "Guaranteed-rate RSpec" }
314 };
315
316 enum rsvp_spec_types { INTSRV = 2 };
317
318 enum intsrv_services {
319         INTSRV_GENERAL = 1,
320         INTSRV_GTD = 2,
321         INTSRV_CLOAD = 5,
322         INTSRV_QUALITATIVE = 128
323 };
324
325 static value_string intsrv_services_str[] = { 
326     {INTSRV_GENERAL, "Default General Parameters"},
327     {INTSRV_GTD, "Guaranteed"},
328     {INTSRV_CLOAD, "Controlled Load"},
329     {INTSRV_QUALITATIVE, "Qualitative"},
330 };
331
332 enum intsrv_field_name {
333         INTSRV_NON_IS_HOPS = 1, INTSRV_COMPOSED_NON_IS_HOPS,
334         INTSRV_IS_HOPS, INTSRV_COMPOSED_IS_HOPS,
335         INTSRV_PATH_BANDWIDTH, INTSRV_MIN_PATH_BANDWIDTH,
336         INTSRV_IF_LATENCY, INTSRV_PATH_LATENCY,
337         INTSRV_MTU, INTSRV_COMPOSED_MTU,
338
339         INTSRV_TOKEN_BUCKET_TSPEC = 127,
340         INTSRV_QUALITATIVE_TSPEC = 128,
341         INTSRV_GTD_RSPEC = 130,
342
343         INTSRV_DELAY = 131,     /* Gtd Parameter C - Max Delay Bound - bytes */
344         INTSRV_MAX_JITTER,      /* Gtd Parameter D - Max Jitter */
345         INTSRV_E2E_DELAY,       /* Gtd Parameter Ctot */
346         INTSRV_E2E_MAX_JITTER,  /* Gtd Parameter Dtot */
347         INTSRV_SHP_DELAY,       /* Gtd Parameter Csum */
348         INTSRV_SHP_MAX_JITTER   /* Gtd Parameter Dsum */
349 };
350
351 /*
352  * Subobjects for Integrated Services
353  */
354
355 typedef struct {
356     guint8 service_num;
357     guint8 break_bit;
358     guint16 length;
359 } service_hdr;
360
361 typedef struct {                                        
362     service_hdr svchdr;
363
364     guint8      param_id;
365     guint8      flags_tspec;
366     guint16     parameter_length;
367
368     guint32     rate;
369     guint32     depth;
370     guint32     peak;
371     guint32     min_unit;
372     guint32     max_unit;
373 } IS_tspec; /* RFC2210 */
374
375 typedef struct {
376     service_hdr svchdr;
377     
378     guint8      param_id;
379     guint8      flags_tspec;
380     guint16     parameter_length;
381
382     guint32     max_unit;
383 } QUAL_tspec; /* Qualitative */
384
385 typedef struct {
386     rsvp_object base;
387     guint8      version;        
388     guint8      __reserved_;
389     guint16     length_in_words;
390
391     /* Data follows, as a sequence of bytes */
392 } rsvp_tspec;
393
394 typedef struct {
395     guint8      param_id;
396     guint8      flags_rspec;
397     guint16     param2_length;
398     guint32     requested_rate;
399     guint32     slack;
400 } IS_rspec;
401
402 typedef struct {
403     IS_tspec tspec;
404     IS_rspec rspec;
405 } IS_flowspec; /* RFC 2210 */
406
407 typedef struct {
408     service_hdr svchdr;
409     
410     guint8      param_id;
411     guint8      flags_tspec;
412     guint16     parameter_length;
413
414     guint32     max_unit;
415 } QUAL_flowspec; /* Qualitative */
416
417
418 typedef struct {
419     rsvp_object base;
420     guint8      version;        
421     guint8      __reserved_;
422     guint16     length_in_words;
423
424     /* Data follows, as a sequence of bytes */
425 } rsvp_flowspec;
426                                         
427
428 typedef struct {
429     guint8 id;
430     guint8 flags;
431     guint16 length;
432     guint32 dataval;
433 } param_hdr;
434     
435 static value_string adspec_params[] = { 
436     {4, "IS Hop Count"},
437     {6, "Path b/w estimate"},
438     {8, "Minimum path latency"},
439     {10, "Composed MTU"},
440     {133, "End-to-end composed value for C"},
441     {134, "End-to-end composed value for D"},
442     {135, "Since-last-reshaping point composed C"},
443     {136, "Since-last-reshaping point composed D"},
444 };
445
446
447
448 #endif