1be51c2fe6a230c7415b5b9466c964e29bfd78f3
[metze/wireshark/wip.git] / epan / dissectors / packet-rsvp.c
1 /* packet-rsvp.c
2  * Routines for RSVP packet disassembly
3  *
4  * (c) Copyright Ashok Narayanan <ashokn@cisco.com>
5  *
6  * $Id$
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 Gerald Combs
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  */
26
27 /*
28  * NOTES
29  *
30  * This module defines routines to disassemble RSVP packets, as defined in
31  * RFC 2205. All objects from RFC2205 are supported, in IPv4 and IPv6 mode.
32  * In addition, the Integrated Services traffic specification objects
33  * defined in RFC2210 are also supported.
34  *
35  * IPv6 support is not completely tested
36  *
37  * Mar 3, 2000: Added support for MPLS/TE objects, as defined in
38  * <draft-ietf-mpls-rsvp-lsp-tunnel-04.txt>
39  *
40  * May 6, 2004: Added support for E-NNI objects, as defined in
41  * <OIF-E-NNI-01.0>   (Roberto Morro)
42  * <roberto.morro[AT]tilab.com>
43  *
44  * May 6, 2004: Modified some UNI objects, as defined in
45  * <OIF2003.249.09>   (Roberto Morro)
46  * <roberto.morro[AT]tilab.com>
47  *
48  * June 2, 2005: Modified more UNI objects to show correct TNA
49  * addresses; Fixed LSP interface ID subobject (Richard Rabbat)
50  * <richard[AT]us.fujitsu.com>
51  *
52  * July 25, 2005: improved ERROR and LABEL_SET objects dissector;
53  * new ASSOCIATION object dissector (Roberto Morro)
54  * <roberto.morro[AT]tilab.com>
55  *
56  * August 22, 2005: added support for tapping and conversations.
57  * (Manu Pathak) <mapathak[AT]cisco.com>
58  *
59  * July 4, 2006: added support for RFC4124; new CLASSTYPE object dissector
60  * (FF) <francesco.fondelli[AT]gmail.com>
61  *
62  * June 9, 2007: added support for draft-ietf-ccamp-ethernet-traffic-parameters-02
63  * and draft-ietf-ccamp-lsp-hierarchy-bis-02; added support for NOTIFY_REQUEST
64  * and RECOVERY_LABEL objects (Roberto Morro) * <roberto.morro[AT]tilab.com>
65  *
66  * Oct 21, 2009: add support for RFC4328, new G.709 traffic parameters,
67  * update gpid, switching and encoding type values to actual IANA numbers.
68  * (FF) <francesco.fondelli[AT]gmail.com>
69  *
70  * Gen 20, 2010: add support for ERROR_STRING IF_ID TLV (see RFC 4783)
71  * (FF) <francesco.fondelli[AT]gmail.com>
72  *
73  * Feb 12, 2010: add support for generalized label interpretation: SUKLM
74  * format for SONET/SDH label (RFC 4606), t3t2t1 format for G.709 ODUk label
75  * (RFC 4328), G.694 format for lambda label (draft-ietf-ccamp-gmpls-g-694-lamb
76  * da-labels-05).  Add related user preference option.
77  * (FF) <francesco.fondelli[AT]gmail.com>
78  *
79  * Dec 3, 2010: add support for vendor private class object and ERO/RRO
80  * sub-object (see RFC 3936).
81  * (FF) <francesco.fondelli[AT]gmail.com>
82  *
83  * Dec 21, 2010: add new PROTECTION obj c-type 2 (RFC4872),
84  * new TLVs for IF_ID (RFC4920), Path Key subobj in ERO (RFC5520),
85  * new ASSOCIATION obj c-type 4 (oif2008.389), new LSP_ATTRIBUTES and
86  * LSP_REQUIRED_ATTRIBUTES objects (RFC5420), improved ERROR object dissection,
87  * new ADMIN_STATUS flags and fix to conversation (not applied to ACK, SREFRESH
88  * and HELLO messages).
89  * (Roberto Morro) <roberto.morro[AT]telecomitalia.it>
90  *
91  */
92
93
94 #include "config.h"
95
96 #ifdef HAVE_UNISTD_H
97 #include <unistd.h>
98 #endif
99
100 #include <glib.h>
101
102 #include <epan/packet.h>
103 #include <prefs.h>
104 #include <epan/in_cksum.h>
105 #include <epan/etypes.h>
106 #include <epan/ipproto.h>
107 #include <epan/conversation.h>
108 #include <epan/tap.h>
109 #include <epan/emem.h>
110 #include <epan/sminmpec.h>
111
112 #include "packet-rsvp.h"
113 #include "packet-ip.h"
114 #include "packet-diffserv-mpls-common.h"
115 #include "packet-osi.h"
116
117 /* RSVP over UDP encapsulation */
118 #define UDP_PORT_PRSVP 3455
119
120 static int proto_rsvp = -1;
121
122 static int hf_rsvp_error_flags = -1;
123 static int hf_rsvp_error_flags_path_state_removed = -1;
124 static int hf_rsvp_error_flags_not_guilty = -1;
125 static int hf_rsvp_error_flags_in_place = -1;
126 static int hf_rsvp_eth_tspec_tlv_color_mode = -1;
127 static int hf_rsvp_eth_tspec_tlv_coupling_flag = -1;
128 static int hf_rsvp_sender_tspec_standard_contiguous_concatenation = -1;
129 static int hf_rsvp_sender_tspec_arbitrary_contiguous_concatenation = -1;
130 static int hf_rsvp_sender_tspec_regenerator_section = -1;
131 static int hf_rsvp_sender_tspec_multiplex_section = -1;
132 static int hf_rsvp_sender_tspec_J0_transparency = -1;
133 static int hf_rsvp_sender_tspec_SOH_RSOH_DCC_transparency = -1;
134 static int hf_rsvp_sender_tspec_LOH_MSOH_DCC_transparency = -1;
135 static int hf_rsvp_sender_tspec_LOH_MSOH_extended_DCC_transparency = -1;
136 static int hf_rsvp_sender_tspec_K1_K2_transparency = -1;
137 static int hf_rsvp_sender_tspec_E1_transparency = -1;
138 static int hf_rsvp_sender_tspec_F1_transparency = -1;
139 static int hf_rsvp_sender_tspec_E2_transparency = -1;
140 static int hf_rsvp_sender_tspec_B1_transparency = -1;
141 static int hf_rsvp_sender_tspec_B2_transparency = -1;
142 static int hf_rsvp_sender_tspec_M0_transparency = -1;
143 static int hf_rsvp_sender_tspec_M1_transparency = -1;
144 static int hf_rsvp_flowspec_standard_contiguous_concatenation = -1;
145 static int hf_rsvp_flowspec_arbitrary_contiguous_concatenation = -1;
146 static int hf_rsvp_flowspec_regenerator_section = -1;
147 static int hf_rsvp_flowspec_multiplex_section = -1;
148 static int hf_rsvp_flowspec_J0_transparency = -1;
149 static int hf_rsvp_flowspec_SOH_RSOH_DCC_transparency = -1;
150 static int hf_rsvp_flowspec_LOH_MSOH_DCC_transparency = -1;
151 static int hf_rsvp_flowspec_LOH_MSOH_extended_DCC_transparency = -1;
152 static int hf_rsvp_flowspec_K1_K2_transparency = -1;
153 static int hf_rsvp_flowspec_E1_transparency = -1;
154 static int hf_rsvp_flowspec_F1_transparency = -1;
155 static int hf_rsvp_flowspec_E2_transparency = -1;
156 static int hf_rsvp_flowspec_B1_transparency = -1;
157 static int hf_rsvp_flowspec_B2_transparency = -1;
158 static int hf_rsvp_flowspec_M0_transparency = -1;
159 static int hf_rsvp_flowspec_M1_transparency = -1;
160 static int hf_rsvp_integrity_flags_handshake = -1;
161 static int hf_rsvp_sa_flags_local = -1;
162 static int hf_rsvp_sa_flags_label = -1;
163 static int hf_rsvp_sa_flags_se_style = -1;
164 static int hf_rsvp_sa_flags_bandwidth = -1;
165 static int hf_rsvp_sa_flags_node = -1;
166 static int hf_rsvp_rro_flags_local_avail = -1;
167 static int hf_rsvp_rro_flags_local_in_use = -1;
168 static int hf_rsvp_rro_flags_bandwidth = -1;
169 static int hf_rsvp_rro_flags_node = -1;
170 static int hf_rsvp_rro_flags_node_address = -1;
171 static int hf_rsvp_rro_flags_backup_tunnel_bandwidth = -1;
172 static int hf_rsvp_rro_flags_backup_tunnel_hop = -1;
173 static int hf_rsvp_rro_flags_global_label = -1;
174 static int hf_rsvp_lsp_attr_e2e = -1;
175 static int hf_rsvp_lsp_attr_boundary = -1;
176 static int hf_rsvp_lsp_attr_segment = -1;
177 static int hf_rsvp_gen_uni_direction = -1;
178 static int hf_rsvp_protection_info_flags_secondary_lsp = -1;
179 static int hf_rsvp_pi_link_flags_extra_traffic = -1;
180 static int hf_rsvp_pi_link_flags_unprotected = -1;
181 static int hf_rsvp_pi_link_flags_shared = -1;
182 static int hf_rsvp_pi_link_flags_dedicated1_1 = -1;
183 static int hf_rsvp_pi_link_flags_dedicated1plus1 = -1;
184 static int hf_rsvp_pi_link_flags_enhanced = -1;
185 static int hf_rsvp_pi_link_flags_extra = -1;
186 static int hf_rsvp_pi_link_flags_dedicated_1_1 = -1;
187 static int hf_rsvp_pi_link_flags_dedicated_1plus1 = -1;
188 static int hf_rsvp_rfc4872_secondary = -1;
189 static int hf_rsvp_rfc4872_protecting = -1;
190 static int hf_rsvp_rfc4872_notification_msg = -1;
191 static int hf_rsvp_rfc4872_operational = -1;
192 static int hf_rsvp_pi_lsp_flags_full_rerouting = -1;
193 static int hf_rsvp_pi_lsp_flags_rerouting_extra = -1;
194 static int hf_rsvp_pi_lsp_flags_1_n_protection = -1;
195 static int hf_rsvp_pi_lsp_flags_1plus1_unidirectional = -1;
196 static int hf_rsvp_pi_lsp_flags_1plus1_bidirectional = -1;
197 static int hf_rsvp_protection_info_in_place = -1;
198 static int hf_rsvp_protection_info_required = -1;
199 static int hf_rsvp_pi_seg_flags_full_rerouting = -1;
200 static int hf_rsvp_pi_seg_flags_rerouting_extra = -1;
201 static int hf_rsvp_pi_seg_flags_1_n_protection = -1;
202 static int hf_rsvp_pi_seg_flags_1plus1_unidirectional = -1;
203 static int hf_rsvp_pi_seg_flags_1plus1_bidirectional = -1;
204 static int hf_rsvp_frr_flags_one2one_backup = -1;
205 static int hf_rsvp_frr_flags_facility_backup = -1;
206 static int hf_rsvp_c_type = -1;
207 static int hf_rsvp_3gpp_obj_tid = -1;
208 static int hf_rsvp_3gpp_obj_ie_len = -1;
209 static int hf_rsvp_3gpp_obj_ie_type = -1;
210
211 static dissector_table_t rsvp_dissector_table;
212
213 static int rsvp_tap = -1;
214
215 /*
216  * All RSVP packets belonging to a particular flow  belong to the same
217  * conversation. The following structure definitions are for auxillary
218  * structures which have all the relevant flow information to make up the
219  * RSVP five-tuple. Note that the values of the five-tuple are determined
220  * from the session object and sender template/filter spec for PATH/RESV
221  * messages.
222  * Update rsvp_request_equal() when you add stuff here. You might also
223  * have to update rsvp_request_hash().
224  * TODO: Support for IPv6 conversations.
225  */
226
227 typedef struct rsvp_session_ipv4_info {
228     address destination;
229     guint8 protocol;
230     guint16 udp_dest_port;
231 } rsvp_session_ipv4_info;
232
233 typedef struct rsvp_session_ipv6_info {
234     /* not supported yet */
235
236     guint8 dummy;
237 } rsvp_session_ipv6_info;
238
239 typedef struct rsvp_session_ipv4_lsp_info {
240     address destination;
241     guint16 udp_dest_port;
242     guint32 ext_tunnel_id;
243 } rsvp_session_ipv4_lsp_info;
244
245 typedef struct rsvp_session_agg_ipv4_info {
246     address destination;
247     guint8 dscp;
248 } rsvp_session_agg_ipv4_info;
249
250 typedef struct rsvp_session_ipv4_uni_info {
251     address destination;
252     guint16 udp_dest_port;
253     guint32 ext_tunnel_id;
254 } rsvp_session_ipv4_uni_info;
255
256 typedef struct rsvp_session_ipv4_enni_info {
257     address destination;
258     guint16 udp_dest_port;
259     guint32 ext_tunnel_id;
260 } rsvp_session_ipv4_enni_info;
261
262 typedef struct rsvp_template_filter_info {
263     address source;
264     guint16 udp_source_port;
265 } rsvp_template_filter_info;
266
267 /*
268  * The actual request key consists of a union of the various session objects
269  * (which are uniquely identified based on the session type), and the
270  * source_info structure, which has the information derived from the sender
271  * template or the filter spec.
272  * The request key is populated by copying the information from the
273  * rsvp_conversation_info structure (rsvph), which in turn is populated when
274  * the session, filter and sender template objects are dissected.
275  */
276 struct rsvp_request_key {
277     guint32 session_type;
278
279     union { /* differentiated by session_type field */
280         rsvp_session_ipv4_info session_ipv4;
281         rsvp_session_ipv6_info session_ipv6;
282         rsvp_session_ipv4_lsp_info session_ipv4_lsp;
283         rsvp_session_agg_ipv4_info session_agg_ipv4;
284         rsvp_session_ipv4_uni_info session_ipv4_uni;
285         rsvp_session_ipv4_enni_info session_ipv4_enni;
286     } u;
287
288     rsvp_template_filter_info source_info;
289     guint32 conversation;
290 };
291
292 /*
293  * At present, there is nothing particularly important that we need to
294  * store for the request value for each rsvp_request_key, so we just
295  * store the unique 32-bit identifier internally allocated for the key
296  * (and stored in the conversation attribute of rsvp_request_key above.
297  * If this changes in the future, then other stuff can be added here.
298  */
299 struct rsvp_request_val {
300     guint32 value;
301 };
302
303 /*
304  * Initialize the conversation related data structures.
305  */
306 static GHashTable *rsvp_request_hash = NULL;
307
308 /*
309  * The list of tree types
310  */
311 enum {
312     TT_RSVP,
313     TT_HDR,
314     TT_SESSION,
315     TT_HOP,
316     TT_HOP_SUBOBJ,
317     TT_TIME_VALUES,
318     TT_ERROR,
319     TT_ERROR_SUBOBJ,
320     TT_ERROR_FLAGS,
321     TT_SCOPE,
322     TT_STYLE,
323     TT_CONFIRM,
324     TT_SENDER_TEMPLATE,
325     TT_FILTER_SPEC,
326     TT_TSPEC,
327     TT_TSPEC_SUBTREE,
328     TT_FLOWSPEC,
329     TT_FLOWSPEC_SUBTREE,
330     TT_ETHSPEC_SUBTREE,
331     TT_ADSPEC,
332     TT_ADSPEC_SUBTREE,
333     TT_INTEGRITY,
334     TT_INTEGRITY_FLAGS,
335     TT_DCLASS,
336     TT_LSP_TUNNEL_IF_ID,
337     TT_LSP_TUNNEL_IF_ID_SUBTREE,
338     TT_POLICY,
339     TT_MESSAGE_ID,
340     TT_MESSAGE_ID_ACK,
341     TT_MESSAGE_ID_LIST,
342     TT_LABEL,
343     TT_LABEL_SET,
344     TT_LABEL_REQUEST,
345     TT_SESSION_ATTRIBUTE,
346     TT_SESSION_ATTRIBUTE_FLAGS,
347     TT_HELLO_OBJ,
348     TT_EXPLICIT_ROUTE,
349     TT_EXPLICIT_ROUTE_SUBOBJ,
350     TT_RECORD_ROUTE,
351     TT_RECORD_ROUTE_SUBOBJ,
352     TT_RECORD_ROUTE_SUBOBJ_FLAGS,
353     TT_ADMIN_STATUS,
354     TT_ADMIN_STATUS_FLAGS,
355     TT_LSP_ATTRIBUTES,
356     TT_LSP_ATTRIBUTES_FLAGS,
357     TT_ASSOCIATION,
358     TT_GEN_UNI,
359     TT_GEN_UNI_SUBOBJ,
360     TT_CALL_ID,
361         TT_3GPP2_OBJECT,
362     TT_BUNDLE_COMPMSG,
363     TT_RESTART_CAP,
364     TT_PROTECTION_INFO,
365     TT_PROTECTION_INFO_LINK,
366     TT_PROTECTION_INFO_LSP,
367     TT_PROTECTION_INFO_SEG,
368     TT_FAST_REROUTE,
369     TT_FAST_REROUTE_FLAGS,
370     TT_DETOUR,
371     TT_DIFFSERV,
372     TT_DIFFSERV_MAP,
373     TT_DIFFSERV_MAP_PHBID,
374     TT_CLASSTYPE,
375     TT_PRIVATE_CLASS,
376     TT_UNKNOWN_CLASS,
377
378     TT_MAX
379 };
380 static gint ett_treelist[TT_MAX];
381 #define TREE(X) ett_treelist[(X)]
382
383 /* Should we dissect bundle messages? */
384 static gboolean rsvp_bundle_dissect = TRUE;
385
386 /* FF: How should we dissect generalized label? */
387 static const enum_val_t rsvp_generalized_label_options[] = {
388     /* see RFC 3471 Section 3.2.1.2 */
389     { "data", "data (no interpretation)", 1 },
390     /* see RFC 4606 Section 3 */
391     { "SUKLM", "SONET/SDH (\"S, U, K, L, M\" scheme)", 2 },
392     /* see I-D draft-ietf-ccamp-gmpls-g-694-lambda-labels-05 */
393     { "G694", "Wavelength Label (G.694 frequency grid)", 3 },
394     /* see RFC 4328 Section 4.1 */
395     { "G709", "ODUk Label", 4 },
396     { NULL, NULL, 0 }
397 };
398
399 static guint rsvp_generalized_label_option = 1;
400
401 /*
402  * RSVP message types.
403  * See
404  *
405  *      http://www.iana.org/assignments/rsvp-parameters
406  */
407 typedef enum {
408     RSVP_MSG_PATH          =  1,        /* RFC 2205 */
409     RSVP_MSG_RESV,                      /* RFC 2205 */
410     RSVP_MSG_PERR,                      /* RFC 2205 */
411     RSVP_MSG_RERR,                      /* RFC 2205 */
412     RSVP_MSG_PTEAR,                     /* RFC 2205 */
413     RSVP_MSG_RTEAR,                     /* RFC 2205 */
414     RSVP_MSG_CONFIRM,                   /* XXX - DREQ, RFC 2745? */
415                                         /* 9 is DREP, RFC 2745 */
416     RSVP_MSG_RTEAR_CONFIRM = 10,        /* from Fred Baker at Cisco */
417                                         /* 11 is unassigned */
418     RSVP_MSG_BUNDLE        = 12,        /* RFC 2961 */
419     RSVP_MSG_ACK,                       /* RFC 2961 */
420                                         /* 14 is reserved */
421     RSVP_MSG_SREFRESH      = 15,        /* RFC 2961 */
422                                         /* 16, 17, 18, 19 not listed */
423     RSVP_MSG_HELLO         = 20,        /* RFC 3209 */
424     RSVP_MSG_NOTIFY                     /* [RFC3473] */
425                                         /* 25 is Integrity Challenge RFC 2747, RFC 3097 */
426                                         /* 26 is Integrity Response RFC 2747, RFC 3097 */
427                                         /* 66 is DSBM_willing [SBM] */
428                                         /* 67 is I_AM_DSBM [SBM] */
429                                         /* [SBM] is Subnet Bandwidth Manager ID from July 1997 */
430 } rsvp_message_types;
431
432 static const value_string message_type_vals[] = {
433     { RSVP_MSG_PATH,            "PATH Message. "},
434     { RSVP_MSG_RESV,            "RESV Message. "},
435     { RSVP_MSG_PERR,            "PATH ERROR Message. "},
436     { RSVP_MSG_RERR,            "RESV ERROR Message. "},
437     { RSVP_MSG_PTEAR,           "PATH TEAR Message. "},
438     { RSVP_MSG_RTEAR,           "RESV TEAR Message. "},
439     { RSVP_MSG_CONFIRM,         "CONFIRM Message. "},
440     { RSVP_MSG_RTEAR_CONFIRM,   "RESV TEAR CONFIRM Message. "},
441     { RSVP_MSG_BUNDLE,          "BUNDLE Message. "},
442     { RSVP_MSG_ACK,             "ACK Message. "},
443     { RSVP_MSG_SREFRESH,        "SREFRESH Message. "},
444     { RSVP_MSG_HELLO,           "HELLO Message. "},
445     { RSVP_MSG_NOTIFY,          "NOTIFY Message. "},
446     { 0, NULL}
447 };
448 static value_string_ext message_type_vals_ext = VALUE_STRING_EXT_INIT(message_type_vals);
449
450 /*
451  * FF: please keep this list in sync with
452  * http://www.iana.org/assignments/rsvp-parameters
453  * Registry Name: 'Class'
454  */
455 enum rsvp_classes {
456     RSVP_CLASS_NULL              =   0,
457     RSVP_CLASS_SESSION,
458
459     RSVP_CLASS_HOP               =   3,
460     RSVP_CLASS_INTEGRITY,
461     RSVP_CLASS_TIME_VALUES,
462     RSVP_CLASS_ERROR,
463     RSVP_CLASS_SCOPE,
464     RSVP_CLASS_STYLE,
465     RSVP_CLASS_FLOWSPEC,
466     RSVP_CLASS_FILTER_SPEC,
467     RSVP_CLASS_SENDER_TEMPLATE,
468     RSVP_CLASS_SENDER_TSPEC,
469     RSVP_CLASS_ADSPEC,
470     RSVP_CLASS_POLICY,
471     RSVP_CLASS_CONFIRM,
472     RSVP_CLASS_LABEL,
473     RSVP_CLASS_HOP_COUNT,
474     RSVP_CLASS_STRICT_SOURCE_ROUTE,
475     RSVP_CLASS_LABEL_REQUEST     =  19,
476     RSVP_CLASS_EXPLICIT_ROUTE,
477     RSVP_CLASS_RECORD_ROUTE,
478
479     RSVP_CLASS_HELLO,
480
481     RSVP_CLASS_MESSAGE_ID,
482     RSVP_CLASS_MESSAGE_ID_ACK,
483     RSVP_CLASS_MESSAGE_ID_LIST,
484
485     /* 26-29  Unassigned */
486
487     RSVP_CLASS_DIAGNOSTIC        = 30,
488     RSVP_CLASS_ROUTE,
489     RSVP_CLASS_DIAG_RESPONSE,
490     RSVP_CLASS_DIAG_SELECT,
491     RSVP_CLASS_RECOVERY_LABEL,
492     RSVP_CLASS_UPSTREAM_LABEL,
493     RSVP_CLASS_LABEL_SET,
494     RSVP_CLASS_PROTECTION,
495
496     /* 38-41  Unassigned */
497     RSVP_CLASS_DSBM_IP_ADDRESS   = 42,
498     RSVP_CLASS_SBM_PRIORITY,
499     RSVP_CLASS_DSBM_TIMER_INTERVALS,
500     RSVP_CLASS_SBM_INFO,
501
502     /* 46-62  Unassigned */
503
504     RSVP_CLASS_DETOUR            = 63,
505     RSVP_CLASS_CHALLENGE,
506     RSVP_CLASS_DIFFSERV,
507     RSVP_CLASS_CLASSTYPE, /* FF: RFC4124 */
508     RSVP_CLASS_LSP_REQUIRED_ATTRIBUTES,
509
510     /* 68-123  Unassigned */
511
512     RSVP_CLASS_VENDOR_PRIVATE_1  = 124,
513     RSVP_CLASS_VENDOR_PRIVATE_2  = 125,
514     RSVP_CLASS_VENDOR_PRIVATE_3  = 126,
515     RSVP_CLASS_VENDOR_PRIVATE_4  = 127,
516
517     RSVP_CLASS_NODE_CHAR         = 128,
518     RSVP_CLASS_SUGGESTED_LABEL,
519     RSVP_CLASS_ACCEPTABLE_LABEL_SET,
520     RSVP_CLASS_RESTART_CAP,
521
522     /* 132-160 Unassigned */
523
524     /* 166-187 Unassigned */
525
526     RSVP_CLASS_VENDOR_PRIVATE_5  = 188,
527     RSVP_CLASS_VENDOR_PRIVATE_6  = 189,
528     RSVP_CLASS_VENDOR_PRIVATE_7  = 190,
529     RSVP_CLASS_VENDOR_PRIVATE_8  = 191,
530
531     RSVP_CLASS_SESSION_ASSOC     = 192,
532     RSVP_CLASS_LSP_TUNNEL_IF_ID,
533     /* 194 Unassigned */
534     RSVP_CLASS_NOTIFY_REQUEST    = 195,
535     RSVP_CLASS_ADMIN_STATUS,
536     RSVP_CLASS_LSP_ATTRIBUTES,
537     RSVP_CLASS_ALARM_SPEC,
538     RSVP_CLASS_ASSOCIATION,
539
540     /* 203-204  Unassigned */
541     RSVP_CLASS_FAST_REROUTE      = 205,
542     /* 206 Unassigned */
543     RSVP_CLASS_SESSION_ATTRIBUTE = 207,
544     /* 208-223 Unassigned */
545     /*
546       Class Numbers 224-255 are assigned by IANA using FCFS allocation.
547       RSVP will silently ignore, but FORWARD an object with a Class Number
548       in this range that it does not understand.
549     */
550     /* 224  Unassigned */
551     RSVP_CLASS_DCLASS            = 225,
552     RSVP_CLASS_PACKETCABLE_EXTENSIONS,
553     RSVP_CLASS_ATM_SERVICECLASS,
554     RSVP_CLASS_CALL_OPS,
555     RSVP_CLASS_GENERALIZED_UNI,
556     RSVP_CLASS_CALL_ID,
557     RSVP_CLASS_3GPP2_OBJECT,
558
559     /* 232-251 Unassigned */
560
561     RSVP_CLASS_VENDOR_PRIVATE_9  = 252,
562     RSVP_CLASS_VENDOR_PRIVATE_10 = 253,
563     RSVP_CLASS_VENDOR_PRIVATE_11 = 254,
564     RSVP_CLASS_VENDOR_PRIVATE_12 = 255
565 };
566
567 /* XXX: are any/all of the "missing" values below supposed to have value-strings */
568 static const value_string rsvp_class_vals[] = {
569     { RSVP_CLASS_NULL,                  "NULL object"},
570     { RSVP_CLASS_SESSION,               "SESSION object"},
571
572     { RSVP_CLASS_HOP,                   "HOP object"},
573     { RSVP_CLASS_INTEGRITY,             "INTEGRITY object"},
574     { RSVP_CLASS_TIME_VALUES,           "TIME VALUES object"},
575     { RSVP_CLASS_ERROR,                 "ERROR object"},
576     { RSVP_CLASS_SCOPE,                 "SCOPE object"},
577     { RSVP_CLASS_STYLE,                 "STYLE object"},
578     { RSVP_CLASS_FLOWSPEC,              "FLOWSPEC object"},
579     { RSVP_CLASS_FILTER_SPEC,           "FILTER SPEC object"},
580     { RSVP_CLASS_SENDER_TEMPLATE,       "SENDER TEMPLATE object"},
581     { RSVP_CLASS_SENDER_TSPEC,          "SENDER TSPEC object"},
582     { RSVP_CLASS_ADSPEC,                "ADSPEC object"},
583     { RSVP_CLASS_POLICY,                "POLICY object"},
584     { RSVP_CLASS_CONFIRM,               "CONFIRM object"},
585     { RSVP_CLASS_LABEL,                 "LABEL object"},
586     { RSVP_CLASS_HOP_COUNT,             "HOP_COUNT object"},
587     { RSVP_CLASS_STRICT_SOURCE_ROUTE,   "STRICT_SOURCE_ROUTE object"},
588     { RSVP_CLASS_LABEL_REQUEST,         "LABEL REQUEST object"},
589     { RSVP_CLASS_EXPLICIT_ROUTE,        "EXPLICIT ROUTE object"},
590     { RSVP_CLASS_RECORD_ROUTE,          "RECORD ROUTE object"},
591
592     { RSVP_CLASS_HELLO,                 "HELLO object"},
593
594     { RSVP_CLASS_MESSAGE_ID,            "MESSAGE-ID object"},
595     { RSVP_CLASS_MESSAGE_ID_ACK,        "MESSAGE-ID ACK/NACK object"},
596     { RSVP_CLASS_MESSAGE_ID_LIST,       "MESSAGE-ID LIST object"},
597
598 /*
599     RSVP_CLASS_DIAGNOSTIC
600     RSVP_CLASS_ROUTE,
601     RSVP_CLASS_DIAG_RESPONSE,
602     RSVP_CLASS_DIAG_SELECT,
603 */
604
605     { RSVP_CLASS_RECOVERY_LABEL,        "RECOVERY-LABEL object"},
606     { RSVP_CLASS_UPSTREAM_LABEL,        "UPSTREAM-LABEL object"},
607     { RSVP_CLASS_LABEL_SET,             "LABEL-SET object"},
608     { RSVP_CLASS_PROTECTION,            "PROTECTION object"},
609
610 /*
611     RSVP_CLASS_DSBM_IP_ADDRESS
612     RSVP_CLASS_SBM_PRIORITY,
613     RSVP_CLASS_DSBM_TIMER_INTERVALS,
614     RSVP_CLASS_SBM_INFO,
615 */
616
617     { RSVP_CLASS_DETOUR,                "DETOUR object"},
618 /*
619     RSVP_CLASS_CHALLENGE,
620 */
621     { RSVP_CLASS_DIFFSERV,              "DIFFSERV object"},
622     { RSVP_CLASS_CLASSTYPE,             "CLASSTYPE object"},
623 /*
624     RSVP_CLASS_LSP_REQUIRED_ATTRIBUTES,
625 */
626
627     { RSVP_CLASS_VENDOR_PRIVATE_1,      "VENDOR PRIVATE object (0bbbbbbb: "
628                                         "reject if unknown)"},
629     { RSVP_CLASS_VENDOR_PRIVATE_2,      "VENDOR PRIVATE object (0bbbbbbb: "
630                                          "reject if unknown)"},
631     { RSVP_CLASS_VENDOR_PRIVATE_3,      "VENDOR PRIVATE object (0bbbbbbb: "
632                                          "reject if unknown)"},
633     { RSVP_CLASS_VENDOR_PRIVATE_4,      "VENDOR PRIVATE object (0bbbbbbb: "
634                                          "reject if unknown)"},
635
636 /*
637     RSVP_CLASS_NODE_CHAR
638 */
639     { RSVP_CLASS_SUGGESTED_LABEL,       "SUGGESTED-LABEL object"},
640     { RSVP_CLASS_ACCEPTABLE_LABEL_SET,  "ACCEPTABLE-LABEL-SET object"},
641     { RSVP_CLASS_RESTART_CAP,           "RESTART-CAPABILITY object"},
642
643     { RSVP_CLASS_VENDOR_PRIVATE_5,      "VENDOR PRIVATE object (10bbbbbb: "
644                                          "ignore if unknown)"},
645     { RSVP_CLASS_VENDOR_PRIVATE_6,      "VENDOR PRIVATE object (10bbbbbb: "
646                                          "ignore if unknown)"},
647     { RSVP_CLASS_VENDOR_PRIVATE_7,      "VENDOR PRIVATE object (10bbbbbb: "
648                                          "ignore if unknown)"},
649     { RSVP_CLASS_VENDOR_PRIVATE_8,      "VENDOR PRIVATE object (10bbbbbb: "
650                                          "ignore if unknown)"},
651 /*
652     RSVP_CLASS_SESSION_ASSOC
653 */
654     { RSVP_CLASS_LSP_TUNNEL_IF_ID,      "LSP-TUNNEL INTERFACE-ID object"},
655
656     { RSVP_CLASS_NOTIFY_REQUEST,        "NOTIFY-REQUEST object"},
657     { RSVP_CLASS_ADMIN_STATUS,          "ADMIN-STATUS object"},
658     { RSVP_CLASS_LSP_ATTRIBUTES,        "LSP ATTRIBUTES object"},
659 /*
660     RSVP_CLASS_ALARM_SPEC,
661 */
662     { RSVP_CLASS_ASSOCIATION,           "ASSOCIATION object"},
663
664     { RSVP_CLASS_FAST_REROUTE,          "FAST-REROUTE object"},
665
666     { RSVP_CLASS_SESSION_ATTRIBUTE,     "SESSION ATTRIBUTE object"},
667
668     { RSVP_CLASS_DCLASS,                "DCLASS object"},
669 /*
670     RSVP_CLASS_PACKETCABLE_EXTENSIONS,
671     RSVP_CLASS_ATM_SERVICECLASS,
672     RSVP_CLASS_CALL_OPS,
673 */
674     { RSVP_CLASS_GENERALIZED_UNI,       "GENERALIZED-UNI object"},
675     { RSVP_CLASS_CALL_ID,               "CALL-ID object"},
676     { RSVP_CLASS_3GPP2_OBJECT,          "3GPP2 object"},
677
678     { RSVP_CLASS_VENDOR_PRIVATE_9,      "VENDOR PRIVATE object (11bbbbbb: "
679                                          "forward if unknown)"},
680     { RSVP_CLASS_VENDOR_PRIVATE_10,     "VENDOR PRIVATE object (11bbbbbb: "
681                                           "forward if unknown)"},
682     { RSVP_CLASS_VENDOR_PRIVATE_11,     "VENDOR PRIVATE object (11bbbbbb: "
683                                           "forward if unknown)"},
684     { RSVP_CLASS_VENDOR_PRIVATE_12,     "VENDOR PRIVATE object (11bbbbbb: "
685                                           "forward if unknown)"},
686     { 0, NULL}
687 };
688 static value_string_ext rsvp_class_vals_ext = VALUE_STRING_EXT_INIT(rsvp_class_vals);
689
690 /*
691  * RSVP error values
692  */
693 enum rsvp_error_types {
694     RSVP_ERROR_CONFIRM   = 0,
695     RSVP_ERROR_ADMISSION,
696     RSVP_ERROR_POLICY,
697     RSVP_ERROR_NO_PATH,
698     RSVP_ERROR_NO_SENDER,
699     RSVP_ERROR_CONFLICT_RESV_STYLE,
700     RSVP_ERROR_UNKNOWN_RESV_STYLE,
701     RSVP_ERROR_CONFLICT_DEST_PORTS,
702     RSVP_ERROR_CONFLICT_SRC_PORTS,
703     RSVP_ERROR_PREEMPTED =12,
704     RSVP_ERROR_UNKNOWN_CLASS,
705     RSVP_ERROR_UNKNOWN_C_TYPE,
706     RSVP_ERROR_TRAFFIC   = 21,
707     RSVP_ERROR_TRAFFIC_SYSTEM,
708     RSVP_ERROR_SYSTEM,
709     RSVP_ERROR_ROUTING,
710     RSVP_ERROR_NOTIFY,
711     RSVP_ERROR_NEW_AGGR,          /* RFC3175 */
712     RSVP_ERROR_DIFFSERV,
713     RSVP_ERROR_DSTE,          /* FF: RFC4124 */
714     RSVP_ERROR_UNKNOWN_ATTR_TLV,  /* RFC5420 */
715     RSVP_ERROR_UNKNOWN_ATTR_BIT,  /* RFC5420 */
716     RSVP_ERROR_ALARMS,            /* RFC4783 */
717     RSVP_ERROR_CALL_MGMT,         /* RFC4974 */
718     RSVP_ERROR_USER_ERROR_SPEC    /* RFC5284 */
719 };
720
721 static const value_string rsvp_error_codes[] = {
722     { RSVP_ERROR_CONFIRM,              "Confirmation"},
723     { RSVP_ERROR_ADMISSION,            "Admission Control Failure "},
724     { RSVP_ERROR_POLICY,               "Policy Control Failure"},
725     { RSVP_ERROR_NO_PATH,              "No PATH information for this RESV message"},
726     { RSVP_ERROR_NO_SENDER,            "No sender information for this RESV message"},
727     { RSVP_ERROR_CONFLICT_RESV_STYLE,  "Conflicting reservation styles"},
728     { RSVP_ERROR_UNKNOWN_RESV_STYLE,   "Unknown reservation style"},
729     { RSVP_ERROR_CONFLICT_DEST_PORTS,  "Conflicting destination ports"},
730     { RSVP_ERROR_CONFLICT_SRC_PORTS,   "Conflicting source ports"},
731     { RSVP_ERROR_PREEMPTED,            "Service preempted"},
732     { RSVP_ERROR_UNKNOWN_CLASS,        "Unknown object class"},
733     { RSVP_ERROR_UNKNOWN_C_TYPE,       "Unknown object C-type"},
734     { RSVP_ERROR_TRAFFIC,              "Traffic Control Error"},
735     { RSVP_ERROR_TRAFFIC_SYSTEM,       "Traffic Control System Error"},
736     { RSVP_ERROR_SYSTEM,               "RSVP System Error"},
737     { RSVP_ERROR_ROUTING,              "Routing Error"},
738     { RSVP_ERROR_NOTIFY,               "RSVP Notify Error"},
739     { RSVP_ERROR_NEW_AGGR,             "New aggregate needed"},
740     { RSVP_ERROR_DIFFSERV,             "RSVP Diff-Serv Error"},
741     { RSVP_ERROR_DSTE,                 "RSVP DiffServ-aware TE Error"},
742     { RSVP_ERROR_UNKNOWN_ATTR_TLV,     "Unknown attributes TLV"},
743     { RSVP_ERROR_UNKNOWN_ATTR_BIT,     "Unknown attributes bit"},
744     { RSVP_ERROR_ALARMS,               "Alarms"},
745     { RSVP_ERROR_CALL_MGMT,            "Call management"},
746     { RSVP_ERROR_USER_ERROR_SPEC,      "User error spec"},
747     { 0, NULL}
748 };
749 static value_string_ext rsvp_error_codes_ext = VALUE_STRING_EXT_INIT(rsvp_error_codes);
750
751 static const value_string rsvp_admission_control_error_vals[] = {
752     { 1, "Delay bound cannot be met"},
753     { 2, "Requested bandwidth unavailable"},
754     { 3, "MTU in flowspec larger than interface MTU"},
755     { 4, "LSP Admission Failure"},
756     { 5, "Bad Association Type"},
757     { 0, NULL}
758 };
759 static value_string_ext rsvp_admission_control_error_vals_ext = VALUE_STRING_EXT_INIT(rsvp_admission_control_error_vals);
760
761 static const value_string rsvp_policy_control_error_vals[] = {
762     {   0, "Information reporting"},
763     {   1, "Warning"},
764     {   2, "Reason unknown"},
765     {   3, "Generic Policy Rejection"},
766     {   4, "Quota or Accounting violation"},
767     {   5, "Flow was preempted"},
768     {   6, "Previously installed policy expired (not refreshed)"},
769     {   7, "Previous policy data was replaced & caused rejection"},
770     {   8, "Policies could not be merged (multicast)"},
771     {   9, "PDP down or non functioning"},
772     {  10, "Third Party Server (e.g., Kerberos) unavailable"},
773     {  11, "POLICY_DATA object has bad syntax"},
774     {  12, "POLICY_DATA object failed Integrity Check"},
775     {  13, "POLICY_ELEMENT object has bad syntax"},
776     {  14, "Mandatory PE Missing (Empty PE is in the PD object)"},
777     {  15, "PEP Out of resources to handle policies."},
778     {  16, "PDP encountered bad RSVP objects or syntax"},
779     {  17, "Service type was rejected"},
780     {  18, "Reservation Style was rejected"},
781     {  19, "FlowSpec was rejected (too large)"},
782     {  20, "Hard Pre-empted"},
783     { 100, "Unauthorized sender"},
784     { 101, "Unauthorized receiver"},
785     { 102, "ERR_PARTIAL_PREEMPT"},
786     { 103, "Inter-domain policy failure"},
787     { 104, "Inter-domain explicit route rejected"},
788     {   0, NULL}
789 };
790 static value_string_ext rsvp_policy_control_error_vals_ext = VALUE_STRING_EXT_INIT(rsvp_policy_control_error_vals);
791
792 static const value_string rsvp_traffic_control_error_vals[] = {
793     { 1, "Service conflict"},
794     { 2, "Service unsupported"},
795     { 3, "Bad Flowspec value"},
796     { 4, "Bad Tspec value"},
797     { 5, "Bad Adspec value"},
798     { 0, NULL}
799 };
800 static value_string_ext rsvp_traffic_control_error_vals_ext = VALUE_STRING_EXT_INIT(rsvp_traffic_control_error_vals);
801
802 static const value_string rsvp_routing_error_vals[] = {
803     {   1, "Bad EXPLICIT_ROUTE object"},
804     {   2, "Bad strict node"},
805     {   3, "Bad loose node"},
806     {   4, "Bad initial subobject"},
807     {   5, "No route available toward destination"},
808     {   6, "Unacceptable label value"},
809     {   7, "RRO indicated routing loops"},
810     {   8, "non-RSVP-capable router stands in the path"},
811     {   9, "MPLS label allocation failure"},
812     {  10, "Unsupported L3PID"},
813     {  11, "Label Set"},
814     {  12, "Switching Type"},
815     {  13, "Unassigned"},
816     {  14, "Unsupported Encoding"},
817     {  15, "Unsupported Link Protection"},
818     {  16, "Unknown Interface Index"},
819     {  17, "Unsupported LSP Protection"},
820     {  18, "PROTECTION object not applicable"},
821     {  19, "Bad PRIMARY_PATH_ROUTE object"},
822     {  20, "PRIMARY_PATH_ROUTE object not applicable"},
823     {  21, "LSP Segment Protection Failed"},
824     {  22, "Re-routing limit exceeded"},
825     {  23, "Unable to Branch"},
826     {  24, "Unsupported LSP Integrity"},
827     {  25, "P2MP Re-Merge Detected"},
828     {  26, "P2MP Re-Merge Parameter Mismatch"},
829     {  27, "ERO Resulted in Re-Merge"},
830     {  28, "Contiguous LSP type not supported"},
831     {  29, "ERO conflicts with inter-domain signaling method"},
832     {  30, "Stitching unsupported"},
833     {  31, "Unknown PCE-ID for PKS expansion"},
834     {  32, "Unreachable PCE for PKS expansion"},
835     {  33, "Unknown Path Key for PKS expansion"},
836     {  34, "ERO too large for MTU"},
837     {  64, "Unsupported Exclude Route Subobject Type"},
838     {  65, "Inconsistent Subobject"},
839     {  66, "Local Node in Exclude Route"},
840     {  67, "Route Blocked by Exclude Route"},
841     {  68, "XRO Too Complex"},
842     {  69, "EXRS Too Complex"},
843     { 100, "Diversity not available"},
844     { 101, "Service level not available"},
845     { 102, "Invalid/Unknown connection ID"},
846     { 103, "No route available toward source (ASON)"},
847     { 104, "Unacceptable interface ID (ASON)"},
848     { 105, "Invalid/unknown call ID (ASON)"},
849     { 106, "Invalid SPC interface ID/label (ASON)"},
850     {   0, NULL}
851 };
852 static value_string_ext rsvp_routing_error_vals_ext = VALUE_STRING_EXT_INIT(rsvp_routing_error_vals);
853
854 static const value_string rsvp_notify_error_vals[] = {
855     {  1, "RRO too large for MTU"},
856     {  2, "RRO Notification"},
857     {  3, "Tunnel locally repaired"},
858     {  4, "Control Channel Active State"},
859     {  5, "Control Channel Degraded State"},
860     {  6, "Preferable path exists"},
861     {  7, "Link maintenance required"},
862     {  8, "Node maintenance required"},
863     {  9, "LSP Failure"},
864     { 10, "LSP recovered"},
865     { 11, "LSP Local Failure"},
866     {  0, NULL}
867 };
868 static value_string_ext rsvp_notify_error_vals_ext = VALUE_STRING_EXT_INIT(rsvp_notify_error_vals);
869
870 static const value_string rsvp_diffserv_error_vals[] = {
871     { 1, "Unexpected DIFFSERV object"},
872     { 2, "Unsupported PHB"},
873     { 3, "Invalid `EXP<->PHB mapping'"},
874     { 4, "Unsupported PSC"},
875     { 5, "Per-LSP context allocation failure"},
876     { 0, NULL}
877 };
878 static value_string_ext rsvp_diffserv_error_vals_ext = VALUE_STRING_EXT_INIT(rsvp_diffserv_error_vals);
879
880 /* FF: RFC4124 */
881 static const value_string rsvp_diffserv_aware_te_error_vals[] = {
882     { 1, "Unexpected CLASSTYPE object"},
883     { 2, "Unsupported Class-Type"},
884     { 3, "Invalid Class-Type value"},
885     { 4, "CT and setup priority do not form a configured TE-Class"},
886     { 5, "CT and holding priority do not form a configured TE-Class"},
887     { 6, "CT and setup priority do not form a configured TE-Class AND CT and holding priority do not form a configured TE-Class"},
888     { 7, "Inconsistency between signaled PSC and signaled CT"},
889     { 8, "Inconsistency between signaled PHBs and signaled CT"},
890     { 0, NULL}
891 };
892 static value_string_ext rsvp_diffserv_aware_te_error_vals_ext = VALUE_STRING_EXT_INIT(rsvp_diffserv_aware_te_error_vals);
893
894 static const value_string rsvp_call_mgmt_error_vals[] = {
895     { 1, "Call ID Contention"},
896     { 2, "Connections still Exist"},
897     { 3, "Unknown Call ID"},
898     { 4, "Duplicate Call"},
899     { 0, NULL}
900 };
901 static value_string_ext rsvp_call_mgmt_error_vals_ext = VALUE_STRING_EXT_INIT(rsvp_call_mgmt_error_vals);
902
903 /*
904  * Defines the reservation style plus style-specific information that
905  * is not a FLOWSPEC or FILTER_SPEC object, in a RESV message.
906  */
907 #define RSVP_DISTINCT (1 << 3)
908 #define RSVP_SHARED   (2 << 3)
909 #define RSVP_SHARING_MASK (RSVP_DISTINCT | RSVP_SHARED)
910
911 #define RSVP_SCOPE_WILD     1
912 #define RSVP_SCOPE_EXPLICIT 2
913 #define RSVP_SCOPE_MASK     0x07
914
915 #define RSVP_WF (RSVP_SHARED   | RSVP_SCOPE_WILD)
916 #define RSVP_FF (RSVP_DISTINCT | RSVP_SCOPE_EXPLICIT)
917 #define RSVP_SE (RSVP_SHARED   | RSVP_SCOPE_EXPLICIT)
918
919 static const value_string style_vals[] = {
920     { RSVP_WF, "Wildcard Filter" },
921     { RSVP_FF, "Fixed Filter" },
922     { RSVP_SE, "Shared-Explicit" },
923     { 0,       NULL }
924 };
925
926 enum {
927     RSVP_SESSION_TYPE_IPV4 = 1,
928     RSVP_SESSION_TYPE_IPV6,
929
930     RSVP_SESSION_TYPE_IPV4_LSP = 7,
931     RSVP_SESSION_TYPE_IPV6_LSP,
932
933     RSVP_SESSION_TYPE_AGGREGATE_IPV4 = 9,
934     RSVP_SESSION_TYPE_AGGREGATE_IPV6,
935
936     RSVP_SESSION_TYPE_IPV4_UNI = 11,
937     RSVP_SESSION_TYPE_IPV4_E_NNI = 15
938 };
939
940 /*
941  * Defines a desired QoS, in a RESV message.
942  */
943 enum    qos_service_type {
944     QOS_QUALITATIVE =     128,          /* Qualitative service */
945     QOS_NULL =              6,          /* Null service (RFC2997) */
946     QOS_CONTROLLED_LOAD=    5,          /* Controlled Load Service */
947     QOS_GUARANTEED =        2,          /* Guaranteed service */
948     QOS_TSPEC =             1           /* Traffic specification */
949 };
950
951 static const value_string qos_vals[] = {
952     { QOS_QUALITATIVE,     "Qualitative QoS" },
953     { QOS_NULL,            "Null-Service QoS" },
954     { QOS_CONTROLLED_LOAD, "Controlled-load QoS" },
955     { QOS_GUARANTEED,      "Guaranteed rate QoS" },
956     { QOS_TSPEC,           "Traffic specification" },
957     { 0, NULL }
958 };
959
960 static const value_string svc_vals[] = {
961     { 126, "Compression Hint" },
962     { 127, "Token bucket" },
963     { 128, "Null Service" },
964     { 130, "Guaranteed-rate RSpec" },
965     { 0, NULL }
966 };
967 static value_string_ext svc_vals_ext = VALUE_STRING_EXT_INIT(svc_vals);
968
969 enum rsvp_spec_types { INTSRV = 2 };
970
971 enum intsrv_services {
972     INTSRV_GENERAL     =   1,
973     INTSRV_GTD         =   2,
974     INTSRV_CLOAD       =   5,
975     INTSRV_NULL        =   6,
976     INTSRV_QUALITATIVE = 128
977 };
978
979 static const value_string intsrv_services_str[] = {
980     { INTSRV_GENERAL,     "Default General Parameters"},
981     { INTSRV_GTD,         "Guaranteed Rate"},
982     { INTSRV_CLOAD,       "Controlled Load"},
983     { INTSRV_NULL,        "Null Service"},
984     { INTSRV_QUALITATIVE, "Null Service"},
985     { 0, NULL }
986 };
987 static value_string_ext intsrv_services_str_ext = VALUE_STRING_EXT_INIT(intsrv_services_str);
988
989 #if 0
990 enum intsrv_field_name {
991     INTSRV_NON_IS_HOPS           = 1,
992     INTSRV_COMPOSED_NON_IS_HOPS,
993     INTSRV_IS_HOPS,
994     INTSRV_COMPOSED_IS_HOPS,
995     INTSRV_PATH_BANDWIDTH,
996     INTSRV_MIN_PATH_BANDWIDTH,
997     INTSRV_IF_LATENCY,
998     INTSRV_PATH_LATENCY,
999     INTSRV_MTU,
1000     INTSRV_COMPOSED_MTU,
1001
1002     INTSRV_TOKEN_BUCKET_TSPEC    = 127,
1003     INTSRV_QUALITATIVE_TSPEC     = 128,
1004     INTSRV_GTD_RSPEC             = 130,
1005
1006     INTSRV_DELAY = 131,         /* Gtd Parameter C - Max Delay Bound - bytes */
1007     INTSRV_MAX_JITTER,          /* Gtd Parameter D - Max Jitter */
1008     INTSRV_E2E_DELAY,           /* Gtd Parameter Ctot */
1009     INTSRV_E2E_MAX_JITTER,      /* Gtd Parameter Dtot */
1010     INTSRV_SHP_DELAY,           /* Gtd Parameter Csum */
1011     INTSRV_SHP_MAX_JITTER       /* Gtd Parameter Dsum */
1012 };
1013 #endif
1014
1015 static const value_string adspec_params[] = {
1016     {   4, "IS Hop Count"},
1017     {   6, "Path b/w estimate"},
1018     {   8, "Minimum path latency"},
1019     {  10, "Composed MTU"},
1020     { 133, "End-to-end composed value for C"},
1021     { 134, "End-to-end composed value for D"},
1022     { 135, "Since-last-reshaping point composed C"},
1023     { 136, "Since-last-reshaping point composed D"},
1024     {   0, NULL }
1025 };
1026 static value_string_ext adspec_params_ext = VALUE_STRING_EXT_INIT(adspec_params);
1027
1028 /*
1029  * FF: please keep this list in sync with
1030  * http://www.iana.org/assignments/gmpls-sig-parameters
1031  * Registry Name: 'LSP Encoding Types'
1032  */
1033 const range_string gmpls_lsp_enc_rvals[] = {
1034     {   1,   1, "Packet" },
1035     {   2,   2, "Ethernet" },
1036     {   3,   3, "ANSI/ETSI PDH" },
1037     {   4,   4, "Reserved" },
1038     {   5,   5, "SDH ITU-T G.707 / SONET ANSI T1.105" },
1039     {   6,   6, "Reserved" },
1040     {   7,   7, "Digital Wrapper" },
1041     {   8,   8, "Lambda (photonic)" },
1042     {   9,   9, "Fiber" },
1043     {  10,  10, "Reserved" },
1044     {  11,  11, "FiberChannel" },
1045     {  12,  12, "G.709 ODUk (Digital Path)" },
1046     {  13,  13, "G.709 Optical Channel" },
1047     {  14, 239, "Unassigned" },
1048     { 240, 255, "Experimental Usage/temporarily" },
1049     {   0,   0, NULL }
1050 };
1051
1052 /*
1053  * FF: please keep this list in sync with
1054  * http://www.iana.org/assignments/gmpls-sig-parameters
1055  * Registry Name: 'Switching Types'
1056  */
1057 const range_string gmpls_switching_type_rvals[] = {
1058     {   1,   1, "Packet-Switch Capable-1 (PSC-1)" },
1059     {   2,   2, "Packet-Switch Capable-2 (PSC-2)" },
1060     {   3,   3, "Packet-Switch Capable-3 (PSC-3)" },
1061     {   4,   4, "Packet-Switch Capable-4 (PSC-4)" },
1062     {   5,  29, "Unassigned" },
1063     {  30,  30, "Ethernet Virtual Private Line (EVPL)" },
1064     {  31,  39, "Unassigned" },
1065     {  40,  40, "802.1 PBB-TE" },
1066     {  41,  50, "Unassigned" },
1067     {  51,  51, "Layer-2 Switch Capable (L2SC)" },
1068     {  52,  99, "Unassigned" },
1069     { 100, 100, "Time-Division-Multiplex Capable (TDM)" },
1070     { 101, 124, "Unassigned" },
1071     { 125, 125, "Data Channel Switching Capable (DCSC)" },
1072     { 126, 149, "Unassigned" },
1073     { 150, 150, "Lambda-Switch Capable (LSC)" },
1074     { 151, 169, "Unassigned" },
1075     { 200, 200, "Fiber-Switch Capable (FSC)" },
1076     { 201, 255, "Unassigned" },
1077     {   0,   0, NULL }
1078 };
1079
1080 /*
1081  * FF: please keep this list in sync with
1082  * http://www.iana.org/assignments/gmpls-sig-parameters
1083  * Registry Name: 'Generalized PID (G-PID)'
1084  */
1085 static const range_string gmpls_gpid_rvals[] = {
1086     {      0,     0, "Unknown" },
1087     {      1,     4, "Reserved" },
1088     {      5,     5, "Asynchronous mapping of E4" },
1089     {      6,     6, "Asynchronous mapping of DS3/T3" },
1090     {      7,     7, "Asynchronous mapping of E3" },
1091     {      8,     8, "Bit synchronous mapping of E3" },
1092     {      9,     9, "Byte synchronous mapping of E3" },
1093     {     10,    10, "Asynchronous mapping of DS2/T2" },
1094     {     11,    11, "Bit synchronous mapping of DS2/T2" },
1095     {     12,    12, "Reserved" },
1096     {     13,    13, "Asynchronous mapping of E1" },
1097     {     14,    14, "Byte synchronous mapping of E1" },
1098     {     15,    15, "Byte synchronous mapping of 31 * DS0" },
1099     {     16,    16, "Asynchronous mapping of DS1/T1" },
1100     {     17,    17, "Bit synchronous mapping of DS1/T1" },
1101     {     18,    18, "Byte synchronous mapping of DS1/T1" },
1102     {     19,    19, "VC-11 in VC-12" },
1103     {     20,    21, "Reserved" },
1104     {     22,    22, "DS1 SF Asynchronous" },
1105     {     23,    23, "DS1 ESF Asynchronous" },
1106     {     24,    24, "DS3 M23 Asynchronous" },
1107     {     25,    25, "DS3 C-Bit Parity Asynchronous" },
1108     {     26,    26, "VT/LOVC" },
1109     {     27,    27, "STS SPE/HOVC" },
1110     {     28,    28, "POS - No Scrambling, 16 bit CRC" },
1111     {     29,    29, "POS - No Scrambling, 32 bit CRC" },
1112     {     30,    30, "POS - Scrambling, 16 bit CRC" },
1113     {     31,    31, "POS - Scrambling, 32 bit CRC" },
1114     {     32,    32, "ATM mapping" },
1115     {     33,    33, "Ethernet PHY" },
1116     {     34,    34, "SONET/SDH" },
1117     {     35,    35, "Reserved (SONET deprecated)" },
1118     {     36,    36, "Digital Wrapper" },
1119     {     37,    37, "Lambda" },
1120     {     38,    38, "ANSI/ETSI PDH" },
1121     {     39,    39, "Reserved" },
1122     {     40,    40, "Link Access Protocol SDH (LAPS - X.85 and X.86)" },
1123     {     41,    41, "FDDI" },
1124     {     42,    42, "DQDB (ETSI ETS 300 216)" },
1125     {     43,    43, "FiberChannel-3 (Services)" },
1126     {     44,    44, "HDLC" },
1127     {     45,    45, "Ethernet V2/DIX (only)" },
1128     {     46,    46, "Ethernet 802.3 (only)" },
1129     {     47,    47, "G.709 ODUj" },
1130     {     48,    48, "G.709 OTUk(v)" },
1131     {     49,    49, "CBR/CBRa" },
1132     {     50,    50, "CBRb" },
1133     {     51,    51, "BSOT" },
1134     {     52,    52, "BSNT" },
1135     {     53,    53, "IP/PPP (GFP)" },
1136     {     54,    54, "Ethernet MAC (framed GFP)" },
1137     {     55,    55, "Ethernet PHY (transparent GFP" },
1138     {     56,    56, "ESCON" },
1139     {     57,    57, "FICON" },
1140     {     58,    58, "Fiber Channel" },
1141     {     59, 31743, "Unassigned" },
1142     {  31744, 32767, "Experimental Usage/temporarily" },
1143     {  32768, 65535, "Reserved" },
1144     {      0,     0, NULL },
1145 };
1146
1147 const value_string gmpls_protection_cap_str[] = {
1148     {   1, "Extra Traffic"},
1149     {   2, "Unprotected"},
1150     {   4, "Shared"},
1151     {   8, "Dedicated 1:1"},
1152     {  16, "Dedicated 1+1"},
1153     {  32, "Enhanced"},
1154     {  64, "Reserved"},
1155     { 128, "Reserved"},
1156     {   0, NULL }
1157 };
1158
1159 static const value_string gmpls_sonet_signal_type_str[] = {
1160     {  1, "VT1.5 SPE / VC-11"},
1161     {  2, "VT2 SPE / VC-12"},
1162     {  3, "VT3 SPE"},
1163     {  4, "VT6 SPE / VC-2"},
1164     {  5, "STS-1 SPE / VC-3"},
1165     {  6, "STS-3c SPE / VC-4"},
1166     {  7, "STS-1 / STM-0 (transp)"},
1167     {  8, "STS-3 / STM-1 (transp)"},
1168     {  9, "STS-12 / STM-4 (transp)"},
1169     { 10, "STS-48 / STM-16 (transp)"},
1170     { 11, "STS-192 / STM-64 (transp)"},
1171     { 12, "STS-768 / STM-256 (transp)"},
1172
1173     /* Extended non-SONET signal types */
1174     { 13, "VTG / TUG-2"},
1175     { 14, "TUG-3"},
1176     { 15, "STSG-3 / AUG-1"},
1177     { 16, "STSG-12  / AUG-4"},
1178     { 17, "STSG-48  / AUG-16"},
1179     { 18, "STSG-192 / AUG-64"},
1180     { 19, "STSG-768 / AUG-256"},
1181
1182     /* Other SONEt signal types */
1183     { 21, "STS-12c SPE / VC-4-4c"},
1184     { 22, "STS-48c SPE / VC-4-16c"},
1185     { 23, "STS-192c SPE / VC-4-64c"},
1186     {  0, NULL}
1187 };
1188 value_string_ext gmpls_sonet_signal_type_str_ext = VALUE_STRING_EXT_INIT(gmpls_sonet_signal_type_str);
1189
1190 static const value_string ouni_guni_diversity_str[] = {
1191     { 1, "Node Diverse"},
1192     { 2, "Link Diverse"},
1193     { 3, "Shared-Risk Link Group Diverse"},
1194     { 4, "Shared Path"},
1195     { 0, NULL}
1196 };
1197
1198 /* FF: RFC 4328 G.709 signal type */
1199 static const range_string gmpls_g709_signal_type_rvals[] = {
1200     { 0,   0, "Not significant"},
1201     { 1,   1, "ODU1 (i.e., 2.5 Gbps)"},
1202     { 2,   2, "ODU2 (i.e., 10  Gbps)"},
1203     { 3,   3, "ODU3 (i.e., 40  Gbps)"},
1204     { 4,   5, "Reserved (for future use)"},
1205     { 6,   6, "OCh at 2.5 Gbps"},
1206     { 7,   7, "OCh at 10  Gbps"},
1207     { 8,   8, "OCh at 40  Gbps"},
1208     { 9, 255, "Reserved (for future use)"},
1209     { 0,   0, NULL}
1210 };
1211
1212 /* -------------------- Stuff for MPLS/TE objects -------------------- */
1213
1214 static const value_string proto_vals[] = {
1215     { IP_PROTO_ICMP, "ICMP"},
1216     { IP_PROTO_IGMP, "IGMP"},
1217     { IP_PROTO_TCP,  "TCP" },
1218     { IP_PROTO_UDP,  "UDP" },
1219     { IP_PROTO_OSPF, "OSPF"},
1220     { 0,             NULL  }
1221 };
1222
1223 /* Filter keys */
1224 enum hf_rsvp_filter_keys {
1225
1226     /* Message types */
1227     RSVPF_MSG,          /* Message type */
1228     /* Shorthand for message types */
1229     RSVPF_PATH,
1230     RSVPF_RESV,
1231     RSVPF_PATHERR,
1232     RSVPF_RESVERR,
1233     RSVPF_PATHTEAR,
1234     RSVPF_RESVTEAR,
1235     RSVPF_RCONFIRM,
1236     RSVPF_JUNK_MSG8,
1237     RSVPF_JUNK_MSG9,
1238     RSVPF_RTEARCONFIRM,
1239     RSVPF_JUNK11,
1240     RSVPF_BUNDLE,
1241     RSVPF_ACK,
1242     RSVPF_JUNK14,
1243     RSVPF_SREFRESH,
1244     RSVPF_JUNK16,
1245     RSVPF_JUNK17,
1246     RSVPF_JUNK18,
1247     RSVPF_JUNK19,
1248     RSVPF_HELLO,
1249     RSVPF_NOTIFY,
1250     /* Does the message contain an object of this type? */
1251     RSVPF_OBJECT,
1252     /* Object present shorthands */
1253     RSVPF_SESSION,
1254     RSVPF_DUMMY_1,
1255     RSVPF_HOP,
1256     RSVPF_INTEGRITY,
1257     RSVPF_TIME_VALUES,
1258     RSVPF_ERROR,
1259     RSVPF_SCOPE,
1260     RSVPF_STYLE,
1261     RSVPF_FLOWSPEC,
1262     RSVPF_FILTER_SPEC,
1263     RSVPF_SENDER,
1264     RSVPF_TSPEC,
1265     RSVPF_ADSPEC,
1266     RSVPF_POLICY,
1267     RSVPF_CONFIRM,
1268     RSVPF_LABEL,
1269     RSVPF_DUMMY_2,
1270     RSVPF_DUMMY_3,
1271     RSVPF_LABEL_REQUEST,
1272     RSVPF_EXPLICIT_ROUTE,
1273     RSVPF_RECORD_ROUTE,
1274     RSVPF_HELLO_OBJ,
1275     RSVPF_MESSAGE_ID,
1276     RSVPF_MESSAGE_ID_ACK,
1277     RSVPF_MESSAGE_ID_LIST,
1278     RSVPF_RECOVERY_LABEL,
1279     RSVPF_UPSTREAM_LABEL,
1280     RSVPF_LABEL_SET,
1281     RSVPF_PROTECTION,
1282     RSVPF_DIFFSERV,
1283     RSVPF_DSTE,
1284
1285     RSVPF_SUGGESTED_LABEL,
1286     RSVPF_ACCEPTABLE_LABEL_SET,
1287     RSVPF_RESTART_CAP,
1288
1289     RSVPF_SESSION_ATTRIBUTE,
1290     RSVPF_DCLASS,
1291     RSVPF_LSP_TUNNEL_IF_ID,
1292     RSVPF_NOTIFY_REQUEST,
1293     RSVPF_ADMIN_STATUS,
1294     RSVPF_ADMIN_STATUS_REFLECT,
1295     RSVPF_ADMIN_STATUS_HANDOVER,
1296     RSVPF_ADMIN_STATUS_LOCKOUT,
1297     RSVPF_ADMIN_STATUS_INHIBIT,
1298     RSVPF_ADMIN_STATUS_CALL_MGMT,
1299     RSVPF_ADMIN_STATUS_TESTING,
1300     RSVPF_ADMIN_STATUS_DOWN,
1301     RSVPF_ADMIN_STATUS_DELETE,
1302     RSVPF_LSP_ATTRIBUTES,
1303     RSVPF_ASSOCIATION,
1304     RSVPF_GENERALIZED_UNI,
1305     RSVPF_CALL_ID,
1306     RSVPF_3GPP2_OBJECT,
1307     RSVPF_UNKNOWN_OBJ,
1308
1309     /* Session object */
1310     RSVPF_SESSION_IP,
1311     RSVPF_SESSION_PROTO,
1312     RSVPF_SESSION_PORT,
1313     RSVPF_SESSION_TUNNEL_ID,
1314     RSVPF_SESSION_EXT_TUNNEL_ID,
1315
1316     /* Sender template */
1317     RSVPF_SENDER_IP,
1318     RSVPF_SENDER_PORT,
1319     RSVPF_SENDER_LSP_ID,
1320
1321     /* Diffserv object */
1322     RSVPF_DIFFSERV_MAPNB,
1323     RSVPF_DIFFSERV_MAP,
1324     RSVPF_DIFFSERV_MAP_EXP,
1325     RSVPF_DIFFSERV_PHBID,
1326     RSVPF_DIFFSERV_PHBID_DSCP,
1327     RSVPF_DIFFSERV_PHBID_CODE,
1328     RSVPF_DIFFSERV_PHBID_BIT14,
1329     RSVPF_DIFFSERV_PHBID_BIT15,
1330
1331     /* Diffserv-aware TE object */
1332     RSVPF_DSTE_CLASSTYPE,
1333
1334     /* Generalized UNI object */
1335     RSVPF_GUNI_SRC_IPV4,
1336     RSVPF_GUNI_DST_IPV4,
1337     RSVPF_GUNI_SRC_IPV6,
1338     RSVPF_GUNI_DST_IPV6,
1339
1340     /* CALL ID object */
1341     RSVPF_CALL_ID_SRC_ADDR_IPV4,
1342     RSVPF_CALL_ID_SRC_ADDR_IPV6,
1343
1344     /* Vendor Private objects */
1345     RSVPF_PRIVATE_OBJ,
1346     RSVPF_ENT_CODE,
1347
1348     /* Sentinel */
1349     RSVPF_MAX
1350 };
1351
1352 static const true_false_string tfs_desired_not_desired = { "Desired", "Not Desired" };
1353 static const true_false_string tfs_next_next_hop_next_hop = { "Next-Next-Hop", "Next-Hop" };
1354 static const true_false_string tfs_gen_uni_direction = { "U: 1 - Upstream label/port ID", "U: 0 - Downstream label/port ID" };
1355
1356 static int hf_rsvp_filter[RSVPF_MAX] = { -1 };
1357
1358 /* RSVP Conversation related Hash functions */
1359
1360 /*
1361  * Compare two RSVP request keys to see if they are equal. Return 1 if they
1362  * are, 0 otherwise.
1363  * Two RSVP request keys are equal if and only if they have the exactly the
1364  * same internal conversation identifier, session type, and matching values in
1365  * the session info and source info structures.
1366  */
1367 static gint
1368 rsvp_equal(gconstpointer k1, gconstpointer k2)
1369 {
1370     const struct rsvp_request_key *key1 = (const struct rsvp_request_key*) k1;
1371     const struct rsvp_request_key *key2 = (const struct rsvp_request_key*) k2;
1372
1373     if (key1->conversation != key2->conversation) {
1374         return 0;
1375     }
1376
1377     if (key1->session_type != key2->session_type) {
1378         return 0;
1379     }
1380
1381     switch (key1->session_type) {
1382     case RSVP_SESSION_TYPE_IPV4:
1383         if (ADDRESSES_EQUAL(&key1->u.session_ipv4.destination,
1384                             &key2->u.session_ipv4.destination) == FALSE)
1385             return 0;
1386
1387         if (key1->u.session_ipv4.protocol != key2->u.session_ipv4.protocol)
1388             return 0;
1389
1390         if (key1->u.session_ipv4.udp_dest_port != key2->u.session_ipv4.udp_dest_port)
1391             return 0;
1392
1393         break;
1394
1395     case RSVP_SESSION_TYPE_IPV6:
1396         /* this is not supported yet for conversations */
1397         break;
1398
1399     case RSVP_SESSION_TYPE_IPV4_LSP:
1400         if (ADDRESSES_EQUAL(&key1->u.session_ipv4_lsp.destination,
1401                             &key2->u.session_ipv4_lsp.destination) == FALSE)
1402             return 0;
1403
1404         if (key1->u.session_ipv4_lsp.udp_dest_port !=
1405             key2->u.session_ipv4_lsp.udp_dest_port)
1406             return 0;
1407
1408
1409         if (key1->u.session_ipv4_lsp.ext_tunnel_id !=
1410             key2->u.session_ipv4_lsp.ext_tunnel_id)
1411             return 0;
1412
1413         break;
1414
1415     case RSVP_SESSION_TYPE_AGGREGATE_IPV4:
1416         if (ADDRESSES_EQUAL(&key1->u.session_agg_ipv4.destination,
1417                             &key2->u.session_agg_ipv4.destination) == FALSE)
1418             return 0;
1419
1420         if (key1->u.session_agg_ipv4.dscp != key2->u.session_agg_ipv4.dscp)
1421             return 0;
1422
1423         break;
1424
1425     case RSVP_SESSION_TYPE_AGGREGATE_IPV6:
1426         /* this is not supported yet for conversations */
1427         break;
1428
1429     case RSVP_SESSION_TYPE_IPV4_UNI:
1430         if (ADDRESSES_EQUAL(&key1->u.session_ipv4_uni.destination,
1431                             &key2->u.session_ipv4_uni.destination) == FALSE)
1432             return 0;
1433
1434         if (key1->u.session_ipv4_uni.udp_dest_port !=
1435             key2->u.session_ipv4_uni.udp_dest_port)
1436             return 0;
1437
1438
1439         if (key1->u.session_ipv4_uni.ext_tunnel_id !=
1440             key2->u.session_ipv4_uni.ext_tunnel_id)
1441             return 0;
1442
1443         break;
1444
1445     case RSVP_SESSION_TYPE_IPV4_E_NNI:
1446         if (ADDRESSES_EQUAL(&key1->u.session_ipv4_enni.destination,
1447                             &key2->u.session_ipv4_enni.destination) == FALSE)
1448             return 0;
1449
1450         if (key1->u.session_ipv4_enni.udp_dest_port !=
1451             key2->u.session_ipv4_enni.udp_dest_port)
1452             return 0;
1453
1454
1455         if (key1->u.session_ipv4_enni.ext_tunnel_id !=
1456             key2->u.session_ipv4_enni.ext_tunnel_id)
1457             return 0;
1458
1459         break;
1460
1461     default:
1462         /* This should never happen. */
1463         break;
1464     }
1465
1466     if (ADDRESSES_EQUAL(&key1->source_info.source,
1467                         &key2->source_info.source) == FALSE)
1468         return 0;
1469
1470     if (key1->source_info.udp_source_port != key2->source_info.udp_source_port)
1471         return 0;
1472
1473     /* If we get here, the two keys are equal. */
1474     return 1;
1475 }
1476
1477 /*
1478  * Calculate a hash key for the supplied RSVP request. The internally allocated
1479  * conversation-id is unique, so we just use that.
1480  */
1481 static guint
1482 rsvp_hash(gconstpointer k)
1483 {
1484     const struct rsvp_request_key *key = (const struct rsvp_request_key*) k;
1485     return key->conversation;
1486 }
1487
1488 /*
1489  * Conversation specific initialization code that deletes any unused memory that
1490  * might need to be freed, and allocates the memory for the various conversation
1491  * hash tables.
1492  */
1493 static void
1494 rsvp_init_protocol(void)
1495 {
1496     if (rsvp_request_hash)
1497         g_hash_table_destroy(rsvp_request_hash);
1498
1499     rsvp_request_hash = g_hash_table_new(rsvp_hash, rsvp_equal);
1500 }
1501
1502 static inline int
1503 rsvp_class_to_filter_num(int classnum)
1504 {
1505     switch(classnum) {
1506     case RSVP_CLASS_SESSION :
1507     case RSVP_CLASS_HOP :
1508     case RSVP_CLASS_INTEGRITY :
1509     case RSVP_CLASS_TIME_VALUES :
1510     case RSVP_CLASS_ERROR :
1511     case RSVP_CLASS_SCOPE :
1512     case RSVP_CLASS_STYLE :
1513     case RSVP_CLASS_FLOWSPEC :
1514     case RSVP_CLASS_FILTER_SPEC :
1515     case RSVP_CLASS_SENDER_TEMPLATE :
1516     case RSVP_CLASS_SENDER_TSPEC :
1517     case RSVP_CLASS_ADSPEC :
1518     case RSVP_CLASS_POLICY :
1519     case RSVP_CLASS_CONFIRM :
1520     case RSVP_CLASS_LABEL :
1521     case RSVP_CLASS_LABEL_REQUEST :
1522     case RSVP_CLASS_HELLO :
1523     case RSVP_CLASS_EXPLICIT_ROUTE :
1524     case RSVP_CLASS_RECORD_ROUTE :
1525     case RSVP_CLASS_MESSAGE_ID :
1526     case RSVP_CLASS_MESSAGE_ID_ACK :
1527     case RSVP_CLASS_MESSAGE_ID_LIST :
1528         return classnum + RSVPF_OBJECT;
1529         break;
1530
1531     case RSVP_CLASS_RECOVERY_LABEL :
1532     case RSVP_CLASS_UPSTREAM_LABEL :
1533     case RSVP_CLASS_LABEL_SET :
1534     case RSVP_CLASS_PROTECTION :
1535         return RSVPF_RECOVERY_LABEL + (classnum - RSVP_CLASS_RECOVERY_LABEL);
1536
1537     case RSVP_CLASS_SUGGESTED_LABEL :
1538     case RSVP_CLASS_ACCEPTABLE_LABEL_SET :
1539     case RSVP_CLASS_RESTART_CAP :
1540         return RSVPF_SUGGESTED_LABEL + (classnum - RSVP_CLASS_SUGGESTED_LABEL);
1541
1542     case RSVP_CLASS_DIFFSERV :
1543         return RSVPF_DIFFSERV;
1544
1545     case RSVP_CLASS_CLASSTYPE :
1546         return RSVPF_DSTE;
1547
1548     case RSVP_CLASS_NOTIFY_REQUEST :
1549         return RSVPF_NOTIFY_REQUEST;
1550     case RSVP_CLASS_ADMIN_STATUS :
1551         return RSVPF_ADMIN_STATUS;
1552     case RSVP_CLASS_LSP_ATTRIBUTES :
1553         return RSVPF_LSP_ATTRIBUTES;
1554     case RSVP_CLASS_ASSOCIATION :
1555         return RSVPF_ASSOCIATION;
1556
1557     case RSVP_CLASS_SESSION_ATTRIBUTE :
1558         return RSVPF_SESSION_ATTRIBUTE;
1559     case RSVP_CLASS_GENERALIZED_UNI :
1560         return RSVPF_GENERALIZED_UNI;
1561     case RSVP_CLASS_CALL_ID :
1562         return RSVPF_CALL_ID;
1563     case RSVP_CLASS_3GPP2_OBJECT :
1564         return RSVPF_3GPP2_OBJECT;
1565     case RSVP_CLASS_DCLASS :
1566         return RSVPF_DCLASS;
1567     case RSVP_CLASS_LSP_TUNNEL_IF_ID :
1568         return RSVPF_LSP_TUNNEL_IF_ID;
1569
1570     case RSVP_CLASS_VENDOR_PRIVATE_1:
1571     case RSVP_CLASS_VENDOR_PRIVATE_2:
1572     case RSVP_CLASS_VENDOR_PRIVATE_3:
1573     case RSVP_CLASS_VENDOR_PRIVATE_4:
1574     case RSVP_CLASS_VENDOR_PRIVATE_5:
1575     case RSVP_CLASS_VENDOR_PRIVATE_6:
1576     case RSVP_CLASS_VENDOR_PRIVATE_7:
1577     case RSVP_CLASS_VENDOR_PRIVATE_8:
1578     case RSVP_CLASS_VENDOR_PRIVATE_9:
1579     case RSVP_CLASS_VENDOR_PRIVATE_10:
1580     case RSVP_CLASS_VENDOR_PRIVATE_11:
1581     case RSVP_CLASS_VENDOR_PRIVATE_12:
1582        return RSVPF_PRIVATE_OBJ;
1583
1584     default:
1585         return RSVPF_UNKNOWN_OBJ;
1586     }
1587 }
1588
1589 static inline int
1590 rsvp_class_to_tree_type(int classnum)
1591 {
1592     switch(classnum) {
1593     case RSVP_CLASS_SESSION :
1594         return TT_SESSION;
1595     case RSVP_CLASS_HOP :
1596         return TT_HOP;
1597     case RSVP_CLASS_INTEGRITY :
1598         return TT_INTEGRITY;
1599     case RSVP_CLASS_TIME_VALUES :
1600         return TT_TIME_VALUES;
1601     case RSVP_CLASS_ERROR :
1602         return TT_ERROR;
1603     case RSVP_CLASS_SCOPE :
1604         return TT_SCOPE;
1605     case RSVP_CLASS_STYLE :
1606         return TT_STYLE;
1607     case RSVP_CLASS_FLOWSPEC :
1608         return TT_FLOWSPEC;
1609     case RSVP_CLASS_FILTER_SPEC :
1610         return TT_FILTER_SPEC;
1611     case RSVP_CLASS_SENDER_TEMPLATE :
1612         return TT_SENDER_TEMPLATE;
1613     case RSVP_CLASS_SENDER_TSPEC :
1614         return TT_TSPEC;
1615     case RSVP_CLASS_ADSPEC :
1616         return TT_ADSPEC;
1617     case RSVP_CLASS_POLICY :
1618         return TT_POLICY;
1619     case RSVP_CLASS_CONFIRM :
1620         return TT_CONFIRM;
1621     case RSVP_CLASS_RECOVERY_LABEL :
1622     case RSVP_CLASS_UPSTREAM_LABEL :
1623     case RSVP_CLASS_SUGGESTED_LABEL :
1624     case RSVP_CLASS_LABEL :
1625         return TT_LABEL;
1626     case RSVP_CLASS_LABEL_REQUEST :
1627         return TT_LABEL_REQUEST;
1628     case RSVP_CLASS_HELLO :
1629         return TT_HELLO_OBJ;
1630     case RSVP_CLASS_EXPLICIT_ROUTE :
1631         return TT_EXPLICIT_ROUTE;
1632     case RSVP_CLASS_RECORD_ROUTE :
1633         return TT_RECORD_ROUTE;
1634     case RSVP_CLASS_MESSAGE_ID :
1635         return TT_MESSAGE_ID;
1636     case RSVP_CLASS_MESSAGE_ID_ACK :
1637         return TT_MESSAGE_ID_ACK;
1638     case RSVP_CLASS_MESSAGE_ID_LIST :
1639         return TT_MESSAGE_ID_LIST;
1640     case RSVP_CLASS_LABEL_SET :
1641         return TT_LABEL_SET;
1642     case RSVP_CLASS_PROTECTION :
1643         return TT_PROTECTION_INFO;
1644     case RSVP_CLASS_ACCEPTABLE_LABEL_SET :
1645         return TT_UNKNOWN_CLASS;
1646     case RSVP_CLASS_RESTART_CAP :
1647         return TT_RESTART_CAP;
1648     case RSVP_CLASS_DIFFSERV :
1649         return TT_DIFFSERV;
1650     case RSVP_CLASS_CLASSTYPE:
1651         return TT_CLASSTYPE;
1652     case RSVP_CLASS_NOTIFY_REQUEST :
1653         return TT_UNKNOWN_CLASS;
1654     case RSVP_CLASS_ADMIN_STATUS :
1655         return TT_ADMIN_STATUS;
1656     case RSVP_CLASS_LSP_ATTRIBUTES :
1657     case RSVP_CLASS_LSP_REQUIRED_ATTRIBUTES :
1658         return TT_LSP_ATTRIBUTES;
1659     case RSVP_CLASS_ASSOCIATION :
1660         return TT_ASSOCIATION;
1661     case RSVP_CLASS_SESSION_ATTRIBUTE :
1662         return TT_SESSION_ATTRIBUTE;
1663     case RSVP_CLASS_GENERALIZED_UNI :
1664         return TT_GEN_UNI;
1665     case RSVP_CLASS_CALL_ID :
1666         return TT_CALL_ID;
1667     case RSVP_CLASS_3GPP2_OBJECT :
1668         return TT_3GPP2_OBJECT;
1669     case RSVP_CLASS_DCLASS :
1670         return TT_DCLASS;
1671     case RSVP_CLASS_LSP_TUNNEL_IF_ID :
1672         return TT_LSP_TUNNEL_IF_ID;
1673     case RSVP_CLASS_VENDOR_PRIVATE_1:
1674     case RSVP_CLASS_VENDOR_PRIVATE_2:
1675     case RSVP_CLASS_VENDOR_PRIVATE_3:
1676     case RSVP_CLASS_VENDOR_PRIVATE_4:
1677     case RSVP_CLASS_VENDOR_PRIVATE_5:
1678     case RSVP_CLASS_VENDOR_PRIVATE_6:
1679     case RSVP_CLASS_VENDOR_PRIVATE_7:
1680     case RSVP_CLASS_VENDOR_PRIVATE_8:
1681     case RSVP_CLASS_VENDOR_PRIVATE_9:
1682     case RSVP_CLASS_VENDOR_PRIVATE_10:
1683     case RSVP_CLASS_VENDOR_PRIVATE_11:
1684     case RSVP_CLASS_VENDOR_PRIVATE_12:
1685         return TT_PRIVATE_CLASS;
1686     default:
1687         return TT_UNKNOWN_CLASS;
1688     }
1689 }
1690
1691 static void
1692 find_rsvp_session_tempfilt(tvbuff_t *tvb, int hdr_offset, int *session_offp, int *tempfilt_offp)
1693 {
1694     int   s_off = 0, t_off = 0;
1695     int   len, off;
1696     guint obj_length;
1697
1698     if (!tvb_bytes_exist(tvb, hdr_offset+6, 2))
1699         goto done;
1700
1701     len = tvb_get_ntohs(tvb, hdr_offset+6) + hdr_offset;
1702     for (off = hdr_offset + 8; (off < len) && tvb_bytes_exist(tvb, off, 3); off += obj_length) {
1703         obj_length = tvb_get_ntohs(tvb, off);
1704         if (obj_length == 0)
1705             break;
1706         switch(tvb_get_guint8(tvb, off+2)) {
1707         case RSVP_CLASS_SESSION:
1708             s_off = off;
1709             break;
1710         case RSVP_CLASS_SENDER_TEMPLATE:
1711         case RSVP_CLASS_FILTER_SPEC:
1712             t_off = off;
1713             break;
1714         default:
1715             break;
1716         }
1717     }
1718
1719  done:
1720     if (session_offp)  *session_offp  = s_off;
1721     if (tempfilt_offp) *tempfilt_offp = t_off;
1722 }
1723
1724 static char *
1725 summary_session(tvbuff_t *tvb, int offset)
1726 {
1727     switch(tvb_get_guint8(tvb, offset+3)) {
1728     case RSVP_SESSION_TYPE_IPV4:
1729         return ep_strdup_printf("SESSION: IPv4, Destination %s, Protocol %d, Port %d. ",
1730                                 tvb_ip_to_str(tvb, offset+4),
1731                                 tvb_get_guint8(tvb, offset+8),
1732                                 tvb_get_ntohs(tvb, offset+10));
1733         break;
1734     case RSVP_SESSION_TYPE_IPV4_LSP:
1735         return ep_strdup_printf("SESSION: IPv4-LSP, Destination %s, Tunnel ID %d, Ext ID %0x. ",
1736                                 tvb_ip_to_str(tvb, offset+4),
1737                                 tvb_get_ntohs(tvb, offset+10),
1738                                 tvb_get_ntohl(tvb, offset+12));
1739         break;
1740     case RSVP_SESSION_TYPE_AGGREGATE_IPV4:
1741         return ep_strdup_printf("SESSION: IPv4-Aggregate, Destination %s, DSCP %d. ",
1742                                 tvb_ip_to_str(tvb, offset+4),
1743                                 tvb_get_guint8(tvb, offset+11));
1744         break;
1745     case RSVP_SESSION_TYPE_IPV4_UNI:
1746         return ep_strdup_printf("SESSION: IPv4-UNI, Destination %s, Tunnel ID %d, Ext Address %s. ",
1747                                 tvb_ip_to_str(tvb, offset+4),
1748                                 tvb_get_ntohs(tvb, offset+10),
1749                                 tvb_ip_to_str(tvb, offset+12));
1750         break;
1751     case RSVP_SESSION_TYPE_IPV4_E_NNI:
1752         return ep_strdup_printf("SESSION: IPv4-E-NNI, Destination %s, Tunnel ID %d, Ext Address %s. ",
1753                                 tvb_ip_to_str(tvb, offset+4),
1754                                 tvb_get_ntohs(tvb, offset+10),
1755                                 tvb_ip_to_str(tvb, offset+12));
1756         break;
1757     default:
1758         return ep_strdup_printf("SESSION: Type %d. ", tvb_get_guint8(tvb, offset+3));
1759         break;
1760     }
1761     DISSECTOR_ASSERT_NOT_REACHED();
1762 }
1763
1764 static char *
1765 summary_template(tvbuff_t *tvb, int offset)
1766 {
1767     const char *objtype;
1768
1769     if (tvb_get_guint8(tvb, offset+2) == RSVP_CLASS_FILTER_SPEC)
1770         objtype = "FILTERSPEC";
1771     else
1772         objtype = "SENDER TEMPLATE";
1773
1774     switch(tvb_get_guint8(tvb, offset+3)) {
1775     case 1:
1776         return ep_strdup_printf("%s: IPv4, Sender %s, Port %d. ", objtype,
1777                                 tvb_ip_to_str(tvb, offset+4),
1778                                 tvb_get_ntohs(tvb, offset+10));
1779         break;
1780     case 7:
1781         return ep_strdup_printf("%s: IPv4-LSP, Tunnel Source: %s, LSP ID: %d. ", objtype,
1782                                 tvb_ip_to_str(tvb, offset+4),
1783                                 tvb_get_ntohs(tvb, offset+10));
1784         break;
1785     case 9:
1786         return ep_strdup_printf("%s: IPv4-Aggregate, Aggregator %s. ", objtype,
1787                                 tvb_ip_to_str(tvb, offset+4));
1788         break;
1789     default:
1790         return ep_strdup_printf("%s: Type %d. ", objtype, tvb_get_guint8(tvb, offset+3));
1791         break;
1792     }
1793     DISSECTOR_ASSERT_NOT_REACHED();
1794 }
1795
1796 /*------------------------------------------------------------------------------
1797  * SESSION
1798  *------------------------------------------------------------------------------*/
1799 static void
1800 dissect_rsvp_session(proto_item *ti, proto_tree *rsvp_object_tree,
1801                      tvbuff_t *tvb,
1802                      int offset, int obj_length,
1803                      int rsvp_class _U_, int type,
1804                      rsvp_conversation_info *rsvph)
1805 {
1806     proto_item *hidden_item;
1807     int         offset2 = offset + 4;
1808
1809     proto_item_set_text(ti, "%s", summary_session(tvb, offset));
1810
1811     switch(type) {
1812     case RSVP_SESSION_TYPE_IPV4:
1813         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
1814                             "C-type: 1 - IPv4");
1815         proto_tree_add_item(rsvp_object_tree,
1816                             hf_rsvp_filter[RSVPF_SESSION_IP],
1817                             tvb, offset2, 4, ENC_BIG_ENDIAN);
1818
1819         proto_tree_add_item(rsvp_object_tree,
1820                             hf_rsvp_filter[RSVPF_SESSION_PROTO], tvb,
1821                             offset2+4, 1, ENC_BIG_ENDIAN);
1822         proto_tree_add_text(rsvp_object_tree, tvb, offset2+5, 1,
1823                             "Flags: %x",
1824                             tvb_get_guint8(tvb, offset2+5));
1825         proto_tree_add_item(rsvp_object_tree,
1826                             hf_rsvp_filter[RSVPF_SESSION_PORT], tvb,
1827                             offset2+6, 2, ENC_BIG_ENDIAN);
1828
1829         /*
1830          * Save this information to build the conversation request key
1831          * later.
1832          */
1833         rsvph->session_type = RSVP_SESSION_TYPE_IPV4;
1834         TVB_SET_ADDRESS(&rsvph->destination, AT_IPv4, tvb, offset2, 4);
1835         rsvph->protocol = tvb_get_guint8(tvb, offset2+4);
1836         rsvph->udp_dest_port = tvb_get_ntohs(tvb, offset2+6);
1837
1838         break;
1839
1840     case RSVP_SESSION_TYPE_IPV6:
1841         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
1842                             "C-type: 2 - IPv6");
1843         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16,
1844                             "Destination address: %s",
1845                             tvb_ip6_to_str(tvb, offset2));
1846         proto_tree_add_text(rsvp_object_tree, tvb, offset2+16, 1,
1847                             "Protocol: %u",
1848                             tvb_get_guint8(tvb, offset2+16));
1849         proto_tree_add_text(rsvp_object_tree, tvb, offset2+17, 1,
1850                             "Flags: %x",
1851                             tvb_get_guint8(tvb, offset2+17));
1852         proto_tree_add_text(rsvp_object_tree, tvb, offset2+18, 2,
1853                             "Destination port: %u",
1854                             tvb_get_ntohs(tvb, offset2+18));
1855         /*
1856          * Save this information to build the conversation request key
1857          * later. IPv6 conversatiuon support is not implemented yet, so only
1858          * the session type is stored.
1859          */
1860         rsvph->session_type = RSVP_SESSION_TYPE_IPV6;
1861
1862         break;
1863
1864     case RSVP_SESSION_TYPE_IPV4_LSP:
1865         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
1866                             "C-type: 7 - IPv4 LSP");
1867         proto_tree_add_item(rsvp_object_tree,
1868                             hf_rsvp_filter[RSVPF_SESSION_IP],
1869                             tvb, offset2, 4, ENC_BIG_ENDIAN);
1870
1871         proto_tree_add_item(rsvp_object_tree,
1872                             hf_rsvp_filter[RSVPF_SESSION_TUNNEL_ID],
1873                             tvb, offset2+6, 2, ENC_BIG_ENDIAN);
1874
1875         proto_tree_add_text(rsvp_object_tree, tvb, offset2+8, 4,
1876                             "Extended Tunnel ID: %u (%s)",
1877                             tvb_get_ntohl(tvb, offset2+8),
1878                             tvb_ip_to_str(tvb, offset2+8));
1879         hidden_item = proto_tree_add_item(rsvp_object_tree,
1880                                    hf_rsvp_filter[RSVPF_SESSION_EXT_TUNNEL_ID],
1881                                    tvb, offset2+8, 4, ENC_BIG_ENDIAN);
1882         PROTO_ITEM_SET_HIDDEN(hidden_item);
1883
1884         /*
1885          * Save this information to build the conversation request key
1886          * later.
1887          */
1888         rsvph->session_type = RSVP_SESSION_TYPE_IPV4_LSP;
1889         TVB_SET_ADDRESS(&rsvph->destination, AT_IPv4, tvb, offset2, 4);
1890         rsvph->udp_dest_port = tvb_get_ntohs(tvb, offset2+6);
1891         rsvph->ext_tunnel_id = tvb_get_ntohl(tvb, offset2 + 8);
1892         break;
1893
1894     case RSVP_SESSION_TYPE_AGGREGATE_IPV4:
1895         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
1896                             "C-type: 9 - IPv4 Aggregate");
1897         proto_tree_add_item(rsvp_object_tree,
1898                             hf_rsvp_filter[RSVPF_SESSION_IP],
1899                             tvb, offset2, 4, ENC_BIG_ENDIAN);
1900
1901         proto_tree_add_text(rsvp_object_tree, tvb, offset2+7, 1,
1902                             "DSCP: %u (%s)",
1903                             tvb_get_guint8(tvb, offset2+7),
1904                             val_to_str_ext(tvb_get_guint8(tvb, offset2+7),
1905                                        &dscp_vals_ext, "Unknown (%d)"));
1906         /*
1907          * Save this information to build the conversation request key
1908          * later.
1909          */
1910         rsvph->session_type = RSVP_SESSION_TYPE_AGGREGATE_IPV4;
1911         TVB_SET_ADDRESS(&rsvph->destination, AT_IPv4, tvb, offset2, 4);
1912         rsvph->dscp = tvb_get_guint8(tvb, offset2+7);
1913         rsvph->ext_tunnel_id = tvb_get_ntohl(tvb, offset2 + 8);
1914         break;
1915
1916     case RSVP_SESSION_TYPE_IPV4_UNI:
1917         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
1918                             "C-type: 11 - IPv4 UNI");
1919         proto_tree_add_item(rsvp_object_tree,
1920                             hf_rsvp_filter[RSVPF_SESSION_IP],
1921                             tvb, offset2, 4, ENC_BIG_ENDIAN);
1922
1923         proto_tree_add_item(rsvp_object_tree,
1924                             hf_rsvp_filter[RSVPF_SESSION_TUNNEL_ID],
1925                             tvb, offset2+6, 2, ENC_BIG_ENDIAN);
1926
1927         proto_tree_add_text(rsvp_object_tree, tvb, offset2+8, 4,
1928                             "Extended IPv4 Address: %s",
1929                             tvb_ip_to_str(tvb, offset2+8));
1930         hidden_item = proto_tree_add_item(rsvp_object_tree,
1931                                    hf_rsvp_filter[RSVPF_SESSION_EXT_TUNNEL_ID],
1932                                    tvb, offset2+8, 4, ENC_BIG_ENDIAN);
1933         PROTO_ITEM_SET_HIDDEN(hidden_item);
1934
1935         /*
1936          * Save this information to build the conversation request key
1937          * later.
1938          */
1939         rsvph->session_type = RSVP_SESSION_TYPE_IPV4_UNI;
1940         TVB_SET_ADDRESS(&rsvph->destination, AT_IPv4, tvb, offset2, 4);
1941         rsvph->udp_dest_port = tvb_get_ntohs(tvb, offset2+6);
1942         rsvph->ext_tunnel_id = tvb_get_ntohl(tvb, offset2 + 8);
1943
1944         break;
1945
1946     case RSVP_SESSION_TYPE_IPV4_E_NNI:
1947         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
1948                             "C-type: 15 - IPv4 E-NNI");
1949         proto_tree_add_item(rsvp_object_tree,
1950                             hf_rsvp_filter[RSVPF_SESSION_IP],
1951                             tvb, offset2, 4, ENC_BIG_ENDIAN);
1952
1953         proto_tree_add_item(rsvp_object_tree,
1954                             hf_rsvp_filter[RSVPF_SESSION_TUNNEL_ID],
1955                             tvb, offset2+6, 2, ENC_BIG_ENDIAN);
1956
1957         proto_tree_add_text(rsvp_object_tree, tvb, offset2+8, 4,
1958                             "Extended IPv4 Address: %s",
1959                             tvb_ip_to_str(tvb, offset2+8));
1960         hidden_item = proto_tree_add_item(rsvp_object_tree,
1961                                    hf_rsvp_filter[RSVPF_SESSION_EXT_TUNNEL_ID],
1962                                    tvb, offset2+8, 4, ENC_BIG_ENDIAN);
1963         PROTO_ITEM_SET_HIDDEN(hidden_item);
1964
1965         /*
1966          * Save this information to build the conversation request key
1967          * later.
1968          */
1969         rsvph->session_type = RSVP_SESSION_TYPE_IPV4_E_NNI;
1970         TVB_SET_ADDRESS(&rsvph->destination, AT_IPv4, tvb, offset2, 4);
1971         rsvph->udp_dest_port = tvb_get_ntohs(tvb, offset2+6);
1972         rsvph->ext_tunnel_id = tvb_get_ntohl(tvb, offset2 + 8);
1973
1974         break;
1975
1976     default:
1977         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
1978                             "C-type: Unknown (%u)",
1979                             type);
1980         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length-4,
1981                             "Data (%d bytes)", obj_length-4);
1982         break;
1983     }
1984 }
1985
1986 /*------------------------------------------------------------------------------
1987  * TLVs for HOP, ERROR and other IF_ID extended objects (RFC4920)
1988  * (TODO: TLV type 12, 13, 25)
1989  *------------------------------------------------------------------------------*/
1990 static void
1991 dissect_rsvp_ifid_tlv(proto_tree *ti, proto_tree *rsvp_object_tree,
1992                       tvbuff_t *tvb, int offset, int length,
1993                       int subtree_type)
1994 {
1995     int         tlv_off, padding;
1996     guint16     tlv_type;
1997     int         tlv_len;
1998     guint8      isis_len;
1999     const char *tlv_name;
2000     proto_tree *rsvp_ifid_subtree=NULL, *ti2;
2001
2002     for (tlv_off = 0; tlv_off < length; ) {
2003         tlv_type = tvb_get_ntohs(tvb, offset+tlv_off);
2004         tlv_len = tvb_get_ntohs(tvb, offset+tlv_off+2);
2005
2006         if ((tlv_len == 0) || (tlv_off+tlv_len > length)) {
2007             proto_tree_add_text(rsvp_object_tree, tvb, offset+tlv_off+2, 2,
2008                                 "Invalid TLV length");
2009             return;
2010         }
2011         switch(tlv_type) {
2012         case 1:                         /* IPv4 */
2013             tlv_name = "";
2014             goto ifid_ipv4;
2015         case 14:                        /* PREVIOUS_HOP_IPV4 */
2016             tlv_name = "Previous-Hop ";
2017             goto ifid_ipv4;
2018         case 16:                        /* INCOMING_IPV4 */
2019             tlv_name = "Incoming ";
2020         ifid_ipv4:
2021             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2022                                       offset+tlv_off, tlv_len,
2023                                       "%sIPv4 TLV - %s", tlv_name,
2024                                       tvb_ip_to_str(tvb, offset+tlv_off+4));
2025
2026             rsvp_ifid_subtree = proto_item_add_subtree(ti2, subtree_type);
2027             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off, 2,
2028                                 "Type: %d (%sIPv4)", tlv_type, tlv_name);
2029             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+2, 2,
2030                                 "Length: %u",
2031                                 tvb_get_ntohs(tvb, offset+tlv_off+2));
2032             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+4, 4,
2033                                 "IPv4 address: %s",
2034                                 tvb_ip_to_str(tvb, offset+tlv_off+4));
2035             proto_item_append_text(ti, "%sIPv4: %s. ", tlv_name,
2036                                    tvb_ip_to_str(tvb, offset+tlv_off+4));
2037             break;
2038
2039         case 2:                         /* IPv6 */
2040             tlv_name = "";
2041             goto ifid_ipv6;
2042         case 15:                        /* PREVIOUS_HOP_IPV6 */
2043             tlv_name = "Previous-Hop ";
2044             goto ifid_ipv6;
2045         case 17:                        /* INCOMING_IPV6 */
2046             tlv_name = "Incoming ";
2047         ifid_ipv6:
2048             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2049                                       offset+tlv_off, tlv_len,
2050                                       "%sIPv6 TLV - %s", tlv_name,
2051                                       tvb_ip6_to_str(tvb, offset+tlv_off+4));
2052
2053             rsvp_ifid_subtree = proto_item_add_subtree(ti2, subtree_type);
2054             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off, 2,
2055                                 "Type: %d (%sIPv6)", tlv_type, tlv_name);
2056             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+2, 2,
2057                                 "Length: %u",
2058                                 tvb_get_ntohs(tvb, offset+tlv_off+2));
2059             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+4, 4,
2060                                 "IPv6 address: %s",
2061                                 tvb_ip6_to_str(tvb, offset+tlv_off+4));
2062             proto_item_append_text(ti, "%sIPv6: %s. ", tlv_name,
2063                                    tvb_ip6_to_str(tvb, offset+tlv_off+4));
2064             break;
2065
2066         case 3:                         /* IF_INDEX */
2067             tlv_name = "";
2068             goto ifid_ifindex;
2069         case 4:                         /* COMPONENT_IF_DOWNSTREAM */
2070             tlv_name = " Forward";
2071             goto ifid_ifindex;
2072         case 5:                         /* COMPONENT_IF_UPSTREAM */
2073             tlv_name = " Reverse";
2074             goto ifid_ifindex;
2075         case 18:                        /* INCOMING_IF_INDEX */
2076             tlv_name = " Incoming";
2077         ifid_ifindex:
2078             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2079                                       offset+tlv_off, tlv_len,
2080                                       "Interface-Index%s TLV - %s, %d",
2081                                       tlv_name,
2082                                       tvb_ip_to_str(tvb, offset+tlv_off+4),
2083                                       tvb_get_ntohl(tvb, offset+tlv_off+8));
2084             rsvp_ifid_subtree = proto_item_add_subtree(ti2, subtree_type);
2085             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off, 2,
2086                                 "Type: %d (Interface Index%s)", tlv_type, tlv_name);
2087             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+2, 2,
2088                                 "Length: %u",
2089                                 tvb_get_ntohs(tvb, offset+tlv_off+2));
2090             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+4, 4,
2091                                 "IPv4 address: %s",
2092                                 tvb_ip_to_str(tvb, offset+tlv_off+4));
2093             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+8, 4,
2094                                 "Interface-ID: %d (0x%0x)",
2095                                 tvb_get_ntohl(tvb, offset+tlv_off+8),
2096                                 tvb_get_ntohl(tvb, offset+tlv_off+8));
2097             proto_item_append_text(ti, "Data If-Index%s: %s, %d. ", tlv_name,
2098                                    tvb_ip_to_str(tvb, offset+tlv_off+4),
2099                                    tvb_get_ntohl(tvb, offset+tlv_off+8));
2100             break;
2101
2102         case 6:                         /* DOWNSTREAM_LABEL */
2103             tlv_name = "Downstream";
2104             goto ifid_label;
2105         case 7:                         /* UPSTREAM_LABEL */
2106             tlv_name = "Upstream";
2107             goto ifid_label;
2108         case 19:                        /* INCOMING_DOWN_LABEL */
2109             tlv_name = "Incoming-Downstream";
2110             goto ifid_label;
2111         case 20:                        /* INCOMING_UP_LABEL */
2112             tlv_name = "Incoming-Upstream";
2113         ifid_label:
2114             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2115                                       offset+tlv_off, tlv_len,
2116                                       "%s-Label TLV - %u", tlv_name,
2117                                       tvb_get_ntohl(tvb, offset+tlv_off+4));
2118             rsvp_ifid_subtree = proto_item_add_subtree(ti2, subtree_type);
2119             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off, 2,
2120                                 "Type: %d (%s-Label)", tlv_type, tlv_name);
2121             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+2, 2,
2122                                 "Length: %u",
2123                                 tvb_get_ntohs(tvb, offset+tlv_off+2));
2124             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+4, 4,
2125                                 "Label: %u",
2126                                 tvb_get_ntohl(tvb, offset+tlv_off+4));
2127             proto_item_append_text(ti, "%s-Label: %u. ", tlv_name,
2128                                    tvb_get_ntohl(tvb, offset+tlv_off+4));
2129             break;
2130
2131
2132         case 8:                         /* NODE_ID */
2133             tlv_name = "";
2134             goto ifid_nodeid;
2135         case 21:                        /* REPORTING_NODE_ID */
2136             tlv_name = "Reporting-";
2137         ifid_nodeid:
2138             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2139                                       offset+tlv_off, tlv_len,
2140                                       "%sNode-ID TLV - %s", tlv_name,
2141                                       tvb_ip_to_str(tvb, offset+tlv_off+4));
2142             rsvp_ifid_subtree = proto_item_add_subtree(ti2, subtree_type);
2143             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off, 2,
2144                                 "Type: %d (%sNode-ID)", tlv_type, tlv_name);
2145             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+2, 2,
2146                                 "Length: %u",
2147                                 tvb_get_ntohs(tvb, offset+tlv_off+2));
2148             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+4, 4,
2149                                 "Node ID: %s",
2150                                 tvb_ip_to_str(tvb, offset+tlv_off+4));
2151             proto_item_append_text(ti, "%sNode-ID: %s. ", tlv_name,
2152                                    tvb_ip_to_str(tvb, offset+tlv_off+4));
2153             break;
2154
2155         case 9:                         /* OSPF_AREA */
2156             tlv_name = "";
2157             goto ifid_ospf;
2158         case 22:                        /* REPORTING_OSPF_AREA */
2159             tlv_name = "Reporting-";
2160         ifid_ospf:
2161             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2162                                       offset+tlv_off, tlv_len,
2163                                       "%sOSPF-Area TLV - %u", tlv_name,
2164                                       tvb_get_ntohl(tvb, offset+tlv_off+4));
2165             rsvp_ifid_subtree = proto_item_add_subtree(ti2, subtree_type);
2166             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off, 2,
2167                                 "Type: %d (%sOSPF-Area)", tlv_type, tlv_name);
2168             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+2, 2,
2169                                 "Length: %u",
2170                                 tvb_get_ntohs(tvb, offset+tlv_off+2));
2171             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+4, 4,
2172                                 "Area: %u",
2173                                 tvb_get_ntohl(tvb, offset+tlv_off+4));
2174             proto_item_append_text(ti, "%sOSPF-Area: %u. ", tlv_name,
2175                                    tvb_get_ntohl(tvb, offset+tlv_off+4));
2176             break;
2177
2178         case 10:                        /* ISIS_AREA */
2179             tlv_name = "";
2180             goto ifid_isis;
2181         case 23:                        /* REPORTING_ISIS_AREA */
2182             tlv_name = "Reporting-";
2183         ifid_isis:
2184             isis_len = tvb_get_guint8(tvb, offset+tlv_off+4);
2185             if ((isis_len < 2) || (isis_len > 11))
2186             {
2187               proto_tree_add_text(rsvp_object_tree, tvb, offset+tlv_off, tlv_len,
2188                                   "%sISIS-Area TLV - Invalid Length field", tlv_name);
2189               break;
2190             }
2191             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2192                                       offset+tlv_off, tlv_len,
2193                                       "%sISIS-Area TLV - %s", tlv_name,
2194                                       print_nsap_net(tvb_get_ptr(tvb, offset+tlv_off+5, isis_len),
2195                                                      isis_len));
2196             rsvp_ifid_subtree = proto_item_add_subtree(ti2, subtree_type);
2197             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off, 2,
2198                                 "Type: %d (%sISIS-Area)", tlv_type, tlv_name);
2199             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+2, 2,
2200                                 "Length: %u",
2201                                 tvb_get_ntohs(tvb, offset+tlv_off+2));
2202             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+4, 4,
2203                                 "IS-IS Area Identifier: %s",
2204                                  print_nsap_net(tvb_get_ptr(tvb, offset+tlv_off+5, isis_len), isis_len));
2205             proto_item_append_text(ti, "%sISIS-Area: %s. ", tlv_name,
2206                                    print_nsap_net(tvb_get_ptr(tvb, offset+tlv_off+5, isis_len), isis_len));
2207             break;
2208
2209         case 11:                        /* AUTONOMOUS_SYSTEM */
2210             tlv_name = "";
2211             goto ifid_as;
2212         case 24:                        /* REPORTING_AUTONOMOUS_SYSTEM */
2213             tlv_name = "Reporting-";
2214         ifid_as:
2215             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2216                                       offset+tlv_off, tlv_len,
2217                                       "%sAS TLV - %u", tlv_name,
2218                                       tvb_get_ntohl(tvb, offset+tlv_off+4));
2219             rsvp_ifid_subtree = proto_item_add_subtree(ti2, subtree_type);
2220             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off, 2,
2221                                 "Type: %d (%sAS)", tlv_type, tlv_name);
2222             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+2, 2,
2223                                 "Length: %u",
2224                                 tvb_get_ntohs(tvb, offset+tlv_off+2));
2225             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+4, 4,
2226                                 "Autonomous System: %u",
2227                                 tvb_get_ntohl(tvb, offset+tlv_off+4));
2228             proto_item_append_text(ti, "%sAS: %u. ", tlv_name,
2229                                    tvb_get_ntohl(tvb, offset+tlv_off+4));
2230             break;
2231
2232         case 26:                        /* NODE_EXCLUSIONS */
2233             tlv_name = "Node";
2234             goto ifid_ex;
2235         case 27:                        /* LINK_EXCLUSIONS */
2236             tlv_name = "Link";
2237         ifid_ex:
2238             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2239                                       offset+tlv_off, tlv_len,
2240                                       "%s-Exclusions TLV - ", tlv_name);
2241             rsvp_ifid_subtree = proto_item_add_subtree(ti2, subtree_type);
2242             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off, 2,
2243                                 "Type: %d (%s-Exclusions)", tlv_type, tlv_name);
2244             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset+tlv_off+2, 2,
2245                                 "Length: %u",
2246                                 tvb_get_ntohs(tvb, offset+tlv_off+2));
2247             dissect_rsvp_ifid_tlv(ti2, rsvp_ifid_subtree, tvb, offset+tlv_off+4,
2248                                   tlv_len-4, TREE(TT_HOP_SUBOBJ));
2249             break;
2250         case 516:
2251             /* FF: ERROR_STRING TLV, RFC 4783 */
2252             ti2 =
2253               proto_tree_add_text(rsvp_object_tree,
2254                                   tvb, offset + tlv_off,
2255                                   tlv_len,
2256                                   "ERROR_STRING TLV - %s",
2257                                   tvb_format_text(tvb, offset + tlv_off + 4,
2258                                                   tlv_len - 4));
2259             rsvp_ifid_subtree = proto_item_add_subtree(ti2, subtree_type);
2260             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset + tlv_off, 2,
2261                                 "Type: 516 (ERROR_STRING)");
2262             proto_tree_add_text(rsvp_ifid_subtree,
2263                                 tvb, offset + tlv_off + 2, 2,
2264                                 "Length: %u",
2265                                 tvb_get_ntohs(tvb, offset + tlv_off + 2));
2266             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset + tlv_off + 4,
2267                                 tlv_len - 4,
2268                                 "Error String: %s",
2269                                 tvb_format_text(tvb, offset + tlv_off + 4,
2270                                                 tlv_len - 4));
2271             break;
2272
2273         default:
2274             /* FF: not yet known TLVs are displayed as raw data */
2275             ti2 = proto_tree_add_text(rsvp_object_tree,
2276                                       tvb, offset + tlv_off,
2277                                       tlv_len,
2278                                       "Unknown TLV (%u)", tlv_type);
2279             rsvp_ifid_subtree = proto_item_add_subtree(ti2, subtree_type);
2280             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset + tlv_off, 2,
2281                                 "Type: %u (Unknown)", tlv_type);
2282             proto_tree_add_text(rsvp_ifid_subtree,
2283                                 tvb, offset + tlv_off + 2, 2,
2284                                 "Length: %u",
2285                                 tvb_get_ntohs(tvb, offset + tlv_off + 2));
2286             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset + tlv_off + 4,
2287                                 tlv_len - 4,
2288                                 "Data: %s",
2289                                 tvb_bytes_to_str_punct(tvb, offset + tlv_off + 4, tlv_len - 4, ' '));
2290             break;
2291         }
2292
2293         padding = (4 - (tlv_len % 4)) % 4;
2294         if (padding != 0)
2295             proto_tree_add_text(rsvp_ifid_subtree, tvb, offset + tlv_off + tlv_len, padding, "Padding: %s",
2296                                 tvb_bytes_to_str_punct(tvb, offset + tlv_off + tlv_len, padding, ' '));
2297         tlv_off += tlv_len + padding;
2298     }
2299 }
2300
2301 /*------------------------------------------------------------------------------
2302  * HOP
2303  *------------------------------------------------------------------------------*/
2304 static void
2305 dissect_rsvp_hop(proto_item *ti, proto_tree *rsvp_object_tree,
2306                  tvbuff_t *tvb,
2307                  int offset, int obj_length,
2308                  int rsvp_class _U_, int type)
2309 {
2310     int offset2 = offset + 4;
2311
2312     switch(type) {
2313     case 1:
2314         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2315                             "C-type: 1 - IPv4");
2316         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4,
2317                             "Neighbor address: %s",
2318                             tvb_ip_to_str(tvb, offset2));
2319         proto_tree_add_text(rsvp_object_tree, tvb, offset2+4, 4,
2320                             "Logical interface: %u",
2321                             tvb_get_ntohl(tvb, offset2+4));
2322         proto_item_set_text(ti, "HOP: IPv4, %s",
2323                             tvb_ip_to_str(tvb, offset2));
2324         break;
2325
2326     case 2:
2327         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2328                             "C-type: 2 - IPv6");
2329         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16,
2330                             "Neighbor address: %s",
2331                             tvb_ip6_to_str(tvb, offset2));
2332         proto_tree_add_text(rsvp_object_tree, tvb, offset2+16, 4,
2333                             "Logical interface: 0x%08x",
2334                             tvb_get_ntohl(tvb, offset2+16));
2335         break;
2336
2337     case 3:
2338         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2339                             "C-type: 3 - IPv4 IF-ID");
2340         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4,
2341                             "Neighbor address: %s",
2342                             tvb_ip_to_str(tvb, offset2));
2343         proto_tree_add_text(rsvp_object_tree, tvb, offset2+4, 4,
2344                             "Logical interface: %u",
2345                             tvb_get_ntohl(tvb, offset2+4));
2346
2347         proto_item_set_text(ti, "HOP: IPv4 IF-ID. Control IPv4: %s. ",
2348                             tvb_ip_to_str(tvb, offset2));
2349
2350         dissect_rsvp_ifid_tlv(ti, rsvp_object_tree, tvb, offset+12, obj_length-12,
2351                               TREE(TT_HOP_SUBOBJ));
2352
2353         break;
2354
2355     default:
2356         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2357                             "C-type: Unknown (%u)",
2358                             type);
2359         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
2360                             "Data (%d bytes)", obj_length - 4);
2361         break;
2362     }
2363 }
2364
2365 /*------------------------------------------------------------------------------
2366  * TIME VALUES
2367  *------------------------------------------------------------------------------*/
2368 static void
2369 dissect_rsvp_time_values(proto_item *ti, proto_tree *rsvp_object_tree,
2370                          tvbuff_t *tvb,
2371                          int offset, int obj_length,
2372                          int rsvp_class _U_, int type)
2373 {
2374     int offset2 = offset + 4;
2375
2376     switch(type) {
2377     case 1:
2378         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2379                             "C-type: 1");
2380         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4,
2381                             "Refresh interval: %u ms (%u seconds)",
2382                             tvb_get_ntohl(tvb, offset2),
2383                             tvb_get_ntohl(tvb, offset2)/1000);
2384         proto_item_set_text(ti, "TIME VALUES: %d ms",
2385                             tvb_get_ntohl(tvb, offset2));
2386         break;
2387
2388     default:
2389         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2390                             "C-type: Unknown (%u)",
2391                             type);
2392         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
2393                             "Data (%d bytes)", obj_length - 4);
2394         break;
2395     }
2396 }
2397
2398 /*------------------------------------------------------------------------------
2399  * Error value field in ERROR object
2400  *------------------------------------------------------------------------------*/
2401 static guint16
2402 dissect_rsvp_error_value(proto_tree *ti, tvbuff_t *tvb,
2403                          int offset, guint8 error_code)
2404 {
2405     guint16           error_val;
2406     guint8            error_class, error_ctype;
2407     value_string_ext *rsvp_error_vals_ext_p = NULL;
2408
2409     error_val = tvb_get_ntohs(tvb, offset);
2410     switch (error_code) {
2411     case RSVP_ERROR_ADMISSION:
2412         rsvp_error_vals_ext_p = &rsvp_admission_control_error_vals_ext;
2413         break;
2414     case RSVP_ERROR_POLICY:
2415         rsvp_error_vals_ext_p = &rsvp_policy_control_error_vals_ext;
2416         break;
2417     case RSVP_ERROR_TRAFFIC:
2418         rsvp_error_vals_ext_p = &rsvp_traffic_control_error_vals_ext;
2419         break;
2420     case RSVP_ERROR_ROUTING:
2421         rsvp_error_vals_ext_p = &rsvp_routing_error_vals_ext;
2422         break;
2423     case RSVP_ERROR_NOTIFY:
2424         rsvp_error_vals_ext_p = &rsvp_notify_error_vals_ext;
2425         break;
2426     case RSVP_ERROR_DIFFSERV:
2427         rsvp_error_vals_ext_p = &rsvp_diffserv_error_vals_ext;
2428         break;
2429     case RSVP_ERROR_DSTE:
2430         rsvp_error_vals_ext_p = &rsvp_diffserv_aware_te_error_vals_ext;
2431         break;
2432     case RSVP_ERROR_CALL_MGMT:
2433         rsvp_error_vals_ext_p = &rsvp_call_mgmt_error_vals_ext;
2434         break;
2435     }
2436
2437     switch (error_code) {
2438     case RSVP_ERROR_ADMISSION:
2439     case RSVP_ERROR_TRAFFIC:
2440         if ((error_val & 0xc0) == 0) {
2441             DISSECTOR_ASSERT(rsvp_error_vals_ext_p != NULL);
2442             proto_tree_add_text(ti, tvb, offset, 2,
2443                 "Error value: %u - %s", error_val,
2444                                 val_to_str_ext(error_val, rsvp_error_vals_ext_p, "Unknown (%d)"));
2445         }
2446         else if ((error_val & 0xc0) == 0x80) {
2447             proto_tree_add_text(ti, tvb, offset, 2,
2448                 "Error value: %u - Organization specific subcode (%u)", error_val,
2449                 error_val);
2450         }
2451         else if ((error_val & 0xc0) == 0xc0) {
2452             proto_tree_add_text(ti, tvb, offset, 2,
2453                 "Error value: %u - Service specific subcode (%u)", error_val,
2454                 error_val);
2455         }
2456         break;
2457     case RSVP_ERROR_UNKNOWN_CLASS:
2458     case RSVP_ERROR_UNKNOWN_C_TYPE:
2459         error_class = error_val / 256;
2460         error_ctype = error_val % 256;
2461         proto_tree_add_text(ti, tvb, offset, 2, "Class: %u (%s) - CType: %u",
2462                             error_class, val_to_str_ext_const(error_class, &rsvp_class_vals_ext, "Unknown"),
2463                             error_ctype);
2464         break;
2465     case RSVP_ERROR_POLICY:
2466     case RSVP_ERROR_NOTIFY:
2467     case RSVP_ERROR_ROUTING:
2468     case RSVP_ERROR_DIFFSERV:
2469     case RSVP_ERROR_DSTE:
2470     case RSVP_ERROR_CALL_MGMT:
2471         DISSECTOR_ASSERT(rsvp_error_vals_ext_p != NULL);
2472         proto_tree_add_text(ti, tvb, offset, 2, "Error value: %u - %s", error_val,
2473                             val_to_str_ext(error_val, rsvp_error_vals_ext_p, "Unknown (%d)"));
2474         break;
2475     default:
2476         proto_tree_add_text(ti, tvb, offset, 2, "Error value: %u", error_val);
2477         break;
2478     }
2479     return error_val;
2480 }
2481
2482 /*------------------------------------------------------------------------------
2483  * ERROR
2484  *------------------------------------------------------------------------------*/
2485 static void
2486 dissect_rsvp_error(proto_item *ti, proto_tree *rsvp_object_tree,
2487                    tvbuff_t *tvb,
2488                    int offset, int obj_length,
2489                    int rsvp_class _U_, int type)
2490 {
2491     int         offset2 = offset + 4;
2492     int         offset3;
2493     guint8      error_flags;
2494     guint8      error_code;
2495     guint16     error_val;
2496     proto_tree *ti2, *rsvp_error_subtree;
2497
2498     switch(type) {
2499     case 1: {
2500         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2501                             "C-type: 1 - IPv4");
2502         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4,
2503                             "Error node: %s",
2504                             tvb_ip_to_str(tvb, offset2));
2505         offset3 = offset2+4;
2506         break;
2507     }
2508
2509     case 2: {
2510         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2511                             "C-type: 2 - IPv6");
2512         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16,
2513                             "Error node: %s",
2514                             tvb_ip6_to_str(tvb, offset2));
2515         offset3 = offset2+16;
2516         break;
2517     }
2518
2519     case 3: {
2520         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2521                             "C-type: 3 - IPv4 IF-ID");
2522         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4,
2523                             "Error node: %s",
2524                             tvb_ip_to_str(tvb, offset2));
2525         offset3 = offset2+4;
2526         break;
2527     }
2528
2529     default:
2530         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2531                             "C-type: Unknown (%u)",
2532                             type);
2533         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
2534                             "Data (%d bytes)", obj_length - 4);
2535         return;
2536     }
2537
2538     error_flags = tvb_get_guint8(tvb, offset3);
2539     ti2 = proto_tree_add_item(rsvp_object_tree, hf_rsvp_error_flags,
2540                              tvb, offset3, 1, ENC_BIG_ENDIAN);
2541     rsvp_error_subtree = proto_item_add_subtree(ti2, TREE(TT_ERROR_FLAGS));
2542     proto_tree_add_item(rsvp_error_subtree, hf_rsvp_error_flags_path_state_removed,
2543                              tvb, offset3, 1, ENC_BIG_ENDIAN);
2544     proto_tree_add_item(rsvp_error_subtree, hf_rsvp_error_flags_not_guilty,
2545                              tvb, offset3, 1, ENC_BIG_ENDIAN);
2546     proto_tree_add_item(rsvp_error_subtree, hf_rsvp_error_flags_in_place,
2547                              tvb, offset3, 1, ENC_BIG_ENDIAN);
2548     proto_item_append_text(ti2, " %s %s %s",
2549                            (error_flags & (1<<2))  ? "Path-State-Removed" : "",
2550                            (error_flags & (1<<1))  ? "NotGuilty" : "",
2551                            (error_flags & (1<<0))  ? "InPlace" : "");
2552     error_code = tvb_get_guint8(tvb, offset3+1);
2553     proto_tree_add_text(rsvp_object_tree, tvb, offset3+1, 1,
2554                         "Error code: %u - %s", error_code,
2555                         val_to_str_ext(error_code, &rsvp_error_codes_ext, "Unknown (%d)"));
2556     error_val = dissect_rsvp_error_value(rsvp_object_tree, tvb, offset3+2, error_code);
2557
2558     switch (type) {
2559     case 1:
2560         proto_item_set_text(ti, "ERROR: IPv4, Error code: %s, Value: %d, Error Node: %s",
2561                             val_to_str_ext(error_code, &rsvp_error_codes_ext, "Unknown (%d)"),
2562                             error_val, tvb_ip_to_str(tvb, offset2));
2563         break;
2564     case 3:
2565         proto_item_set_text(ti, "ERROR: IPv4 IF-ID, Error code: %s, Value: %d, Control Node: %s. ",
2566                             val_to_str_ext(error_code, &rsvp_error_codes_ext, "Unknown (%d)"),
2567                             error_val, tvb_ip_to_str(tvb, offset2));
2568         dissect_rsvp_ifid_tlv(ti, rsvp_object_tree, tvb, offset+12, obj_length-12,
2569                               TREE(TT_ERROR_SUBOBJ));
2570         break;
2571     }
2572 }
2573
2574 /*------------------------------------------------------------------------------
2575  * SCOPE
2576  *------------------------------------------------------------------------------*/
2577 static void
2578 dissect_rsvp_scope(proto_item *ti _U_, proto_tree *rsvp_object_tree,
2579                    tvbuff_t *tvb,
2580                    int offset, int obj_length,
2581                    int rsvp_class _U_, int type)
2582 {
2583     int offset2 = offset + 4;
2584     int mylen;
2585
2586     mylen = obj_length - 4;
2587     switch(type) {
2588     case 1: {
2589         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2590                             "C-type: 1 - IPv4");
2591         while (mylen > 0) {
2592             proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4,
2593                                 "IPv4 Address: %s",
2594                                 tvb_ip_to_str(tvb, offset2));
2595             offset2 += 4;
2596             mylen -= 4;
2597         }
2598         break;
2599     }
2600
2601     case 2: {
2602         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2603                             "C-type: 2 - IPv6");
2604         while (mylen > 0) {
2605             proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16,
2606                                 "IPv6 Address: %s",
2607                                 tvb_ip6_to_str(tvb, offset2));
2608             offset2 += 16;
2609             mylen -= 16;
2610         }
2611         break;
2612     }
2613
2614     default:
2615         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2616                             "C-type: Unknown (%u)",
2617                             type);
2618         proto_tree_add_text(rsvp_object_tree, tvb, offset2, mylen,
2619                             "Data (%d bytes)", mylen);
2620         break;
2621     }
2622 }
2623
2624 /*------------------------------------------------------------------------------
2625  * STYLE
2626  *------------------------------------------------------------------------------*/
2627 static void
2628 dissect_rsvp_style(proto_item *ti, proto_tree *rsvp_object_tree,
2629                    tvbuff_t *tvb,
2630                    int offset, int obj_length,
2631                    int rsvp_class _U_, int type)
2632 {
2633     int offset2 = offset + 4;
2634
2635     switch(type) {
2636     case 1: {
2637         guint32 style;
2638
2639         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2640                             "C-type: 1");
2641         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
2642                             "Flags: 0x%02x",
2643                             tvb_get_guint8(tvb, offset2));
2644         style = tvb_get_ntoh24(tvb, offset2+1);
2645         proto_tree_add_text(rsvp_object_tree, tvb, offset2+1,
2646                             3, "Style: 0x%06X - %s", style,
2647                             val_to_str_const(style, style_vals, "Unknown"));
2648         proto_item_set_text(ti, "STYLE: %s (%d)",
2649                             val_to_str_const(style, style_vals, "Unknown"),
2650                             style);
2651         break;
2652     }
2653
2654     default:
2655         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2656                             "C-type: Unknown (%u)",
2657                             type);
2658         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
2659                             "Data (%d bytes)", obj_length - 4);
2660         break;
2661     }
2662 }
2663
2664 /*------------------------------------------------------------------------------
2665  * CONFIRM
2666  *------------------------------------------------------------------------------*/
2667 static void
2668 dissect_rsvp_confirm(proto_item *ti, proto_tree *rsvp_object_tree,
2669                      tvbuff_t *tvb,
2670                      int offset, int obj_length,
2671                      int rsvp_class _U_, int type)
2672 {
2673     int offset2 = offset + 4;
2674
2675     switch(type) {
2676     case 1: {
2677         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2678                             "C-type: 1 - IPv4");
2679         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4,
2680                             "Receiver address: %s",
2681                             tvb_ip_to_str(tvb, offset2));
2682         proto_item_set_text(ti, "CONFIRM: Receiver %s",
2683                             tvb_ip_to_str(tvb, offset2));
2684         break;
2685     }
2686
2687     case 2: {
2688         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2689                             "C-type: 2 - IPv6");
2690         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16,
2691                             "Receiver address: %s",
2692                             tvb_ip6_to_str(tvb, offset2));
2693         break;
2694     }
2695
2696     default:
2697         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2698                             "C-type: Unknown (%u)",
2699                             type);
2700         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
2701                             "Data (%d bytes)", obj_length - 4);
2702         break;
2703     }
2704 }
2705
2706 /*------------------------------------------------------------------------------
2707  * SENDER TEMPLATE and FILTERSPEC
2708  *------------------------------------------------------------------------------*/
2709 static void
2710 dissect_rsvp_template_filter(proto_item *ti, proto_tree *rsvp_object_tree,
2711                              tvbuff_t *tvb,
2712                              int offset, int obj_length,
2713                              int rsvp_class _U_, int type,
2714                              rsvp_conversation_info *rsvph)
2715 {
2716     int offset2 = offset + 4;
2717
2718     proto_item_set_text(ti, "%s", summary_template(tvb, offset));
2719     switch(type) {
2720     case 1:
2721          proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2722                              "C-type: 1 - IPv4");
2723          proto_tree_add_item(rsvp_object_tree,
2724                              hf_rsvp_filter[RSVPF_SENDER_IP],
2725                              tvb, offset2, 4, ENC_BIG_ENDIAN);
2726          proto_tree_add_item(rsvp_object_tree,
2727                              hf_rsvp_filter[RSVPF_SENDER_PORT],
2728                              tvb, offset2+6, 2, ENC_BIG_ENDIAN);
2729
2730          /*
2731           * Save this information to build the conversation request key later.
2732           */
2733          TVB_SET_ADDRESS(&rsvph->source, AT_IPv4, tvb, offset2, 4);
2734          rsvph->udp_source_port = tvb_get_ntohs(tvb, offset2+6);
2735          break;
2736
2737      case 2:
2738          proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2739                              "C-type: 2 - IPv6");
2740          proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16,
2741                              "Source address: %s",
2742                              tvb_ip6_to_str(tvb, offset2));
2743          proto_tree_add_text(rsvp_object_tree, tvb, offset2+18, 2,
2744                              "Source port: %u",
2745                              tvb_get_ntohs(tvb, offset2+18));
2746          break;
2747
2748      case 7:
2749          proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2750                              "C-type: 7 - IPv4 LSP");
2751          proto_tree_add_item(rsvp_object_tree,
2752                              hf_rsvp_filter[RSVPF_SENDER_IP],
2753                              tvb, offset2, 4, ENC_BIG_ENDIAN);
2754          proto_tree_add_item(rsvp_object_tree,
2755                              hf_rsvp_filter[RSVPF_SENDER_LSP_ID],
2756                              tvb, offset2+6, 2, ENC_BIG_ENDIAN);
2757
2758          /*
2759           * Save this information to build the conversation request key later.
2760           */
2761          TVB_SET_ADDRESS(&rsvph->source, AT_IPv4, tvb, offset2, 4);
2762          rsvph->udp_source_port = tvb_get_ntohs(tvb, offset2+6);
2763          break;
2764
2765     case 9:
2766          proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2767                              "C-type: 9 - IPv4 Aggregate");
2768          proto_tree_add_item(rsvp_object_tree,
2769                              hf_rsvp_filter[RSVPF_SENDER_IP],
2770                              tvb, offset2, 4, ENC_BIG_ENDIAN);
2771
2772          /*
2773           * Save this information to build the conversation request key later.
2774           */
2775          TVB_SET_ADDRESS(&rsvph->source, AT_IPv4, tvb, offset2, 4);
2776          break;
2777
2778      default:
2779          proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2780                              "C-type: Unknown (%u)",
2781                              type);
2782          proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
2783                              "Data (%d bytes)", obj_length - 4);
2784          break;
2785  }
2786 }
2787
2788 /*------------------------------------------------------------------------------
2789  * TLVs for Ethernet SENDER TSPEC and FLOWSPEC (RFC6003)
2790  *------------------------------------------------------------------------------*/
2791 static void
2792 dissect_rsvp_eth_tspec_tlv(proto_item *ti, proto_tree *rsvp_object_tree,
2793                            tvbuff_t *tvb, int offset, int tlv_length,
2794                            int subtree_type)
2795 {
2796     int         tlv_off;
2797     guint16     tlv_type;
2798     int         tlv_len;
2799     guint8      profile;
2800     proto_tree *rsvp_ethspec_subtree, *ethspec_profile_subtree, *ti2, *ti3;
2801
2802     for (tlv_off = 0; tlv_off < tlv_length; ) {
2803         tlv_type = tvb_get_ntohs(tvb, offset+tlv_off);
2804         tlv_len = tvb_get_ntohs(tvb, offset+tlv_off+2);
2805
2806         if ((tlv_len == 0) || (tlv_off+tlv_len > tlv_length)) {
2807             proto_tree_add_text(rsvp_object_tree, tvb, offset+tlv_off+2, 2,
2808                                 "Invalid length");
2809             return;
2810         }
2811         switch(tlv_type) {
2812         case 0:
2813         case 1:
2814         case 255:
2815             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2816                                       offset+tlv_off, tlv_len,
2817                                       "RESERVED (RFC6003)");
2818             rsvp_ethspec_subtree = proto_item_add_subtree(ti2, subtree_type);
2819             proto_tree_add_text(rsvp_ethspec_subtree, tvb, offset+tlv_off, 2,
2820                                 "Type: %u (RESERVED)", tlv_type);
2821             proto_tree_add_text(rsvp_ethspec_subtree, tvb, offset+tlv_off+2, 2,
2822                                 "Length: %u", tlv_len);
2823             break;
2824
2825         case 2:
2826         case 129:     /* OIF demo 2009 */
2827             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2828                                       offset+tlv_off, tlv_len,
2829                                       "Ethernet Bandwidth Profile TLV: CIR=%.10g, CBS=%.10g, "
2830                                       "EIR=%.10g, EBS=%.10g",
2831                                       tvb_get_ntohieee_float(tvb, offset+tlv_off+8),
2832                                       tvb_get_ntohieee_float(tvb, offset+tlv_off+12),
2833                                       tvb_get_ntohieee_float(tvb, offset+tlv_off+16),
2834                                       tvb_get_ntohieee_float(tvb, offset+tlv_off+20));
2835             rsvp_ethspec_subtree = proto_item_add_subtree(ti2, subtree_type);
2836             proto_tree_add_text(rsvp_ethspec_subtree, tvb, offset+tlv_off, 2,
2837                                 "Type: %u - Ethernet Bandwidth Profile", tlv_type);
2838             proto_tree_add_text(rsvp_ethspec_subtree, tvb, offset+tlv_off+2, 2,
2839                                 "Length: %u", tlv_len);
2840             profile = tvb_get_guint8(tvb, offset+tlv_off+4);
2841             ti3 = proto_tree_add_text(rsvp_ethspec_subtree, tvb, offset+tlv_off+4, 1,
2842                                       "Profile: 0x%02x", profile);
2843             ethspec_profile_subtree = proto_item_add_subtree(ti3, TREE(TT_ETHSPEC_SUBTREE));
2844             proto_tree_add_item(ethspec_profile_subtree, hf_rsvp_eth_tspec_tlv_color_mode,
2845                              tvb, offset+tlv_off+4, 1, ENC_BIG_ENDIAN);
2846             proto_tree_add_item(ethspec_profile_subtree, hf_rsvp_eth_tspec_tlv_coupling_flag,
2847                              tvb, offset+tlv_off+4, 1, ENC_BIG_ENDIAN);
2848             proto_item_append_text(ti3, " %s %s",
2849                                    (profile & (1<<1))  ? "CM" : "",
2850                                    (profile & (1<<0))  ? "CF" : "");
2851             proto_tree_add_text(rsvp_ethspec_subtree, tvb, offset+tlv_off+5, 1,
2852                                 "Index: %x", tvb_get_guint8(tvb, offset+tlv_off+5));
2853             proto_tree_add_text(rsvp_ethspec_subtree, tvb, offset+tlv_off+6, 2,
2854                                 "Reserved: %x", tvb_get_ntohs(tvb, offset+tlv_off+6));
2855             proto_tree_add_text(rsvp_ethspec_subtree, tvb, offset+tlv_off+8, 4, "CIR: %.10g",
2856                                 tvb_get_ntohieee_float(tvb, offset+tlv_off+8));
2857             proto_tree_add_text(rsvp_ethspec_subtree, tvb, offset+tlv_off+12, 4, "CBS: %.10g",
2858                                 tvb_get_ntohieee_float(tvb, offset+tlv_off+12));
2859             proto_tree_add_text(rsvp_ethspec_subtree, tvb, offset+tlv_off+16, 4, "EIR: %.10g",
2860                                 tvb_get_ntohieee_float(tvb, offset+tlv_off+16));
2861             proto_tree_add_text(rsvp_ethspec_subtree, tvb, offset+tlv_off+20, 4, "EBS: %.10g",
2862                                 tvb_get_ntohieee_float(tvb, offset+tlv_off+20));
2863
2864             proto_item_append_text(ti, "ETH profile: CIR=%.10g, CBS=%.10g, EIR=%.10g, "
2865                                        "EBS=%.10g",
2866                                    tvb_get_ntohieee_float(tvb, offset+tlv_off+8),
2867                                    tvb_get_ntohieee_float(tvb, offset+tlv_off+12),
2868                                    tvb_get_ntohieee_float(tvb, offset+tlv_off+16),
2869                                    tvb_get_ntohieee_float(tvb, offset+tlv_off+20));
2870             break;
2871
2872         default:
2873             proto_tree_add_text(rsvp_object_tree, tvb, offset+tlv_off, 2,
2874                                 "Unknown TLV: %u", tlv_type);
2875             break;
2876         }
2877         tlv_off += tlv_len;
2878     }
2879 }
2880
2881 /*------------------------------------------------------------------------------
2882  * SENDER TSPEC
2883  *------------------------------------------------------------------------------*/
2884 static void
2885 dissect_rsvp_tspec(proto_item *ti, proto_tree *rsvp_object_tree,
2886                    tvbuff_t *tvb,
2887                    int offset, int obj_length,
2888                    int rsvp_class _U_, int type)
2889 {
2890     int         offset2 = offset + 4;
2891     int         mylen;
2892     proto_tree *tspec_tree, *ti2;
2893     guint8      signal_type;
2894     guint16     switch_gran;
2895
2896     mylen = obj_length - 4;
2897
2898     switch(type) {
2899     case 2:
2900         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
2901                             "C-type: 2 - Integrated Services");
2902         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
2903                             "Message format version: %u",
2904                             tvb_get_guint8(tvb, offset2)>>4);
2905         proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
2906                             "Data length: %u words, not including header",
2907                             tvb_get_ntohs(tvb, offset2+2));
2908
2909         mylen -= 4;
2910         offset2 += 4;
2911
2912         proto_item_set_text(ti, "SENDER TSPEC: IntServ, ");
2913
2914         while (mylen > 0) {
2915             guint8 service_num;
2916             guint8 param_id;
2917             guint param_len;
2918             guint param_len_processed;
2919             guint length;
2920
2921             service_num = tvb_get_guint8(tvb, offset2);
2922             proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
2923                                 "Service header: %u - %s",
2924                                 service_num,
2925                                 val_to_str_const(service_num, qos_vals, "Unknown"));
2926             length = tvb_get_ntohs(tvb, offset2+2);
2927             proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
2928                                 "Length of service %u data: %u words, "
2929                                 "not including header",
2930                                 service_num, length);
2931
2932             mylen -= 4;
2933             offset2 += 4;
2934
2935             /* Process all known service headers as a set of parameters */
2936             param_len_processed = 0;
2937             while (param_len_processed < length) {
2938                 param_id = tvb_get_guint8(tvb, offset2);
2939                 param_len = tvb_get_ntohs(tvb, offset2+2) + 1;
2940                 if (param_len < 1)
2941                     THROW(ReportedBoundsError);
2942                 switch(param_id) {
2943                 case 127:
2944                     /* Token Bucket */
2945                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2946                                               offset2, param_len*4,
2947                                               "Token Bucket TSpec: ");
2948                     tspec_tree = proto_item_add_subtree(ti2, TREE(TT_TSPEC_SUBTREE));
2949
2950                     proto_tree_add_text(tspec_tree, tvb, offset2, 1,
2951                                         "Parameter %u - %s",
2952                                         param_id,
2953                                         val_to_str_ext_const(param_id, &svc_vals_ext, "Unknown"));
2954                     proto_tree_add_text(tspec_tree, tvb, offset2+1, 1,
2955                                         "Parameter %u flags: 0x%02x",
2956                                         param_id,
2957                                         tvb_get_guint8(tvb, offset2+1));
2958                     proto_tree_add_text(tspec_tree, tvb, offset2+2, 2,
2959                                         "Parameter %u data length: %u words, "
2960                                         "not including header",
2961                                         param_id,
2962                                         tvb_get_ntohs(tvb, offset2+2));
2963                     proto_tree_add_text(tspec_tree, tvb, offset2+4, 4,
2964                                         "Token bucket rate: %.10g",
2965                                         tvb_get_ntohieee_float(tvb, offset2+4));
2966                     proto_tree_add_text(tspec_tree, tvb, offset2+8, 4,
2967                                         "Token bucket size: %.10g",
2968                                         tvb_get_ntohieee_float(tvb, offset2+8));
2969                     proto_tree_add_text(tspec_tree, tvb, offset2+12, 4,
2970                                         "Peak data rate: %.10g",
2971                                         tvb_get_ntohieee_float(tvb, offset2+12));
2972                     proto_tree_add_text(tspec_tree, tvb, offset2+16, 4,
2973                                         "Minimum policed unit [m]: %u",
2974                                         tvb_get_ntohl(tvb, offset2+16));
2975                     proto_tree_add_text(tspec_tree, tvb, offset2+20, 4,
2976                                         "Maximum packet size [M]: %u",
2977                                         tvb_get_ntohl(tvb, offset2+20));
2978                     proto_item_append_text(ti, "Token Bucket, %.10g bytes/sec. ",
2979                                            tvb_get_ntohieee_float(tvb, offset2+4));
2980                     proto_item_append_text(ti2, "Rate=%.10g Burst=%.10g Peak=%.10g m=%u M=%u",
2981                                            tvb_get_ntohieee_float(tvb, offset2+4),
2982                                            tvb_get_ntohieee_float(tvb, offset2+8),
2983                                            tvb_get_ntohieee_float(tvb, offset2+12),
2984                                            tvb_get_ntohl(tvb, offset2+16),
2985                                            tvb_get_ntohl(tvb, offset2+20));
2986                     break;
2987
2988                 case 128:
2989                     /* Null Service (RFC2997) */
2990                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
2991                                               offset2, param_len*4,
2992                                               "Null Service TSpec: ");
2993                     tspec_tree = proto_item_add_subtree(ti2, TREE(TT_TSPEC_SUBTREE));
2994
2995                     proto_tree_add_text(tspec_tree, tvb, offset2, 1,
2996                                         "Parameter %u - %s",
2997                                         param_id,
2998                                         val_to_str_ext_const(param_id, &svc_vals_ext, "Unknown"));
2999                     proto_tree_add_text(tspec_tree, tvb, offset2+1, 1,
3000                                         "Parameter %u flags: %x",
3001                                         param_id,
3002                                         tvb_get_guint8(tvb, offset2+1));
3003                     proto_tree_add_text(tspec_tree, tvb, offset2+2, 2,
3004                                         "Parameter %u data length: %u words, "
3005                                         "not including header",
3006                                         param_id,
3007                                         tvb_get_ntohs(tvb, offset2+2));
3008                     proto_tree_add_text(tspec_tree, tvb, offset2+4, 4,
3009                                         "Maximum packet size [M]: %u",
3010                                         tvb_get_ntohl(tvb, offset2+4));
3011                     proto_item_append_text(ti, "Null Service. M=%u",
3012                                            tvb_get_ntohl(tvb, offset2+4));
3013                     proto_item_append_text(ti2, "Max pkt size=%u",
3014                                            tvb_get_ntohl(tvb, offset2+4));
3015                     break;
3016
3017                 case 126:
3018                     /* Compression hint (RFC3006) */
3019                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
3020                                               offset2, param_len*4,
3021                                               "Compression Hint: ");
3022                     tspec_tree = proto_item_add_subtree(ti2, TREE(TT_TSPEC_SUBTREE));
3023
3024                     proto_tree_add_text(tspec_tree, tvb, offset2, 1,
3025                                         "Parameter %u - %s",
3026                                         param_id,
3027                                         val_to_str_ext_const(param_id, &svc_vals_ext, "Unknown"));
3028                     proto_tree_add_text(tspec_tree, tvb, offset2+1, 1,
3029                                         "Parameter %u flags: %x",
3030                                         param_id,
3031                                         tvb_get_guint8(tvb, offset2+1));
3032                     proto_tree_add_text(tspec_tree, tvb, offset2+2, 2,
3033                                         "Parameter %u data length: %u words, "
3034                                         "not including header",
3035                                         param_id,
3036                                         tvb_get_ntohs(tvb, offset2+2));
3037                     proto_tree_add_text(tspec_tree, tvb, offset2+4, 4,
3038                                         "Hint: %u",
3039                                         tvb_get_ntohl(tvb, offset2+4));
3040                     proto_tree_add_text(tspec_tree, tvb, offset2+4, 4,
3041                                         "Compression Factor: %u",
3042                                         tvb_get_ntohl(tvb, offset2+8));
3043                     proto_item_append_text(ti, "Compression Hint. Hint=%u, Factor=%u",
3044                                            tvb_get_ntohl(tvb, offset2+4),
3045                                            tvb_get_ntohl(tvb, offset2+8));
3046                     proto_item_append_text(ti2, "Hint=%u, Factor=%u",
3047                                            tvb_get_ntohl(tvb, offset2+4),
3048                                            tvb_get_ntohl(tvb, offset2+8));
3049                     break;
3050
3051                 default:
3052                     proto_tree_add_text(rsvp_object_tree, tvb, offset2, param_len*4,
3053                                         "Unknown parameter %d, %d words",
3054                                         param_id, param_len);
3055                     break;
3056                 }
3057                 param_len_processed += param_len;
3058                 offset2 += param_len*4;
3059             }
3060             mylen -= length*4;
3061         }
3062         break;
3063
3064     case 4: /* SONET/SDH Tspec */
3065         proto_item_set_text(ti, "SENDER TSPEC: SONET/SDH, ");
3066
3067         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
3068                             "C-type: 4 - SONET/SDH");
3069         signal_type = tvb_get_guint8(tvb, offset2);
3070         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
3071                             "Signal Type: %d - %s", signal_type,
3072                             val_to_str_ext_const(signal_type,
3073                                                  &gmpls_sonet_signal_type_str_ext, "Unknown"));
3074         ti2 = proto_tree_add_text(rsvp_object_tree, tvb, offset2+1, 1,
3075                             "Requested Concatenation (RCC): %d", tvb_get_guint8(tvb, offset2+1));
3076         tspec_tree = proto_item_add_subtree(ti2, TREE(TT_TSPEC_SUBTREE));
3077         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_standard_contiguous_concatenation,
3078                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
3079         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_arbitrary_contiguous_concatenation,
3080                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
3081         proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
3082                             "Number of Contiguous Components (NCC): %d", tvb_get_ntohs(tvb, offset2+2));
3083         proto_tree_add_text(rsvp_object_tree, tvb, offset2+4, 2,
3084                             "Number of Virtual Components (NVC): %d", tvb_get_ntohs(tvb, offset2+4));
3085         proto_tree_add_text(rsvp_object_tree, tvb, offset2+6, 2,
3086                             "Multiplier (MT): %d", tvb_get_ntohs(tvb, offset2+6));
3087         ti2 = proto_tree_add_text(rsvp_object_tree, tvb, offset2+8, 4,
3088                                   "Transparency (T): 0x%0x", tvb_get_ntohl(tvb, offset2+8));
3089         tspec_tree = proto_item_add_subtree(ti2, TREE(TT_TSPEC_SUBTREE));
3090
3091         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_regenerator_section,
3092                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3093         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_multiplex_section,
3094                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3095         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_J0_transparency,
3096                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3097         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_SOH_RSOH_DCC_transparency,
3098                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3099         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_LOH_MSOH_DCC_transparency,
3100                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3101         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_LOH_MSOH_extended_DCC_transparency,
3102                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3103         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_K1_K2_transparency,
3104                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3105         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_E1_transparency,
3106                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3107         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_F1_transparency,
3108                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3109         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_E2_transparency,
3110                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3111         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_B1_transparency,
3112                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3113         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_B2_transparency,
3114                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3115         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_M0_transparency,
3116                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3117         proto_tree_add_item(tspec_tree, hf_rsvp_sender_tspec_M1_transparency,
3118                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3119
3120         proto_tree_add_text(rsvp_object_tree, tvb, offset2+12, 4,
3121                             "Profile (P): %d", tvb_get_ntohl(tvb, offset2+12));
3122
3123         proto_item_append_text(ti, "Signal [%s], RCC %d, NCC %d, NVC %d, MT %d, Transparency %d, Profile %d",
3124                                val_to_str_ext_const(signal_type, &gmpls_sonet_signal_type_str_ext, "Unknown"),
3125                                tvb_get_guint8(tvb, offset2+1), tvb_get_ntohs(tvb, offset2+2),
3126                                tvb_get_ntohs(tvb, offset2+4), tvb_get_ntohs(tvb, offset2+6),
3127                                tvb_get_ntohl(tvb, offset2+8), tvb_get_ntohl(tvb, offset2+12));
3128         break;
3129
3130     case 5: /* FF: G.709 TSPEC, RFC 4328 */
3131         proto_item_set_text(ti, "SENDER TSPEC: G.709, ");
3132
3133         proto_tree_add_text(rsvp_object_tree, tvb, offset + 3, 1,
3134                             "C-type: 5 - G.709");
3135         signal_type = tvb_get_guint8(tvb, offset2);
3136         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
3137                             "Signal Type: %d - %s", signal_type,
3138                             rval_to_str(signal_type,
3139                                         gmpls_g709_signal_type_rvals,
3140                                         "Unknown"));
3141         proto_tree_add_text(rsvp_object_tree, tvb, offset2 + 2, 2,
3142                             "Number of Multiplexed Components (NMC): %d",
3143                             tvb_get_ntohs(tvb, offset2 + 2));
3144         proto_tree_add_text(rsvp_object_tree, tvb, offset2 + 4, 2,
3145                             "Number of Virtual Components (NVC): %d",
3146                             tvb_get_ntohs(tvb, offset2 + 4));
3147
3148         proto_tree_add_text(rsvp_object_tree, tvb, offset2 + 6, 2,
3149                             "Multiplier (MT): %d",
3150                             tvb_get_ntohs(tvb, offset2 + 6));
3151         proto_item_append_text(ti, "Signal [%s], NMC %d, NVC %d, MT %d",
3152                                rval_to_str(signal_type,
3153                                            gmpls_g709_signal_type_rvals,
3154                                            "Unknown"),
3155                                tvb_get_ntohs(tvb, offset2 + 2),
3156                                tvb_get_ntohs(tvb, offset2 + 4),
3157                                tvb_get_ntohs(tvb, offset2 + 6));
3158         break;
3159
3160     case 6:   /* Ethernet TSPEC (RFC6003)  */
3161         proto_item_set_text(ti, "SENDER TSPEC: Ethernet, ");
3162         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
3163                             "C-type: 6 - Ethernet");
3164         switch_gran = tvb_get_ntohs(tvb, offset2);
3165         if (switch_gran == 0)
3166           proto_tree_add_text(rsvp_object_tree, tvb, offset2, 2,
3167                               "Switching granularity: 0 - Provided in signaling");
3168         else if (switch_gran == 1)
3169           proto_tree_add_text(rsvp_object_tree, tvb, offset2, 2,
3170                               "Switching granularity: 1 - Ethernet port");
3171         else if (switch_gran == 2)
3172           proto_tree_add_text(rsvp_object_tree, tvb, offset2, 2,
3173                               "Switching granularity: 2 - Ethernet frame");
3174         else
3175           proto_tree_add_text(rsvp_object_tree, tvb, offset2, 2,
3176                               "Switching granularity: %u - ???", switch_gran);
3177
3178         proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
3179                             "MTU: %u", tvb_get_ntohs(tvb, offset2+2));
3180
3181         dissect_rsvp_eth_tspec_tlv(ti, rsvp_object_tree, tvb, offset+8, obj_length-8,
3182                                    TREE(TT_TSPEC_SUBTREE));
3183         break;
3184
3185     default: /* Unknown TSpec */
3186         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
3187                             "C-type: Unknown (%u)",
3188                             type);
3189         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
3190                             "Data (%d bytes)", obj_length - 4);
3191         break;
3192
3193     }
3194 }
3195
3196 /*------------------------------------------------------------------------------
3197  * FLOWSPEC
3198  *------------------------------------------------------------------------------*/
3199 static void
3200 dissect_rsvp_flowspec(proto_item *ti, proto_tree *rsvp_object_tree,
3201                       tvbuff_t *tvb,
3202                       int offset, int obj_length,
3203                       int rsvp_class _U_, int type)
3204 {
3205     int         offset2 = offset + 4;
3206     int         mylen, signal_type;
3207     proto_tree *flowspec_tree, *ti2;
3208     proto_item *item;
3209     guint16     switch_gran;
3210
3211     proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
3212                         "C-type: %u", type);
3213     mylen = obj_length - 4;
3214
3215     switch(type) {
3216
3217     case 2:
3218         if (mylen < 4) {
3219             item = proto_tree_add_text(rsvp_object_tree, tvb, 0, 0,
3220                                        "Object length %u < 8", obj_length);
3221             PROTO_ITEM_SET_GENERATED(item);
3222             return;
3223         }
3224         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
3225                             "Message format version: %u",
3226                             tvb_get_guint8(tvb, offset2)>>4);
3227         proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
3228                             "Data length: %u words, not including header",
3229                             tvb_get_ntohs(tvb, offset2+2));
3230
3231         proto_item_set_text(ti, "FLOWSPEC: ");
3232
3233         mylen -= 4;
3234         offset2+= 4;
3235         while (mylen > 0) {
3236             guint8 service_num;
3237             guint length;
3238             guint8 param_id;
3239             guint param_len;
3240             guint param_len_processed;
3241
3242             if (mylen < 4) {
3243                 item = proto_tree_add_text(rsvp_object_tree, tvb, 0, 0,
3244                                            "Object length %u not large enough",
3245                                            obj_length);
3246                 PROTO_ITEM_SET_GENERATED(item);
3247                 return;
3248             }
3249             service_num = tvb_get_guint8(tvb, offset2);
3250             proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
3251                                 "Service header: %u - %s",
3252                                 service_num,
3253                                 val_to_str_ext_const(service_num, &intsrv_services_str_ext, "Unknown"));
3254             length = tvb_get_ntohs(tvb, offset2+2);
3255             proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
3256                                 "Length of service %u data: %u words, "
3257                                 "not including header",
3258                                 service_num,
3259                                 length);
3260
3261             mylen   -= 4;
3262             offset2 += 4;
3263
3264             proto_item_append_text(ti, "%s: ",
3265                                    val_to_str_ext(service_num, &intsrv_services_str_ext,
3266                                                   "Unknown (%d)"));
3267
3268             /* Process all known service headers as a set of parameters */
3269             param_len_processed = 0;
3270             while (param_len_processed < length) {
3271                 param_id = tvb_get_guint8(tvb, offset2);
3272                 param_len = tvb_get_ntohs(tvb, offset2+2) + 1;
3273                 if (param_len < 1)
3274                     THROW(ReportedBoundsError);
3275                 switch(param_id) {
3276                 case 127:
3277                     /* Token Bucket */
3278                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
3279                                               offset2, param_len*4,
3280                                               "Token Bucket: ");
3281                     flowspec_tree = proto_item_add_subtree(ti2, TREE(TT_FLOWSPEC_SUBTREE));
3282
3283                     proto_tree_add_text(flowspec_tree, tvb, offset2, 1,
3284                                         "Parameter %u - %s",
3285                                         param_id,
3286                                         val_to_str_ext_const(param_id, &svc_vals_ext, "Unknown"));
3287                     proto_tree_add_text(flowspec_tree, tvb, offset2+1, 1,
3288                                         "Parameter %u flags: 0x%02x",
3289                                         param_id,
3290                                         tvb_get_guint8(tvb, offset2+1));
3291                     proto_tree_add_text(flowspec_tree, tvb, offset2+2, 2,
3292                                         "Parameter %u data length: %u words, "
3293                                         "not including header",
3294                                         param_id,
3295                                         tvb_get_ntohs(tvb, offset2+2));
3296                     proto_tree_add_text(flowspec_tree, tvb, offset2+4, 4,
3297                                         "Token bucket rate: %.10g",
3298                                         tvb_get_ntohieee_float(tvb, offset2+4));
3299                     proto_tree_add_text(flowspec_tree, tvb, offset2+8, 4,
3300                                         "Token bucket size: %.10g",
3301                                         tvb_get_ntohieee_float(tvb, offset2+8));
3302                     proto_tree_add_text(flowspec_tree, tvb, offset2+12, 4,
3303                                         "Peak data rate: %.10g",
3304                                         tvb_get_ntohieee_float(tvb, offset2+12));
3305                     proto_tree_add_text(flowspec_tree, tvb, offset2+16, 4,
3306                                         "Minimum policed unit [m]: %u",
3307                                         tvb_get_ntohl(tvb, offset2+16));
3308                     proto_tree_add_text(flowspec_tree, tvb, offset2+20, 4,
3309                                         "Maximum packet size [M]: %u",
3310                                         tvb_get_ntohl(tvb, offset2+20));
3311                     proto_item_append_text(ti, "Token Bucket, %.10g bytes/sec. ",
3312                                            tvb_get_ntohieee_float(tvb, offset2+4));
3313                     proto_item_append_text(ti2, "Rate=%.10g Burst=%.10g Peak=%.10g m=%u M=%u",
3314                                            tvb_get_ntohieee_float(tvb, offset2+4),
3315                                            tvb_get_ntohieee_float(tvb, offset2+8),
3316                                            tvb_get_ntohieee_float(tvb, offset2+12),
3317                                            tvb_get_ntohl(tvb, offset2+16),
3318                                            tvb_get_ntohl(tvb, offset2+20));
3319                     break;
3320
3321                 case 130:
3322                     /* Guaranteed-rate RSpec */
3323                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
3324                                               offset2, param_len*4,
3325                                               "Guaranteed-Rate RSpec: ");
3326                     flowspec_tree = proto_item_add_subtree(ti2, TREE(TT_FLOWSPEC_SUBTREE));
3327                     proto_tree_add_text(flowspec_tree, tvb, offset2, 1,
3328                                         "Parameter %u - %s",
3329                                         param_id,
3330                                         val_to_str_ext_const(param_id, &svc_vals_ext, "Unknown"));
3331                     proto_tree_add_text(flowspec_tree, tvb, offset2+1, 1,
3332                                         "Parameter %u flags: %x",
3333                                         param_id,
3334                                         tvb_get_guint8(tvb, offset2+1));
3335                     proto_tree_add_text(flowspec_tree, tvb, offset2+2, 2,
3336                                         "Parameter %u data length: %u words, "
3337                                         "not including header",
3338                                         param_id,
3339                                         tvb_get_ntohs(tvb, offset2+2));
3340
3341                     proto_tree_add_text(flowspec_tree, tvb, offset2+4, 4,
3342                                         "Rate: %.10g",
3343                                         tvb_get_ntohieee_float(tvb, offset2+4));
3344                     proto_tree_add_text(flowspec_tree, tvb, offset2+8, 4,
3345                                         "Slack term: %u",
3346                                         tvb_get_ntohl(tvb, offset2+8));
3347                     proto_item_append_text(ti, "RSpec, %.10g bytes/sec. ",
3348                                            tvb_get_ntohieee_float(tvb, offset2+4));
3349                     proto_item_append_text(ti2, "R=%.10g, s=%u",
3350                                            tvb_get_ntohieee_float(tvb, offset2+4),
3351                                            tvb_get_ntohl(tvb, offset2+8));
3352                     break;
3353
3354                 case 128:
3355                     /* Null Service (RFC2997) */
3356                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
3357                                               offset2, param_len*4,
3358                                               "Null Service Flowspec: ");
3359                     flowspec_tree = proto_item_add_subtree(ti2, TREE(TT_FLOWSPEC_SUBTREE));
3360
3361                     proto_tree_add_text(flowspec_tree, tvb, offset2, 1,
3362                                         "Parameter %u - %s",
3363                                         param_id,
3364                                         val_to_str_ext_const(param_id, &svc_vals_ext, "Unknown"));
3365                     proto_tree_add_text(flowspec_tree, tvb, offset2+1, 1,
3366                                         "Parameter %u flags: %x",
3367                                         param_id,
3368                                         tvb_get_guint8(tvb, offset2+1));
3369                     proto_tree_add_text(flowspec_tree, tvb, offset2+2, 2,
3370                                         "Parameter %u data length: %u words, "
3371                                         "not including header",
3372                                         param_id,
3373                                         tvb_get_ntohs(tvb, offset2+2));
3374                     proto_tree_add_text(flowspec_tree, tvb, offset2+4, 4,
3375                                         "Maximum packet size [M]: %u",
3376                                         tvb_get_ntohl(tvb, offset2+4));
3377                     proto_item_append_text(ti, "Null Service. M=%u",
3378                                            tvb_get_ntohl(tvb, offset2+4));
3379                     proto_item_append_text(ti2, "Max pkt size=%u",
3380                                            tvb_get_ntohl(tvb, offset2+4));
3381                     break;
3382
3383                 default:
3384                     proto_tree_add_text(rsvp_object_tree, tvb, offset2, param_len*4,
3385                                         "Unknown parameter %d, %d words",
3386                                         param_id, param_len);
3387                     break;
3388                 }
3389                 param_len_processed += param_len;
3390                 offset2 += param_len * 4;
3391             }
3392
3393             /* offset2 += length*4; */
3394             mylen -= length*4;
3395         }
3396         break;
3397
3398     case 4:
3399         proto_item_set_text(ti, "FLOWSPEC: SONET/SDH, ");
3400
3401         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
3402                             "C-type: 4 - SONET/SDH");
3403         signal_type = tvb_get_guint8(tvb, offset2);
3404         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
3405                             "Signal Type: %d - %s", signal_type,
3406                             val_to_str_ext_const(signal_type,
3407                                                  &gmpls_sonet_signal_type_str_ext, "Unknown"));
3408         ti2 = proto_tree_add_text(rsvp_object_tree, tvb, offset2+1, 1,
3409                                   "Requested Concatenation (RCC): %d", tvb_get_guint8(tvb, offset2+1));
3410         flowspec_tree = proto_item_add_subtree(ti2, TREE(TT_FLOWSPEC_SUBTREE));
3411         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_standard_contiguous_concatenation,
3412                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
3413         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_arbitrary_contiguous_concatenation,
3414                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
3415         proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
3416                             "Number of Contiguous Components (NCC): %d", tvb_get_ntohs(tvb, offset2+2));
3417         proto_tree_add_text(rsvp_object_tree, tvb, offset2+4, 2,
3418                             "Number of Virtual Components (NVC): %d", tvb_get_ntohs(tvb, offset2+4));
3419         proto_tree_add_text(rsvp_object_tree, tvb, offset2+6, 2,
3420                             "Multiplier (MT): %d", tvb_get_ntohs(tvb, offset2+6));
3421         ti2 = proto_tree_add_text(rsvp_object_tree, tvb, offset2+8, 4,
3422                                   "Transparency (T): 0x%0x", tvb_get_ntohl(tvb, offset2+8));
3423         flowspec_tree = proto_item_add_subtree(ti2, TREE(TT_FLOWSPEC_SUBTREE));
3424
3425         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_regenerator_section,
3426                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3427         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_multiplex_section,
3428                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3429         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_J0_transparency,
3430                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3431         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_SOH_RSOH_DCC_transparency,
3432                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3433         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_LOH_MSOH_DCC_transparency,
3434                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3435         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_LOH_MSOH_extended_DCC_transparency,
3436                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3437         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_K1_K2_transparency,
3438                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3439         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_E1_transparency,
3440                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3441         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_F1_transparency,
3442                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3443         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_E2_transparency,
3444                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3445         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_B1_transparency,
3446                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3447         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_B2_transparency,
3448                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3449         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_M0_transparency,
3450                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3451         proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_M1_transparency,
3452                              tvb, offset2+8, 4, ENC_BIG_ENDIAN);
3453
3454         proto_tree_add_text(rsvp_object_tree, tvb, offset2+12, 4,
3455                             "Profile (P): %d", tvb_get_ntohl(tvb, offset2+12));
3456
3457         proto_item_append_text(ti, "Signal [%s], RCC %d, NCC %d, NVC %d, MT %d, Transparency %d, Profile %d",
3458                                val_to_str_ext_const(signal_type, &gmpls_sonet_signal_type_str_ext, "Unknown"),
3459                                tvb_get_guint8(tvb, offset2+1), tvb_get_ntohs(tvb, offset2+2),
3460                                tvb_get_ntohs(tvb, offset2+4), tvb_get_ntohs(tvb, offset2+6),
3461                                tvb_get_ntohl(tvb, offset2+8), tvb_get_ntohl(tvb, offset2+12));
3462         break;
3463
3464     case 5: /* FF: G.709 FLOWSPEC, RFC 4328 */
3465         proto_item_set_text(ti, "FLOWSPEC: G.709, ");
3466
3467         proto_tree_add_text(rsvp_object_tree, tvb, offset + 3, 1,
3468                             "C-type: 5 - G.709");
3469         signal_type = tvb_get_guint8(tvb, offset2);
3470         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
3471                             "Signal Type: %d - %s", signal_type,
3472                             rval_to_str(signal_type,
3473                                         gmpls_g709_signal_type_rvals,
3474                                         "Unknown"));
3475         proto_tree_add_text(rsvp_object_tree, tvb, offset2 + 2, 2,
3476                             "Number of Multiplexed Components (NMC): %d",
3477                             tvb_get_ntohs(tvb, offset2 + 2));
3478         proto_tree_add_text(rsvp_object_tree, tvb, offset2 + 4, 2,
3479                             "Number of Virtual Components (NVC): %d",
3480                             tvb_get_ntohs(tvb, offset2 + 4));
3481
3482         proto_tree_add_text(rsvp_object_tree, tvb, offset2 + 6, 2,
3483                             "Multiplier (MT): %d",
3484                             tvb_get_ntohs(tvb, offset2 + 6));
3485         proto_item_append_text(ti, "Signal [%s], NMC %d, NVC %d, MT %d",
3486                                rval_to_str(signal_type,
3487                                            gmpls_g709_signal_type_rvals,
3488                                            "Unknown"),
3489                                tvb_get_ntohs(tvb, offset2 + 2),
3490                                tvb_get_ntohs(tvb, offset2 + 4),
3491                                tvb_get_ntohs(tvb, offset2 + 6));
3492         break;
3493
3494     case 6:   /* Ethernet FLOWSPEC (RFC6003)  */
3495         proto_item_set_text(ti, "FLOWSPEC: Ethernet, ");
3496         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
3497                             "C-type: 6 - Ethernet");
3498         switch_gran = tvb_get_ntohs(tvb, offset2);
3499         if (switch_gran == 0)
3500             proto_tree_add_text(rsvp_object_tree, tvb, offset2, 2,
3501                                 "Switching granularity: 0 - Provided in signaling");
3502         else if (switch_gran == 1)
3503             proto_tree_add_text(rsvp_object_tree, tvb, offset2, 2,
3504                                 "Switching granularity: 1 - Ethernet port");
3505         else if (switch_gran == 2)
3506             proto_tree_add_text(rsvp_object_tree, tvb, offset2, 2,
3507                                 "Switching granularity: 2 - Ethernet frame");
3508         else
3509             proto_tree_add_text(rsvp_object_tree, tvb, offset2, 2,
3510                                 "Switching granularity: %u - ???", switch_gran);
3511
3512         proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
3513                             "MTU: %u", tvb_get_ntohs(tvb, offset2+2));
3514
3515         dissect_rsvp_eth_tspec_tlv(ti, rsvp_object_tree, tvb, offset+8, obj_length-8,
3516                                    TREE(TT_FLOWSPEC_SUBTREE));
3517         break;
3518
3519     default:
3520         break;
3521     }
3522 }
3523
3524 /*------------------------------------------------------------------------------
3525  * ADSPEC
3526  *------------------------------------------------------------------------------*/
3527 static void
3528 dissect_rsvp_adspec(proto_item *ti, proto_tree *rsvp_object_tree,
3529                     tvbuff_t *tvb,
3530                     int offset, int obj_length,
3531                     int rsvp_class _U_, int type)
3532 {
3533     int         offset2 = offset + 4;
3534     int         mylen, i;
3535     proto_tree *adspec_tree;
3536
3537     proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
3538                         "C-type: %u", type);
3539     mylen = obj_length - 4;
3540
3541     proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
3542                         "Message format version: %u",
3543                         tvb_get_guint8(tvb, offset2)>>4);
3544     proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
3545                         "Data length: %u words, not including header",
3546                         tvb_get_ntohs(tvb, offset2+2));
3547     mylen -= 4;
3548     offset2 += 4;
3549     while (mylen > 0) {
3550         guint8 service_num;
3551         guint8 break_bit;
3552         guint length;
3553         const char *str;
3554
3555         service_num = tvb_get_guint8(tvb, offset2);
3556         str = val_to_str_ext_const(service_num, &intsrv_services_str_ext, "Unknown");
3557         break_bit = tvb_get_guint8(tvb, offset2+1);
3558         length = tvb_get_ntohs(tvb, offset2+2);
3559         ti = proto_tree_add_text(rsvp_object_tree, tvb, offset2,
3560                                  (length+1)*4, "%s",
3561                                  str);
3562         adspec_tree = proto_item_add_subtree(ti,
3563                                              TREE(TT_ADSPEC_SUBTREE));
3564         proto_tree_add_text(adspec_tree, tvb, offset2, 1,
3565                             "Service header %u - %s",
3566                             service_num, str);
3567         proto_tree_add_text(adspec_tree, tvb, offset2+1, 1,
3568                             (break_bit&0x80)?
3569                             "Break bit set":"Break bit not set");
3570         proto_tree_add_text(adspec_tree, tvb, offset2+2, 2,
3571                             "Data length: %u words, not including header",
3572                             length);
3573         mylen -= 4;
3574         offset2 += 4;
3575         i = length*4;
3576         while (i > 0) {
3577             guint8 id;
3578             guint phdr_length;
3579
3580             id = tvb_get_guint8(tvb, offset2);
3581             phdr_length = tvb_get_ntohs(tvb, offset2+2);
3582             str = try_val_to_str_ext(id, &adspec_params_ext);
3583             if (str) {
3584                 switch(id) {
3585                 case 4:
3586                 case 8:
3587                 case 10:
3588                 case 133:
3589                 case 134:
3590                 case 135:
3591                 case 136:
3592                     /* 32-bit unsigned integer */
3593                     proto_tree_add_text(adspec_tree, tvb, offset2,
3594                                         (phdr_length+1)<<2,
3595                                         "%s - %u (type %u, length %u)",
3596                                         str,
3597                                         tvb_get_ntohl(tvb, offset2+4),
3598                                         id, phdr_length);
3599                     break;
3600
3601                 case 6:
3602                     /* IEEE float */
3603                     proto_tree_add_text(adspec_tree, tvb, offset2,
3604                                         (phdr_length+1)<<2,
3605                                         "%s - %.10g (type %u, length %u)",
3606                                         str,
3607                                         tvb_get_ntohieee_float(tvb, offset2+4),
3608                                         id, phdr_length);
3609                     break;
3610                 default:
3611                     proto_tree_add_text(adspec_tree, tvb, offset2,
3612                                         (phdr_length+1)<<2,
3613                                         "%s (type %u, length %u)",
3614                                         str,
3615                                         id, phdr_length);
3616                     break;
3617                 }
3618             } else {
3619                 proto_tree_add_text(adspec_tree, tvb, offset2,
3620                                     (phdr_length+1)<<2,
3621                                     "Unknown (type %u, length %u)",
3622                                     id, phdr_length);
3623             }
3624             offset2 += (phdr_length+1)<<2;
3625             i -= (phdr_length+1)<<2;
3626             mylen -= (phdr_length+1)<<2;
3627         }
3628     }
3629 }
3630
3631 /*------------------------------------------------------------------------------
3632  * INTEGRITY
3633  *------------------------------------------------------------------------------*/
3634 static void
3635 dissect_rsvp_integrity(proto_item *ti _U_, proto_tree *rsvp_object_tree,
3636                        tvbuff_t *tvb,
3637                        int offset, int obj_length,
3638                        int rsvp_class _U_, int type)
3639 {
3640     int         offset2 = offset + 4;
3641     proto_tree *ti2, *rsvp_integ_flags_tree;
3642     int         flags;
3643
3644     proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
3645                         "C-type: %u", type);
3646     flags = tvb_get_guint8(tvb, offset2);
3647     ti2 = proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
3648                               "Flags: 0x%02x", flags);
3649     rsvp_integ_flags_tree = proto_item_add_subtree(ti2, TREE(TT_INTEGRITY_FLAGS));
3650     proto_tree_add_item(rsvp_integ_flags_tree, hf_rsvp_integrity_flags_handshake,
3651                              tvb, offset2, 1, ENC_BIG_ENDIAN);
3652     proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 6,
3653                         "Key Identifier: %s", tvb_bytes_to_str(tvb, offset2+2, 6));
3654     proto_tree_add_text(rsvp_object_tree, tvb, offset2+8, 8,
3655                         "Sequence Number: %" G_GINT64_MODIFIER "u", tvb_get_ntoh64(tvb, offset2+8));
3656     proto_tree_add_text(rsvp_object_tree, tvb, offset2+16, obj_length - 20,
3657                         "Hash: %s", tvb_bytes_to_str(tvb, offset2+16, obj_length - 20));
3658 }
3659
3660 /*------------------------------------------------------------------------------
3661  * POLICY
3662  *------------------------------------------------------------------------------*/
3663 static void
3664 dissect_rsvp_policy(proto_item *ti _U_, proto_tree *rsvp_object_tree,
3665                     tvbuff_t *tvb,
3666                     int offset, int obj_length,
3667                     int rsvp_class _U_, int type)
3668 {
3669     int offset2 = offset + 4;
3670
3671     proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
3672                         "C-type: %u", type);
3673     proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
3674                         "Data (%d bytes)", obj_length - 4);
3675 }
3676
3677 /*------------------------------------------------------------------------------
3678  * LABEL_REQUEST
3679  *------------------------------------------------------------------------------*/
3680 static void
3681 dissect_rsvp_label_request(proto_item *ti, proto_tree *rsvp_object_tree,
3682                            tvbuff_t *tvb,
3683                            int offset, int obj_length,
3684                            int rsvp_class _U_, int type)
3685 {
3686     int offset2 = offset + 4;
3687     static const value_string lab_req_type_str[] = {
3688         { 1, ""},
3689         { 2, "(Label Request with ATM label Range)"},
3690         { 3, "(Label Request with Frame-Relay label Range)"},
3691         { 4, "(Generalized Label Request)"},
3692         { 5, "(Generalized Channel_set Label Request)"},
3693         { 0, NULL }
3694     };
3695     static value_string_ext lab_req_type_str_ext = VALUE_STRING_EXT_INIT(lab_req_type_str);
3696
3697     proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
3698                         "C-type: %d %s", type,
3699                         val_to_str_ext_const(type, &lab_req_type_str_ext, "Unknown"));
3700     switch(type) {
3701     case 1: {
3702         unsigned short l3pid = tvb_get_ntohs(tvb, offset2+2);
3703         proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
3704                             "L3PID: %s (0x%04x)",
3705                             val_to_str_const(l3pid, etype_vals, "Unknown"),
3706                             l3pid);
3707         proto_item_set_text(ti, "LABEL REQUEST: Basic: L3PID: %s (0x%04x)",
3708                             val_to_str_const(l3pid, etype_vals, "Unknown"),
3709                             l3pid);
3710         break;
3711     }
3712
3713     case 2: {
3714         unsigned short l3pid = tvb_get_ntohs(tvb, offset2+2);
3715         unsigned short min_vpi, min_vci, max_vpi, max_vci;
3716         proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
3717                             "L3PID: %s (0x%04x)",
3718                             val_to_str_const(l3pid, etype_vals, "Unknown"),
3719                             l3pid);
3720         proto_tree_add_text(rsvp_object_tree, tvb, offset2+4, 1,
3721                             "M: %s Merge in Data Plane",
3722                             (tvb_get_guint8(tvb, offset2+4) & 0x80) ?
3723                             "1: Can" : "0: Cannot");
3724         min_vpi = tvb_get_ntohs(tvb, offset2+4) & 0x7f;
3725         min_vci = tvb_get_ntohs(tvb, offset2+6);
3726         max_vpi = tvb_get_ntohs(tvb, offset2+8) & 0x7f;
3727         max_vci = tvb_get_ntohs(tvb, offset2+10);
3728         proto_tree_add_text(rsvp_object_tree, tvb, offset2+4, 2,
3729                             "Min VPI: %d", min_vpi);
3730         proto_tree_add_text(rsvp_object_tree, tvb, offset2+6, 2,
3731                             "Min VCI: %d", min_vci);
3732         proto_tree_add_text(rsvp_object_tree, tvb, offset2+8, 2,
3733                             "Max VPI: %d", max_vpi);
3734         proto_tree_add_text(rsvp_object_tree, tvb, offset2+10, 2,
3735                             "Max VCI: %d", max_vci);
3736         proto_item_set_text(ti, "LABEL REQUEST: ATM: L3PID: %s (0x%04x). VPI/VCI: Min: %d/%d, Max: %d/%d. %s Merge. ",
3737                             val_to_str_const(l3pid, etype_vals, "Unknown"), l3pid,
3738                             min_vpi, min_vci, max_vpi, max_vci,
3739                             (tvb_get_guint8(tvb, offset2+4) & 0x80) ? "Can" : "Cannot");
3740         break;
3741     }
3742
3743     case 3: {
3744         guint16 l3pid = tvb_get_ntohs(tvb, offset2+2);
3745         guint32 min_dlci, max_dlci, dlci_len, dlci_len_code;
3746         proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
3747                             "L3PID: %s (0x%04x)",
3748                             val_to_str_const(l3pid, etype_vals, "Unknown"),
3749                             l3pid);
3750         dlci_len_code = (tvb_get_ntohs(tvb, offset2+4) & 0x0180) >> 7;
3751         min_dlci = tvb_get_ntohl(tvb, offset2+4) & 0x7fffff;
3752         max_dlci = tvb_get_ntohl(tvb, offset2+8) & 0x7fffff;
3753         switch(dlci_len_code) {
3754         case 0:
3755             /* 10-bit DLCIs */
3756             dlci_len = 10;
3757             min_dlci &= 0x3ff;
3758             max_dlci &= 0x3ff;
3759             break;
3760         case 2:
3761             dlci_len = 23;
3762             break;
3763         default:
3764             dlci_len = 0;
3765             min_dlci = 0;
3766             max_dlci = 0;
3767             break;
3768         }
3769         proto_tree_add_text(rsvp_object_tree, tvb, offset2+4, 2,
3770                             "DLCI Length: %s (%d)",
3771                             (dlci_len==10) ? "10 bits" :
3772                             (dlci_len==23) ? "23 bits" :
3773                             "INVALID", dlci_len_code);
3774         proto_tree_add_text(rsvp_object_tree, tvb, offset2+5, 3,
3775                             "Min DLCI: %d", min_dlci);
3776         proto_tree_add_text(rsvp_object_tree, tvb, offset2+8, 2,
3777                             "Max DLCI: %d", max_dlci);
3778         proto_item_set_text(ti, "LABEL REQUEST: Frame: L3PID: %s (0x%04x). DLCI Len: %s. Min DLCI: %d. Max DLCI: %d",
3779                             val_to_str_const(l3pid, etype_vals, "Unknown"), l3pid,
3780                             (dlci_len==10) ? "10 bits" :
3781                             (dlci_len==23) ? "23 bits" :
3782                             "INVALID", min_dlci, max_dlci);
3783         break;
3784     }
3785     case 4:
3786     case 5: {
3787         unsigned short l3pid = tvb_get_ntohs(tvb, offset2+2);
3788         unsigned char  lsp_enc = tvb_get_guint8(tvb,offset2);
3789         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
3790                             "LSP Encoding Type: %s",
3791                             rval_to_str(lsp_enc, gmpls_lsp_enc_rvals, "Unknown (%d)"));
3792         proto_tree_add_text(rsvp_object_tree, tvb, offset2+1, 1,
3793                             "Switching Type: %s",
3794                             rval_to_str(tvb_get_guint8(tvb,offset2+1),
3795                                         gmpls_switching_type_rvals, "Unknown (%d)"));
3796         proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2,
3797                             "G-PID: %s (0x%0x)",
3798                             rval_to_str(l3pid, gmpls_gpid_rvals,
3799                                         val_to_str(l3pid, etype_vals,
3800                                                    "Unknown G-PID(0x%04x)")),
3801                             l3pid);
3802         proto_item_set_text(ti, "LABEL REQUEST: Generalized: LSP Encoding=%s, "
3803                             "Switching Type=%s, G-PID=%s ",
3804                             rval_to_str(lsp_enc, gmpls_lsp_enc_rvals, "Unknown (%d)"),
3805                             rval_to_str(tvb_get_guint8(tvb,offset2+1),
3806                                        gmpls_switching_type_rvals, "Unknown (%d)"),
3807                             rval_to_str(l3pid, gmpls_gpid_rvals,
3808                                         val_to_str(l3pid, etype_vals,
3809                                                    "Unknown (0x%04x)")));
3810         break;
3811     }
3812
3813     default:
3814         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
3815                             "Data (%d bytes)", obj_length - 4);
3816         break;
3817     } /* switch(type) */
3818 }
3819
3820 /*-----------------------------------------------------------------------------
3821  * LABEL
3822  *---------------------------------------------------------------------------*/
3823
3824 /*
3825    FF: G.694 lambda label, see draft-ietf-ccamp-gmpls-g-694-lambda-labels-05
3826
3827     0                   1                   2                   3
3828     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
3829    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3830    |Grid | C.S   |    Reserved     |              n                |
3831    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3832  */
3833 static void
3834 dissect_glabel_lambda(proto_tree *ti _U_, proto_tree *rsvp_object_tree,
3835                       tvbuff_t *tvb,
3836                       int offset)
3837 {
3838     float   freq       = 0.0f;
3839     guint32 wavelength = 0;
3840     float   cs_thz     = 0.0f;
3841
3842     guint8 grid = ((tvb_get_guint8(tvb, offset) & 0xE0) >> 5);
3843     guint8 cs   = ((tvb_get_guint8(tvb, offset) & 0x1E) >> 1);
3844     gint16 n    = tvb_get_ntohs(tvb, offset + 2);
3845
3846     if (grid == 1) {
3847         /* DWDM grid: Frequency (THz) = 193.1 THz + n * channel spacing (THz) */
3848         cs_thz =
3849             cs == 1 ? 0.1f :
3850             cs == 2 ? 0.05f :
3851             cs == 3 ? 0.025f :
3852             cs == 4 ? 0.0125f :
3853         0.0f;
3854         freq = 193.1f + (n * cs_thz);
3855         proto_tree_add_text(rsvp_object_tree, tvb, offset, 4,
3856                             "Wavelength Label: "
3857                             "grid=%s, "
3858                             "channel spacing=%s, "
3859                             "n=%d, "
3860                             "freq=%.2fTHz",
3861                             /* grid */
3862                             "DWDM",
3863                             /* channel spacing */
3864                             cs == 1 ? "100GHz" :
3865                             cs == 2 ? "50GHz" :
3866                             cs == 3 ? "25GHz" :
3867                             cs == 4 ? "12.5GHz" :
3868                             "unknown",
3869                             /* n */
3870                             n,
3871                             /* frequency */
3872                             freq);
3873         proto_item_append_text(ti, ": Wavelength: "
3874                                "grid=%s, "
3875                                "channel spacing=%s, "
3876                                "n=%d, "
3877                                "freq=%.2fTHz",
3878                                "DWDM",
3879                                cs == 1 ? "100GHz" :
3880                                cs == 2 ? "50GHz" :
3881                                cs == 3 ? "25GHz" :
3882                                cs == 4 ? "12.5GHz" :
3883                                "unknown",
3884                                n,
3885                                freq);
3886     } else if (grid == 2) {
3887         /* CWDM grid: Wavelength (nm) = 1471 nm + n * 20 nm  */
3888         wavelength = 1471 + (n * 20);
3889         proto_tree_add_text(rsvp_object_tree, tvb, offset, 4,
3890                             "Wavelength Label: "
3891                             "grid=%s, "
3892                             "channel spacing=%s, "
3893                             "n=%d, "
3894                             "wavelength=%unm",
3895                             /* grid */
3896                             "CWDM",
3897                             /* channel spacing */
3898                             cs == 1 ? "20nm" :
3899                             "unknown",
3900                             /* n */
3901                             n,
3902                             /* wavelength */
3903                             wavelength);
3904         proto_item_append_text(ti, ": Wavelength: "
3905                                "grid=%s, "
3906                                "channel spacing=%s, "
3907                                "n=%d, "
3908                                "wavelength=%unm",
3909                                "CWDM",
3910                                cs == 1 ? "20nm" :
3911                                "unknown",
3912                                n,
3913                                wavelength);
3914     } else {
3915         /* unknown grid: */
3916         proto_tree_add_text(rsvp_object_tree, tvb, offset, 4,
3917                             "Wavelength Label: "
3918                             "grid=%u, "
3919                             "channel spacing=%u, "
3920                             "n=%d",
3921                             grid, cs, n);
3922         proto_item_append_text(ti, ": Wavelength: "
3923                                "grid=%u, "
3924                                "channel spacing=%u, "
3925                                "n=%d",
3926                                grid, cs, n);
3927     }
3928     return;
3929 }
3930
3931 /*
3932    FF: SONET/SDH label, see RFC 4606
3933
3934     0                   1                   2                   3
3935     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
3936    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3937    |               S               |   U   |   K   |   L   |   M   |
3938    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3939 */
3940 static void
3941 dissect_glabel_sdh(proto_tree *ti _U_, proto_tree *rsvp_object_tree,
3942                    tvbuff_t *tvb,
3943                    int offset)
3944 {
3945     guint16 s = tvb_get_ntohs(tvb, offset);
3946     guint8 u = ((tvb_get_guint8(tvb, offset + 2) & 0xF0) >> 4);
3947     guint8 k = ((tvb_get_guint8(tvb, offset + 2) & 0x0F) >> 0);
3948     guint8 l = ((tvb_get_guint8(tvb, offset + 3) & 0xF0) >> 4);
3949     guint8 m = ((tvb_get_guint8(tvb, offset + 3) & 0x0F) >> 0);
3950
3951     proto_tree_add_text(rsvp_object_tree, tvb, offset, 4,
3952                         "SONET/SDH Label: "
3953                         "S=%u, "
3954                         "U=%u, "
3955                         "K=%u, "
3956                         "L=%u, "
3957                         "M=%u",
3958                         s, u, k, l, m);
3959     proto_item_append_text(ti, ": SONET/SDH: "
3960                            "S=%u, "
3961                            "U=%u, "
3962                            "K=%u, "
3963                            "L=%u, "
3964                            "M=%u",
3965                            s, u, k, l, m);
3966 }
3967
3968 /*
3969     FF: G.709 label (aka ODUk label), see RFC 4328
3970
3971      0                   1                   2                   3
3972      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
3973     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3974     |                   Reserved                |     t3    | t2  |t1
3975     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3976 */
3977 static void
3978 dissect_glabel_g709(proto_tree *ti _U_, proto_tree *rsvp_object_tree,
3979                     tvbuff_t *tvb,
3980                     int offset)
3981 {
3982     guint8 t2 = ((tvb_get_guint8(tvb, offset + 3) & 0x0E) >> 1);
3983     guint8 t1 = ((tvb_get_guint8(tvb, offset + 3) & 0x01) >> 0);
3984
3985     guint8 t3 = ((tvb_get_guint8(tvb, offset + 2) & 0x03) << 4);
3986     t3 |= ((tvb_get_guint8(tvb, offset + 3) & 0xF0) >> 4);
3987
3988     proto_tree_add_text(rsvp_object_tree, tvb, offset, 4,
3989                         "G.709 ODUk Label: "
3990                         "t3=%u, "
3991                         "t2=%u, "
3992                         "t1=%u",
3993                         t3, t2, t1);
3994     proto_item_append_text(ti, ": G.709 ODUk: "
3995                         "t3=%u, "
3996                         "t2=%u, "
3997                         "t1=%u",
3998                         t3, t2, t1);
3999 }
4000
4001 static void
4002 dissect_rsvp_label(proto_tree *ti, proto_tree *rsvp_object_tree,
4003                    tvbuff_t *tvb,
4004                    int offset, int obj_length,
4005                    int rsvp_class, int type)
4006 {
4007     int         offset2 = offset + 4;
4008     int         mylen, i;
4009     const char *name;
4010
4011     name = (rsvp_class==RSVP_CLASS_SUGGESTED_LABEL ? "SUGGESTED LABEL":
4012             (rsvp_class==RSVP_CLASS_UPSTREAM_LABEL ? "UPSTREAM LABEL":
4013              (rsvp_class==RSVP_CLASS_RECOVERY_LABEL ? "RECOVERY LABEL":
4014              "LABEL")));
4015     mylen = obj_length - 4;
4016     switch(type) {
4017     case 1:
4018         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4019                             "C-type: 1 (Packet Label)");
4020         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4,
4021                             "Label: %u",
4022                             tvb_get_ntohl(tvb, offset2));
4023         proto_item_set_text(ti, "%s: %u", name,
4024                             tvb_get_ntohl(tvb, offset2));
4025         break;
4026
4027     case 2:
4028         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4029                             "C-type: 2 (Generalized Label)");
4030         if (rsvp_generalized_label_option == 1) {
4031             /* FF: no generalized label interpretation */
4032             proto_item_set_text(ti, "%s: Generalized: ", name);
4033             for (i = 0; i < mylen; i += 4) {
4034                 proto_tree_add_text(rsvp_object_tree, tvb, offset2+i, 4,
4035                                     "Generalized Label: %u (0x%x)",
4036                                     tvb_get_ntohl(tvb, offset2+i),
4037                                     tvb_get_ntohl(tvb, offset2+i));
4038                 if (i < 16) {
4039                     proto_item_append_text(ti, "0x%x%s",
4040                                            tvb_get_ntohl(tvb, offset2+i),
4041                                            i+4<mylen?", ":"");
4042                 } else if (i == 16) {
4043                     proto_item_append_text(ti, "...");
4044                 }
4045             }
4046         } else if (rsvp_generalized_label_option == 2) {
4047             dissect_glabel_sdh(ti, rsvp_object_tree, tvb, offset2);
4048         } else if (rsvp_generalized_label_option == 4) {
4049             dissect_glabel_g709(ti, rsvp_object_tree, tvb, offset2);
4050         } else if (rsvp_generalized_label_option == 3) {
4051             dissect_glabel_lambda(ti, rsvp_object_tree, tvb, offset2);
4052         }
4053         break;
4054
4055     case 4:
4056         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4057                             "C-type: 4 (Generalized Channel_set)");
4058         proto_item_append_text(ti, ": Generalized Channel_set");
4059         proto_tree_add_text(rsvp_object_tree, tvb, offset2, mylen,
4060                             "Data (%d bytes)", mylen);
4061         break;
4062
4063     default:
4064         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4065                             "C-type: Unknown (%u)", type);
4066         proto_tree_add_text(rsvp_object_tree, tvb, offset2, mylen,
4067                             "Data (%d bytes)", mylen);
4068         break;
4069     }
4070 }
4071 /*------------------------------------------------------------------------------
4072  * LABEL_SET
4073  *------------------------------------------------------------------------------*/
4074 static void
4075 dissect_rsvp_label_set(proto_item *ti, proto_tree *rsvp_object_tree,
4076                        tvbuff_t *tvb,
4077                        int offset, int obj_length,
4078                        int rsvp_class _U_, int type)
4079 {
4080     int    offset2 = offset + 8;
4081     guint8 label_type;
4082     int    len, i;
4083
4084     static const value_string action_type_vals[] = {
4085         { 0, "Inclusive list"},
4086         { 1, "Exclusive list"},
4087         { 2, "Inclusive range"},
4088         { 3, "Exclusive range"},
4089         { 0, NULL}
4090    };
4091     static value_string_ext action_type_vals_ext = VALUE_STRING_EXT_INIT(action_type_vals);
4092
4093     len = obj_length - 8;
4094     proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1, "C-type: %u", type);
4095     proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 1, "Action: %s",
4096                         val_to_str_ext(tvb_get_guint8(tvb, offset+4),
4097                                        &action_type_vals_ext, "Unknown (%u)"));
4098     proto_item_append_text(ti, ": %s",
4099                            val_to_str_ext(tvb_get_guint8(tvb, offset+4),
4100                            &action_type_vals_ext, "Unknown (%u)"));
4101     label_type = tvb_get_guint8 (tvb, offset+7);
4102     proto_tree_add_text(rsvp_object_tree, tvb, offset+7, 1, "Label type: %s",
4103                         (label_type == 1) ? "Packet Label" : "Generalized Label");
4104     proto_item_append_text(ti, ", %s",
4105                            (label_type == 1) ? "Packet Label: " : "Generalized Label: ");
4106
4107     for (i = 0; i < len/4; i++) {
4108         proto_tree_add_text(rsvp_object_tree, tvb, offset2+i*4, 4,
4109                             "Subchannel %u: %u (0x%x)", i+1,
4110                             tvb_get_ntohl(tvb, offset2+i*4),
4111                             tvb_get_ntohl(tvb, offset2+i*4));
4112
4113         if (i<5) {
4114             if (i!=0)
4115                 proto_item_append_text(ti, ", ");
4116
4117             proto_item_append_text(ti, "%u",
4118                                    tvb_get_ntohl(tvb, offset2+i*4));
4119         }
4120     }
4121 }
4122
4123 /*------------------------------------------------------------------------------
4124  * SESSION ATTRIBUTE
4125  *------------------------------------------------------------------------------*/
4126 static void
4127 dissect_rsvp_session_attribute(proto_item *ti, proto_tree *rsvp_object_tree,
4128                                tvbuff_t *tvb,
4129                                int offset, int obj_length,
4130                                int rsvp_class _U_, int type)
4131 {
4132     int         offset2 = offset + 4;
4133     guint8      flags;
4134     guint8      name_len;
4135     proto_tree *ti2, *rsvp_sa_flags_tree;
4136
4137     switch(type) {
4138     case 1:
4139     case 7:
4140
4141         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4142                             "C-type: %u - IPv4 LSP (%sResource Affinities)",
4143                             type, (type == 1) ? "" : "No ");
4144
4145         if (type == 1) {
4146             proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4,
4147                             "Exclude-Any: 0x%0x", tvb_get_ntohl(tvb, offset2));
4148             proto_tree_add_text(rsvp_object_tree, tvb, offset2+4, 4,
4149                             "Include-Any: 0x%0x", tvb_get_ntohl(tvb, offset2+4));
4150             proto_tree_add_text(rsvp_object_tree, tvb, offset2+8, 4,
4151                             "Include-All: 0x%0x", tvb_get_ntohl(tvb, offset2+8));
4152             offset2 = offset2+12;
4153         }
4154
4155         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1,
4156                             "Setup priority: %u",
4157                             tvb_get_guint8(tvb, offset2));
4158         proto_tree_add_text(rsvp_object_tree, tvb, offset2+1, 1,
4159                             "Hold priority: %u",
4160                             tvb_get_guint8(tvb, offset2+1));
4161         flags = tvb_get_guint8(tvb, offset2+2);
4162         ti2 = proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 1,
4163                                   "Flags: 0x%02x", flags);
4164         rsvp_sa_flags_tree = proto_item_add_subtree(ti2,
4165                                                     TREE(TT_SESSION_ATTRIBUTE_FLAGS));
4166         proto_tree_add_item(rsvp_sa_flags_tree, hf_rsvp_sa_flags_local,
4167                              tvb, offset2+2, 1, ENC_BIG_ENDIAN);
4168         proto_tree_add_item(rsvp_sa_flags_tree, hf_rsvp_sa_flags_label,
4169                              tvb, offset2+2, 1, ENC_BIG_ENDIAN);
4170         proto_tree_add_item(rsvp_sa_flags_tree, hf_rsvp_sa_flags_se_style,
4171                              tvb, offset2+2, 1, ENC_BIG_ENDIAN);
4172         proto_tree_add_item(rsvp_sa_flags_tree, hf_rsvp_sa_flags_bandwidth,
4173                              tvb, offset2+2, 1, ENC_BIG_ENDIAN);
4174         proto_tree_add_item(rsvp_sa_flags_tree, hf_rsvp_sa_flags_node,
4175                              tvb, offset2+2, 1, ENC_BIG_ENDIAN);
4176
4177         name_len = tvb_get_guint8(tvb, offset2+3);
4178         proto_tree_add_text(rsvp_object_tree, tvb, offset2+3, 1,
4179                             "Name length: %u", name_len);
4180         proto_tree_add_text(rsvp_object_tree, tvb, offset2+4, name_len,
4181                             "Name: %s",
4182                             tvb_format_text(tvb, offset2+4, name_len));
4183
4184         proto_item_set_text(ti, "SESSION ATTRIBUTE: SetupPrio %d, HoldPrio %d, %s%s%s%s%s [%s]",
4185                             tvb_get_guint8(tvb, offset2),
4186                             tvb_get_guint8(tvb, offset2+1),
4187                             flags &0x01 ? "Local Protection, " : "",
4188                             flags &0x02 ? "Label Recording, " : "",
4189                             flags &0x04 ? "SE Style, " : "",
4190                             flags &0x08 ? "Bandwidth Protection, " : "",
4191                             flags &0x10 ? "Node Protection, " : "",
4192                             name_len ? tvb_format_text(tvb, offset2+4, name_len) : "");
4193         break;
4194
4195     default:
4196         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4197                             "C-type: Unknown (%u)",
4198                             type);
4199         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
4200                             "Data (%d bytes)", obj_length - 4);
4201         break;
4202     }
4203 }
4204
4205 /*------------------------------------------------------------------------------
4206  * EXPLICIT ROUTE AND RECORD ROUTE SUBOBJECTS,
4207  * RFC 3209, RFC 3473, RFC 5420, RFC 4873, RFC 5553
4208  *------------------------------------------------------------------------------*/
4209 static void
4210 dissect_rsvp_ero_rro_subobjects(proto_tree *ti, proto_tree *rsvp_object_tree,
4211                                 tvbuff_t *tvb,
4212                                 int offset, int obj_length, int rsvp_class)
4213 {
4214     int         i, j, k, l, flags;
4215     proto_tree *ti2, *rsvp_ro_subtree, *rsvp_rro_flags_subtree;
4216     int         tree_type;
4217
4218     switch(rsvp_class) {
4219     case RSVP_CLASS_EXPLICIT_ROUTE:
4220         tree_type = TREE(TT_EXPLICIT_ROUTE_SUBOBJ);
4221         break;
4222     case RSVP_CLASS_RECORD_ROUTE:
4223         tree_type = TREE(TT_RECORD_ROUTE_SUBOBJ);
4224         break;
4225     default:
4226         /* Bail out */
4227         return;
4228     }
4229
4230     for (i=1, l = 0; l < obj_length - 4; i++) {
4231         j = tvb_get_guint8(tvb, offset+l) & 0x7f;
4232         switch(j) {
4233         case 1: /* IPv4 */
4234             k = tvb_get_guint8(tvb, offset+l) & 0x80;
4235             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
4236                                       offset+l, 8,
4237                                       "IPv4 Subobject - %s%s",
4238                                       tvb_ip_to_str(tvb, offset+l+2),
4239                                       rsvp_class == RSVP_CLASS_EXPLICIT_ROUTE ?
4240                                       (k ? ", Loose" : ", Strict") : "");
4241             rsvp_ro_subtree =
4242                 proto_item_add_subtree(ti2, tree_type);
4243             if (rsvp_class == RSVP_CLASS_EXPLICIT_ROUTE)
4244                 proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4245                                     k ? "Loose Hop " : "Strict Hop");
4246             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4247                                 "Type: 1 (IPv4)");
4248             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+1, 1,
4249                                 "Length: %u",
4250                                 tvb_get_guint8(tvb, offset+l+1));
4251             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+2, 4,
4252                                 "IPv4 hop: %s",
4253                                 tvb_ip_to_str(tvb, offset+l+2));
4254             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+6, 1,
4255                                 "Prefix length: %u",
4256                                 tvb_get_guint8(tvb, offset+l+6));
4257             if (i < 4) {
4258                 proto_item_append_text(ti, "IPv4 %s%s",
4259                                        tvb_ip_to_str(tvb, offset+l+2),
4260                                        k ? " [L]" : "");
4261             }
4262             if (rsvp_class == RSVP_CLASS_RECORD_ROUTE) {
4263                 flags = tvb_get_guint8(tvb, offset+l+7);
4264                 if (flags&0x10) {
4265                     proto_item_append_text(ti,  " (Node-id)");
4266                     proto_item_append_text(ti2, " (Node-id)");
4267                 }
4268                 if (flags&0x01) proto_item_append_text(ti2, ", Local Protection Available");
4269                 if (flags&0x02) proto_item_append_text(ti2, ", Local Protection In Use");
4270                 if (flags&0x04) proto_item_append_text(ti2, ", Backup BW Avail");
4271                 if (flags&0x08) proto_item_append_text(ti2, ", Backup is Next-Next-Hop");
4272                 ti2 = proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+7, 1,
4273                                           "Flags: 0x%02x", flags);
4274                 rsvp_rro_flags_subtree =
4275                     proto_item_add_subtree(ti2, TREE(TT_RECORD_ROUTE_SUBOBJ_FLAGS));
4276                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_local_avail,
4277                              tvb, offset+l+7, 1, ENC_BIG_ENDIAN);
4278                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_local_in_use,
4279                              tvb, offset+l+7, 1, ENC_BIG_ENDIAN);
4280                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_bandwidth,
4281                              tvb, offset+l+7, 1, ENC_BIG_ENDIAN);
4282                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_node,
4283                              tvb, offset+l+7, 1, ENC_BIG_ENDIAN);
4284                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_node_address,
4285                              tvb, offset+l+7, 1, ENC_BIG_ENDIAN);
4286             }
4287
4288             break;
4289
4290         case 2: /* IPv6 */
4291             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
4292                                       offset+l, 20,
4293                                       "IPv6 Subobject");
4294             rsvp_ro_subtree =
4295                 proto_item_add_subtree(ti2, tree_type);
4296             k = tvb_get_guint8(tvb, offset+l) & 0x80;
4297             if (rsvp_class == RSVP_CLASS_EXPLICIT_ROUTE)
4298                 proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4299                                     k ? "Loose Hop " : "Strict Hop");
4300             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4301                                 "Type: 2 (IPv6)");
4302             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+1, 1,
4303                                 "Length: %u",
4304                                 tvb_get_guint8(tvb, offset+l+1));
4305             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+2, 16,
4306                                 "IPv6 hop: %s",
4307                                 tvb_ip6_to_str(tvb, offset+l+2));
4308             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+18, 1,
4309                                 "Prefix length: %u",
4310                                 tvb_get_guint8(tvb, offset+l+18));
4311             if (i < 4) {
4312                 proto_item_append_text(ti, "IPv6 [...]%s", k ? " [L]":"");
4313             }
4314             if (rsvp_class == RSVP_CLASS_RECORD_ROUTE) {
4315                 flags = tvb_get_guint8(tvb, offset+l+19);
4316                 if (flags&0x10) {
4317                     proto_item_append_text(ti,  " (Node-id)");
4318                     proto_item_append_text(ti2, " (Node-id)");
4319                 }
4320                 if (flags&0x01) proto_item_append_text(ti2, ", Local Protection Available");
4321                 if (flags&0x02) proto_item_append_text(ti2, ", Local Protection In Use");
4322                 if (flags&0x04) proto_item_append_text(ti2, ", Backup BW Avail");
4323                 if (flags&0x08) proto_item_append_text(ti2, ", Backup is Next-Next-Hop");
4324                 ti2 = proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+19, 1,
4325                                           "Flags: 0x%02x", flags);
4326                 rsvp_rro_flags_subtree =
4327                     proto_item_add_subtree(ti2, TREE(TT_RECORD_ROUTE_SUBOBJ_FLAGS));
4328
4329                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_local_avail,
4330                              tvb, offset+l+19, 1, ENC_BIG_ENDIAN);
4331                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_local_in_use,
4332                              tvb, offset+l+19, 1, ENC_BIG_ENDIAN);
4333                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_backup_tunnel_bandwidth,
4334                              tvb, offset+l+19, 1, ENC_BIG_ENDIAN);
4335                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_backup_tunnel_hop,
4336                              tvb, offset+l+19, 1, ENC_BIG_ENDIAN);
4337                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_node_address,
4338                              tvb, offset+l+19, 1, ENC_BIG_ENDIAN);
4339
4340             }
4341
4342             break;
4343
4344         case 3: /* Label RFC 3477 */
4345             k = tvb_get_guint8(tvb, offset+l) & 0x80;
4346             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
4347                                       offset+l, 8,
4348                                       "Label Subobject - %d, %s",
4349                                       tvb_get_ntohl(tvb, offset+l+4),
4350                                       rsvp_class == RSVP_CLASS_EXPLICIT_ROUTE ?
4351                                       (k ? "Loose" : "Strict") : "");
4352             rsvp_ro_subtree =
4353                 proto_item_add_subtree(ti2, tree_type);
4354             if (rsvp_class == RSVP_CLASS_EXPLICIT_ROUTE)
4355                 proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4356                                     k ? "Loose Hop " : "Strict Hop");
4357             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4358                                 "Type: 3 (Label)");
4359             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+1, 1,
4360                                 "Length: %u",
4361                                 tvb_get_guint8(tvb, offset+l+1));
4362             if (rsvp_class == RSVP_CLASS_RECORD_ROUTE) {
4363                 flags = tvb_get_guint8(tvb, offset+l+2);
4364                 if (flags&0x01) proto_item_append_text(ti2, "The label will be understood if received on any interface");
4365                 ti2 = proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+2, 1,
4366                                           "Flags: 0x%02x", flags);
4367                 rsvp_rro_flags_subtree =
4368                     proto_item_add_subtree(ti2, TREE(TT_RECORD_ROUTE_SUBOBJ_FLAGS));
4369
4370                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_global_label,
4371                              tvb, offset+l+2, 1, ENC_BIG_ENDIAN);
4372             }
4373             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+3, 1,
4374                                 "C-Type: %u",
4375                                 tvb_get_guint8(tvb, offset+l+3));
4376             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+4, 4,
4377                                 "Label: %d",
4378                                 tvb_get_ntohl(tvb, offset+l+4));
4379             if (i < 4) {
4380                 proto_item_append_text(ti, "Label %d%s",
4381                                        tvb_get_ntohl(tvb, offset+l+4),
4382                                        k ? " [L]":"");
4383             }
4384             break;
4385
4386         case 4: /* Unnumbered Interface-ID RFC 3477, RFC 6107*/
4387             k = tvb_get_guint8(tvb, offset+l) & 0x80;
4388             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
4389                                       offset+l, 8,
4390                                       "Unnumbered Interface-ID - %s, %d, %s",
4391                                       tvb_ip_to_str(tvb, offset+l+4),
4392                                       tvb_get_ntohl(tvb, offset+l+8),
4393                                       rsvp_class == RSVP_CLASS_EXPLICIT_ROUTE ?
4394                                       (k ? "Loose" : "Strict") : "");
4395             rsvp_ro_subtree =
4396                 proto_item_add_subtree(ti2, tree_type);
4397             if (rsvp_class == RSVP_CLASS_EXPLICIT_ROUTE)
4398                 proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4399                                     k ? "Loose Hop " : "Strict Hop");
4400             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4401                                 "Type: 4 (Unnumbered Interface-ID)");
4402             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+1, 1,
4403                                 "Length: %u",
4404                                 tvb_get_guint8(tvb, offset+l+1));
4405             if (rsvp_class == RSVP_CLASS_RECORD_ROUTE) {
4406                 flags = tvb_get_guint8(tvb, offset+l+2);
4407                 if (flags&0x01) proto_item_append_text(ti2, ", Local Protection Available");
4408                 if (flags&0x02) proto_item_append_text(ti2, ", Local Protection In Use");
4409                 ti2 = proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+2, 1,
4410                                           "Flags: 0x%02x", flags);
4411                 rsvp_rro_flags_subtree =
4412                     proto_item_add_subtree(ti2, TREE(TT_RECORD_ROUTE_SUBOBJ_FLAGS));
4413                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_local_avail,
4414                              tvb, offset+l+2, 1, ENC_BIG_ENDIAN);
4415                 proto_tree_add_item(rsvp_rro_flags_subtree, hf_rsvp_rro_flags_local_in_use,
4416                              tvb, offset+l+2, 1, ENC_BIG_ENDIAN);
4417             }
4418             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+4, 4,
4419                                 "Router-ID: %s",
4420                                 tvb_ip_to_str(tvb, offset+l+4));
4421             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+8, 4,
4422                                 "Interface-ID: %d",
4423                                 tvb_get_ntohl(tvb, offset+l+8));
4424             if (i < 4) {
4425                 proto_item_append_text(ti, "Unnum %s/%d%s",
4426                                        tvb_ip_to_str(tvb, offset+l+4),
4427                                        tvb_get_ntohl(tvb, offset+l+8),
4428                                        k ? " [L]":"");
4429             }
4430             break;
4431
4432         case 32: /* AS */
4433             if (rsvp_class == RSVP_CLASS_RECORD_ROUTE) goto defaultsub;
4434             k = tvb_get_ntohs(tvb, offset+l+2);
4435             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
4436                                       offset+l, 4,
4437                                       "Autonomous System %u",
4438                                       k);
4439             rsvp_ro_subtree =
4440                 proto_item_add_subtree(ti2, tree_type);
4441             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4442                                 "Type: 32 (Autonomous System Number)");
4443             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+1, 1,
4444                                 "Length: %u",
4445                                 tvb_get_guint8(tvb, offset+l+1));
4446             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+2, 2,
4447                                 "Autonomous System %u", k);
4448             if (i < 4) {
4449                 proto_item_append_text(ti, "AS %d",
4450                                        tvb_get_ntohs(tvb, offset+l+2));
4451             }
4452             break;
4453
4454         case 64: /* PKSv4 - RFC5520 */
4455             if (rsvp_class == RSVP_CLASS_RECORD_ROUTE) goto defaultsub;
4456             k = tvb_get_ntohs(tvb, offset+l+2);
4457             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
4458                                       offset+l, 8,
4459                                       "Path Key subobject - %s, %u",
4460                                       tvb_ip_to_str(tvb, offset+l+4),
4461                                       k);
4462             rsvp_ro_subtree =
4463                 proto_item_add_subtree(ti2, tree_type);
4464             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4465                                 "Type: 64 (Path Key with IPv4 PCE-ID)");
4466             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+1, 1,
4467                                 "Length: %u",
4468                                 tvb_get_guint8(tvb, offset+l+1));
4469             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+2, 2,
4470                                 "Path Key: %u", k);
4471             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+4, 4,
4472                                 "PCE-ID: %s",
4473                                 tvb_ip_to_str(tvb, offset+l+4));
4474             if (i < 4) {
4475                 proto_item_append_text(ti, "Path Key %d", k);
4476             }
4477             break;
4478
4479         case 65: /* PKSv6 - RFC5520 */
4480             if (rsvp_class == RSVP_CLASS_RECORD_ROUTE) goto defaultsub;
4481             k = tvb_get_ntohs(tvb, offset+l+2);
4482             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
4483                                       offset+l, 8,
4484                                       "Path Key subobject - %s, %u",
4485                                       tvb_ip6_to_str(tvb, offset+l+4),
4486                                       k);
4487             rsvp_ro_subtree =
4488                 proto_item_add_subtree(ti2, tree_type);
4489             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4490                                 "Type: 65 (Path Key with IPv6 PCE-ID)");
4491             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+1, 1,
4492                                 "Length: %u",
4493                                 tvb_get_guint8(tvb, offset+l+1));
4494             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+2, 2,
4495                                 "Path Key: %u", k);
4496             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+4, 4,
4497                                 "PCE-ID: %s",
4498                                 tvb_ip6_to_str(tvb, offset+l+4));
4499             if (i < 4) {
4500                 proto_item_append_text(ti, "Path Key %d", k);
4501             }
4502             break;
4503
4504         case 124:
4505         case 125:
4506         case 126:
4507         case 127:
4508             /*
4509              * FF: Types 124 through 127 are to be reserved for Vendor
4510              * Private Use (see RFC 3936, Section 2.3.1) in case of
4511              * EXPLICIT_ROUTE (aka ERO).
4512              */
4513             if (rsvp_class == RSVP_CLASS_RECORD_ROUTE)
4514                 goto defaultsub;
4515             else
4516                 goto privatesub;
4517             break;
4518
4519         case 252:
4520         case 253:
4521         case 254:
4522         case 255:
4523             /*
4524              * FF: Types 252 through 255 are to be reserved for Vendor
4525              * Private Use (see RFC 3936, Section 2.3.1) in case of
4526              * RECORD_ROUTE (aka RRO).
4527              */
4528             if (rsvp_class == RSVP_CLASS_EXPLICIT_ROUTE)
4529                 goto defaultsub;
4530             else
4531                 goto privatesub;
4532             break;
4533
4534         privatesub: /* Private subobject */
4535             /*
4536              * FF: The first four octets of the sub-object contents of
4537              * a Vendor Private sub-object of an EXPLICIT_ROUTE or
4538              * RECORD_ROUTE object MUST be that vendor's SMI enterprise
4539              * code in network octet order.
4540              */
4541             {
4542                 guint8 private_so_len = tvb_get_guint8(tvb, offset+l+1);
4543                 k = tvb_get_guint8(tvb, offset+l) & 0x80;
4544                 ti2 = proto_tree_add_text(rsvp_object_tree, tvb, offset+l,
4545                                           tvb_get_guint8(tvb, offset+l+1),
4546                                           "Private Subobject: %d", j);
4547                 rsvp_ro_subtree =
4548                     proto_item_add_subtree(ti2, tree_type);
4549                 proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4550                                     k ? "Loose Hop " : "Strict Hop");
4551                 proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4552                                     "Type: %u (Private)", j);
4553                 proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+1, 1,
4554                                     "Length: %u",
4555                                     private_so_len);
4556
4557                 proto_tree_add_item(rsvp_ro_subtree,
4558                                     hf_rsvp_filter[RSVPF_ENT_CODE],
4559                                     tvb, offset+l+4, 4, ENC_BIG_ENDIAN);
4560                 if (private_so_len > 8) {
4561                     /* some private data */
4562                     proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+8,
4563                                         private_so_len - 8,
4564                                         "Data (%d bytes)",
4565                                         private_so_len - 8);
4566                 }
4567             }
4568             break;
4569
4570         default: /* Unknown subobject */
4571         defaultsub:
4572             k = tvb_get_guint8(tvb, offset+l) & 0x80;
4573             ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
4574                                       offset+l,
4575                                       tvb_get_guint8(tvb, offset+l+1),
4576                                       "Unknown subobject: %d", j);
4577             rsvp_ro_subtree =
4578                 proto_item_add_subtree(ti2, tree_type);
4579             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4580                                 k ? "Loose Hop " : "Strict Hop");
4581             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l, 1,
4582                                 "Type: %u (Unknown)", j);
4583             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+1, 1,
4584                                 "Length: %u",
4585                                 tvb_get_guint8(tvb, offset+l+1));
4586             break;
4587         }
4588
4589         if (tvb_get_guint8(tvb, offset+l+1) < 1) {
4590             proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+1, 1,
4591                 "Invalid length: %u", tvb_get_guint8(tvb, offset+l+1));
4592             return;
4593         }
4594         l += tvb_get_guint8(tvb, offset+l+1);
4595         if (l < obj_length - 4) {
4596             if (i < 4)
4597                 proto_item_append_text(ti, ", ");
4598             else if (i==4)
4599                 proto_item_append_text(ti, "...");
4600         }
4601     }
4602 }
4603
4604 /*------------------------------------------------------------------------------
4605  * EXPLICIT ROUTE OBJECT
4606  *------------------------------------------------------------------------------*/
4607 static void
4608 dissect_rsvp_explicit_route(proto_item *ti, proto_tree *rsvp_object_tree,
4609                             tvbuff_t *tvb,
4610                             int offset, int obj_length,
4611                             int rsvp_class, int type)
4612 {
4613     switch(type) {
4614     case 1:
4615         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4616                             "C-type: 1");
4617         proto_item_set_text(ti, "EXPLICIT ROUTE: ");
4618
4619         dissect_rsvp_ero_rro_subobjects(ti, rsvp_object_tree, tvb,
4620                                         offset + 4, obj_length, rsvp_class);
4621         break;
4622
4623     default:
4624         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4625                             "C-type: Unknown (%u)",
4626                             type);
4627         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, obj_length - 4,
4628                             "Data (%d bytes)", obj_length - 4);
4629         break;
4630     }
4631 }
4632
4633 /*------------------------------------------------------------------------------
4634  * RECORD ROUTE OBJECT
4635  *------------------------------------------------------------------------------*/
4636 static void
4637 dissect_rsvp_record_route(proto_item *ti, proto_tree *rsvp_object_tree,
4638                           tvbuff_t *tvb,
4639                           int offset, int obj_length,
4640                           int rsvp_class, int type)
4641 {
4642     proto_item_set_text(ti, "RECORD ROUTE: ");
4643     switch(type) {
4644     case 1:
4645         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4646                             "C-type: 1");
4647
4648         dissect_rsvp_ero_rro_subobjects(ti, rsvp_object_tree, tvb,
4649                                         offset + 4, obj_length, rsvp_class);
4650         break;
4651
4652     default:
4653         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4654                             "C-type: Unknown (%u)",
4655                             type);
4656         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, obj_length - 4,
4657                             "Data (%d bytes)", obj_length - 4);
4658         break;
4659     }
4660 }
4661
4662 /*------------------------------------------------------------------------------
4663  * MESSAGE ID
4664  *------------------------------------------------------------------------------*/
4665 static void
4666 dissect_rsvp_message_id(proto_tree *ti, proto_tree *rsvp_object_tree,
4667                         tvbuff_t *tvb,
4668                         int offset, int obj_length,
4669                         int rsvp_class _U_, int type)
4670 {
4671     int offset2 = offset + 4;
4672
4673     switch(type) {
4674     case 1:
4675         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4676                             "C-type: 1");
4677         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 1,
4678                             "Flags: %d", tvb_get_guint8(tvb, offset+4));
4679         proto_tree_add_text(rsvp_object_tree, tvb, offset+5, 3,
4680                             "Epoch: %d", tvb_get_ntoh24(tvb, offset+5));
4681         proto_tree_add_text(rsvp_object_tree, tvb, offset+8, 4,
4682                             "Message-ID: %d", tvb_get_ntohl(tvb, offset+8));
4683         proto_item_set_text(ti, "MESSAGE-ID: %d %s",
4684                             tvb_get_ntohl(tvb, offset+8),
4685                             tvb_get_guint8(tvb, offset+4) & 1 ? "(Ack Desired)" : "");
4686         break;
4687
4688     default:
4689         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4690                             "C-type: Unknown (%u)",
4691                             type);
4692         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
4693                             "Data (%d bytes)", obj_length - 4);
4694         break;
4695     }
4696 }
4697
4698 /*------------------------------------------------------------------------------
4699  * MESSAGE ID ACK
4700  *------------------------------------------------------------------------------*/
4701 static void
4702 dissect_rsvp_message_id_ack(proto_tree *ti, proto_tree *rsvp_object_tree,
4703                             tvbuff_t *tvb,
4704                             int offset, int obj_length,
4705                             int rsvp_class _U_, int type)
4706 {
4707     int offset2 = offset + 4;
4708
4709     switch(type) {
4710     case 1:
4711         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4712                             "C-type: 1");
4713         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 1,
4714                             "Flags: %d", tvb_get_guint8(tvb, offset+4));
4715         proto_tree_add_text(rsvp_object_tree, tvb, offset+5, 3,
4716                             "Epoch: %d", tvb_get_ntoh24(tvb, offset+5));
4717         proto_tree_add_text(rsvp_object_tree, tvb, offset+8, 4,
4718                             "Message-ID: %d", tvb_get_ntohl(tvb, offset+8));
4719         proto_item_set_text(ti, "MESSAGE-ID ACK: %d", tvb_get_ntohl(tvb, offset+8));
4720         break;
4721
4722     case 2:
4723         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4724                             "C-type: 2");
4725         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 1,
4726                             "Flags: %d", tvb_get_guint8(tvb, offset+4));
4727         proto_tree_add_text(rsvp_object_tree, tvb, offset+5, 3,
4728                             "Epoch: %d", tvb_get_ntoh24(tvb, offset+5));
4729         proto_tree_add_text(rsvp_object_tree, tvb, offset+8, 4,
4730                             "Message-ID: %d", tvb_get_ntohl(tvb, offset+8));
4731         proto_item_set_text(ti, "MESSAGE-ID NACK: %d", tvb_get_ntohl(tvb, offset+8));
4732         break;
4733
4734     default:
4735         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4736                             "C-type: Unknown (%u)",
4737                             type);
4738         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
4739                             "Data (%d bytes)", obj_length - 4);
4740         break;
4741     }
4742 }
4743
4744 /*------------------------------------------------------------------------------
4745  * MESSAGE ID LIST
4746  *------------------------------------------------------------------------------*/
4747 static void
4748 dissect_rsvp_message_id_list(proto_tree *ti, proto_tree *rsvp_object_tree,
4749                              tvbuff_t *tvb,
4750                              int offset, int obj_length,
4751                              int rsvp_class _U_, int type)
4752 {
4753     int offset2 = offset + 4;
4754     int mylen;
4755
4756     switch(type) {
4757     case 1:
4758         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4759                             "C-type: 1");
4760         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 1,
4761                             "Flags: %d", tvb_get_guint8(tvb, offset+4));
4762         proto_tree_add_text(rsvp_object_tree, tvb, offset+5, 3,
4763                             "Epoch: %d", tvb_get_ntoh24(tvb, offset+5));
4764         for (mylen = 8; mylen < obj_length; mylen += 4)
4765             proto_tree_add_text(rsvp_object_tree, tvb, offset+mylen, 4,
4766                                 "Message-ID: %d", tvb_get_ntohl(tvb, offset+mylen));
4767         proto_item_set_text(ti, "MESSAGE-ID LIST: %d IDs",
4768                             (obj_length - 8)/4);
4769         break;
4770
4771     default:
4772         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4773                             "C-type: Unknown (%u)",
4774                             type);
4775         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
4776                             "Data (%d bytes)", obj_length - 4);
4777         break;
4778     }
4779 }
4780
4781 /*------------------------------------------------------------------------------
4782  * HELLO
4783  *------------------------------------------------------------------------------*/
4784 static void
4785 dissect_rsvp_hello(proto_tree *ti, proto_tree *rsvp_object_tree,
4786                    tvbuff_t *tvb,
4787                    int offset, int obj_length _U_,
4788                    int rsvp_class _U_, int type)
4789 {
4790     switch(type) {
4791     case 1:
4792     case 2:
4793         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4794                             "C-Type: %d - HELLO %s object",
4795                             tvb_get_guint8 (tvb, offset+3),
4796                             type==1 ? "REQUEST" : "ACK");
4797         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 4,
4798                             "Source Instance: 0x%x",tvb_get_ntohl(tvb, offset+4));
4799         proto_tree_add_text(rsvp_object_tree, tvb, offset+8, 4,
4800                             "Destination Instance: 0x%x",tvb_get_ntohl(tvb, offset+8));
4801         proto_item_append_text(ti, ": %s. Src Instance: 0x%0x. Dest Instance: 0x%0x. ",
4802                                type==1 ? "REQUEST" : "ACK",
4803                                tvb_get_ntohl(tvb, offset+4),
4804                                tvb_get_ntohl(tvb, offset+8));
4805         break;
4806     default:
4807         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4808                             "C-Type: %d - UNKNOWN", type);
4809         break;
4810     };
4811 }
4812
4813 /*------------------------------------------------------------------------------
4814  * DCLASS
4815  *------------------------------------------------------------------------------*/
4816 static void
4817 dissect_rsvp_dclass(proto_tree *ti, proto_tree *rsvp_object_tree,
4818                     tvbuff_t *tvb,
4819                     int offset, int obj_length,
4820                     int rsvp_class _U_, int type)
4821 {
4822     int offset2 = offset + 4;
4823     int mylen;
4824
4825     proto_item_set_text(ti, "DCLASS: ");
4826     switch(type) {
4827     case 1:
4828         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4829                             "C-type: 1");
4830         for (mylen = 4; mylen < obj_length; mylen += 4) {
4831             proto_tree_add_text(rsvp_object_tree, tvb, offset+mylen+3, 1,
4832                                 "DSCP: %s",
4833                                 val_to_str_ext(tvb_get_guint8(tvb, offset+mylen+3),
4834                                                &dscp_vals_ext, "Unknown (%d)"));
4835             proto_item_append_text(ti, "%d%s",
4836                                    tvb_get_guint8(tvb, offset+mylen+3)>>2,
4837                                    mylen==obj_length-4 ? "":
4838                                    mylen<16 ? ", ":
4839                                    mylen==16 ? ", ..." : "");
4840         }
4841         break;
4842
4843     default:
4844         mylen = obj_length - 4;
4845         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4846                             "C-type: Unknown (%u)",
4847                             type);
4848         proto_tree_add_text(rsvp_object_tree, tvb, offset2, mylen,
4849                             "Data (%d bytes)", mylen);
4850         break;
4851     }
4852 }
4853
4854 /*------------------------------------------------------------------------------
4855  * ADMINISTRATIVE STATUS
4856  *------------------------------------------------------------------------------*/
4857 static void
4858 dissect_rsvp_admin_status(proto_tree *ti, proto_tree *rsvp_object_tree,
4859                           tvbuff_t *tvb,
4860                           int offset, int obj_length,
4861                           int rsvp_class _U_, int type)
4862 {
4863     int         offset2 = offset + 4;
4864     proto_tree *ti2, *rsvp_admin_subtree;
4865     guint32     status;
4866
4867     proto_item_set_text(ti, "ADMIN STATUS: ");
4868     switch(type) {
4869     case 1:
4870         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4871                             "C-type: 1");
4872         status = tvb_get_ntohl(tvb, offset2);
4873         ti2 = proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4,
4874                                   "Admin Status: 0x%08x", status);
4875         rsvp_admin_subtree =
4876             proto_item_add_subtree(ti2, TREE(TT_ADMIN_STATUS_FLAGS));
4877
4878         proto_tree_add_boolean(rsvp_admin_subtree,
4879                                hf_rsvp_filter[RSVPF_ADMIN_STATUS_REFLECT],
4880                                tvb, offset2, 4, status);
4881         proto_tree_add_boolean(rsvp_admin_subtree,
4882                                hf_rsvp_filter[RSVPF_ADMIN_STATUS_HANDOVER],
4883                                tvb, offset2, 4, status);
4884         proto_tree_add_boolean(rsvp_admin_subtree,
4885                                hf_rsvp_filter[RSVPF_ADMIN_STATUS_LOCKOUT],
4886                                tvb, offset2, 4, status);
4887         proto_tree_add_boolean(rsvp_admin_subtree,
4888                                hf_rsvp_filter[RSVPF_ADMIN_STATUS_INHIBIT],
4889                                tvb, offset2, 4, status);
4890         proto_tree_add_boolean(rsvp_admin_subtree,
4891                                hf_rsvp_filter[RSVPF_ADMIN_STATUS_CALL_MGMT],
4892                                tvb, offset2, 4, status);
4893         proto_tree_add_boolean(rsvp_admin_subtree,
4894                                hf_rsvp_filter[RSVPF_ADMIN_STATUS_TESTING],
4895                                tvb, offset2, 4, status);
4896         proto_tree_add_boolean(rsvp_admin_subtree,
4897                                hf_rsvp_filter[RSVPF_ADMIN_STATUS_DOWN],
4898                                tvb, offset2, 4, status);
4899         proto_tree_add_boolean(rsvp_admin_subtree,
4900                                hf_rsvp_filter[RSVPF_ADMIN_STATUS_DELETE],
4901                                tvb, offset2, 4, status);
4902         proto_item_set_text(ti, "ADMIN-STATUS: %s%s%s%s%s%s%s%s",
4903                             (status & (1<<31)) ? "Reflect " : "",
4904                             (status & (1<<6)) ? "Handover " : "",
4905                             (status & (1<<5)) ? "Lockout " : "",
4906                             (status & (1<<4)) ? "Inhibit " : "",
4907                             (status & (1<<3)) ? "Call " : "",
4908                             (status & (1<<2)) ? "Testing " : "",
4909                             (status & (1<<1)) ? "Admin-Down " : "",
4910                             (status & (1<<0)) ? "Deleting " : "");
4911         break;
4912
4913     default:
4914         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4915                             "C-type: Unknown (%u)",
4916                             type);
4917         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
4918                             "Data (%d bytes)", obj_length - 4);
4919         break;
4920     }
4921 }
4922
4923 /*------------------------------------------------------------------------------
4924  * LSP ATTRIBUTES
4925  *------------------------------------------------------------------------------*/
4926 static void
4927 dissect_rsvp_lsp_attributes(proto_tree *ti, proto_tree *rsvp_object_tree,
4928                             tvbuff_t *tvb, int offset, int obj_length,
4929                             int rsvp_class _U_, int type)
4930 {
4931     int         tlv_off;
4932     guint32     attributes;
4933     guint16     tlv_type, tlv_len;
4934     proto_tree *ti2, *rsvp_lsp_attr_subtree;
4935
4936     if (rsvp_class == RSVP_CLASS_LSP_REQUIRED_ATTRIBUTES)
4937         proto_item_set_text(ti, "LSP REQUIRED ATTRIBUTES: ");
4938     else
4939         proto_item_set_text(ti, "LSP ATTRIBUTES: ");
4940
4941     switch(type) {
4942     case 1:
4943         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4944                             "C-type: 1");
4945         for (tlv_off = 4; tlv_off < obj_length-4; ) {
4946             tlv_type = tvb_get_ntohs(tvb, offset+tlv_off);
4947             tlv_len = tvb_get_ntohs(tvb, offset+tlv_off+2);
4948
4949             if ((tlv_len == 0) || (tlv_off+tlv_len > (obj_length-4))) {
4950                 proto_tree_add_text(rsvp_object_tree, tvb, offset+tlv_off+2, 2,
4951                                     "Invalid length");
4952                 return;
4953             }
4954             switch(tlv_type) {
4955             case 1:
4956                 attributes = tvb_get_ntohl(tvb, offset+tlv_off+4);
4957                 ti2 = proto_tree_add_text(rsvp_object_tree, tvb, offset+tlv_off, tlv_len,
4958                                           "LSP attributes TLV: 0x%08x", attributes);
4959                 rsvp_lsp_attr_subtree = proto_item_add_subtree(ti2, TREE(TT_LSP_ATTRIBUTES_FLAGS));
4960                 proto_tree_add_item(rsvp_lsp_attr_subtree, hf_rsvp_lsp_attr_e2e,
4961                              tvb, offset+tlv_off+4, 4, ENC_BIG_ENDIAN);
4962                 proto_tree_add_item(rsvp_lsp_attr_subtree, hf_rsvp_lsp_attr_boundary,
4963                              tvb, offset+tlv_off+4, 4, ENC_BIG_ENDIAN);
4964                 proto_tree_add_item(rsvp_lsp_attr_subtree, hf_rsvp_lsp_attr_segment,
4965                              tvb, offset+tlv_off+4, 4, ENC_BIG_ENDIAN);
4966                 proto_item_append_text(ti, "LSP Attribute:%s%s%s",
4967                                        (attributes & 0x01) ? " End-to-end re-routing" : "",
4968                                        (attributes & 0x02) ? " Boundary re-routing" : "",
4969                                        (attributes & 0x04) ? " Segment-based re-routing" : "");
4970                 break;
4971
4972             default:
4973                 proto_tree_add_text(rsvp_object_tree, tvb, offset+tlv_off, tlv_len,
4974                                     "Unknown TLV");
4975                 break;
4976             }
4977             tlv_off += tlv_len;
4978         }
4979         break;
4980
4981     default:
4982         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
4983                             "C-type: Unknown (%u)",
4984                             type);
4985         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, obj_length - 4,
4986                             "Data (%d bytes)", obj_length - 4);
4987         break;
4988     }
4989 }
4990
4991 /*------------------------------------------------------------------------------
4992  * ASSOCIATION
4993  *------------------------------------------------------------------------------*/
4994 static void
4995 dissect_rsvp_association(proto_tree *ti, proto_tree *rsvp_object_tree,
4996                          tvbuff_t *tvb,
4997                          int offset, int obj_length,
4998                          int rsvp_class _U_, int type)
4999 {
5000     guint16 association_type;
5001     guint16 association_id;
5002
5003     static const value_string association_type_vals[] = {
5004         { 0, "Reserved"},
5005         { 1, "Recovery"},
5006         { 2, "Resource Sharing"},
5007         { 3, "Segment Recovery"},
5008         { 4, "Inter-domain Recovery"},
5009         { 0, NULL}
5010     };
5011     static value_string_ext association_type_vals_ext = VALUE_STRING_EXT_INIT(association_type_vals);
5012
5013     proto_item_set_text(ti, "ASSOCIATION ");
5014     association_type = tvb_get_ntohs (tvb, offset + 4);
5015     association_id = tvb_get_ntohs (tvb, offset + 6);
5016     switch(type) {
5017     case 1:
5018         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5019                             "C-type: 1 (IPv4)");
5020         proto_item_append_text(ti, "(IPv4): ");
5021         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 2,
5022                             "Association type: %s",
5023                             val_to_str_ext(association_type, &association_type_vals_ext, "Unknown (%u)"));
5024         proto_item_append_text(ti, "%s. ",
5025                                val_to_str_ext(association_type, &association_type_vals_ext, "Unknown (%u)"));
5026         proto_tree_add_text(rsvp_object_tree, tvb, offset+6, 2,
5027                             "Association ID: %u", association_id);
5028         proto_item_append_text(ti, "ID: %u. ", association_id);
5029         proto_tree_add_text(rsvp_object_tree, tvb, offset+8, 4,
5030                             "Association source: %s", tvb_ip_to_str(tvb, offset+8));
5031         proto_item_append_text(ti, "Src: %s", tvb_ip_to_str(tvb, offset+8));
5032         break;
5033
5034     case 2:
5035         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5036                             "C-type: 2 (IPv6)");
5037         proto_item_append_text(ti, "(IPv6): ");
5038         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 2,
5039                             "Association type: %s",
5040                             val_to_str_ext(association_type, &association_type_vals_ext, "Unknown (%u)"));
5041         proto_item_append_text(ti, "%s. ",
5042                                val_to_str_ext(association_type, &association_type_vals_ext, "Unknown (%u)"));
5043         proto_tree_add_text(rsvp_object_tree, tvb, offset+6, 2,
5044                             "Association ID: %u", association_id);
5045         proto_item_append_text(ti, "ID: %u. ", association_id);
5046         proto_tree_add_text(rsvp_object_tree, tvb, offset+8, 16,
5047                             "Association source: %s", tvb_ip6_to_str(tvb, offset+8));
5048         proto_item_append_text(ti, "Src: %s", tvb_ip6_to_str(tvb, offset+8));
5049         break;
5050
5051     case 4:       /* oif2008.389 */
5052         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5053                             "C-type: 4 (Routing Area)");
5054         proto_item_append_text(ti, "(Routing Area): ");
5055         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 2,
5056                             "Association type: %s",
5057                             val_to_str_ext(association_type, &association_type_vals_ext, "Unknown (%u)"));
5058         proto_item_append_text(ti, "%s. ",
5059                                val_to_str_ext(association_type, &association_type_vals_ext, "Unknown (%u)"));
5060         proto_tree_add_text(rsvp_object_tree, tvb, offset+6, 2,
5061                             "Association ID: %u", association_id);
5062         proto_item_append_text(ti, "Association ID: %u, ", association_id);
5063         proto_tree_add_text(rsvp_object_tree, tvb, offset+8, 4,
5064                             "Routing Area ID: %u", tvb_get_ntohl (tvb, offset+8));
5065         proto_item_append_text(ti, "Routing Area ID: %u, ", tvb_get_ntohl (tvb, offset+8));
5066         proto_tree_add_text(rsvp_object_tree, tvb, offset+12, 4,
5067                             "Node ID: %s", tvb_ip_to_str(tvb, offset+12));
5068         proto_item_append_text(ti, "Node ID: %s", tvb_ip_to_str(tvb, offset+12));
5069         proto_tree_add_text(rsvp_object_tree, tvb, offset+8, 16,
5070                             "Padding: %s", tvb_bytes_to_str_punct(tvb, offset+16, 8, ' '));
5071         break;
5072
5073     default:
5074         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5075                             "C-type: Unknown (%u)", type);
5076         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, obj_length - 4,
5077                             "Data (%d bytes)", obj_length - 4);
5078         break;
5079     }
5080 }
5081 /*------------------------------------------------------------------------------
5082  * TLVs for LSP TUNNEL IF ID object
5083  * draft-ietf-ccamp-lsp-hierarchy-bis-02
5084  *------------------------------------------------------------------------------*/
5085 static void
5086 dissect_rsvp_lsp_tunnel_if_id_tlv(proto_tree *rsvp_object_tree,
5087                                   tvbuff_t *tvb, int offset, int tlv_length,
5088                                   int subtree_type)
5089 {
5090     int       tlv_off;
5091     guint16   tlv_type;
5092     int       tlv_len;
5093     proto_tree *ti, *rsvp_lsp_tunnel_if_id_subtree;
5094
5095     for (tlv_off = 0; tlv_off < tlv_length; ) {
5096         tlv_type = tvb_get_ntohs(tvb, offset+tlv_off);
5097         tlv_len = tvb_get_ntohs(tvb, offset+tlv_off+2);
5098
5099         if ((tlv_len == 0) || ((tlv_off+tlv_len) > tlv_length)) {
5100             proto_tree_add_text(rsvp_object_tree, tvb, offset+tlv_off+2, 2,
5101                                 "Invalid length");
5102             return;
5103         }
5104         switch(tlv_type) {
5105         case 1:
5106             ti = proto_tree_add_text(rsvp_object_tree, tvb,
5107                                      offset+tlv_off, tlv_len,
5108                                      "Unnumbered component link identifier: %u",
5109                                      tvb_get_ntohl(tvb, offset+tlv_off+4));
5110             rsvp_lsp_tunnel_if_id_subtree = proto_item_add_subtree(ti, subtree_type);
5111             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off, 2,
5112                                 "Type: 1 (Unnumbered component link identifier)");
5113             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off+2, 2,
5114                                 "Length: %u", tlv_len);
5115             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off+4, 4,
5116                                 "Component link identifier: %u",
5117                                 tvb_get_ntohl(tvb, offset+tlv_off+4));
5118             break;
5119
5120         case 2:
5121             ti = proto_tree_add_text(rsvp_object_tree, tvb,
5122                                      offset+tlv_off, tlv_len,
5123                                      "IPv4 component link identifier: %s",
5124                                      tvb_ip_to_str(tvb, offset+tlv_off+4));
5125             rsvp_lsp_tunnel_if_id_subtree = proto_item_add_subtree(ti, subtree_type);
5126             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off, 2,
5127                                 "Type: 2 (IPv4 component link identifier)");
5128             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off+2, 2,
5129                                 "Length: %u", tlv_len);
5130             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off+4, 4,
5131                                 "Component link identifier: %s",
5132                                 tvb_ip_to_str(tvb, offset+tlv_off+4));
5133             break;
5134
5135         case 32769:  /* oif-p0040.002.09 demo spec */
5136             ti = proto_tree_add_text(rsvp_object_tree, tvb,
5137                                      offset+tlv_off, tlv_len,
5138                                      "Targeted client layer: ");
5139             rsvp_lsp_tunnel_if_id_subtree = proto_item_add_subtree(ti, subtree_type);
5140             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off, 2,
5141                                 "Type: 32769 (Targeted client layer)");
5142             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off+2, 2,
5143                                 "Length: %u", tlv_len);
5144             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off+4, 1,
5145                                 "LSP Encoding Type: %s",
5146                                 rval_to_str(tvb_get_guint8(tvb,offset+tlv_off+4),
5147                                            gmpls_lsp_enc_rvals, "Unknown (%d)"));
5148             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off+5, 1,
5149                                 "Switching Type: %s",
5150                                 rval_to_str(tvb_get_guint8(tvb,offset+tlv_off+5),
5151                                            gmpls_switching_type_rvals, "Unknown (%d)"));
5152             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off+6, 1,
5153                                 "Signal Type: %s",
5154                                 val_to_str_ext(tvb_get_guint8(tvb,offset+tlv_off+6),
5155                                                &gmpls_sonet_signal_type_str_ext, "Unknown (%d)"));
5156             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off+8, 8,
5157                                 "Sub Interface/Connection ID: %" G_GINT64_MODIFIER "u (0x%s)",
5158                                 tvb_get_ntoh64(tvb, offset+tlv_off+8),
5159                                 tvb_bytes_to_str(tvb, offset+tlv_off+8, 8));
5160             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off+16, 4,
5161                                 "SC PC ID: %s",
5162                                 tvb_ip_to_str(tvb, offset+tlv_off+16));
5163             proto_tree_add_text(rsvp_lsp_tunnel_if_id_subtree, tvb, offset+tlv_off+20, 4,
5164                                 "SC PC SCN Address: %s",
5165                                 tvb_ip_to_str(tvb, offset+tlv_off+20));
5166             proto_item_append_text(ti, "LSP Encoding=%s, Switching Type=%s, Signal Type=%s",
5167                                    rval_to_str(tvb_get_guint8(tvb,offset+tlv_off+4),
5168                                               gmpls_lsp_enc_rvals, "Unknown (%d)"),
5169                                    rval_to_str(tvb_get_guint8(tvb,offset+tlv_off+5),
5170                                               gmpls_switching_type_rvals, "Unknown (%d)"),
5171                                    val_to_str_ext(tvb_get_guint8(tvb,offset+tlv_off+6),
5172                                                   &gmpls_sonet_signal_type_str_ext, "Unknown (%d)"));
5173             break;
5174
5175         default:
5176             proto_tree_add_text(rsvp_object_tree, tvb, offset+tlv_off, 2,
5177                                 "Unknown TLV: %u", tlv_type);
5178             break;
5179         }
5180         tlv_off += tlv_len;
5181     }
5182 }
5183
5184 /*------------------------------------------------------------------------------
5185  * LSP TUNNEL INTERFACE ID
5186  *------------------------------------------------------------------------------*/
5187 static void
5188 dissect_rsvp_lsp_tunnel_if_id(proto_tree *ti, proto_tree *rsvp_object_tree,
5189                               tvbuff_t *tvb,
5190                               int offset, int obj_length,
5191                               int rsvp_class _U_, int type)
5192 {
5193     guint8  action;
5194
5195     static const value_string lsp_tunnel_if_id_action_str[] = {
5196         { 0, "LSP is FA (MPLS-TE topology advertisement only)"},
5197         { 1, "LSP is RA (IP network advertisement only)"},
5198         { 2, "LSP is RA (both IP and MPLS-TE topology advertisement)"},
5199         { 3, "LSP is to be used as a virtual local link"},
5200         { 0, NULL}
5201     };
5202
5203     proto_item_set_text(ti, "LSP INTERFACE-ID: ");
5204     switch(type) {
5205     case 1:
5206         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5207                             "C-type: 1 - Unnumbered interface");
5208         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 4,
5209                             "Router ID: %s",
5210                             tvb_ip_to_str(tvb, offset+4));
5211         proto_tree_add_text(rsvp_object_tree, tvb, offset+8, 4,
5212                             "Interface ID: %u", tvb_get_ntohl(tvb, offset+8));
5213         proto_item_set_text(ti, "LSP INTERFACE-ID: Unnumbered, Router-ID %s, Interface-ID %d",
5214                             tvb_ip_to_str(tvb, offset+4),
5215                             tvb_get_ntohl(tvb, offset+8));
5216         break;
5217
5218     case 2:
5219         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5220                             "C-type: 2 - IPv4");
5221         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 4,
5222                             "IPv4 interface address: %s",
5223                             tvb_ip_to_str(tvb, offset+4));
5224         proto_tree_add_text(rsvp_object_tree, tvb, offset+8, 4,
5225                             "Target IGP instance: %s",
5226                             tvb_ip_to_str(tvb, offset+8));
5227         proto_item_set_text(ti, "LSP INTERFACE-ID: IPv4, interface address %s,"
5228                             "IGP instance %s",
5229                             tvb_ip_to_str(tvb, offset+4),
5230                             tvb_ip_to_str(tvb, offset+8));
5231         action = tvb_get_guint8(tvb, offset+12);
5232         action >>= 4;
5233         proto_tree_add_text(rsvp_object_tree, tvb, offset+12, 1, "Action: %d - %s",
5234                             action,
5235                             val_to_str_const(action, lsp_tunnel_if_id_action_str, "Unknown"));
5236         dissect_rsvp_lsp_tunnel_if_id_tlv(rsvp_object_tree, tvb, offset+16, obj_length-16,
5237                                           TREE(TT_LSP_TUNNEL_IF_ID_SUBTREE));
5238         break;
5239
5240     case 3:
5241         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5242                             "C-type: 3 - IPv6");
5243         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 16,
5244                             "IPv6 interface address: %s",
5245                             tvb_ip6_to_str(tvb, offset+4));
5246         proto_tree_add_text(rsvp_object_tree, tvb, offset+20, 4,
5247                             "Target IGP instance: %s",
5248                             tvb_ip_to_str(tvb, offset+20));
5249         proto_item_set_text(ti, "LSP INTERFACE-ID: IPv6, interface address %s,"
5250                             "IGP instance %s",
5251                             tvb_ip6_to_str(tvb, offset+4),
5252                             tvb_ip_to_str(tvb, offset+20));
5253         action = tvb_get_guint8(tvb, offset+24);
5254         action >>= 4;
5255         proto_tree_add_text(rsvp_object_tree, tvb, offset+24, 1, "Action: %d - %s",
5256                             action,
5257                             val_to_str_const(action, lsp_tunnel_if_id_action_str, "Unknown"));
5258         dissect_rsvp_lsp_tunnel_if_id_tlv(rsvp_object_tree, tvb, offset+28, obj_length-28,
5259                                           TREE(TT_LSP_TUNNEL_IF_ID_SUBTREE));
5260         break;
5261
5262     case 4:
5263         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5264                             "C-type: 4 - Unnumbered interface with target");
5265         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 4,
5266                             "Router ID: %s",
5267                             tvb_ip_to_str(tvb, offset+4));
5268         proto_tree_add_text(rsvp_object_tree, tvb, offset+8, 4,
5269                             "Interface ID: %u", tvb_get_ntohl(tvb, offset+8));
5270         proto_tree_add_text(rsvp_object_tree, tvb, offset+12, 4,
5271                             "Target IGP instance: %s",
5272                             tvb_ip_to_str(tvb, offset+12));
5273         proto_item_set_text(ti, "LSP INTERFACE-ID: Unnumbered with target, Router-ID %s,"
5274                             " Interface-ID %d, IGP instance %s",
5275                             tvb_ip_to_str(tvb, offset+4),
5276                             tvb_get_ntohl(tvb, offset+8),
5277                             tvb_ip_to_str(tvb, offset+12));
5278         action = tvb_get_guint8(tvb, offset+16);
5279         action >>= 4;
5280         proto_tree_add_text(rsvp_object_tree, tvb, offset+16, 1, "Action: %d - %s",
5281                             action,
5282                             val_to_str_const(action, lsp_tunnel_if_id_action_str, "Unknown"));
5283         dissect_rsvp_lsp_tunnel_if_id_tlv(rsvp_object_tree, tvb, offset+20, obj_length-20,
5284                                           TREE(TT_LSP_TUNNEL_IF_ID_SUBTREE));
5285         break;
5286
5287     default:
5288         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5289                             "C-type: Unknown (%u)",
5290                             type);
5291         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, obj_length-4,
5292                             "Data (%d bytes)", obj_length-4);
5293         break;
5294     }
5295 }
5296
5297 /*------------------------------------------------------------------------------
5298  * NOTIFY REQUEST
5299  *------------------------------------------------------------------------------*/
5300 static void
5301 dissect_rsvp_notify_request(proto_item *ti, proto_tree *rsvp_object_tree,
5302                             tvbuff_t *tvb,
5303                             int offset, int obj_length,
5304                             int rsvp_class _U_, int type)
5305 {
5306     int offset2 = offset + 4;
5307
5308     switch(type) {
5309     case 1: {
5310         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5311                             "C-type: 1 - IPv4");
5312         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4,
5313                             "Notify node address: %s",
5314                             tvb_ip_to_str(tvb, offset2));
5315         proto_item_append_text(ti, ": Notify node: %s",
5316                             tvb_ip_to_str(tvb, offset2));
5317         break;
5318     }
5319
5320     case 2: {
5321         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5322                             "C-type: 2 - IPv6");
5323         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16,
5324                             "Notify node address: %s",
5325                             tvb_ip6_to_str(tvb, offset2));
5326         proto_item_append_text(ti, ": Notify node: %s",
5327                                tvb_ip6_to_str(tvb, offset2));
5328         break;
5329     }
5330
5331     default:
5332         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5333                             "C-type: Unknown (%u)",
5334                             type);
5335         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
5336                             "Data (%d bytes)", obj_length - 4);
5337         break;
5338     }
5339 }
5340
5341 /*------------------------------------------------------------------------------
5342  * GENERALIZED UNI
5343  *------------------------------------------------------------------------------*/
5344 static void
5345 dissect_rsvp_gen_uni(proto_tree *ti, proto_tree *rsvp_object_tree,
5346                      tvbuff_t *tvb,
5347                      int offset, int obj_length,
5348                      int rsvp_class _U_, int type,
5349                      rsvp_conversation_info *rsvph)
5350 {
5351     int         offset2 = offset + 4;
5352     int         mylen, i, j, k, l, m;
5353     proto_item *ti2;
5354     proto_tree *rsvp_gen_uni_subtree, *rsvp_session_subtree, *rsvp_template_subtree;
5355     int         s_len, s_class, s_type, sobj_len, nsap_len;
5356     int         offset3;
5357
5358     proto_item_set_text(ti, "GENERALIZED UNI: ");
5359
5360     mylen = obj_length - 4;
5361     switch(type) {
5362     case 1: {
5363         const char *c;
5364         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5365                             "C-type: 1");
5366         for (i=1, l = 0; l < mylen; i++) {
5367             sobj_len = tvb_get_ntohs(tvb, offset2+l);
5368             j = tvb_get_guint8(tvb, offset2+l+2);
5369             switch(j) {
5370             case 1:
5371             case 2: /* We do source and destination TNA together */
5372                 c = (j==1) ? "Source" : "Destination";
5373                 k = tvb_get_guint8(tvb, offset2+l+3);
5374                 switch(k) {
5375                 case 1:
5376                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
5377                                               offset2+l, 8,
5378                                               "%s IPv4 TNA: %s", c,
5379                                               tvb_ip_to_str(tvb, offset2+l+4));
5380                     rsvp_gen_uni_subtree =
5381                         proto_item_add_subtree(ti2, TREE(TT_GEN_UNI_SUBOBJ));
5382                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+2, 1,
5383                                         "Class: %d (%s)", j, c);
5384                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+3, 1,
5385                                         "Type: 1 (IPv4)");
5386                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l, 2,
5387                                         "Length: %u", sobj_len);
5388                     if (j==1)
5389                       proto_tree_add_item(rsvp_gen_uni_subtree, hf_rsvp_filter[RSVPF_GUNI_SRC_IPV4],
5390                                           tvb, offset2+l+4, 4, ENC_BIG_ENDIAN);
5391                     else
5392                       proto_tree_add_item(rsvp_gen_uni_subtree, hf_rsvp_filter[RSVPF_GUNI_DST_IPV4],
5393                                           tvb, offset2+l+4, 4, ENC_BIG_ENDIAN);
5394                     if (i < 4) {
5395                         proto_item_append_text(ti, "%s IPv4 TNA: %s", c,
5396                                                tvb_ip_to_str(tvb, offset2+l+4));
5397                     }
5398                     break;
5399
5400                 case 2:
5401                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
5402                                               offset2+l, 20,
5403                                               "%s IPv6 TNA:", c);
5404                     rsvp_gen_uni_subtree =
5405                         proto_item_add_subtree(ti2, TREE(TT_GEN_UNI_SUBOBJ));
5406                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+2, 1,
5407                                         "Class: %d (%s)", j, c);
5408                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+3, 1,
5409                                         "Type: 2 (IPv6)");
5410                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l, 2,
5411                                         "Length: %u", sobj_len);
5412                     if (j==1)
5413                       proto_tree_add_item(rsvp_gen_uni_subtree, hf_rsvp_filter[RSVPF_GUNI_SRC_IPV6],
5414                                           tvb, offset2+l+4, 16, ENC_NA);
5415                     else
5416                       proto_tree_add_item(rsvp_gen_uni_subtree, hf_rsvp_filter[RSVPF_GUNI_DST_IPV6],
5417                                           tvb, offset2+l+4, 16, ENC_NA);
5418                     if (i < 4) {
5419                         proto_item_append_text(ti, "%s IPv6 TNA: %s", c,
5420                                                tvb_ip6_to_str(tvb, offset2+l+4));
5421                     }
5422                     break;
5423
5424                 case 3:
5425                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
5426                                               offset2+l, tvb_get_ntohs(tvb, offset2+l),
5427                                               "%s NSAP TNA: ", c);
5428                     rsvp_gen_uni_subtree =
5429                         proto_item_add_subtree(ti2, TREE(TT_GEN_UNI_SUBOBJ));
5430                     nsap_len = tvb_get_guint8(tvb, offset2+l+4);
5431                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+2, 1,
5432                                         "Class: %d (%s)", j, c);
5433                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+3, 1,
5434                                         "Type: 3 (NSAP)");
5435                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l, 2,
5436                                         "Length: %u", sobj_len);
5437                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+4, 1,
5438                                         "NSAP Length: %u", nsap_len);
5439                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+5,
5440                                         sobj_len-4,
5441                                         "NSAP address: %s",
5442                                         print_nsap_net(tvb_get_ptr(tvb, offset2+l+5, nsap_len), nsap_len));
5443                     if (i < 4) {
5444                         proto_item_append_text(ti, "%s NSAP TNA: %s", c,
5445                                                print_nsap_net(tvb_get_ptr(tvb, offset2+l+5, nsap_len), nsap_len));
5446                     }
5447                     break;
5448
5449                 default:
5450                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
5451                                               offset2+l, tvb_get_ntohs(tvb, offset2+l),
5452                                               "%s UNKNOWN TNA", c);
5453                     rsvp_gen_uni_subtree =
5454                         proto_item_add_subtree(ti2, TREE(TT_GEN_UNI_SUBOBJ));
5455                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+2, 1,
5456                                         "Class: %d (%s)", j, c);
5457                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+3, 1,
5458                                         "Type: %d (UNKNOWN)", j);
5459                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l, 2,
5460                                         "Length: %u", sobj_len);
5461                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+4,
5462                                         sobj_len-4,
5463                                         "Data");
5464                     if (i < 4) {
5465                         proto_item_append_text(ti, "%s UNKNOWN", c);
5466                     }
5467                     break;
5468                 }
5469                 break;
5470
5471             case 3: /* Diversity subobject */
5472                 k = tvb_get_guint8(tvb, offset2+l+3);
5473                 switch(k) {
5474                 default:
5475                 case 1:
5476                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
5477                                               offset2+l, tvb_get_ntohs(tvb, offset2+l),
5478                                               "Diversity Subobject");
5479                     rsvp_gen_uni_subtree =
5480                         proto_item_add_subtree(ti2, TREE(TT_GEN_UNI_SUBOBJ));
5481                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+2, 1,
5482                                         "Class: %d (Diversity)", j);
5483                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+3, 1,
5484                                         "Type: %d", tvb_get_guint8(tvb, offset2+l+3));
5485                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l, 2,
5486                                         "Length: %u", sobj_len);
5487                     m = tvb_get_guint8(tvb, offset2+l+4) >> 4;
5488                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+4, 1,
5489                                         "Diversity: %d - %s", m,
5490                                         val_to_str_const(m, ouni_guni_diversity_str, "Unknown"));
5491                     s_len = tvb_get_ntohs(tvb, offset2+l+8);
5492                     s_class = tvb_get_guint8(tvb, offset2+l+10);
5493                     s_type = tvb_get_guint8(tvb, offset2+l+11);
5494                     ti2 = proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+8,
5495                                               s_len, "Session");
5496                     rsvp_session_subtree =
5497                         proto_item_add_subtree(ti2, TREE(rsvp_class_to_tree_type(s_class)));
5498                     if (s_len < 4) {
5499                         proto_tree_add_text(rsvp_object_tree, tvb, offset2+l+8, 2,
5500                             "Length: %u (bogus, must be >= 4)", s_len);
5501                         break;
5502                     }
5503                     proto_tree_add_text(rsvp_session_subtree, tvb, offset2+l+8, 2,
5504                                 "Length: %u", s_len);
5505                     proto_tree_add_uint(rsvp_session_subtree, hf_rsvp_filter[RSVPF_OBJECT], tvb,
5506                                 offset2+8+l+10, 1, s_class);
5507                     dissect_rsvp_session(ti2, rsvp_session_subtree, tvb, offset2+l+8,
5508                                          s_len, s_class, s_type, rsvph);
5509                     offset3 = offset2 + s_len;
5510                     s_len = tvb_get_ntohs(tvb, offset3+l+8);
5511                     s_class = tvb_get_guint8(tvb, offset3+l+10);
5512                     s_type = tvb_get_guint8(tvb, offset3+l+11);
5513                     ti2 = proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset3+l+8,
5514                                               s_len, "Template");
5515                     rsvp_template_subtree =
5516                         proto_item_add_subtree(ti2, TREE(rsvp_class_to_tree_type(s_class)));
5517                     if (s_len < 4) {
5518                         proto_tree_add_text(rsvp_object_tree, tvb, offset3+l+8, 2,
5519                             "Length: %u (bogus, must be >= 4)", s_len);
5520                         break;
5521                     }
5522                     proto_tree_add_text(rsvp_template_subtree, tvb, offset3+l+8, 2,
5523                                 "Length: %u", s_len);
5524                     proto_tree_add_uint(rsvp_template_subtree, hf_rsvp_filter[RSVPF_OBJECT], tvb,
5525                                 offset3+8+l+10, 1, s_class);
5526                     dissect_rsvp_template_filter(ti2, rsvp_template_subtree, tvb, offset3+l+8,
5527                                                  s_len, s_class, s_type, rsvph);
5528
5529                     if (i < 4) {
5530                         proto_item_append_text(ti, "Diversity");
5531                     }
5532                     break;
5533
5534                 }
5535                 break;
5536
5537             case 4: /* Egress Label */
5538                 k = tvb_get_guint8(tvb, offset2+l+3);
5539                 if (k == 1)             /* Egress label sub-type */
5540                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
5541                                               offset2+l, sobj_len,
5542                                               "Egress Label Subobject");
5543                 else if (k == 2)        /* SPC_label sub-type (see G.7713.2) */
5544                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
5545                                               offset2+l, sobj_len,
5546                                               "SPC Label Subobject");
5547                 else
5548                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
5549                                               offset2+l, sobj_len,
5550                                               "Unknown Label Subobject");
5551                 rsvp_gen_uni_subtree = proto_item_add_subtree(ti2, TREE(TT_GEN_UNI_SUBOBJ));
5552                 proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+2, 1,
5553                                     "Class: %d (Egress/SPC Label)", j);
5554                 proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+3, 1,
5555                                     "Type: %d", k);
5556                 proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l, 2,
5557                                     "Length: %u", sobj_len);
5558                 proto_tree_add_item(rsvp_gen_uni_subtree, hf_rsvp_gen_uni_direction,
5559                              tvb, offset+l+2, 1, ENC_BIG_ENDIAN);
5560                 proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+7, 1,
5561                                     "Label type: %u", tvb_get_guint8(tvb, offset2+l+7));
5562                 proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+8, 4,
5563                                     "Logical Port ID: %u", tvb_get_ntohl(tvb, offset2+l+8));
5564                 proto_item_append_text(ti2, ": %s, Label type %d, Port ID %d, Label ",
5565                                        tvb_get_guint8(tvb, offset2+l+4) & 0x80 ?
5566                                        "Upstream" : "Downstream",
5567                                        tvb_get_guint8(tvb, offset2+l+7),
5568                                        tvb_get_ntohl(tvb, offset2+l+8));
5569                 for (j=12; j < sobj_len; j+=4) {
5570                         proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+j, 4,
5571                                             "Label: %u", tvb_get_ntohl(tvb, offset2+l+j));
5572                         proto_item_append_text(ti2, "%u ", tvb_get_ntohl(tvb, offset2+l+j));
5573                 }
5574                 if (i < 4) {
5575                         if (k == 1)
5576                             proto_item_append_text(ti, "Egress Label");
5577                         else if (k == 2)
5578                             proto_item_append_text(ti, "SPC Label");
5579                 }
5580                 break;
5581
5582             case 5: /* Service Level */
5583                 k = tvb_get_guint8(tvb, offset2+l+3);
5584                 switch(k) {
5585                 default:
5586                 case 1:
5587                     ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
5588                                               offset2+l, sobj_len,
5589                                               "Service Level Subobject");
5590                     rsvp_gen_uni_subtree =
5591                         proto_item_add_subtree(ti2, TREE(TT_GEN_UNI_SUBOBJ));
5592                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+2, 1,
5593                                         "Class: %d (Service Level)", j);
5594                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+3, 1,
5595                                         "Type: %d", tvb_get_guint8(tvb, offset2+l+3));
5596                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l, 2,
5597                                         "Length: %u", sobj_len);
5598                     proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+4, 1,
5599                                         "Service Level: %u", tvb_get_guint8(tvb, offset2+l+4));
5600                     proto_item_append_text(ti2, ": %u", tvb_get_guint8(tvb, offset2+l+4));
5601                     if (i < 4) {
5602                         proto_item_append_text(ti, "Service Level %d", tvb_get_guint8(tvb, offset2+l+4));
5603                     }
5604                     break;
5605                 }
5606                 break;
5607
5608             default: /* Unknown subobject */
5609                 ti2 = proto_tree_add_text(rsvp_object_tree, tvb,
5610                                           offset2+l, sobj_len,
5611                                           "Unknown subobject: %u",
5612                                           j);
5613                 rsvp_gen_uni_subtree =
5614                     proto_item_add_subtree(ti2, TREE(TT_GEN_UNI_SUBOBJ));
5615                 proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l, 1,
5616                                     "Type: %u (Unknown)", j);
5617                 proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+1, 1,
5618                                     "Length: %u",
5619                                     tvb_get_guint8(tvb, offset2+l+1));
5620                 break;
5621             }
5622
5623             if (tvb_get_guint8(tvb, offset2+l+1) < 1) {
5624                 proto_tree_add_text(rsvp_gen_uni_subtree, tvb, offset2+l+1, 1,
5625                     "Invalid length: %u", tvb_get_guint8(tvb, offset2+l+1));
5626                 return;
5627             }
5628             l += tvb_get_guint8(tvb, offset2+l+1);
5629             if (l < mylen) {
5630                 if (i < 4)
5631                     proto_item_append_text(ti, ", ");
5632                 else if (i==4)
5633                     proto_item_append_text(ti, "...");
5634             }
5635         }
5636         break;
5637     }
5638
5639     default:
5640         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5641                             "C-type: Unknown (%u)",
5642                             type);
5643         proto_tree_add_text(rsvp_object_tree, tvb, offset2, mylen,
5644                             "Data (%d bytes)", mylen);
5645         break;
5646     }
5647 }
5648
5649 /*------------------------------------------------------------------------------
5650  * CALL_ID
5651  *------------------------------------------------------------------------------*/
5652 static void
5653 dissect_rsvp_call_id(proto_tree *ti, proto_tree *rsvp_object_tree,
5654                      tvbuff_t *tvb,
5655                      int offset, int obj_length,
5656                      int rsvp_class _U_, int c_type)
5657 {
5658     int         type    = 0;
5659     const char *str;
5660     int         offset2 = offset + 4;
5661     int         offset3, offset4, len;
5662
5663     static const value_string address_type_vals[] = {
5664         { 1, "1 (IPv4)"},
5665         { 2, "2 (IPv6)"},
5666         { 3, "3 (NSAP)"},
5667         { 4, "4 (MAC)"},
5668         { 0x7f, "0x7f (Vendor-defined)"},
5669         { 0, NULL}
5670     };
5671     static value_string_ext address_type_vals_ext = VALUE_STRING_EXT_INIT(address_type_vals);
5672
5673     proto_item_set_text(ti, "CALL-ID: ");
5674     switch(c_type) {
5675     case 0:
5676         proto_item_append_text(ti,"Empty");
5677         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5678                             "C-type: Empty (%u)", c_type);
5679         if (obj_length > 4)
5680           proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length-4,
5681                               "Data (%d bytes)", obj_length-4);
5682         break;
5683     case 1:
5684     case 2:
5685         type = tvb_get_guint8 (tvb, offset2);
5686         if (c_type == 1) {
5687             offset3 = offset2 + 4;
5688             len = obj_length - 16;
5689             proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5690                                 "C-type: 1 (operator specific)");
5691             proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1, "Address type: %s",
5692                                 val_to_str_ext(type, &address_type_vals_ext, "Unknown (%u)"));
5693             proto_tree_add_text(rsvp_object_tree, tvb, offset2+1, 3, "Reserved: %u",
5694                                 tvb_get_ntoh24(tvb, offset2+1));
5695             proto_item_append_text(ti, "Operator-Specific. Addr Type: %s. ",
5696                                    val_to_str_ext(type, &address_type_vals_ext, "Unknown (%u)"));
5697         }
5698         else {
5699             offset3 = offset2 + 16;
5700             len = obj_length - 28;
5701             proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5702                                 "C-type: 2 (globally unique)");
5703             proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1, "Address type: %s",
5704                                 val_to_str_ext(type, &address_type_vals_ext, "Unknown (%u)"));
5705             str = tvb_get_ephemeral_string (tvb, offset2 + 1, 3);
5706             proto_tree_add_text(rsvp_object_tree, tvb, offset2 + 1, 3,
5707                                 "International Segment: %s", str);
5708             proto_item_append_text(ti, "Globally-Unique. Addr Type: %s. Intl Segment: %s. ",
5709                                    val_to_str_ext(type, &address_type_vals_ext, "Unknown (%u)"), str);
5710             str = tvb_get_ephemeral_string (tvb, offset2 + 4, 12);
5711             proto_tree_add_text(rsvp_object_tree, tvb, offset2 + 4, 12,
5712                                 "National Segment: %s", str);
5713             proto_item_append_text(ti, "Natl Segment: %s. ", str);
5714         }
5715
5716         switch(type) {
5717         case 1:
5718             offset4 = offset3 + 4;
5719             str = tvb_ip_to_str(tvb, offset3);
5720             proto_tree_add_item(rsvp_object_tree, hf_rsvp_filter[RSVPF_CALL_ID_SRC_ADDR_IPV4],
5721                                 tvb, offset3, 4, ENC_BIG_ENDIAN);
5722             break;
5723
5724         case 2:
5725             offset4 = offset3 + 16;
5726             str = tvb_ip6_to_str(tvb, offset3);
5727             proto_tree_add_item(rsvp_object_tree, hf_rsvp_filter[RSVPF_CALL_ID_SRC_ADDR_IPV6],
5728                                 tvb, offset3, 16, ENC_NA);
5729             break;
5730
5731         case 3:
5732             offset4 = offset3 + 20;
5733             str = print_nsap_net(tvb_get_ptr(tvb, offset3, 20), 20);
5734             proto_tree_add_text(rsvp_object_tree, tvb, offset3, 20,
5735                                 "Source Transport Network addr: %s", str);
5736             break;
5737
5738         case 4:
5739             offset4 = offset3 + 6;
5740             str = tvb_ether_to_str(tvb, offset3);
5741             proto_tree_add_text(rsvp_object_tree, tvb, offset3, 6,
5742                                 "Source Transport Network addr: %s", str);
5743             break;
5744
5745         case 0x7F:
5746             offset4 = offset3 + len;
5747             str = tvb_bytes_to_str(tvb, offset3, len);
5748             proto_tree_add_text(rsvp_object_tree, tvb, offset3, len,
5749                                 "Source Transport Network addr: %s", str);
5750             break;
5751
5752         default:
5753             offset4 = offset3 + len;
5754             str = "???";
5755             proto_tree_add_text(rsvp_object_tree, tvb, offset3, len, "Unknown Transport Network type: %d",
5756                                 type);
5757             break;
5758         }
5759
5760         proto_item_append_text(ti, "Src: %s. ", str);
5761         proto_tree_add_text(rsvp_object_tree, tvb, offset4, 8, "Local Identifier: %s",
5762                             tvb_bytes_to_str(tvb, offset4, 8));
5763         proto_item_append_text(ti, "Local ID: %s. ", tvb_bytes_to_str(tvb, offset4, 8));
5764         break;
5765
5766     default:
5767         proto_item_append_text(ti, " Unknown");
5768         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5769                             "C-type: Unknown (%u)", c_type);
5770         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length-4,
5771                             "Data (%d bytes)", obj_length-4);
5772         break;
5773     }
5774 }
5775
5776 /*------------------------------------------------------------------------------
5777  * 3GPP2_OBJECT X.S0057-0 v1.0
5778  *------------------------------------------------------------------------------*/
5779 static const value_string rsvp_3gpp_object_ie_type_vals[] = {
5780     { 0, "TFTIPv4"},
5781     { 2, "TFTIPv6"},
5782     { 0, NULL}
5783 };
5784
5785 static void
5786 dissect_rsvp_3gpp_object(proto_tree *ti, proto_tree *rsvp_object_tree,
5787                      tvbuff_t *tvb,
5788                      int offset, int obj_length,
5789                      int rsvp_class _U_, int c_type)
5790 {
5791     guint16 length;
5792
5793     offset+=3;
5794     proto_tree_add_item(rsvp_object_tree, hf_rsvp_c_type, tvb, offset, 1, ENC_BIG_ENDIAN);
5795     offset++;
5796     /* Set obj_length to the remaining bytes */
5797     obj_length = obj_length - 4;
5798     if(c_type==1){
5799         /* Transaction ID */
5800         proto_tree_add_item(rsvp_object_tree, hf_rsvp_3gpp_obj_tid, tvb, offset, 4, ENC_BIG_ENDIAN);
5801         offset+=4;
5802         obj_length = obj_length - 4;
5803         /* IE List */
5804         while(obj_length>0){
5805             length = tvb_get_ntohs(tvb, offset); 
5806             proto_tree_add_item(rsvp_object_tree, hf_rsvp_3gpp_obj_ie_len, tvb, offset, 2, ENC_BIG_ENDIAN);
5807             offset+=2;
5808             proto_tree_add_item(rsvp_object_tree, hf_rsvp_3gpp_obj_ie_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5809             offset+=2;
5810             proto_tree_add_text(rsvp_object_tree, tvb, offset, length-2, "IE Data");
5811             obj_length = obj_length - length;
5812         }
5813     }
5814
5815 }
5816 /*------------------------------------------------------------------------------
5817  * RESTART CAPABILITY
5818  *------------------------------------------------------------------------------*/
5819 static void
5820 dissect_rsvp_restart_cap(proto_tree *ti, proto_tree *rsvp_object_tree,
5821                          tvbuff_t *tvb,
5822                          int offset, int obj_length,
5823                          int rsvp_class _U_, int type)
5824 {
5825     int offset2 = offset + 4;
5826
5827     proto_item_set_text(ti, "RESTART CAPABILITY: ");
5828     switch(type) {
5829     case 1:
5830         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5831                             "C-type: 1");
5832         proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4,
5833                             "Restart Time: %d ms",
5834                             tvb_get_ntohl(tvb, offset2));
5835         proto_tree_add_text(rsvp_object_tree, tvb, offset2+4, 4,
5836                             "Recovery Time: %d ms",
5837                             tvb_get_ntohl(tvb, offset2+4));
5838         proto_item_append_text(ti, "Restart Time: %d ms. Recovery Time: %d ms.",
5839                             tvb_get_ntohl(tvb, offset2), tvb_get_ntohl(tvb, offset2+4));
5840         break;
5841
5842     default:
5843         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5844                             "C-type: Unknown (%u)",
5845                             type);
5846         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
5847                             "Data (%d bytes)", obj_length - 4);
5848         break;
5849     }
5850 }
5851
5852 /*------------------------------------------------------------------------------
5853  * PROTECTION INFORMATION
5854  *------------------------------------------------------------------------------*/
5855 static void
5856 dissect_rsvp_protection_info(proto_tree *ti, proto_tree *rsvp_object_tree,
5857                              tvbuff_t *tvb,
5858                              int offset, int obj_length,
5859                              int rsvp_class _U_, int type)
5860 {
5861     guint8      flags1, lsp_flags, link_flags, seg_flags;
5862     proto_tree *ti2, *ti3, *ti4, *rsvp_pi_link_flags_tree, *rsvp_pi_lsp_flags_tree, *rsvp_pi_seg_flags_tree;
5863     int         offset2 = offset + 4;
5864
5865     proto_item_set_text(ti, "PROTECTION_INFO: ");
5866     switch(type) {
5867     case 1:
5868         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5869                             "C-type: 1");
5870         flags1 = tvb_get_guint8(tvb, offset2);
5871         proto_tree_add_item(rsvp_object_tree, hf_rsvp_protection_info_flags_secondary_lsp,
5872                              tvb, offset2, 1, ENC_BIG_ENDIAN);
5873
5874         link_flags = tvb_get_guint8(tvb, offset2+3);
5875         ti2 = proto_tree_add_text(rsvp_object_tree, tvb, offset2+3, 1,
5876                                   "Link Flags: 0x%02x", link_flags);
5877         rsvp_pi_link_flags_tree = proto_item_add_subtree(ti2, TREE(TT_PROTECTION_INFO_LINK));
5878         proto_tree_add_item(rsvp_pi_link_flags_tree, hf_rsvp_pi_link_flags_extra_traffic,
5879                              tvb, offset2+3, 1, ENC_BIG_ENDIAN);
5880         proto_tree_add_item(rsvp_pi_link_flags_tree, hf_rsvp_pi_link_flags_unprotected,
5881                              tvb, offset2+3, 1, ENC_BIG_ENDIAN);
5882         proto_tree_add_item(rsvp_pi_link_flags_tree, hf_rsvp_pi_link_flags_shared,
5883                              tvb, offset2+3, 1, ENC_BIG_ENDIAN);
5884         proto_tree_add_item(rsvp_pi_link_flags_tree, hf_rsvp_pi_link_flags_dedicated1_1,
5885                              tvb, offset2+3, 1, ENC_BIG_ENDIAN);
5886         proto_tree_add_item(rsvp_pi_link_flags_tree, hf_rsvp_pi_link_flags_dedicated1plus1,
5887                              tvb, offset2+3, 1, ENC_BIG_ENDIAN);
5888         proto_tree_add_item(rsvp_pi_link_flags_tree, hf_rsvp_pi_link_flags_enhanced,
5889                              tvb, offset2+3, 1, ENC_BIG_ENDIAN);
5890         proto_item_append_text(ti, "%s%s%s%s%s%s%s.",
5891                                flags1&0x80 ? "SecondaryLSP ":"",
5892                                link_flags&0x01 ? "ExtraTraffic ":"",
5893                                link_flags&0x02 ? "Unprotected ":"",
5894                                link_flags&0x04 ? "Shared ":"",
5895                                link_flags&0x08 ? "Dedicated1:1 ":"",
5896                                link_flags&0x10 ? "Dedicated1+1 ":"",
5897                                link_flags&0x20 ? "Enhanced ":"");
5898         break;
5899
5900     case 2:       /* RFC4872 */
5901         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
5902                             "C-type:2");
5903         flags1 = tvb_get_guint8(tvb, offset2);
5904         proto_tree_add_item(rsvp_object_tree, hf_rsvp_rfc4872_secondary,
5905                              tvb, offset2, 1, ENC_BIG_ENDIAN);
5906         proto_tree_add_item(rsvp_object_tree, hf_rsvp_rfc4872_protecting,
5907                              tvb, offset2, 1, ENC_BIG_ENDIAN);
5908         proto_tree_add_item(rsvp_object_tree, hf_rsvp_rfc4872_notification_msg,
5909                              tvb, offset2, 1, ENC_BIG_ENDIAN);
5910         proto_tree_add_item(rsvp_object_tree, hf_rsvp_rfc4872_operational,
5911                              tvb, offset2, 1, ENC_BIG_ENDIAN);
5912
5913         lsp_flags = tvb_get_guint8(tvb, offset2+1);
5914         ti3 = proto_tree_add_text(rsvp_object_tree, tvb, offset2+1, 1,
5915                                   "LSP Flags: 0x%02x -%s%s%s%s%s%s", lsp_flags,
5916                                   lsp_flags == 0 ? " Unprotected":"",
5917                                   lsp_flags&0x01 ? " Rerouting":"",
5918                                   lsp_flags&0x02 ? " Rerouting with extra-traffic":"",
5919                                   lsp_flags&0x04 ? " 1:N Protection with extra-traffic":"",
5920                                   lsp_flags&0x08 ? " 1+1 Unidirectional protection":"",
5921                                   lsp_flags&0x10 ? " 1+1 Bidirectional protection":"");
5922         rsvp_pi_lsp_flags_tree = proto_item_add_subtree(ti3, TREE(TT_PROTECTION_INFO_LSP));
5923         proto_tree_add_item(rsvp_pi_lsp_flags_tree, hf_rsvp_pi_lsp_flags_full_rerouting,
5924                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
5925         proto_tree_add_item(rsvp_pi_lsp_flags_tree, hf_rsvp_pi_lsp_flags_rerouting_extra,
5926                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
5927         proto_tree_add_item(rsvp_pi_lsp_flags_tree, hf_rsvp_pi_lsp_flags_1_n_protection,
5928                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
5929         proto_tree_add_item(rsvp_pi_lsp_flags_tree, hf_rsvp_pi_lsp_flags_1plus1_unidirectional,
5930                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
5931         proto_tree_add_item(rsvp_pi_lsp_flags_tree, hf_rsvp_pi_lsp_flags_1plus1_bidirectional,
5932                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
5933
5934         link_flags = tvb_get_guint8(tvb, offset2+3);
5935         ti2 = proto_tree_add_text(rsvp_object_tree, tvb, offset2+3, 1,
5936                                   "Link Flags: 0x%02x -%s%s%s%s%s%s", link_flags,
5937                                   link_flags&0x01 ? " ExtraTraffic":"",
5938                                   link_flags&0x02 ? " Unprotected":"",
5939                                   link_flags&0x04 ? " Shared":"",
5940                                   link_flags&0x08 ? " Dedicated1:1":"",
5941                                   link_flags&0x10 ? " Dedicated1+1":"",
5942                                   link_flags&0x20 ? " Enhanced":"");
5943         rsvp_pi_link_flags_tree = proto_item_add_subtree(ti2, TREE(TT_PROTECTION_INFO_LINK));
5944         proto_tree_add_item(rsvp_pi_link_flags_tree, hf_rsvp_pi_link_flags_extra,
5945                              tvb, offset2+3, 1, ENC_BIG_ENDIAN);
5946         proto_tree_add_item(rsvp_pi_link_flags_tree, hf_rsvp_pi_link_flags_unprotected,
5947                              tvb, offset2+3, 1, ENC_BIG_ENDIAN);
5948         proto_tree_add_item(rsvp_pi_link_flags_tree, hf_rsvp_pi_link_flags_shared,
5949                              tvb, offset2+3, 1, ENC_BIG_ENDIAN);
5950         proto_tree_add_item(rsvp_pi_link_flags_tree, hf_rsvp_pi_link_flags_dedicated_1_1,
5951                              tvb, offset2+3, 1, ENC_BIG_ENDIAN);
5952         proto_tree_add_item(rsvp_pi_link_flags_tree, hf_rsvp_pi_link_flags_dedicated_1plus1,
5953                              tvb, offset2+3, 1, ENC_BIG_ENDIAN);
5954         proto_tree_add_item(rsvp_pi_link_flags_tree, hf_rsvp_pi_link_flags_enhanced,
5955                              tvb, offset2+3, 1, ENC_BIG_ENDIAN);
5956
5957         proto_tree_add_item(rsvp_object_tree, hf_rsvp_protection_info_in_place,
5958                              tvb, offset2+4, 1, ENC_BIG_ENDIAN);
5959         proto_tree_add_item(rsvp_object_tree, hf_rsvp_protection_info_required,
5960                              tvb, offset2+4, 1, ENC_BIG_ENDIAN);
5961
5962         seg_flags = tvb_get_guint8(tvb, offset2+5);
5963         ti4 = proto_tree_add_text(rsvp_object_tree, tvb, offset2+5, 1,
5964                                  "Segment recovery Flags: 0x%02x - %s%s%s%s%s%s", seg_flags,
5965                                   seg_flags == 0 ? " Unprotected":"",
5966                                   seg_flags&0x01 ? " Rerouting":"",
5967                                   seg_flags&0x02 ? " Rerouting with extra-traffic":"",
5968                                   seg_flags&0x04 ? " 1:N Protection with extra-traffic":"",
5969                                   seg_flags&0x08 ? " 1+1 Unidirectional protection":"",
5970                                   seg_flags&0x10 ? " 1+1 Bidirectional protection":"");
5971         rsvp_pi_seg_flags_tree = proto_item_add_subtree(ti4, TREE(TT_PROTECTION_INFO_SEG));
5972         proto_tree_add_item(rsvp_pi_seg_flags_tree, hf_rsvp_pi_seg_flags_full_rerouting,
5973                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
5974         proto_tree_add_item(rsvp_pi_seg_flags_tree, hf_rsvp_pi_seg_flags_rerouting_extra,
5975                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
5976         proto_tree_add_item(rsvp_pi_seg_flags_tree, hf_rsvp_pi_seg_flags_1_n_protection,
5977                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
5978         proto_tree_add_item(rsvp_pi_seg_flags_tree, hf_rsvp_pi_seg_flags_1plus1_unidirectional,
5979                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
5980         proto_tree_add_item(rsvp_pi_seg_flags_tree, hf_rsvp_pi_seg_flags_1plus1_bidirectional,
5981                              tvb, offset2+1, 1, ENC_BIG_ENDIAN);
5982
5983         proto_item_append_text(ti, "%s%s%s%s Link:%s%s%s%s%s%s, LSP:%s%s%s%s%s%s.",
5984                                flags1&0x80 ? "SecondaryLSP ":"",
5985                                flags1&0x40 ? "ProtectingLSP ":"",
5986                                flags1&0x20 ? "Notification ":"",
5987                                flags1&0x10 ? "OperationalLSP ":"",
5988                                link_flags&0x01 ? " ExtraTraffic":"",
5989                                link_flags&0x02 ? " Unprotected":"",
5990                                link_flags&0x04 ? " Shared":"",
5991                                link_flags&0x08 ? " Dedicated1:1":"",
5992                                link_flags&0x10 ? " Dedicated1+1":"",
5993                                link_flags&0x20 ? " Enhanced":"",
5994                                lsp_flags == 0 ? " Unprotected":"",
5995                                lsp_flags&0x01 ? " Rerouting":"",
5996                                lsp_flags&0x02 ? " Rerouting with extra-traffic":"",
5997                                lsp_flags&0x04 ? " 1:N Protection with extra-traffic":"",
5998                                lsp_flags&0x08 ? " 1+1 Unidirectional protection":"",
5999                                lsp_flags&0x10 ? " 1+1 Bidirectional protection":"");
6000         break;
6001
6002     default:
6003         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
6004                             "C-type: Unknown (%u)",
6005                             type);
6006         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
6007                             "Data (%d bytes)", obj_length - 4);
6008         break;
6009     }
6010 }
6011
6012 /*------------------------------------------------------------------------------
6013  * FAST REROUTE
6014  *------------------------------------------------------------------------------*/
6015 static void
6016 dissect_rsvp_fast_reroute(proto_tree *ti, proto_tree *rsvp_object_tree,
6017                           tvbuff_t *tvb,
6018                           int offset, int obj_length,
6019                           int rsvp_class _U_, int type)
6020 {
6021     guint8      flags;
6022     proto_tree *ti2, *rsvp_frr_flags_tree;
6023
6024     proto_item_set_text(ti, "FAST_REROUTE: ");
6025     switch(type) {
6026     case 1:
6027     case 7:
6028         if (((type == 1) && (obj_length != 24)) || ((type == 7) && (obj_length != 20))) {
6029             proto_tree_add_text(rsvp_object_tree, tvb, offset, obj_length,
6030                                 "<<<Invalid length: cannot decode>>>");
6031             proto_item_append_text(ti, "Invalid length");
6032             break;
6033         }
6034         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
6035                             "C-type: %u", type);
6036         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, 1,
6037                             "Setup Priority: %d", tvb_get_guint8(tvb, offset+4));
6038         proto_tree_add_text(rsvp_object_tree, tvb, offset+5, 1,
6039                             "Hold Priority: %d", tvb_get_guint8(tvb, offset+5));
6040         proto_tree_add_text(rsvp_object_tree, tvb, offset+6, 1,
6041                             "Hop Limit: %d", tvb_get_guint8(tvb, offset+6));
6042
6043         flags = tvb_get_guint8(tvb, offset+7);
6044         ti2 = proto_tree_add_text(rsvp_object_tree, tvb, offset+7, 1,
6045                                   "Flags: 0x%02x", flags);
6046         rsvp_frr_flags_tree = proto_item_add_subtree(ti2, TREE(TT_FAST_REROUTE_FLAGS));
6047         proto_tree_add_item(rsvp_frr_flags_tree, hf_rsvp_frr_flags_one2one_backup,
6048                              tvb, offset+7, 1, ENC_BIG_ENDIAN);
6049         proto_tree_add_item(rsvp_frr_flags_tree, hf_rsvp_frr_flags_facility_backup,
6050                              tvb, offset+7, 1, ENC_BIG_ENDIAN);
6051         proto_tree_add_text(rsvp_object_tree, tvb, offset+8, 4,
6052                             "Bandwidth: %.10g", tvb_get_ntohieee_float(tvb, offset+8));
6053         proto_tree_add_text(rsvp_object_tree, tvb, offset+12, 4,
6054                             "Include-Any: 0x%0x", tvb_get_ntohl(tvb, offset+12));
6055         proto_tree_add_text(rsvp_object_tree, tvb, offset+16, 4,
6056                             "Exclude-Any: 0x%0x", tvb_get_ntohl(tvb, offset+16));
6057         if (type == 1) {
6058             proto_tree_add_text(rsvp_object_tree, tvb, offset+20, 4,
6059                                 "Include-All: 0x%0x", tvb_get_ntohl(tvb, offset+20));
6060         }
6061
6062         proto_item_append_text(ti, "%s%s",
6063                                flags &0x01 ? "One-to-One Backup, " : "",
6064                                flags &0x02 ? "Facility Backup" : "");
6065         break;
6066
6067     default:
6068         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
6069                             "C-type: Unknown (%u)",
6070                             type);
6071         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, obj_length - 4,
6072                             "Data (%d bytes)", obj_length - 4);
6073         break;
6074     }
6075 }
6076
6077 /*------------------------------------------------------------------------------
6078  * DETOUR
6079  *------------------------------------------------------------------------------*/
6080 static void
6081 dissect_rsvp_detour(proto_tree *ti, proto_tree *rsvp_object_tree,
6082                     tvbuff_t *tvb,
6083                     int offset, int obj_length,
6084                     int rsvp_class _U_, int type)
6085 {
6086     int remaining_length, count;
6087     int iter;
6088
6089     proto_item_set_text(ti, "DETOUR: ");
6090     switch(type) {
6091     case 7:
6092         iter = 0;
6093         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
6094                             "C-type: %u", type);
6095         for (remaining_length = obj_length - 4, count = 1;
6096              remaining_length > 0; remaining_length -= 8, count++) {
6097             if (remaining_length < 8) {
6098                 proto_tree_add_text(rsvp_object_tree, tvb, offset+remaining_length,
6099                                     obj_length-remaining_length,
6100                                     "<<<Invalid length: cannot decode>>>");
6101                 proto_item_append_text(ti, "Invalid length");
6102                 break;
6103             }
6104             iter++;
6105             proto_tree_add_text(rsvp_object_tree, tvb, offset+(4*iter), 4,
6106                                 "PLR ID %d: %s", count,
6107                                 tvb_ip_to_str(tvb, offset+(4*iter)));
6108             iter++;
6109             proto_tree_add_text(rsvp_object_tree, tvb, offset+(4*iter), 4,
6110                                 "Avoid Node ID %d: %s", count,
6111                                 tvb_ip_to_str(tvb, offset+(4*iter)));
6112         }
6113         break;
6114
6115     default:
6116         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
6117                             "C-type: Unknown (%u)",
6118                             type);
6119         proto_tree_add_text(rsvp_object_tree, tvb, offset+4, obj_length - 4,
6120                             "Data (%d bytes)", obj_length - 4);
6121         break;
6122     }
6123 }
6124
6125 /*------------------------------------------------------------------------------
6126  * DIFFSERV
6127  *------------------------------------------------------------------------------*/
6128 static void
6129 dissect_rsvp_diffserv(proto_tree *ti, proto_tree *rsvp_object_tree,
6130                       tvbuff_t *tvb,
6131                       int offset, int obj_length,
6132                       int rsvp_class _U_, int type)
6133 {
6134     int mapnb, count;
6135     int *hfindexes[] = {
6136         &hf_rsvp_filter[RSVPF_DIFFSERV_MAP],
6137         &hf_rsvp_filter[RSVPF_DIFFSERV_MAP_EXP],
6138         &hf_rsvp_filter[RSVPF_DIFFSERV_PHBID],
6139         &hf_rsvp_filter[RSVPF_DIFFSERV_PHBID_DSCP],
6140         &hf_rsvp_filter[RSVPF_DIFFSERV_PHBID_CODE],
6141         &hf_rsvp_filter[RSVPF_DIFFSERV_PHBID_BIT14],
6142         &hf_rsvp_filter[RSVPF_DIFFSERV_PHBID_BIT15]
6143     };
6144     gint *etts[] = {
6145         &TREE(TT_DIFFSERV_MAP),
6146         &TREE(TT_DIFFSERV_MAP_PHBID)
6147     };
6148
6149     proto_item_set_text(ti, "DIFFSERV: ");
6150     offset += 3;
6151     switch (type) {
6152     case 1:
6153         proto_tree_add_text(rsvp_object_tree, tvb, offset, 1,
6154                             "C-type: 1 - E-LSP");
6155         proto_tree_add_uint(rsvp_object_tree, hf_rsvp_filter[RSVPF_DIFFSERV_MAPNB],
6156                             tvb, offset + 4, 1,
6157                             mapnb = tvb_get_guint8(tvb, offset + 4) & 15);
6158         proto_item_append_text(ti, "E-LSP, %u MAP%s", mapnb,
6159                                (mapnb == 0) ? "" : "s");
6160         offset += 5;
6161
6162         for (count = 0; count < mapnb; count++) {
6163             dissect_diffserv_mpls_common(tvb, rsvp_object_tree, type,
6164                                          offset, hfindexes, etts);
6165             offset += 4;
6166         }
6167         break;
6168     case 2:
6169         proto_item_append_text(ti, "L-LSP");
6170         proto_tree_add_text(rsvp_object_tree, tvb, offset, 1,
6171                             "C-type: 2 - L-LSP");
6172         dissect_diffserv_mpls_common(tvb, rsvp_object_tree, type,
6173                                      offset + 3, hfindexes, etts);
6174         break;
6175     default:
6176         proto_tree_add_text(rsvp_object_tree, tvb, offset, 1,
6177                             "C-type: Unknown (%u)", type);
6178         proto_tree_add_text(rsvp_object_tree, tvb, offset + 1, obj_length - 4,
6179                             "Data (%d bytes)", obj_length - 4);
6180         break;
6181     }
6182 }
6183
6184 /*------------------------------------------------------------------------------
6185  * CLASSTYPE
6186  *------------------------------------------------------------------------------*/
6187 static void
6188 dissect_rsvp_diffserv_aware_te(proto_tree *ti, proto_tree *rsvp_object_tree,
6189                                tvbuff_t *tvb,
6190                                int offset, int obj_length,
6191                                int rsvp_class _U_, int type)
6192 {
6193     proto_item *hidden_item;
6194     int         offset2 = offset + 4;
6195     guint8      ct      = 0;
6196
6197     hidden_item = proto_tree_add_item(rsvp_object_tree,
6198                                hf_rsvp_filter[RSVPF_DSTE],
6199                                tvb, offset, 8, ENC_NA);
6200     PROTO_ITEM_SET_HIDDEN(hidden_item);
6201
6202     switch(type) {
6203     case 1:
6204         ct = tvb_get_guint8(tvb, offset2+3);
6205         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1, "C-type: 1");
6206         proto_tree_add_item(rsvp_object_tree,
6207                             hf_rsvp_filter[RSVPF_DSTE_CLASSTYPE],
6208                             tvb, offset2+3, 1, ENC_BIG_ENDIAN);
6209         proto_item_set_text(ti, "CLASSTYPE: CT %u", ct);
6210         break;
6211     default:
6212         proto_item_set_text(ti, "CLASSTYPE: (Unknown C-type)");
6213         proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1,
6214                             "C-type: Unknown (%u)", type);
6215         proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
6216                             "Data (%d bytes)", obj_length - 4);
6217         break;
6218     }
6219 }
6220
6221 /*----------------------------------------------------------------------------
6222  * VENDOR PRIVATE USE
6223  *---------------------------------------------------------------------------*/
6224 static void
6225 dissect_rsvp_vendor_private_use(proto_tree *ti _U_,
6226                                 proto_tree *rsvp_object_tree,
6227                                 tvbuff_t *tvb,
6228                                 int offset, int obj_length,
6229                                 int rsvp_class _U_, int type)
6230 {
6231     /*
6232      * FF: from Section 2, RFC 3936
6233      *
6234      * "Organization/Vendor Private" ranges refer to values that are
6235      * enterprise-specific;  these MUST NOT be registered with IANA.  For
6236      * Vendor Private values, the first 4-octet word of the data field MUST
6237      * be an enterprise code [ENT: www.iana.org/assignments/enterprise-numbers]
6238      * (network order) as registered with the IANA SMI Network Management
6239      * Private Enterprise Codes, and the rest of the data thereafter is for
6240      * the private use of the registered enterprise.
6241      */
6242     proto_item *hidden_item;
6243
6244     hidden_item = proto_tree_add_item(rsvp_object_tree,
6245                                       hf_rsvp_filter[RSVPF_PRIVATE_OBJ],
6246                                       tvb, offset, obj_length, ENC_NA);
6247     PROTO_ITEM_SET_HIDDEN(hidden_item);
6248     proto_tree_add_text(rsvp_object_tree, tvb, offset + 3, 1,
6249                         "C-type: %u", type);
6250     proto_tree_add_item(rsvp_object_tree,
6251                         hf_rsvp_filter[RSVPF_ENT_CODE],
6252                         tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6253     proto_tree_add_text(rsvp_object_tree, tvb, offset + 8, obj_length - 8,
6254                         "Data (%d bytes)", obj_length - 8);
6255 }
6256
6257 /*------------------------------------------------------------------------------
6258  * Dissect a single RSVP message in a tree
6259  *------------------------------------------------------------------------------*/
6260 static void
6261 dissect_rsvp_msg_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
6262                       int tree_mode, rsvp_conversation_info *rsvph)
6263 {
6264     proto_tree *rsvp_tree;
6265     proto_tree *rsvp_header_tree;
6266     proto_tree *rsvp_object_tree;
6267     proto_tree *ti;
6268     proto_item *hidden_item;
6269     guint16     cksum, computed_cksum;
6270     vec_t       cksum_vec[1];
6271     int         offset    = 0;
6272     int         len;
6273     guint8      ver_flags;
6274     guint8      message_type;
6275     int         session_off, tempfilt_off;
6276     int         msg_length;
6277     int         obj_length;
6278     int         offset2;
6279
6280     offset       = 0;
6281     ver_flags    = tvb_get_guint8(tvb, 0);
6282     msg_length   = tvb_get_ntohs(tvb, 6);
6283     message_type = tvb_get_guint8(tvb, 1);
6284
6285     ti = proto_tree_add_item(tree, proto_rsvp, tvb, offset, msg_length,
6286                              ENC_NA);
6287     rsvp_tree = proto_item_add_subtree(ti, tree_mode);
6288     if (pinfo->ipproto == IP_PROTO_RSVPE2EI)
6289         proto_item_append_text(rsvp_tree, " (E2E-IGNORE)");
6290     proto_item_append_text(rsvp_tree, ": ");
6291     proto_item_append_text(rsvp_tree, "%s", val_to_str_ext(message_type, &message_type_vals_ext,
6292                                                  "Unknown (%u). "));
6293     find_rsvp_session_tempfilt(tvb, 0, &session_off, &tempfilt_off);
6294     if (session_off)
6295         proto_item_append_text(rsvp_tree, "%s", summary_session(tvb, session_off));
6296     if (tempfilt_off)
6297         proto_item_append_text(rsvp_tree, "%s", summary_template(tvb, tempfilt_off));
6298
6299     ti = proto_tree_add_text(rsvp_tree, tvb, offset, 8, "RSVP Header. %s",
6300                              val_to_str_ext(message_type, &message_type_vals_ext,
6301                                         "Unknown Message (%u). "));
6302     if (pinfo->ipproto == IP_PROTO_RSVPE2EI)
6303         proto_item_append_text(ti, " (E2E-IGNORE)");
6304     rsvp_header_tree = proto_item_add_subtree(ti, TREE(TT_HDR));
6305
6306     proto_tree_add_text(rsvp_header_tree, tvb, offset, 1, "RSVP Version: %u",
6307                         (ver_flags & 0xf0)>>4);
6308     proto_tree_add_text(rsvp_header_tree, tvb, offset, 1, "Flags: %02x",
6309                         ver_flags & 0xf);
6310     proto_tree_add_uint(rsvp_header_tree, hf_rsvp_filter[RSVPF_MSG], tvb,
6311                         offset+1, 1, message_type);
6312     switch (RSVPF_MSG + message_type) {
6313
6314     case RSVPF_PATH:
6315     case RSVPF_RESV:
6316     case RSVPF_PATHERR:
6317     case RSVPF_RESVERR:
6318     case RSVPF_PATHTEAR:
6319     case RSVPF_RESVTEAR:
6320     case RSVPF_RCONFIRM:
6321     case RSVPF_RTEARCONFIRM:
6322     case RSVPF_BUNDLE:
6323     case RSVPF_ACK:
6324     case RSVPF_SREFRESH:
6325     case RSVPF_HELLO:
6326     case RSVPF_NOTIFY:
6327         hidden_item = proto_tree_add_boolean(rsvp_header_tree, hf_rsvp_filter[RSVPF_MSG + message_type], tvb,
6328                                       offset+1, 1, 1);
6329         PROTO_ITEM_SET_HIDDEN(hidden_item);
6330         break;
6331     }
6332
6333     cksum = tvb_get_ntohs(tvb, offset+2);
6334     if (!pinfo->fragmented && ((int) tvb_length(tvb) >= msg_length)) {
6335         /* The packet isn't part of a fragmented datagram and isn't
6336            truncated, so we can checksum it. */
6337         cksum_vec[0].ptr = tvb_get_ptr(tvb, 0, msg_length);
6338         cksum_vec[0].len = msg_length;
6339         computed_cksum = in_cksum(&cksum_vec[0], 1);
6340         if (computed_cksum == 0) {
6341             proto_tree_add_text(rsvp_header_tree, tvb, offset+2, 2,
6342                                 "Message Checksum: 0x%04x [correct]",
6343                                 cksum);
6344         } else {
6345             proto_tree_add_text(rsvp_header_tree, tvb, offset+2, 2,
6346                                 "Message Checksum: 0x%04x [incorrect, should be 0x%04x]",
6347                                 cksum,
6348                                 in_cksum_shouldbe(cksum, computed_cksum));
6349         }
6350     } else {
6351         proto_tree_add_text(rsvp_header_tree, tvb, offset+2, 2,
6352                             "Message Checksum: 0x%04x",
6353                             cksum);
6354     }
6355     proto_tree_add_text(rsvp_header_tree, tvb, offset+4, 1,
6356                         "Sending TTL: %u",
6357                         tvb_get_guint8(tvb, offset+4));
6358     proto_tree_add_text(rsvp_header_tree, tvb, offset+6, 2,
6359                         "Message length: %u", msg_length);
6360
6361     offset = 8;
6362     len    = 8;
6363
6364     if (message_type == RSVP_MSG_BUNDLE) {
6365         /* Bundle message. Dissect component messages */
6366         if (rsvp_bundle_dissect) {
6367             int len2 = 8;
6368             while (len2 < msg_length) {
6369                 gint      sub_len;
6370                 tvbuff_t *tvb_sub;
6371                 sub_len = tvb_get_ntohs(tvb, len2+6);
6372                 tvb_sub = tvb_new_subset(tvb, len2, sub_len, sub_len);
6373                 dissect_rsvp_msg_tree(tvb_sub, pinfo, rsvp_tree, TREE(TT_BUNDLE_COMPMSG), rsvph);
6374                 len2 += sub_len;
6375             }
6376         } else {
6377             proto_tree_add_text(rsvp_tree, tvb, offset, msg_length - len,
6378                                 "Bundle Component Messages Not Dissected");
6379         }
6380         return;
6381     }
6382
6383     while (len < msg_length) {
6384         guint8 rsvp_class;
6385         guint8 type;
6386
6387         obj_length = tvb_get_ntohs(tvb, offset);
6388         rsvp_class = tvb_get_guint8(tvb, offset+2);
6389         type = tvb_get_guint8(tvb, offset+3);
6390         ti = proto_tree_add_item(rsvp_tree, hf_rsvp_filter[rsvp_class_to_filter_num(rsvp_class)],
6391                                  tvb, offset, obj_length, ENC_BIG_ENDIAN);
6392         rsvp_object_tree = proto_item_add_subtree(ti, TREE(rsvp_class_to_tree_type(rsvp_class)));
6393         if (obj_length < 4) {
6394             proto_tree_add_text(rsvp_object_tree, tvb, offset, 2,
6395                                 "Length: %u (bogus, must be >= 4)", obj_length);
6396             break;
6397         }
6398         proto_tree_add_text(rsvp_object_tree, tvb, offset, 2,
6399                             "Length: %u", obj_length);
6400         proto_tree_add_uint(rsvp_object_tree, hf_rsvp_filter[RSVPF_OBJECT], tvb,
6401                             offset+2, 1, rsvp_class);
6402
6403         offset2 = offset+4;
6404
6405         switch(rsvp_class) {
6406
6407         case RSVP_CLASS_SESSION:
6408             dissect_rsvp_session(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type, rsvph);
6409             break;
6410
6411         case RSVP_CLASS_HOP:
6412             dissect_rsvp_hop(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6413             break;
6414
6415         case RSVP_CLASS_TIME_VALUES:
6416             dissect_rsvp_time_values(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6417             break;
6418
6419         case RSVP_CLASS_ERROR:
6420             dissect_rsvp_error(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6421             break;
6422
6423         case RSVP_CLASS_SCOPE:
6424             dissect_rsvp_scope(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6425             break;
6426
6427         case RSVP_CLASS_STYLE:
6428             dissect_rsvp_style(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6429             break;
6430
6431         case RSVP_CLASS_CONFIRM:
6432             dissect_rsvp_confirm(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6433             break;
6434
6435         case RSVP_CLASS_SENDER_TEMPLATE:
6436         case RSVP_CLASS_FILTER_SPEC:
6437             dissect_rsvp_template_filter(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type, rsvph);
6438             break;
6439
6440         case RSVP_CLASS_SENDER_TSPEC:
6441             dissect_rsvp_tspec(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6442             break;
6443
6444         case RSVP_CLASS_FLOWSPEC:
6445             dissect_rsvp_flowspec(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6446             break;
6447
6448         case RSVP_CLASS_ADSPEC:
6449             dissect_rsvp_adspec(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6450             break;
6451
6452         case RSVP_CLASS_INTEGRITY:
6453             dissect_rsvp_integrity(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6454             break;
6455
6456         case RSVP_CLASS_POLICY:
6457             dissect_rsvp_policy(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6458             break;
6459
6460         case RSVP_CLASS_LABEL_REQUEST:
6461             dissect_rsvp_label_request(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6462             break;
6463
6464         case RSVP_CLASS_RECOVERY_LABEL:
6465         case RSVP_CLASS_UPSTREAM_LABEL:
6466         case RSVP_CLASS_SUGGESTED_LABEL:
6467         case RSVP_CLASS_LABEL:
6468             dissect_rsvp_label(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6469             break;
6470
6471         case RSVP_CLASS_LABEL_SET:
6472             dissect_rsvp_label_set(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6473             break;
6474
6475         case RSVP_CLASS_SESSION_ATTRIBUTE:
6476             dissect_rsvp_session_attribute(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6477             break;
6478
6479         case RSVP_CLASS_EXPLICIT_ROUTE:
6480             dissect_rsvp_explicit_route(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6481             break;
6482
6483         case RSVP_CLASS_RECORD_ROUTE:
6484             dissect_rsvp_record_route(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6485             break;
6486
6487         case RSVP_CLASS_MESSAGE_ID:
6488             dissect_rsvp_message_id(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6489             break;
6490
6491         case RSVP_CLASS_MESSAGE_ID_ACK:
6492             dissect_rsvp_message_id_ack(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6493             break;
6494
6495         case RSVP_CLASS_MESSAGE_ID_LIST:
6496             dissect_rsvp_message_id_list(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6497             break;
6498
6499         case RSVP_CLASS_HELLO:
6500             dissect_rsvp_hello(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6501             break;
6502
6503         case RSVP_CLASS_DCLASS:
6504             dissect_rsvp_dclass(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6505             break;
6506
6507         case RSVP_CLASS_ADMIN_STATUS:
6508             dissect_rsvp_admin_status(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6509             break;
6510
6511         case RSVP_CLASS_LSP_ATTRIBUTES:
6512         case RSVP_CLASS_LSP_REQUIRED_ATTRIBUTES:
6513             dissect_rsvp_lsp_attributes(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6514             break;
6515
6516         case RSVP_CLASS_ASSOCIATION:
6517             dissect_rsvp_association(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6518             break;
6519
6520         case RSVP_CLASS_LSP_TUNNEL_IF_ID:
6521             dissect_rsvp_lsp_tunnel_if_id(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6522             break;
6523
6524         case RSVP_CLASS_NOTIFY_REQUEST:
6525             dissect_rsvp_notify_request(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6526             break;
6527
6528         case RSVP_CLASS_GENERALIZED_UNI:
6529             dissect_rsvp_gen_uni(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type, rsvph);
6530             break;
6531
6532         case RSVP_CLASS_CALL_ID:
6533             dissect_rsvp_call_id(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6534             break;
6535
6536         case RSVP_CLASS_3GPP2_OBJECT:
6537             dissect_rsvp_3gpp_object(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6538             break;
6539
6540         case RSVP_CLASS_RESTART_CAP:
6541             dissect_rsvp_restart_cap(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6542             break;
6543
6544         case RSVP_CLASS_PROTECTION:
6545             dissect_rsvp_protection_info(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6546             break;
6547
6548         case RSVP_CLASS_FAST_REROUTE:
6549             dissect_rsvp_fast_reroute(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6550             break;
6551
6552         case RSVP_CLASS_DETOUR:
6553             dissect_rsvp_detour(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6554             break;
6555
6556         case RSVP_CLASS_DIFFSERV:
6557             dissect_rsvp_diffserv(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6558             break;
6559
6560         case RSVP_CLASS_CLASSTYPE:
6561             dissect_rsvp_diffserv_aware_te(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6562             break;
6563
6564         case RSVP_CLASS_VENDOR_PRIVATE_1:
6565         case RSVP_CLASS_VENDOR_PRIVATE_2:
6566         case RSVP_CLASS_VENDOR_PRIVATE_3:
6567         case RSVP_CLASS_VENDOR_PRIVATE_4:
6568         case RSVP_CLASS_VENDOR_PRIVATE_5:
6569         case RSVP_CLASS_VENDOR_PRIVATE_6:
6570         case RSVP_CLASS_VENDOR_PRIVATE_7:
6571         case RSVP_CLASS_VENDOR_PRIVATE_8:
6572         case RSVP_CLASS_VENDOR_PRIVATE_9:
6573         case RSVP_CLASS_VENDOR_PRIVATE_10:
6574         case RSVP_CLASS_VENDOR_PRIVATE_11:
6575         case RSVP_CLASS_VENDOR_PRIVATE_12:
6576             dissect_rsvp_vendor_private_use(ti, rsvp_object_tree, tvb, offset, obj_length, rsvp_class, type);
6577             break;
6578
6579         case RSVP_CLASS_NULL:
6580         default:
6581             proto_tree_add_text(rsvp_object_tree, tvb, offset2, obj_length - 4,
6582                                 "Data (%d bytes)", obj_length - 4);
6583             break;
6584         }
6585
6586         offset += obj_length;
6587         len += obj_length;
6588     }
6589 }
6590
6591 /*------------------------------------------------------------------------------
6592  * The main loop
6593  *------------------------------------------------------------------------------*/
6594 static void
6595 dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
6596 {
6597     guint8 message_type;
6598     int    session_off, tempfilt_off;
6599
6600     rsvp_conversation_info  *rsvph;
6601     conversation_t          *conversation;
6602     struct rsvp_request_key  request_key, *new_request_key;
6603     struct rsvp_request_val *request_val;
6604
6605     col_set_str(pinfo->cinfo, COL_PROTOCOL,
6606                 (pinfo->ipproto == IP_PROTO_RSVPE2EI) ? "RSVP-E2EI" : "RSVP");
6607     col_clear(pinfo->cinfo, COL_INFO);
6608
6609     message_type = tvb_get_guint8(tvb, 1);
6610
6611     rsvph = ep_new0(rsvp_conversation_info);
6612
6613     /* Copy over the source and destination addresses from the pinfo strucutre */
6614     SET_ADDRESS(&rsvph->source, pinfo->src.type, pinfo->src.len, pinfo->src.data);
6615     SET_ADDRESS(&rsvph->destination, pinfo->dst.type, pinfo->dst.len, pinfo->dst.data);
6616
6617     col_add_str(pinfo->cinfo, COL_INFO,
6618                 val_to_str_ext(message_type, &message_type_vals_ext, "Unknown (%u). "));
6619
6620     if (message_type == RSVP_MSG_BUNDLE) {
6621         col_set_str(pinfo->cinfo, COL_INFO,
6622                     rsvp_bundle_dissect ?
6623                     "Component Messages Dissected" :
6624                     "Component Messages Not Dissected");
6625     } else {
6626         find_rsvp_session_tempfilt(tvb, 0, &session_off, &tempfilt_off);
6627         if (session_off)
6628             col_append_str(pinfo->cinfo, COL_INFO, summary_session(tvb, session_off));
6629         if (tempfilt_off)
6630             col_append_str(pinfo->cinfo, COL_INFO, summary_template(tvb, tempfilt_off));
6631     }
6632
6633     if (tree) {
6634         dissect_rsvp_msg_tree(tvb, pinfo, tree, TREE(TT_RSVP), rsvph);
6635     }
6636
6637     /* ACK, SREFRESH and HELLO messages don't have any associated SESSION and,
6638        therefore, no conversation */
6639     if ((message_type == RSVP_MSG_ACK)      ||
6640         (message_type == RSVP_MSG_SREFRESH) ||
6641         (message_type == RSVP_MSG_HELLO))
6642       return;
6643
6644     /* Find out what conversation this packet is part of. */
6645     conversation = find_or_create_conversation(pinfo);
6646
6647     /* Now build the request key */
6648     memset(&request_key, 0, sizeof(request_key));
6649     request_key.conversation = conversation->index;
6650     request_key.session_type = rsvph->session_type;
6651
6652     switch (request_key.session_type) {
6653     case RSVP_SESSION_TYPE_IPV4:
6654         SET_ADDRESS(&request_key.u.session_ipv4.destination,
6655                     rsvph->destination.type, rsvph->destination.len,
6656                     rsvph->destination.data);
6657         request_key.u.session_ipv4.protocol = rsvph->protocol;
6658         request_key.u.session_ipv4.udp_dest_port = rsvph->udp_dest_port;
6659         break;
6660
6661     case RSVP_SESSION_TYPE_IPV6:
6662         /* Not supported yet */
6663         break;
6664
6665     case RSVP_SESSION_TYPE_IPV4_LSP:
6666         SET_ADDRESS(&request_key.u.session_ipv4_lsp.destination,
6667                     rsvph->destination.type, rsvph->destination.len,
6668                     rsvph->destination.data);
6669         request_key.u.session_ipv4_lsp.udp_dest_port = rsvph->udp_dest_port;
6670         request_key.u.session_ipv4_lsp.ext_tunnel_id = rsvph->ext_tunnel_id;
6671         break;
6672
6673     case RSVP_SESSION_TYPE_AGGREGATE_IPV4:
6674         SET_ADDRESS(&request_key.u.session_agg_ipv4.destination,
6675                     rsvph->destination.type, rsvph->destination.len,
6676                     rsvph->destination.data);
6677         request_key.u.session_agg_ipv4.dscp = rsvph->dscp;
6678         break;
6679
6680     case RSVP_SESSION_TYPE_IPV4_UNI:
6681         SET_ADDRESS(&request_key.u.session_ipv4_uni.destination,
6682                     rsvph->destination.type, rsvph->destination.len,
6683                     rsvph->destination.data);
6684         request_key.u.session_ipv4_uni.udp_dest_port = rsvph->udp_dest_port;
6685         request_key.u.session_ipv4_uni.ext_tunnel_id = rsvph->ext_tunnel_id;
6686         break;
6687
6688     case RSVP_SESSION_TYPE_IPV4_E_NNI:
6689         SET_ADDRESS(&request_key.u.session_ipv4_enni.destination,
6690                     rsvph->destination.type, rsvph->destination.len,
6691                     rsvph->destination.data);
6692         request_key.u.session_ipv4_enni.udp_dest_port = rsvph->udp_dest_port;
6693         request_key.u.session_ipv4_enni.ext_tunnel_id = rsvph->ext_tunnel_id;
6694         break;
6695     default:
6696         /* This should never happen. */
6697         if (tree) {
6698             proto_tree_add_text(tree, tvb, 0, 0, "Unknown session type");
6699         }
6700         break;
6701     }
6702
6703     SE_COPY_ADDRESS(&request_key.source_info.source, &rsvph->source);
6704     request_key.source_info.udp_source_port = rsvph->udp_source_port;
6705
6706     /* See if a request with this key already exists */
6707     request_val =
6708         (struct rsvp_request_val *) g_hash_table_lookup(rsvp_request_hash,
6709                                                         &request_key);
6710
6711     /* If not, insert the new request key into the hash table */
6712     if (!request_val) {
6713         new_request_key = (struct rsvp_request_key *)se_memdup(&request_key, sizeof(struct rsvp_request_key));
6714
6715         request_val = se_new(struct rsvp_request_val);
6716         request_val->value = conversation->index;
6717
6718         g_hash_table_insert(rsvp_request_hash, new_request_key, request_val);
6719     }
6720
6721     tap_queue_packet(rsvp_tap, pinfo, rsvph);
6722 }
6723
6724 static void
6725 register_rsvp_prefs(void)
6726 {
6727     module_t *rsvp_module;
6728
6729     rsvp_module = prefs_register_protocol(proto_rsvp, NULL);
6730     prefs_register_bool_preference(
6731         rsvp_module, "process_bundle",
6732         "Dissect sub-messages in BUNDLE message",
6733         "Specifies whether Wireshark should decode and display sub-messages within BUNDLE messages",
6734         &rsvp_bundle_dissect);
6735     prefs_register_enum_preference(
6736         rsvp_module, "generalized_label_options",
6737         "Dissect generalized labels as",
6738         "Specifies how Wireshark should dissect generalized labels",
6739         (gint *)&rsvp_generalized_label_option,
6740         rsvp_generalized_label_options,
6741         FALSE);
6742 }
6743
6744 void
6745 proto_register_rsvp(void)
6746 {
6747     gint i;
6748
6749     static hf_register_info rsvpf_info[] = {
6750
6751         /* Message type number */
6752         {&hf_rsvp_filter[RSVPF_MSG],
6753          { "Message Type", "rsvp.msg",
6754            FT_UINT8, BASE_DEC | BASE_EXT_STRING, &message_type_vals_ext, 0x0,
6755            NULL, HFILL }
6756         },
6757
6758         /* Message type shorthands */
6759         {&hf_rsvp_filter[RSVPF_PATH],
6760          { "Path Message", "rsvp.path",
6761            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6762            NULL, HFILL }
6763         },
6764
6765         {&hf_rsvp_filter[RSVPF_RESV],
6766          { "Resv Message", "rsvp.resv",
6767            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6768            NULL, HFILL }
6769         },
6770
6771         {&hf_rsvp_filter[RSVPF_PATHERR],
6772          { "Path Error Message", "rsvp.perr",
6773            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6774            NULL, HFILL }
6775         },
6776
6777         {&hf_rsvp_filter[RSVPF_RESVERR],
6778          { "Resv Error Message", "rsvp.rerr",
6779            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6780            NULL, HFILL }
6781         },
6782
6783         {&hf_rsvp_filter[RSVPF_PATHTEAR],
6784          { "Path Tear Message", "rsvp.ptear",
6785            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6786            NULL, HFILL }
6787         },
6788
6789         {&hf_rsvp_filter[RSVPF_RESVTEAR],
6790          { "Resv Tear Message", "rsvp.rtear",
6791            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6792            NULL, HFILL }
6793         },
6794
6795         {&hf_rsvp_filter[RSVPF_RCONFIRM],
6796          { "Resv Confirm Message", "rsvp.resvconf",
6797            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6798            NULL, HFILL }
6799         },
6800
6801         {&hf_rsvp_filter[RSVPF_RTEARCONFIRM],
6802          { "Resv Tear Confirm Message", "rsvp.rtearconf",
6803            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6804            NULL, HFILL }
6805         },
6806
6807         {&hf_rsvp_filter[RSVPF_BUNDLE],
6808          { "Bundle Message", "rsvp.bundle",
6809            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6810            NULL, HFILL }
6811         },
6812
6813         {&hf_rsvp_filter[RSVPF_ACK],
6814          { "Ack Message", "rsvp.ack",
6815            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6816            NULL, HFILL }
6817         },
6818
6819         {&hf_rsvp_filter[RSVPF_SREFRESH],
6820          { "Srefresh Message", "rsvp.srefresh",
6821            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6822            NULL, HFILL }
6823         },
6824
6825         {&hf_rsvp_filter[RSVPF_HELLO],
6826          { "HELLO Message", "rsvp.hello",
6827            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6828            NULL, HFILL }
6829         },
6830
6831         /* Object class */
6832         {&hf_rsvp_filter[RSVPF_OBJECT],
6833          { "Object class", "rsvp.object",
6834            FT_UINT8, BASE_DEC | BASE_EXT_STRING, &rsvp_class_vals_ext, 0x0,
6835            NULL, HFILL }
6836         },
6837
6838         {&hf_rsvp_filter[RSVPF_NOTIFY],
6839          { "Notify Message", "rsvp.notify",
6840            FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6841            NULL, HFILL }
6842         },
6843
6844         /* Object present shorthands */
6845         {&hf_rsvp_filter[RSVPF_SESSION],
6846          { "SESSION", "rsvp.session",
6847            FT_NONE, BASE_NONE, NULL, 0x0,
6848            NULL, HFILL }
6849         },
6850
6851         {&hf_rsvp_filter[RSVPF_HOP],
6852          { "HOP", "rsvp.hop",
6853            FT_NONE, BASE_NONE, NULL, 0x0,
6854            NULL, HFILL }
6855         },
6856
6857         {&hf_rsvp_filter[RSVPF_HELLO_OBJ],
6858          { "HELLO Request/Ack", "rsvp.hello_obj",
6859            FT_NONE, BASE_NONE, NULL, 0x0,
6860            NULL, HFILL }
6861         },
6862
6863         {&hf_rsvp_filter[RSVPF_INTEGRITY],
6864          { "INTEGRITY", "rsvp.integrity",
6865            FT_NONE, BASE_NONE, NULL, 0x0,
6866            NULL, HFILL }
6867         },
6868
6869         {&hf_rsvp_filter[RSVPF_TIME_VALUES],
6870          { "TIME VALUES", "rsvp.time",
6871            FT_NONE, BASE_NONE, NULL, 0x0,
6872            NULL, HFILL }
6873         },
6874
6875         {&hf_rsvp_filter[RSVPF_ERROR],
6876          { "ERROR", "rsvp.error",
6877            FT_NONE, BASE_NONE, NULL, 0x0,
6878            NULL, HFILL }
6879         },
6880
6881         {&hf_rsvp_filter[RSVPF_SCOPE],
6882          { "SCOPE", "rsvp.scope",
6883            FT_NONE, BASE_NONE, NULL, 0x0,
6884            NULL, HFILL }
6885         },
6886
6887         {&hf_rsvp_filter[RSVPF_STYLE],
6888          { "STYLE", "rsvp.style",
6889            FT_NONE, BASE_NONE, NULL, 0x0,
6890            NULL, HFILL }
6891         },
6892
6893         {&hf_rsvp_filter[RSVPF_FLOWSPEC],
6894          { "FLOWSPEC", "rsvp.flowspec",
6895            FT_NONE, BASE_NONE, NULL, 0x0,
6896            NULL, HFILL }
6897         },
6898
6899         {&hf_rsvp_filter[RSVPF_FILTER_SPEC],
6900          { "FILTERSPEC", "rsvp.filter",
6901            FT_NONE, BASE_NONE, NULL, 0x0,
6902            NULL, HFILL }
6903         },
6904
6905         {&hf_rsvp_filter[RSVPF_SENDER],
6906          { "SENDER TEMPLATE", "rsvp.sender",
6907            FT_NONE, BASE_NONE, NULL, 0x0,
6908            NULL, HFILL }
6909         },
6910
6911         {&hf_rsvp_filter[RSVPF_TSPEC],
6912          { "SENDER TSPEC", "rsvp.tspec",
6913            FT_NONE, BASE_NONE, NULL, 0x0,
6914            NULL, HFILL }
6915         },
6916
6917         {&hf_rsvp_filter[RSVPF_ADSPEC],
6918          { "ADSPEC", "rsvp.adspec",
6919            FT_NONE, BASE_NONE, NULL, 0x0,
6920            NULL, HFILL }
6921         },
6922
6923         {&hf_rsvp_filter[RSVPF_POLICY],
6924          { "POLICY", "rsvp.policy",
6925            FT_NONE, BASE_NONE, NULL, 0x0,
6926            NULL, HFILL }
6927         },
6928
6929         {&hf_rsvp_filter[RSVPF_CONFIRM],
6930          { "CONFIRM", "rsvp.confirm",
6931            FT_NONE, BASE_NONE, NULL, 0x0,
6932            NULL, HFILL }
6933         },
6934
6935         {&hf_rsvp_filter[RSVPF_LABEL],
6936          { "LABEL", "rsvp.label",
6937            FT_NONE, BASE_NONE, NULL, 0x0,
6938            NULL, HFILL }
6939         },
6940
6941         {&hf_rsvp_filter[RSVPF_RECOVERY_LABEL],
6942          { "RECOVERY LABEL", "rsvp.recovery_label",
6943            FT_NONE, BASE_NONE, NULL, 0x0,
6944            NULL, HFILL }
6945         },
6946
6947         {&hf_rsvp_filter[RSVPF_UPSTREAM_LABEL],
6948          { "UPSTREAM LABEL", "rsvp.upstream_label",
6949            FT_NONE, BASE_NONE, NULL, 0x0,
6950            NULL, HFILL }
6951         },
6952
6953         {&hf_rsvp_filter[RSVPF_SUGGESTED_LABEL],
6954          { "SUGGESTED LABEL", "rsvp.suggested_label",
6955            FT_NONE, BASE_NONE, NULL, 0x0,
6956            NULL, HFILL }
6957         },
6958
6959         {&hf_rsvp_filter[RSVPF_LABEL_SET],
6960          { "LABEL SET", "rsvp.label_set",
6961            FT_NONE, BASE_NONE, NULL, 0x0,
6962            NULL, HFILL }
6963         },
6964
6965         {&hf_rsvp_filter[RSVPF_ACCEPTABLE_LABEL_SET],
6966          { "ACCEPTABLE LABEL SET", "rsvp.acceptable_label_set",
6967            FT_NONE, BASE_NONE, NULL, 0x0,
6968            NULL, HFILL }
6969         },
6970
6971         {&hf_rsvp_filter[RSVPF_PROTECTION],
6972          { "PROTECTION", "rsvp.protection",
6973            FT_NONE, BASE_NONE, NULL, 0x0,
6974            NULL, HFILL }
6975         },
6976
6977         {&hf_rsvp_filter[RSVPF_DIFFSERV],
6978          { "DIFFSERV", "rsvp.diffserv",
6979            FT_NONE, BASE_NONE, NULL, 0x0,
6980            NULL, HFILL }
6981         },
6982
6983         {&hf_rsvp_filter[RSVPF_DSTE],
6984          { "CLASSTYPE", "rsvp.dste",
6985            FT_NONE, BASE_NONE, NULL, 0x0,
6986            NULL, HFILL }
6987         },
6988
6989         {&hf_rsvp_filter[RSVPF_RESTART_CAP],
6990          { "RESTART CAPABILITY", "rsvp.restart",
6991            FT_NONE, BASE_NONE, NULL, 0x0,
6992            NULL, HFILL }
6993         },
6994
6995         {&hf_rsvp_filter[RSVPF_LABEL_REQUEST],
6996          { "LABEL REQUEST", "rsvp.label_request",
6997            FT_NONE, BASE_NONE, NULL, 0x0,
6998            NULL, HFILL }
6999         },
7000
7001         {&hf_rsvp_filter[RSVPF_SESSION_ATTRIBUTE],
7002          { "SESSION ATTRIBUTE", "rsvp.session_attribute",
7003            FT_NONE, BASE_NONE, NULL, 0x0,
7004            NULL, HFILL }
7005         },
7006
7007         {&hf_rsvp_filter[RSVPF_EXPLICIT_ROUTE],
7008          { "EXPLICIT ROUTE", "rsvp.explicit_route",
7009            FT_NONE, BASE_NONE, NULL, 0x0,
7010            NULL, HFILL }
7011         },
7012
7013         {&hf_rsvp_filter[RSVPF_RECORD_ROUTE],
7014          { "RECORD ROUTE", "rsvp.record_route",
7015            FT_NONE, BASE_NONE, NULL, 0x0,
7016            NULL, HFILL }
7017         },
7018
7019         {&hf_rsvp_filter[RSVPF_MESSAGE_ID],
7020          { "MESSAGE-ID", "rsvp.msgid",
7021            FT_NONE, BASE_NONE, NULL, 0x0,
7022            NULL, HFILL }
7023         },
7024
7025         {&hf_rsvp_filter[RSVPF_MESSAGE_ID_ACK],
7026          { "MESSAGE-ID ACK", "rsvp.msgid_ack",
7027            FT_NONE, BASE_NONE, NULL, 0x0,
7028            NULL, HFILL }
7029         },
7030
7031         {&hf_rsvp_filter[RSVPF_MESSAGE_ID_LIST],
7032          { "MESSAGE-ID LIST", "rsvp.msgid_list",
7033            FT_NONE, BASE_NONE, NULL, 0x0,
7034            NULL, HFILL }
7035         },
7036
7037         {&hf_rsvp_filter[RSVPF_DCLASS],
7038          { "DCLASS", "rsvp.dclass",
7039            FT_NONE, BASE_NONE, NULL, 0x0,
7040            NULL, HFILL }
7041         },
7042
7043         {&hf_rsvp_filter[RSVPF_LSP_TUNNEL_IF_ID],
7044          { "LSP INTERFACE-ID", "rsvp.lsp_tunnel_if_id",
7045            FT_NONE, BASE_NONE, NULL, 0x0,
7046            NULL, HFILL }
7047         },
7048
7049         {&hf_rsvp_filter[RSVPF_ADMIN_STATUS],
7050          { "ADMIN STATUS", "rsvp.admin_status",
7051            FT_NONE, BASE_NONE, NULL, 0x0,
7052            NULL, HFILL }
7053         },
7054
7055         {&hf_rsvp_filter[RSVPF_ADMIN_STATUS_REFLECT],
7056          { "Reflect", "rsvp.admin_status.reflect",
7057            FT_BOOLEAN, 32, NULL, 0x80000000,
7058            NULL, HFILL }
7059         },
7060
7061         {&hf_rsvp_filter[RSVPF_ADMIN_STATUS_HANDOVER],
7062          { "Handover", "rsvp.admin_status.handover",
7063            FT_BOOLEAN, 32, NULL, 0x40,
7064            NULL, HFILL }
7065         },
7066
7067         {&hf_rsvp_filter[RSVPF_ADMIN_STATUS_LOCKOUT],
7068          { "Lockout", "rsvp.admin_status.lockout",
7069            FT_BOOLEAN, 32, NULL, 0x20,
7070            NULL, HFILL }
7071         },
7072
7073         {&hf_rsvp_filter[RSVPF_ADMIN_STATUS_INHIBIT],
7074          { "Inhibit Alarm Communication", "rsvp.admin_status.inhibit",
7075            FT_BOOLEAN, 32, NULL, 0x10,
7076            NULL, HFILL }
7077         },
7078
7079         {&hf_rsvp_filter[RSVPF_ADMIN_STATUS_CALL_MGMT],
7080          { "Call Management", "rsvp.admin_status.callmgmt",
7081            FT_BOOLEAN, 32, NULL, 0x08,
7082            NULL, HFILL }
7083         },
7084
7085         {&hf_rsvp_filter[RSVPF_ADMIN_STATUS_TESTING],
7086          { "Testing", "rsvp.admin_status.testing",
7087            FT_BOOLEAN, 32, NULL, 0x04,
7088            NULL, HFILL }
7089         },
7090
7091         {&hf_rsvp_filter[RSVPF_ADMIN_STATUS_DOWN],
7092          { "Administratively down", "rsvp.admin_status.down",
7093            FT_BOOLEAN, 32, NULL, 0x02,
7094            NULL, HFILL }
7095         },
7096
7097         {&hf_rsvp_filter[RSVPF_ADMIN_STATUS_DELETE],
7098          { "Delete in progress", "rsvp.admin_status.delete",
7099            FT_BOOLEAN, 32, NULL, 0x01,
7100            NULL, HFILL }
7101         },
7102
7103         {&hf_rsvp_filter[RSVPF_LSP_ATTRIBUTES],
7104          { "LSP ATTRIBUTES", "rsvp.lsp_attributes",
7105            FT_NONE, BASE_NONE, NULL, 0x0,
7106            NULL, HFILL }
7107         },
7108
7109         {&hf_rsvp_filter[RSVPF_ASSOCIATION],
7110          { "ASSOCIATION", "rsvp.association",
7111            FT_NONE, BASE_NONE, NULL, 0x0,
7112            NULL, HFILL }
7113         },
7114
7115         {&hf_rsvp_filter[RSVPF_NOTIFY_REQUEST],
7116          { "NOTIFY REQUEST", "rsvp.notify_request",
7117            FT_NONE, BASE_NONE, NULL, 0x0,
7118            NULL, HFILL }
7119         },
7120
7121         {&hf_rsvp_filter[RSVPF_GENERALIZED_UNI],
7122          { "GENERALIZED UNI", "rsvp.generalized_uni",
7123            FT_NONE, BASE_NONE, NULL, 0x0,
7124            NULL, HFILL }
7125         },
7126
7127         {&hf_rsvp_filter[RSVPF_CALL_ID],
7128          { "CALL ID", "rsvp.call_id",
7129            FT_NONE, BASE_NONE, NULL, 0x0,
7130            NULL, HFILL }
7131         },
7132
7133         {&hf_rsvp_filter[RSVPF_3GPP2_OBJECT],
7134          { "3GPP2 OBJECT", "rsvp.3gpp2_object",
7135            FT_NONE, BASE_NONE, NULL, 0x0,
7136            NULL, HFILL }
7137         },
7138         {&hf_rsvp_filter[RSVPF_PRIVATE_OBJ],
7139          { "Private object", "rsvp.obj_private",
7140            FT_NONE, BASE_NONE, NULL, 0x0,
7141            NULL, HFILL }
7142         },
7143
7144         {&hf_rsvp_filter[RSVPF_UNKNOWN_OBJ],
7145          { "Unknown object", "rsvp.obj_unknown",
7146            FT_NONE, BASE_NONE, NULL, 0x0,
7147            NULL, HFILL }
7148         },
7149
7150         /* Session fields */
7151         {&hf_rsvp_filter[RSVPF_SESSION_IP],
7152          { "Destination address", "rsvp.session.ip",
7153            FT_IPv4, BASE_NONE, NULL, 0x0,
7154            NULL, HFILL }
7155         },
7156
7157         {&hf_rsvp_filter[RSVPF_SESSION_PORT],
7158          { "Port number", "rsvp.session.port",
7159            FT_UINT16, BASE_DEC, NULL, 0x0,
7160            NULL, HFILL }
7161         },
7162
7163         {&hf_rsvp_filter[RSVPF_SESSION_PROTO],
7164          { "Protocol", "rsvp.session.proto",
7165            FT_UINT8, BASE_DEC, VALS(proto_vals), 0x0,
7166            NULL, HFILL }
7167         },
7168
7169         {&hf_rsvp_filter[RSVPF_SESSION_TUNNEL_ID],
7170          { "Tunnel ID", "rsvp.session.tunnel_id",
7171            FT_UINT16, BASE_DEC, NULL, 0x0,
7172            NULL, HFILL }
7173         },
7174
7175         {&hf_rsvp_filter[RSVPF_SESSION_EXT_TUNNEL_ID],
7176          { "Extended tunnel ID", "rsvp.session.ext_tunnel_id",
7177            FT_UINT32, BASE_DEC, NULL, 0x0,
7178            NULL, HFILL }
7179         },
7180
7181         /* Sender template/Filterspec fields */
7182         {&hf_rsvp_filter[RSVPF_SENDER_IP],
7183          { "Sender IPv4 address", "rsvp.sender.ip",
7184            FT_IPv4, BASE_NONE, NULL, 0x0,
7185            NULL, HFILL }
7186         },
7187
7188         {&hf_rsvp_filter[RSVPF_SENDER_PORT],
7189          { "Sender port number", "rsvp.sender.port",
7190            FT_UINT16, BASE_DEC, NULL, 0x0,
7191            NULL, HFILL }
7192         },
7193
7194         {&hf_rsvp_filter[RSVPF_SENDER_LSP_ID],
7195          { "Sender LSP ID", "rsvp.sender.lsp_id",
7196            FT_UINT16, BASE_DEC, NULL, 0x0,
7197            NULL, HFILL }
7198         },
7199
7200         /* Diffserv object fields */
7201         {&hf_rsvp_filter[RSVPF_DIFFSERV_MAPNB],
7202          { "MAPnb", "rsvp.diffserv.mapnb",
7203            FT_UINT8, BASE_DEC, NULL, 0x0,
7204            MAPNB_DESCRIPTION, HFILL }
7205         },
7206
7207         {&hf_rsvp_filter[RSVPF_DIFFSERV_MAP],
7208          { "MAP", "rsvp.diffserv.map",
7209            FT_NONE, BASE_NONE, NULL, 0x0,
7210            MAP_DESCRIPTION, HFILL }
7211         },
7212
7213         {&hf_rsvp_filter[RSVPF_DIFFSERV_MAP_EXP],
7214          { "EXP", "rsvp.diffserv.map.exp",
7215            FT_UINT8, BASE_DEC, NULL, 0x0,
7216            EXP_DESCRIPTION, HFILL }
7217         },
7218
7219         {&hf_rsvp_filter[RSVPF_DIFFSERV_PHBID],
7220          { PHBID_DESCRIPTION, "rsvp.diffserv.phbid",
7221            FT_NONE, BASE_NONE, NULL, 0x0,
7222            NULL, HFILL }
7223         },
7224
7225         {&hf_rsvp_filter[RSVPF_DIFFSERV_PHBID_DSCP],
7226          { PHBID_DSCP_DESCRIPTION, "rsvp.diffserv.phbid.dscp",
7227            FT_UINT16, BASE_DEC, NULL, PHBID_DSCP_MASK,
7228            NULL, HFILL }
7229         },
7230
7231         {&hf_rsvp_filter[RSVPF_DIFFSERV_PHBID_CODE],
7232          { PHBID_CODE_DESCRIPTION, "rsvp.diffserv.phbid.code",
7233            FT_UINT16, BASE_DEC, NULL, PHBID_CODE_MASK,
7234            NULL, HFILL }
7235         },
7236
7237         {&hf_rsvp_filter[RSVPF_DIFFSERV_PHBID_BIT14],
7238          { PHBID_BIT14_DESCRIPTION, "rsvp.diffserv.phbid.bit14",
7239            FT_UINT16, BASE_DEC, VALS(phbid_bit14_vals), PHBID_BIT14_MASK,
7240            NULL, HFILL }
7241         },
7242
7243         {&hf_rsvp_filter[RSVPF_DIFFSERV_PHBID_BIT15],
7244          { PHBID_BIT15_DESCRIPTION, "rsvp.diffserv.phbid.bit15",
7245            FT_UINT16, BASE_DEC, VALS(phbid_bit15_vals), PHBID_BIT15_MASK,
7246            NULL, HFILL }
7247         },
7248
7249         /* Diffserv-aware TE object field */
7250         {&hf_rsvp_filter[RSVPF_DSTE_CLASSTYPE],
7251          { "CT", "rsvp.dste.classtype",
7252            FT_UINT8, BASE_DEC, NULL, 0x0,
7253            NULL, HFILL }
7254         },
7255
7256         /* Generalized UNI object field */
7257         {&hf_rsvp_filter[RSVPF_GUNI_SRC_IPV4],
7258          { "Source TNA", "rsvp.guni.srctna.ipv4",
7259            FT_IPv4, BASE_NONE, NULL, 0x0,
7260            NULL, HFILL }
7261         },
7262
7263         {&hf_rsvp_filter[RSVPF_GUNI_DST_IPV4],
7264          { "Destination TNA", "rsvp.guni.dsttna.ipv4",
7265            FT_IPv4, BASE_NONE, NULL, 0x0,
7266            NULL, HFILL }
7267         },
7268
7269         {&hf_rsvp_filter[RSVPF_GUNI_SRC_IPV6],
7270          { "Source TNA", "rsvp.guni.srctna.ipv6",
7271            FT_IPv6, BASE_NONE, NULL, 0x0,
7272            NULL, HFILL }
7273         },
7274
7275         {&hf_rsvp_filter[RSVPF_GUNI_DST_IPV6],
7276          { "Destination TNA", "rsvp.guni.dsttna.ipv6",
7277            FT_IPv6, BASE_NONE, NULL, 0x0,
7278            NULL, HFILL }
7279         },
7280
7281         /* Generalized UNI object field */
7282         {&hf_rsvp_filter[RSVPF_CALL_ID_SRC_ADDR_IPV4],
7283          { "Source Transport Network Address", "rsvp.callid.srcaddr.ipv4",
7284            FT_IPv4, BASE_NONE, NULL, 0x0,
7285            NULL, HFILL }
7286         },
7287
7288         {&hf_rsvp_filter[RSVPF_CALL_ID_SRC_ADDR_IPV6],
7289          { "Source Transport Network Address", "rsvp.callid.srcaddr.ipv6",
7290            FT_IPv6, BASE_NONE, NULL, 0x0,
7291            NULL, HFILL }
7292         },
7293         /*
7294          * FF: Vendor Private object field, please see
7295          * http://www.iana.org/assignments/enterprise-numbers
7296          */
7297         {&hf_rsvp_filter[RSVPF_ENT_CODE],
7298          { "Enterprise Code", "rsvp.obj_private.enterprise",
7299            FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x0,
7300            "IANA Network Management Private Enterprise Code", HFILL }
7301         },
7302
7303         {&hf_rsvp_error_flags,
7304          { "Flags", "rsvp.error_flags",
7305            FT_UINT8, BASE_HEX, NULL, 0x0,
7306            NULL, HFILL }
7307         },
7308
7309         {&hf_rsvp_error_flags_path_state_removed,
7310          { "Path State Removed", "rsvp.error_flags.path_state_removed",
7311            FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x04,
7312            NULL, HFILL }
7313         },
7314
7315         {&hf_rsvp_error_flags_not_guilty,
7316          { "NotGuilty", "rsvp.error_flags.not_guilty",
7317            FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02,
7318            NULL, HFILL }
7319         },
7320
7321         {&hf_rsvp_error_flags_in_place,
7322          { "InPlace", "rsvp.error_flags.in_place",
7323            FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01,
7324            NULL, HFILL }
7325         },
7326
7327         {&hf_rsvp_eth_tspec_tlv_color_mode,
7328          { "Color Mode (CM)", "rsvp.eth_tspec_tlv.color_mode",
7329            FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02,
7330            NULL, HFILL }
7331         },
7332
7333         {&hf_rsvp_eth_tspec_tlv_coupling_flag,
7334          { "Coupling Flag (CF)", "rsvp.eth_tspec_tlv.coupling_flag",
7335            FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01,
7336            NULL, HFILL }
7337         },
7338
7339         {&hf_rsvp_sender_tspec_standard_contiguous_concatenation,
7340          { "Standard contiguous concatenation", "rsvp.sender_tspec.standard_contiguous_concatenation",
7341            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
7342            NULL, HFILL }
7343         },
7344
7345         {&hf_rsvp_sender_tspec_arbitrary_contiguous_concatenation,
7346          { "Arbitrary contiguous concatenation", "rsvp.sender_tspec.arbitrary_contiguous_concatenation",
7347            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
7348            NULL, HFILL }
7349         },
7350
7351         {&hf_rsvp_sender_tspec_regenerator_section,
7352          { "Section/Regenerator Section layer transparency", "rsvp.sender_tspec.regenerator_section",
7353            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0001,
7354            NULL, HFILL }
7355         },
7356
7357         {&hf_rsvp_sender_tspec_multiplex_section,
7358          { "Line/Multiplex Section layer transparency", "rsvp.sender_tspec.multiplex_section",
7359            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0002,
7360            NULL, HFILL }
7361         },
7362
7363         {&hf_rsvp_sender_tspec_J0_transparency,
7364          { "J0 transparency", "rsvp.sender_tspec.J0_transparency",
7365            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0004,
7366            NULL, HFILL }
7367         },
7368
7369         {&hf_rsvp_sender_tspec_SOH_RSOH_DCC_transparency,
7370          { "SOH/RSOH DCC transparency", "rsvp.sender_tspec.SOH_RSOH_DCC_transparency",
7371            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0008,
7372            NULL, HFILL }
7373         },
7374
7375         {&hf_rsvp_sender_tspec_LOH_MSOH_DCC_transparency,
7376          { "LOH/MSOH DCC transparency", "rsvp.sender_tspec.LOH_MSOH_DCC_transparency",
7377            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0010,
7378            NULL, HFILL }
7379         },
7380
7381         {&hf_rsvp_sender_tspec_LOH_MSOH_extended_DCC_transparency,
7382          { "LOH/MSOH Extended DCC transparency", "rsvp.sender_tspec.LOH_MSOH_extended_DCC_transparency",
7383            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0020,
7384            NULL, HFILL }
7385         },
7386
7387         {&hf_rsvp_sender_tspec_K1_K2_transparency,
7388          { "K1/K2 transparency", "rsvp.sender_tspec.K1_K2_transparency",
7389            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0040,
7390            NULL, HFILL }
7391         },
7392
7393         {&hf_rsvp_sender_tspec_E1_transparency,
7394          { "E1 transparency", "rsvp.sender_tspec.E1_transparency",
7395            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0080,
7396            NULL, HFILL }
7397         },
7398
7399         {&hf_rsvp_sender_tspec_F1_transparency,
7400          { "F1 transparency", "rsvp.sender_tspec.F1_transparency",
7401            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0100,
7402            NULL, HFILL }
7403         },
7404
7405         {&hf_rsvp_sender_tspec_E2_transparency,
7406          { "E2 transparency", "rsvp.sender_tspec.E2_transparency",
7407            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0200,
7408            NULL, HFILL }
7409         },
7410
7411         {&hf_rsvp_sender_tspec_B1_transparency,
7412          { "B1 transparency", "rsvp.sender_tspec.B1_transparency",
7413            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0400,
7414            NULL, HFILL }
7415         },
7416
7417         {&hf_rsvp_sender_tspec_B2_transparency,
7418          { "B2 transparency", "rsvp.sender_tspec.B2_transparency",
7419            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0800,
7420            NULL, HFILL }
7421         },
7422
7423         {&hf_rsvp_sender_tspec_M0_transparency,
7424          { "M0 transparency", "rsvp.sender_tspec.M0_transparency",
7425            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x1000,
7426            NULL, HFILL }
7427         },
7428
7429         {&hf_rsvp_sender_tspec_M1_transparency,
7430          { "M1 transparency", "rsvp.sender_tspec.M1_transparency",
7431            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x2000,
7432            NULL, HFILL }
7433         },
7434
7435         {&hf_rsvp_flowspec_standard_contiguous_concatenation,
7436          { "Standard contiguous concatenation", "rsvp.flowspec.standard_contiguous_concatenation",
7437            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
7438            NULL, HFILL }
7439         },
7440
7441         {&hf_rsvp_flowspec_arbitrary_contiguous_concatenation,
7442          { "Arbitrary contiguous concatenation", "rsvp.flowspec.arbitrary_contiguous_concatenation",
7443            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
7444            NULL, HFILL }
7445         },
7446
7447         {&hf_rsvp_flowspec_regenerator_section,
7448          { "Section/Regenerator Section layer transparency", "rsvp.flowspec.regenerator_section",
7449            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0001,
7450            NULL, HFILL }
7451         },
7452
7453         {&hf_rsvp_flowspec_multiplex_section,
7454          { "Line/Multiplex Section layer transparency", "rsvp.flowspec.multiplex_section",
7455            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0002,
7456            NULL, HFILL }
7457         },
7458
7459         {&hf_rsvp_flowspec_J0_transparency,
7460          { "J0 transparency", "rsvp.flowspec.J0_transparency",
7461            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0004,
7462            NULL, HFILL }
7463         },
7464
7465         {&hf_rsvp_flowspec_SOH_RSOH_DCC_transparency,
7466          { "SOH/RSOH DCC transparency", "rsvp.flowspec.SOH_RSOH_DCC_transparency",
7467            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0008,
7468            NULL, HFILL }
7469         },
7470
7471         {&hf_rsvp_flowspec_LOH_MSOH_DCC_transparency,
7472          { "LOH/MSOH DCC transparency", "rsvp.flowspec.LOH_MSOH_DCC_transparency",
7473            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0010,
7474            NULL, HFILL }
7475         },
7476
7477         {&hf_rsvp_flowspec_LOH_MSOH_extended_DCC_transparency,
7478          { "LOH/MSOH Extended DCC transparency", "rsvp.flowspec.LOH_MSOH_extended_DCC_transparency",
7479            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0020,
7480            NULL, HFILL }
7481         },
7482
7483         {&hf_rsvp_flowspec_K1_K2_transparency,
7484          { "K1/K2 transparency", "rsvp.flowspec.K1_K2_transparency",
7485            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0040,
7486            NULL, HFILL }
7487         },
7488
7489         {&hf_rsvp_flowspec_E1_transparency,
7490          { "E1 transparency", "rsvp.flowspec.E1_transparency",
7491            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0080,
7492            NULL, HFILL }
7493         },
7494
7495         {&hf_rsvp_flowspec_F1_transparency,
7496          { "F1 transparency", "rsvp.flowspec.F1_transparency",
7497            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0100,
7498            NULL, HFILL }
7499         },
7500
7501         {&hf_rsvp_flowspec_E2_transparency,
7502          { "E2 transparency", "rsvp.flowspec.E2_transparency",
7503            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0200,
7504            NULL, HFILL }
7505         },
7506
7507         {&hf_rsvp_flowspec_B1_transparency,
7508          { "B1 transparency", "rsvp.flowspec.B1_transparency",
7509            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0400,
7510            NULL, HFILL }
7511         },
7512
7513         {&hf_rsvp_flowspec_B2_transparency,
7514          { "B2 transparency", "rsvp.flowspec.B2_transparency",
7515            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x0800,
7516            NULL, HFILL }
7517         },
7518
7519         {&hf_rsvp_flowspec_M0_transparency,
7520          { "M0 transparency", "rsvp.flowspec.M0_transparency",
7521            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x1000,
7522            NULL, HFILL }
7523         },
7524
7525         {&hf_rsvp_flowspec_M1_transparency,
7526          { "M1 transparency", "rsvp.flowspec.M1_transparency",
7527            FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x2000,
7528            NULL, HFILL }
7529         },
7530
7531         {&hf_rsvp_integrity_flags_handshake,
7532          { "Handshake", "rsvp.integrity.flags.handshake",
7533            FT_BOOLEAN, 8, TFS(&tfs_capable_not_capable), 0x01,
7534            NULL, HFILL }
7535         },
7536
7537         {&hf_rsvp_sa_flags_local,
7538          { "Local protection", "rsvp.sa.flags.local",
7539            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x01,
7540            NULL, HFILL }
7541         },
7542
7543         {&hf_rsvp_sa_flags_label,
7544          { "Label recording", "rsvp.sa.flags.label",
7545            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x02,
7546            NULL, HFILL }
7547         },
7548
7549         {&hf_rsvp_sa_flags_se_style,
7550          { "SE style", "rsvp.sa.flags.se_style",
7551            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x04,
7552            NULL, HFILL }
7553         },
7554
7555         {&hf_rsvp_sa_flags_bandwidth,
7556          { "Bandwidth protection", "rsvp.sa.flags.bandwidth",
7557            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x08,
7558            NULL, HFILL }
7559         },
7560
7561         {&hf_rsvp_sa_flags_node,
7562          { "Node protection", "rsvp.sa.flags.node",
7563            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x10,
7564            NULL, HFILL }
7565         },
7566
7567         {&hf_rsvp_rro_flags_local_avail,
7568          { "Local Protection", "rsvp.rro.flags.local_avail",
7569            FT_BOOLEAN, 8, TFS(&tfs_available_not_available), 0x01,
7570            NULL, HFILL }
7571         },
7572
7573         {&hf_rsvp_rro_flags_local_in_use,
7574          { "Local Protection", "rsvp.rro.flags.local_in_use",
7575            FT_BOOLEAN, 8, TFS(&tfs_used_notused), 0x02,
7576            NULL, HFILL }
7577         },
7578
7579         {&hf_rsvp_rro_flags_bandwidth,
7580          { "Bandwidth Protection", "rsvp.rro.flags.bandwidth",
7581            FT_BOOLEAN, 8, TFS(&tfs_available_not_available), 0x04,
7582            NULL, HFILL }
7583         },
7584
7585         {&hf_rsvp_rro_flags_node,
7586          { "Node Protection", "rsvp.rro.flags.node",
7587            FT_BOOLEAN, 8, TFS(&tfs_available_not_available), 0x08,
7588            NULL, HFILL }
7589         },
7590
7591         {&hf_rsvp_rro_flags_node_address,
7592          { "Address Specifies a Node-id Address", "rsvp.rro.flags.node_address",
7593            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
7594            NULL, HFILL }
7595         },
7596
7597         {&hf_rsvp_rro_flags_backup_tunnel_bandwidth,
7598          { "Backup Tunnel Has Bandwidth", "rsvp.rro.flags.backup_tunnel_bandwidth",
7599            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
7600            NULL, HFILL }
7601         },
7602
7603         {&hf_rsvp_rro_flags_backup_tunnel_hop,
7604          { "Backup Tunnel Goes To", "rsvp.rro.flags.backup_tunnel_hop",
7605            FT_BOOLEAN, 8, TFS(&tfs_next_next_hop_next_hop), 0x08,
7606            NULL, HFILL }
7607         },
7608
7609         {&hf_rsvp_rro_flags_global_label,
7610          { "Global label", "rsvp.rro.flags.global_label",
7611            FT_BOOLEAN, 8, NULL, 0x01,
7612            NULL, HFILL }
7613         },
7614
7615         {&hf_rsvp_lsp_attr_e2e,
7616          { "E2E re-routing", "rsvp.lsp_attr.e2e",
7617            FT_BOOLEAN, 32, TFS(&tfs_desired_not_desired), 0x01,
7618            NULL, HFILL }
7619         },
7620
7621         {&hf_rsvp_lsp_attr_boundary,
7622          { "Boundary re-routing", "rsvp.lsp_attr.boundary",
7623            FT_BOOLEAN, 32, TFS(&tfs_desired_not_desired), 0x02,
7624            NULL, HFILL }
7625         },
7626
7627         {&hf_rsvp_lsp_attr_segment,
7628          { "Segment-based re-routing", "rsvp.lsp_attr.segment",
7629            FT_BOOLEAN, 32, TFS(&tfs_desired_not_desired), 0x04,
7630            NULL, HFILL }
7631         },
7632
7633         {&hf_rsvp_gen_uni_direction,
7634          { "Direction", "rsvp.gen_uni.direction",
7635            FT_BOOLEAN, 8, TFS(&tfs_gen_uni_direction), 0x80,
7636            NULL, HFILL }
7637         },
7638
7639         {&hf_rsvp_protection_info_flags_secondary_lsp,
7640          { "Secondary LSP", "rsvp.pi.flags.secondary_lsp",
7641            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80,
7642            NULL, HFILL }
7643         },
7644
7645         {&hf_rsvp_pi_link_flags_extra_traffic,
7646          { "Extra Traffic", "rsvp.pi_link.flags.extra_traffic",
7647            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x01,
7648            NULL, HFILL }
7649         },
7650
7651         {&hf_rsvp_pi_link_flags_unprotected,
7652          { "Unprotected", "rsvp.pi_link.flags.unprotected",
7653            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x02,
7654            NULL, HFILL }
7655         },
7656
7657         {&hf_rsvp_pi_link_flags_shared,
7658          { "Shared", "rsvp.pi_link.flags.shared",
7659            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x04,
7660            NULL, HFILL }
7661         },
7662
7663         {&hf_rsvp_pi_link_flags_dedicated1_1,
7664          { "Dedicated 1:1", "rsvp.pi_link.flags.dedicated1_1",
7665            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x08,
7666            NULL, HFILL }
7667         },
7668
7669         {&hf_rsvp_pi_link_flags_dedicated1plus1,
7670          { "Dedicated 1+1", "rsvp.pi_link.flags.dedicated1plus1",
7671            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x10,
7672            NULL, HFILL }
7673         },
7674
7675         {&hf_rsvp_pi_link_flags_enhanced,
7676          { "Enhanced", "rsvp.pi_link.flags.enhanced",
7677            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x20,
7678            NULL, HFILL }
7679         },
7680
7681         {&hf_rsvp_pi_link_flags_extra,
7682          { "Extra Traffic", "rsvp.pi_link.flags.extra",
7683            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x01,
7684            NULL, HFILL }
7685         },
7686
7687         {&hf_rsvp_pi_link_flags_dedicated_1_1,
7688          { "Dedicated 1:1", "rsvp.pi_link.flags.dedicated_1_1",
7689            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x08,
7690            NULL, HFILL }
7691         },
7692
7693         {&hf_rsvp_pi_link_flags_dedicated_1plus1,
7694          { "Dedicated 1+1", "rsvp.pi_link.flags.dedicated_1plus1",
7695            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x10,
7696            NULL, HFILL }
7697         },
7698
7699         {&hf_rsvp_rfc4872_secondary,
7700          { "Secondary LSP", "rsvp.rfc4872.secondary",
7701            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80,
7702            NULL, HFILL }
7703         },
7704
7705         {&hf_rsvp_rfc4872_protecting,
7706          { "Protecting LSP", "rsvp.rfc4872.protecting",
7707            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40,
7708            NULL, HFILL }
7709         },
7710
7711         {&hf_rsvp_rfc4872_notification_msg,
7712          { "Protecting LSP", "rsvp.rfc4872.notification_msg",
7713            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20,
7714            NULL, HFILL }
7715         },
7716
7717         {&hf_rsvp_rfc4872_operational,
7718          { "Protecting LSP", "rsvp.rfc4872.operational",
7719            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
7720            NULL, HFILL }
7721         },
7722
7723         {&hf_rsvp_pi_lsp_flags_full_rerouting,
7724          { "(Full) rerouting", "rsvp.pi_lsp.flags.full_rerouting",
7725            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x01,
7726            NULL, HFILL }
7727         },
7728
7729         {&hf_rsvp_pi_lsp_flags_rerouting_extra,
7730          { "Rerouting without extra-traffic", "rsvp.pi_lsp.flags.rerouting_extra",
7731            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x02,
7732            NULL, HFILL }
7733         },
7734
7735         {&hf_rsvp_pi_lsp_flags_1_n_protection,
7736          { "1:N protection with extra-traffic", "rsvp.pi_lsp.flags.1_n_protection",
7737            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x04,
7738            NULL, HFILL }
7739         },
7740
7741         {&hf_rsvp_pi_lsp_flags_1plus1_unidirectional,
7742          { "1+1 unidirectional protection", "rsvp.pi_lsp.flags.1plus1_unidirectional",
7743            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x08,
7744            NULL, HFILL }
7745         },
7746
7747         {&hf_rsvp_pi_lsp_flags_1plus1_bidirectional,
7748          { "1+1 bidirectional protection", "rsvp.pi_lsp.flags.1plus1_bidirectional",
7749            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x10,
7750            NULL, HFILL }
7751         },
7752
7753         {&hf_rsvp_protection_info_in_place,
7754          { "In-Place", "rsvp.protection_info.in_place",
7755            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80,
7756            NULL, HFILL }
7757         },
7758
7759         {&hf_rsvp_protection_info_required,
7760          { "Required", "rsvp.protection_info.required",
7761            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40,
7762            NULL, HFILL }
7763         },
7764
7765         {&hf_rsvp_pi_seg_flags_full_rerouting,
7766          { "(Full) rerouting", "rsvp.pi_seg.flags.full_rerouting",
7767            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x01,
7768            NULL, HFILL }
7769         },
7770
7771         {&hf_rsvp_pi_seg_flags_rerouting_extra,
7772          { "Rerouting without extra-traffic", "rsvp.pi_seg.flags.rerouting_extra",
7773            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x02,
7774            NULL, HFILL }
7775         },
7776
7777         {&hf_rsvp_pi_seg_flags_1_n_protection,
7778          { "1:N protection with extra-traffic", "rsvp.pi_seg.flags.1_n_protection",
7779            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x04,
7780            NULL, HFILL }
7781         },
7782
7783         {&hf_rsvp_pi_seg_flags_1plus1_unidirectional,
7784          { "1+1 unidirectional protection", "rsvp.pi_seg.flags.1plus1_unidirectional",
7785            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x08,
7786            NULL, HFILL }
7787         },
7788
7789         {&hf_rsvp_pi_seg_flags_1plus1_bidirectional,
7790          { "1+1 bidirectional protection", "rsvp.pi_seg.flags.1plus1_bidirectional",
7791            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x10,
7792            NULL, HFILL }
7793         },
7794
7795         {&hf_rsvp_frr_flags_one2one_backup,
7796          { "One-to-One Backup", "rsvp.frr.flags.one2one_backup",
7797            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x01,
7798            NULL, HFILL }
7799         },
7800
7801         {&hf_rsvp_frr_flags_facility_backup,
7802          { "Facility Backup", "rsvp.frr.flags.facility_backup",
7803            FT_BOOLEAN, 8, TFS(&tfs_desired_not_desired), 0x02,
7804            NULL, HFILL }
7805         },
7806         {&hf_rsvp_c_type,
7807          { "C-Type", "rsvp.ctype",
7808            FT_UINT8, BASE_DEC, NULL, 0,
7809            NULL, HFILL }
7810         },
7811         {&hf_rsvp_3gpp_obj_tid,
7812          { "Transaction ID", "rsvp.3gpp_obj.tid",
7813            FT_UINT32, BASE_DEC, NULL, 0,
7814            NULL, HFILL }
7815         },
7816         {&hf_rsvp_3gpp_obj_ie_len,
7817          { "Length", "rsvp.3gpp_obj.length",
7818            FT_UINT32, BASE_DEC, NULL, 0,
7819            NULL, HFILL }
7820         },
7821         {&hf_rsvp_3gpp_obj_ie_type,
7822          { "IE Type", "rsvp.3gpp_obj.ie_type",
7823            FT_UINT32, BASE_DEC, VALS(rsvp_3gpp_object_ie_type_vals), 0,
7824            NULL, HFILL }
7825         },
7826
7827     };
7828
7829     gint *ett_tree[TT_MAX];
7830
7831     /* Build the tree array */
7832     for (i=0; i<TT_MAX; i++) {
7833         ett_treelist[i] = -1;
7834         ett_tree[i] = &(ett_treelist[i]);
7835     }
7836     proto_rsvp = proto_register_protocol("Resource ReserVation Protocol (RSVP)",
7837                                          "RSVP", "rsvp");
7838     proto_register_field_array(proto_rsvp, rsvpf_info, array_length(rsvpf_info));
7839     proto_register_subtree_array(ett_tree, array_length(ett_tree));
7840     register_rsvp_prefs();
7841
7842     rsvp_dissector_table = register_dissector_table("rsvp.proto", "RSVP Protocol",
7843                                                     FT_UINT8, BASE_DEC);
7844
7845     /* Initialization routine for RSVP conversations */
7846     register_init_routine(&rsvp_init_protocol);
7847 }
7848
7849 void
7850 proto_reg_handoff_rsvp(void)
7851 {
7852     dissector_handle_t rsvp_handle;
7853
7854     rsvp_handle = create_dissector_handle(dissect_rsvp, proto_rsvp);
7855     dissector_add_uint("ip.proto", IP_PROTO_RSVP, rsvp_handle);
7856     dissector_add_uint("ip.proto", IP_PROTO_RSVPE2EI, rsvp_handle);
7857     dissector_add_uint("udp.port", UDP_PORT_PRSVP, rsvp_handle);
7858     rsvp_tap = register_tap("rsvp");
7859 }