HACK: 2nd try to match RowsetProperties
[wireshark-wip.git] / epan / dissectors / packet-ldp.c
blob965597df6eb001c8aff6ae4a787378a8b86e9de5
1 /* packet-ldp.c
2 * Routines for LDP (RFC 3036) packet disassembly
4 * $Id$
6 * Copyright (c) November 2000 by Richard Sharpe <rsharpe@ns.aus.com>
8 * CRLDP (RFC3212) is now supported
9 * - (c) 2002 Michael Rozhavsky <mike[AT]tochna.technion.ac.il>
11 * (c) Copyright 2011, Shobhank Sharma <ssharma5@ncsu.edu>
12 * - update the VCCV bitmaps as per RFC 5885
14 * (c) Copyright 2012, Aditya Ambadkar and Diana Chris <arambadk,dvchris@ncsu.edu>
15 * - support for the flowlabel sub-tlv as per RFC 6391
17 * (c) Copyright 2013, Gaurav Patwardhan <gspatwar@ncsu.edu>
18 * - support for the GTSM flag as per RFC 6720
20 * (c) Copyright 2013, Rupesh Patro <rbpatro@ncsu.edu>
21 * - Support for Upstream-Assigned Label TLVs and Sub-TLVs as per RFC 6389
23 * Wireshark - Network traffic analyzer
24 * By Gerald Combs <gerald@wireshark.org>
25 * Copyright 1999 Gerald Combs
27 * This program is free software; you can redistribute it and/or
28 * modify it under the terms of the GNU General Public License
29 * as published by the Free Software Foundation; either version 2
30 * of the License, or (at your option) any later version.
32 * This program is distributed in the hope that it will be useful,
33 * but WITHOUT ANY WARRANTY; without even the implied warranty of
34 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 * GNU General Public License for more details.
37 * You should have received a copy of the GNU General Public License
38 * along with this program; if not, write to the Free Software
39 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
42 #include "config.h"
44 #include <glib.h>
46 #include <epan/packet.h>
47 #include <epan/exceptions.h>
48 #include <epan/addr_resolv.h>
49 #include <epan/prefs.h>
50 #include <epan/afn.h>
51 #include <epan/wmem/wmem.h>
52 #include <epan/expert.h>
53 #include <epan/show_exception.h>
55 #include "packet-diffserv-mpls-common.h"
56 #include "packet-ldp.h"
58 #define TCP_PORT_LDP 646
59 #define UDP_PORT_LDP 646
61 void proto_reg_handoff_ldp(void);
63 static int proto_ldp = -1;
65 /* Delete the following if you do not use it, or add to it if you need */
66 /* static int hf_ldp_req = -1; */
67 /* static int hf_ldp_rsp = -1; */
68 static int hf_ldp_version = -1;
69 static int hf_ldp_pdu_len = -1;
70 static int hf_ldp_lsr = -1;
71 static int hf_ldp_ls_id = -1;
72 static int hf_ldp_msg_ubit = -1;
73 static int hf_ldp_msg_type = -1;
74 static int hf_ldp_msg_len = -1;
75 static int hf_ldp_msg_id = -1;
76 static int hf_ldp_msg_vendor_id = -1;
77 static int hf_ldp_msg_experiment_id = -1;
78 static int hf_ldp_tlv_value = -1;
79 static int hf_ldp_tlv_type = -1;
80 static int hf_ldp_tlv_unknown = -1;
81 static int hf_ldp_tlv_len = -1;
82 static int hf_ldp_tlv_val_hold = -1;
83 static int hf_ldp_tlv_val_target = -1;
84 static int hf_ldp_tlv_val_request = -1;
85 static int hf_ldp_tlv_val_res = -1;
86 static int hf_ldp_tlv_val_gtsm_flag = -1;
87 static int hf_ldp_tlv_ipv4_taddr = -1;
88 static int hf_ldp_tlv_config_seqno = -1;
89 static int hf_ldp_tlv_ipv6_taddr = -1;
90 static int hf_ldp_tlv_fec_wc = -1;
91 static int hf_ldp_tlv_fec_af = -1;
92 static int hf_ldp_tlv_fec_len = -1;
93 static int hf_ldp_tlv_fec_pfval = -1;
94 static int hf_ldp_tlv_fec_hoval = -1;
95 static int hf_ldp_tlv_addrl_addr_family = -1;
96 static int hf_ldp_tlv_addrl_addr = -1;
97 static int hf_ldp_tlv_hc_value = -1;
98 static int hf_ldp_tlv_pv_lsrid = -1;
99 static int hf_ldp_tlv_generic_label = -1;
100 static int hf_ldp_tlv_atm_label_vbits = -1;
101 static int hf_ldp_tlv_atm_label_vpi = -1;
102 static int hf_ldp_tlv_atm_label_vci = -1;
103 static int hf_ldp_tlv_fr_label_len = -1;
104 static int hf_ldp_tlv_fr_label_dlci = -1;
105 static int hf_ldp_tlv_ft_protect_sequence_num = -1;
106 static int hf_ldp_tlv_status_ebit = -1;
107 static int hf_ldp_tlv_status_fbit = -1;
108 static int hf_ldp_tlv_status_data = -1;
109 static int hf_ldp_tlv_status_msg_id = -1;
110 static int hf_ldp_tlv_status_msg_type = -1;
111 static int hf_ldp_tlv_extstatus_data = -1;
112 static int hf_ldp_tlv_returned_version = -1;
113 static int hf_ldp_tlv_returned_pdu_len = -1;
114 static int hf_ldp_tlv_returned_lsr = -1;
115 static int hf_ldp_tlv_returned_ls_id = -1;
116 static int hf_ldp_tlv_returned_msg_ubit = -1;
117 static int hf_ldp_tlv_returned_msg_type = -1;
118 static int hf_ldp_tlv_returned_msg_len = -1;
119 static int hf_ldp_tlv_returned_msg_id = -1;
120 static int hf_ldp_tlv_mac = -1;
121 static int hf_ldp_tlv_sess_ver = -1;
122 static int hf_ldp_tlv_sess_ka = -1;
123 static int hf_ldp_tlv_sess_advbit = -1;
124 static int hf_ldp_tlv_sess_ldetbit = -1;
125 static int hf_ldp_tlv_sess_pvlim = -1;
126 static int hf_ldp_tlv_sess_mxpdu = -1;
127 static int hf_ldp_tlv_sess_rxlsr = -1;
128 static int hf_ldp_tlv_sess_rxls = -1;
129 static int hf_ldp_tlv_sess_atm_merge = -1;
130 static int hf_ldp_tlv_sess_atm_lr = -1;
131 static int hf_ldp_tlv_sess_atm_dir = -1;
132 static int hf_ldp_tlv_sess_atm_minvpi = -1;
133 static int hf_ldp_tlv_sess_atm_maxvpi = -1;
134 static int hf_ldp_tlv_sess_atm_minvci = -1;
135 static int hf_ldp_tlv_sess_atm_maxvci = -1;
136 static int hf_ldp_tlv_sess_fr_merge = -1;
137 static int hf_ldp_tlv_sess_fr_lr = -1;
138 static int hf_ldp_tlv_sess_fr_dir = -1;
139 static int hf_ldp_tlv_sess_fr_len = -1;
140 static int hf_ldp_tlv_sess_fr_mindlci = -1;
141 static int hf_ldp_tlv_sess_fr_maxdlci = -1;
142 static int hf_ldp_tlv_ft_sess_flags = -1;
143 static int hf_ldp_tlv_ft_sess_flag_r = -1;
144 static int hf_ldp_tlv_ft_sess_flag_res = -1;
145 static int hf_ldp_tlv_ft_sess_flag_s = -1;
146 static int hf_ldp_tlv_ft_sess_flag_a = -1;
147 static int hf_ldp_tlv_ft_sess_flag_c = -1;
148 static int hf_ldp_tlv_ft_sess_flag_l = -1;
149 static int hf_ldp_tlv_ft_sess_res = -1;
150 static int hf_ldp_tlv_ft_sess_reconn_to = -1;
151 static int hf_ldp_tlv_ft_sess_recovery_time = -1;
152 static int hf_ldp_tlv_ft_ack_sequence_num = -1;
153 static int hf_ldp_tlv_lbl_req_msg_id = -1;
154 static int hf_ldp_tlv_vendor_id = -1;
155 static int hf_ldp_tlv_experiment_id = -1;
156 static int hf_ldp_tlv_fec_vc_controlword = -1;
157 static int hf_ldp_tlv_fec_vc_vctype = -1;
158 static int hf_ldp_tlv_fec_vc_infolength = -1;
159 static int hf_ldp_tlv_fec_vc_groupid = -1;
160 static int hf_ldp_tlv_fec_vc_vcid = -1;
161 static int hf_ldp_tlv_fec_vc_intparam_length = -1;
162 static int hf_ldp_tlv_fec_vc_intparam_mtu = -1;
163 static int hf_ldp_tlv_fec_vc_intparam_tdmbps = -1;
164 static int hf_ldp_tlv_fec_vc_intparam_id = -1;
165 static int hf_ldp_tlv_fec_vc_intparam_maxcatmcells = -1;
166 static int hf_ldp_tlv_fec_vc_intparam_desc = -1;
167 static int hf_ldp_tlv_fec_vc_intparam_cepbytes = -1;
168 static int hf_ldp_tlv_fec_vc_intparam_cepopt_ais = -1;
169 static int hf_ldp_tlv_fec_vc_intparam_cepopt_une = -1;
170 static int hf_ldp_tlv_fec_vc_intparam_cepopt_rtp = -1;
171 static int hf_ldp_tlv_fec_vc_intparam_cepopt_ebm = -1;
172 static int hf_ldp_tlv_fec_vc_intparam_cepopt_mah = -1;
173 static int hf_ldp_tlv_fec_vc_intparam_cepopt_res = -1;
174 static int hf_ldp_tlv_fec_vc_intparam_cepopt_ceptype = -1;
175 static int hf_ldp_tlv_fec_vc_intparam_cepopt_t3 = -1;
176 static int hf_ldp_tlv_fec_vc_intparam_cepopt_e3 = -1;
177 static int hf_ldp_tlv_fec_vc_intparam_vlanid = -1;
178 static int hf_ldp_tlv_fec_vc_intparam_dlcilen = -1;
179 static int hf_ldp_tlv_fec_vc_intparam_fcslen = -1;
180 static int hf_ldp_tlv_fec_vc_intparam_tdmopt_r = -1;
181 static int hf_ldp_tlv_fec_vc_intparam_tdmopt_d = -1;
182 static int hf_ldp_tlv_fec_vc_intparam_tdmopt_f = -1;
183 static int hf_ldp_tlv_fec_vc_intparam_tdmopt_res1 = -1;
184 static int hf_ldp_tlv_fec_vc_intparam_tdmopt_pt = -1;
185 static int hf_ldp_tlv_fec_vc_intparam_tdmopt_res2 = -1;
186 static int hf_ldp_tlv_fec_vc_intparam_tdmopt_freq = -1;
187 static int hf_ldp_tlv_fec_vc_intparam_tdmopt_ssrc = -1;
188 static int hf_ldp_tlv_fec_vc_intparam_vccv_cctype_cw = -1;
189 static int hf_ldp_tlv_fec_vc_intparam_vccv_cctype_mplsra = -1;
190 static int hf_ldp_tlv_fec_vc_intparam_vccv_cctype_ttl1 = -1;
191 static int hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_icmpping = -1;
192 static int hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_lspping = -1;
193 static int hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd1 = -1;
194 static int hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd2 = -1;
195 static int hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd3 = -1;
196 static int hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd4 = -1;
197 static int hf_ldp_tlv_fec_vc_intparam_flowlabel_t = -1; /* Flow label interface parameter RFC6391 */
198 static int hf_ldp_tlv_fec_vc_intparam_flowlabel_r = -1; /* Flow label interface parameter RFC6391 */
199 static int hf_ldp_tlv_fec_vc_intparam_flowlabel_res = -1; /* Flow label interface parameter RFC6391 */
200 static int hf_ldp_tlv_lspid_act_flg = -1;
201 static int hf_ldp_tlv_lspid_cr_lsp = -1;
202 static int hf_ldp_tlv_lspid_ldpid = -1;
203 static int hf_ldp_tlv_er_hop_loose = -1;
204 static int hf_ldp_tlv_er_hop_prelen = -1;
205 static int hf_ldp_tlv_er_hop_prefix4 = -1;
206 static int hf_ldp_tlv_er_hop_prefix6 = -1;
207 static int hf_ldp_tlv_er_hop_as = -1;
208 static int hf_ldp_tlv_er_hop_cr_lsp = -1;
209 static int hf_ldp_tlv_er_hop_ldpid = -1;
210 static int hf_ldp_tlv_flags_reserv = -1;
211 static int hf_ldp_tlv_flags_weight = -1;
212 static int hf_ldp_tlv_flags_ebs = -1;
213 static int hf_ldp_tlv_flags_cbs = -1;
214 static int hf_ldp_tlv_flags_cdr = -1;
215 static int hf_ldp_tlv_flags_pbs = -1;
216 static int hf_ldp_tlv_flags_pdr = -1;
217 static int hf_ldp_tlv_frequency = -1;
218 static int hf_ldp_tlv_pdr = -1;
219 static int hf_ldp_tlv_pbs = -1;
220 static int hf_ldp_tlv_cdr = -1;
221 static int hf_ldp_tlv_cbs = -1;
222 static int hf_ldp_tlv_ebs = -1;
223 static int hf_ldp_tlv_weight = -1;
224 static int hf_ldp_tlv_set_prio = -1;
225 static int hf_ldp_tlv_hold_prio = -1;
226 static int hf_ldp_tlv_route_pinning = -1;
227 static int hf_ldp_tlv_resource_class = -1;
228 /* static int hf_ldp_tlv_diffserv = -1; */
229 static int hf_ldp_tlv_diffserv_type = -1;
230 static int hf_ldp_tlv_diffserv_mapnb = -1;
231 static int hf_ldp_tlv_diffserv_map = -1;
232 static int hf_ldp_tlv_diffserv_map_exp = -1;
233 static int hf_ldp_tlv_diffserv_phbid = -1;
234 static int hf_ldp_tlv_diffserv_phbid_dscp = -1;
235 static int hf_ldp_tlv_diffserv_phbid_code = -1;
236 static int hf_ldp_tlv_diffserv_phbid_bit14 = -1;
237 static int hf_ldp_tlv_diffserv_phbid_bit15 = -1;
238 static int hf_ldp_tlv_fec_gen_agi_type = -1;
239 static int hf_ldp_tlv_fec_gen_agi_length = -1;
240 static int hf_ldp_tlv_fec_gen_agi_value = -1;
241 static int hf_ldp_tlv_fec_gen_saii_type = -1;
242 static int hf_ldp_tlv_fec_gen_saii_length = -1;
243 static int hf_ldp_tlv_fec_gen_saii_value = -1;
244 static int hf_ldp_tlv_fec_gen_taii_type = -1;
245 static int hf_ldp_tlv_fec_gen_taii_length = -1;
246 static int hf_ldp_tlv_fec_gen_taii_value = -1;
247 static int hf_ldp_tlv_fec_gen_aai_globalid = -1;
248 static int hf_ldp_tlv_fec_gen_aai_prefix = -1;
249 static int hf_ldp_tlv_fec_gen_aai_ac_id = -1;
250 static int hf_ldp_tlv_pw_status_data = -1;
251 static int hf_ldp_tlv_pw_not_forwarding = -1;
252 static int hf_ldp_tlv_pw_lac_ingress_recv_fault = -1;
253 static int hf_ldp_tlv_pw_lac_egress_recv_fault = -1;
254 static int hf_ldp_tlv_pw_psn_pw_ingress_recv_fault = -1;
255 static int hf_ldp_tlv_pw_psn_pw_egress_recv_fault = -1;
256 static int hf_ldp_tlv_pw_grouping_value = -1;
257 static int hf_ldp_tlv_intparam_length = -1;
258 static int hf_ldp_tlv_intparam_mtu = -1;
259 static int hf_ldp_tlv_intparam_tdmbps = -1;
260 static int hf_ldp_tlv_intparam_id = -1;
261 static int hf_ldp_tlv_intparam_maxcatmcells = -1;
262 static int hf_ldp_tlv_intparam_desc = -1;
263 static int hf_ldp_tlv_intparam_cepbytes = -1;
264 static int hf_ldp_tlv_intparam_cepopt_ais = -1;
265 static int hf_ldp_tlv_intparam_cepopt_une = -1;
266 static int hf_ldp_tlv_intparam_cepopt_rtp = -1;
267 static int hf_ldp_tlv_intparam_cepopt_ebm = -1;
268 static int hf_ldp_tlv_intparam_cepopt_mah = -1;
269 static int hf_ldp_tlv_intparam_cepopt_res = -1;
270 static int hf_ldp_tlv_intparam_cepopt_ceptype = -1;
271 static int hf_ldp_tlv_intparam_cepopt_t3 = -1;
272 static int hf_ldp_tlv_intparam_cepopt_e3 = -1;
273 static int hf_ldp_tlv_intparam_vlanid = -1;
274 static int hf_ldp_tlv_intparam_dlcilen = -1;
275 static int hf_ldp_tlv_intparam_fcslen = -1;
276 static int hf_ldp_tlv_intparam_tdmopt_r = -1;
277 static int hf_ldp_tlv_intparam_tdmopt_d = -1;
278 static int hf_ldp_tlv_intparam_tdmopt_f = -1;
279 static int hf_ldp_tlv_intparam_tdmopt_res1 = -1;
280 static int hf_ldp_tlv_intparam_tdmopt_pt = -1;
281 static int hf_ldp_tlv_intparam_tdmopt_res2 = -1;
282 static int hf_ldp_tlv_intparam_tdmopt_freq = -1;
283 static int hf_ldp_tlv_intparam_tdmopt_ssrc = -1;
284 static int hf_ldp_tlv_intparam_vccv_cctype_cw = -1;
285 static int hf_ldp_tlv_intparam_vccv_cctype_mplsra = -1;
286 static int hf_ldp_tlv_intparam_vccv_cctype_ttl1 = -1;
287 static int hf_ldp_tlv_intparam_vccv_cvtype_icmpping = -1;
288 static int hf_ldp_tlv_intparam_vccv_cvtype_lspping = -1;
289 static int hf_ldp_tlv_intparam_vccv_cvtype_bfd = -1;
290 static int hf_ldp_tlv_upstr_sbit = -1;
291 static int hf_ldp_tlv_upstr_lbl_req_resvbit = -1;
292 static int hf_ldp_tlv_upstr_ass_lbl = -1;
293 static int hf_ldp_tlv_upstr_lbl_resvbit = -1;
294 static int hf_ldp_tlv_ipv4_intID_hop_addr = -1;
295 static int hf_ldp_tlv_logical_intID = -1;
296 static int hf_ldp_tlv_ip_multicast_srcaddr = -1;
297 static int hf_ldp_tlv_ip_multicast_mltcstaddr = -1;
298 static int hf_ldp_tlv_ldp_p2mp_lsptype = -1;
299 static int hf_ldp_tlv_ip_mpls_context_srcaddr = -1;
300 static int hf_ldp_tlv_ldp_p2mp_addrfam = -1;
301 static int hf_ldp_tlv_ldp_p2mp_addrlen = -1;
302 static int hf_ldp_tlv_ldp_p2mp_rtnodeaddr = -1;
303 static int hf_ldp_tlv_ldp_p2mp_oplength = -1;
304 static int hf_ldp_tlv_ldp_p2mp_opvalue = -1;
305 static int hf_ldp_tlv_rsvp_te_p2mp_id = -1;
306 static int hf_ldp_tlv_must_be_zero = -1;
307 static int hf_ldp_tlv_tunnel_id = -1;
308 static int hf_ldp_tlv_ext_tunnel_id = -1;
309 static int hf_ldp_tlv_inv_length = -1;
311 static int ett_ldp = -1;
312 static int ett_ldp_header = -1;
313 static int ett_ldp_ldpid = -1;
314 static int ett_ldp_message = -1;
315 static int ett_ldp_tlv = -1;
316 static int ett_ldp_tlv_val = -1;
317 static int ett_ldp_tlv_ft_flags = -1;
318 static int ett_ldp_fec = -1;
319 static int ett_ldp_fec_vc_interfaceparam = -1;
320 static int ett_ldp_fec_vc_interfaceparam_cepopt = -1;
321 static int ett_ldp_fec_vc_interfaceparam_vccvtype = -1;
322 static int ett_ldp_diffserv_map = -1;
323 static int ett_ldp_diffserv_map_phbid = -1;
324 static int ett_ldp_gen_agi = -1;
325 static int ett_ldp_gen_saii = -1;
326 static int ett_ldp_gen_taii = -1;
327 static int ett_ldp_gen_aai_type2 = -1;
328 static int ett_ldp_sub_tlv = -1;
330 static expert_field ei_ldp_dtsm_and_target = EI_INIT;
331 static expert_field ei_ldp_gtsm_supported = EI_INIT;
332 static expert_field ei_ldp_gtsm_not_supported_basic_discovery = EI_INIT;
333 static expert_field ei_ldp_gtsm_not_supported = EI_INIT;
334 static expert_field ei_ldp_inv_length = EI_INIT;
335 static expert_field ei_ldp_tlv_fec_vc_infolength = EI_INIT;
336 static expert_field ei_ldp_tlv_fec_type = EI_INIT;
337 static expert_field ei_ldp_tlv_fec_len = EI_INIT;
338 static expert_field ei_ldp_malformed_data = EI_INIT;
339 static expert_field ei_ldp_address_family_not_implemented = EI_INIT;
340 static expert_field ei_ldp_malformed_interface_parameter = EI_INIT;
341 static expert_field ei_ldp_tlv_fec = EI_INIT;
343 /* desegmentation of LDP over TCP */
344 static gboolean ldp_desegment = TRUE;
346 static guint32 global_ldp_tcp_port = TCP_PORT_LDP;
347 static guint32 global_ldp_udp_port = UDP_PORT_LDP;
350 * The following define all the TLV types I know about
351 * http://www.iana.org/assignments/ldp-namespaces
354 #define TLV_FEC 0x0100
355 #define TLV_ADDRESS_LIST 0x0101
356 #define TLV_HOP_COUNT 0x0103
357 #define TLV_PATH_VECTOR 0x0104
358 #define TLV_GENERIC_LABEL 0x0200
359 #define TLV_ATM_LABEL 0x0201
360 #define TLV_FRAME_LABEL 0x0202
361 #define TLV_FT_PROTECTION 0x0203
362 #define TLV_STATUS 0x0300
363 #define TLV_EXTENDED_STATUS 0x0301
364 #define TLV_RETURNED_PDU 0x0302
365 #define TLV_RETURNED_MESSAGE 0x0303
366 #define TLV_COMMON_HELLO_PARMS 0x0400
367 #define TLV_IPV4_TRANSPORT_ADDRESS 0x0401
368 #define TLV_CONFIGURATION_SEQNO 0x0402
369 #define TLV_IPV6_TRANSPORT_ADDRESS 0x0403
370 #define TLV_MAC 0x0404
371 #define TLV_COMMON_SESSION_PARMS 0x0500
372 #define TLV_ATM_SESSION_PARMS 0x0501
373 #define TLV_FRAME_RELAY_SESSION_PARMS 0x0502
374 #define TLV_FT_SESSION 0x0503
375 #define TLV_FT_ACK 0x0504
376 #define TLV_FT_CORK 0x0505
377 #define TLV_LABEL_REQUEST_MESSAGE_ID 0x0600 /* RFC5036 */
378 #define TLV_MTU 0x0601 /* RFC3988 */
379 #define TLV_ER 0x0800
380 #define TLV_ER_HOP_IPV4 0x0801
381 #define TLV_ER_HOP_IPV6 0x0802
382 #define TLV_ER_HOP_AS 0x0803
383 #define TLV_ER_HOP_LSPID 0x0804
384 #define TLV_TRAFFIC_PARAM 0x0810
385 #define TLV_PREEMPTION 0x0820
386 #define TLV_LSPID 0x0821
387 #define TLV_RESOURCE_CLASS 0x0822
388 #define TLV_ROUTE_PINNING 0x0823
389 #define TLV_UPSTRM_LBL_ASS_CAP 0x0507
390 #define TLV_UPSTRM_ASS_LBL_REQ 0x0205
391 #define TLV_UPSTRM_ASS_LBL 0x0204
392 #define TLV_IP_MULTICAST_TUNNEL 0x001E
393 #define TLV_MPLS_CONTEXT_LBL 0x001F
394 #define TLV_LDP_P2MP_LSP 0x001D
395 #define TLV_RSVP_TE_P2MP_LSP 0x001C
397 0x0824 Generalized Label Request TLV [RFC3472]
398 0x0825 Generalized Label TLV [RFC3472]
399 0x0826 Upstream Label TLV [RFC3472]
400 0x0827 Label Set TLV [RFC3472]
401 0x0828 Waveband Label TLV [RFC3472]
402 0x0829 ER-Hop TLV [RFC3472]
403 0x082a Acceptable Label Set TLV [RFC3472]
404 0x082b Admin Status TLV [RFC3472]
405 0x082c Interface ID TLV [RFC3472]
406 0x082d IPV4 Interface ID TLV [RFC3472]
407 0x082e IPV6 Interface ID TLV [RFC3472]
408 0x082f IPv4 IF_ID Status TLV [RFC3472]
409 0x0830 IPv6 IF_ID Status TLV [RFC3472]
410 0x0831 Op-Sp Call ID TLV [RFC3475]
411 0x0832 GU Call ID TLV [RFC3475]
412 0x0833 Call Capability TLV [RFC3475]
413 0x0834 Crankback TLV [RFC3475]
414 0x0835 Protection TLV [RFC3472]
415 0x0836 LSP_TUNNEL_INTERFACE_ID TLV [RFC3480]
416 0x0837 Unnumbered Interface ID TLV [RFC3480]
417 0x0838 SONET/SDH Traffic Parameters TLV [RFC4606]
419 #define TLV_IPV4_INTERFACE_ID 0x082D
420 #define TLV_DIFFSERV 0x0901
421 #define TLV_VENDOR_PRIVATE_START 0x3E00
422 #define TLV_VENDOR_PRIVATE_END 0x3EFF
423 #define TLV_EXPERIMENTAL_START 0x3F00
424 #define TLV_EXPERIMENTAL_END 0x3FFF
425 #define TLV_PW_STATUS 0x096A
426 #define TLV_PW_INTERFACE_PARAMETERS 0x096B
427 #define TLV_PW_GROUPING 0x096C
429 static const value_string tlv_type_names[] = {
430 { TLV_FEC, "Forwarding Equivalence Classes TLV" },
431 { TLV_ADDRESS_LIST, "Address List TLV"},
432 { TLV_HOP_COUNT, "Hop Count TLV"},
433 { TLV_PATH_VECTOR, "Path Vector TLV"},
434 { TLV_GENERIC_LABEL, "Generic Label TLV"},
435 { TLV_ATM_LABEL, "ATM Label TLV"},
436 { TLV_FRAME_LABEL, "Frame Label TLV"},
437 { TLV_FT_PROTECTION, "FT Protection TLV"},
438 { TLV_STATUS, "Status TLV"},
439 { TLV_EXTENDED_STATUS, "Extended Status TLV"},
440 { TLV_RETURNED_PDU, "Returned PDU TLV"},
441 { TLV_RETURNED_MESSAGE, "Returned Message TLV"},
442 { TLV_COMMON_HELLO_PARMS, "Common Hello Parameters TLV"},
443 { TLV_IPV4_TRANSPORT_ADDRESS, "IPv4 Transport Address TLV"},
444 { TLV_CONFIGURATION_SEQNO, "Configuration Sequence Number TLV"},
445 { TLV_IPV6_TRANSPORT_ADDRESS, "IPv6 Transport Address TLV"},
446 { TLV_MAC, "MAC TLV"},
447 { TLV_COMMON_SESSION_PARMS, "Common Session Parameters TLV"},
448 { TLV_ATM_SESSION_PARMS, "ATM Session Parameters TLV"},
449 { TLV_FRAME_RELAY_SESSION_PARMS, "Frame Relay Session Parameters TLV"},
450 { TLV_FT_SESSION, "FT Session TLV"},
451 { TLV_FT_ACK, "FT ACK TLV"},
452 { TLV_FT_CORK, "FT Cork TLV"},
453 { TLV_LABEL_REQUEST_MESSAGE_ID, "Label Request Message ID TLV"},
454 { TLV_MTU, "MTU TLV"},
455 { TLV_LSPID, "LSP ID TLV"},
456 { TLV_ER, "Explicit route TLV"},
457 { TLV_ER_HOP_IPV4, "ER hop IPv4 prefix TLV"},
458 { TLV_ER_HOP_IPV6, "ER hop IPv6 prefix TLV"},
459 { TLV_ER_HOP_AS, "ER hop Autonomous system number prefix TLV"},
460 { TLV_TRAFFIC_PARAM, "Traffic parameters TLV"},
461 { TLV_PREEMPTION, "Preemption TLV"},
462 { TLV_ER_HOP_LSPID, "ER hop LSPID prefix TLV"},
463 { TLV_RESOURCE_CLASS, "Resource Class (Color) TLV"},
464 { TLV_ROUTE_PINNING, "Route Pinning TLV"},
465 { 0x0824, "Generalized Label Request TLV"}, /* RFC3472 */
466 { 0x0825, "Generalized Label TLV"}, /* RFC3472 */
467 { 0x0826, "Upstream Label TLV"}, /* RFC3472 */
468 { 0x0827, "Label Set TLV"}, /* RFC3472 */
469 { 0x0828, "Waveband Label TLV"}, /* RFC3472 */
470 { 0x0829, "ER-Hop TLV"}, /* RFC3472 */
471 { 0x082a, "Acceptable Label Set TLV"}, /* RFC3472 */
472 { 0x082b, "Admin Status TLV"}, /* RFC3472 */
473 { 0x082c, "Interface ID TLV"}, /* RFC3472 */
474 { TLV_IPV4_INTERFACE_ID, "IPV4 Interface ID TLV"}, /* RFC3472 */
475 { 0x082e, "IPV6 Interface ID TLV"}, /* RFC3472 */
476 { 0x082f, "IPv4 IF_ID Status TLV"}, /* RFC3472 */
477 { 0x0830, "IPv6 IF_ID Status TLV"}, /* RFC3472 */
478 { 0x0831, "Op-Sp Call ID TLV"}, /* RFC3475 */
479 { 0x0832, "GU Call ID TLV"}, /* RFC3475 */
480 { 0x0833, "Call Capability TLV"}, /* RFC3475 */
481 { 0x0834, "Crankback TLV"}, /* RFC3475 */
482 { 0x0835, "Protection TLV"}, /* RFC3472 */
483 { 0x0836, "LSP_TUNNEL_INTERFACE_ID TLV"}, /* RFC3480 */
484 { 0x0837, "Unnumbered Interface ID TLV"}, /* RFC3480 */
485 { 0x0838, "SONET/SDH Traffic Parameters TLV"}, /* RFC4606]*/
486 { 0x0960, "IPv4 Source ID TLV"}, /*[RFC3476]*/
487 { 0x0961, "IPv6 Source ID TLV"}, /*[RFC3476]*/
488 { 0x0962, "NSAP Source ID TLV"}, /*[RFC3476]*/
489 { 0x0963, "IPv4 Destination ID TLV"}, /*[RFC3476]*/
490 { 0x0964, "IPv6 Destination ID TLV"}, /*[RFC3476]*/
491 { 0x0965, "NSAP Destination ID TLV"}, /*[RFC3476]*/
492 { 0x0966, "Egress Label TLV"}, /*[RFC3476]*/
493 { 0x0967, "Local Connection ID TLV"}, /*[RFC3476]*/
494 { 0x0968, "Diversity TLV"}, /*[RFC3476]*/
495 { 0x0969, "Contract ID TLV"}, /*[RFC3476]*/
496 { TLV_PW_STATUS, "PW Status TLV"}, /*[RFC4447]*/
497 { TLV_PW_INTERFACE_PARAMETERS, "PW Interface Parameters TLV"}, /*[RFC4447]*/
498 { TLV_PW_GROUPING, "Group ID TLV"}, /*[RFC4447]*/
499 { 0x096E, "Bandwidth TLV"}, /*[draft-ietf-pwe3-dynamic-ms-pw](TEMPORARY - Expires 2008-11-21)*/
500 { 0x0970, "UNI Service Level TLV"}, /*[RFC3476]*/
501 { TLV_DIFFSERV, "Diff-Serv TLV"},
502 { TLV_VENDOR_PRIVATE_START, "Vendor Private TLV"},
503 { TLV_EXPERIMENTAL_START, "Experimental TLV"},
504 { TLV_UPSTRM_LBL_ASS_CAP, "LDP Upstream Label Assignment Capability TLV"},
505 { TLV_UPSTRM_ASS_LBL_REQ, "Upstream-Assigned Label Request TLV"},
506 { TLV_UPSTRM_ASS_LBL, "Upstream-Assigned Label TLV"},
507 { TLV_IP_MULTICAST_TUNNEL, "IP Multicast Tunnel TLV"},
508 { TLV_MPLS_CONTEXT_LBL, "MPLS Context Label TLV"},
509 { TLV_LDP_P2MP_LSP, "LDP P2MP LSP TLV"},
510 { TLV_RSVP_TE_P2MP_LSP, "RSVP-TE P2MP LSP TLV"},
511 { 0, NULL}
515 * The following define all the message types I know about
518 #define LDP_NOTIFICATION 0x0001
519 #define LDP_HELLO 0x0100
520 #define LDP_INITIALIZATION 0x0200
521 #define LDP_KEEPALIVE 0x0201
522 #define LDP_ADDRESS 0x0300
523 #define LDP_ADDRESS_WITHDRAWAL 0x0301
524 #define LDP_LABEL_MAPPING 0x0400
525 #define LDP_LABEL_REQUEST 0x0401
526 #define LDP_LABEL_WITHDRAWAL 0x0402
527 #define LDP_LABEL_RELEASE 0x0403
528 #define LDP_LABEL_ABORT_REQUEST 0x0404
529 #define LDP_VENDOR_PRIVATE_START 0x3E00
530 #define LDP_VENDOR_PRIVATE_END 0x3EFF
531 #define LDP_EXPERIMENTAL_MESSAGE_START 0x3F00
532 #define LDP_EXPERIMENTAL_MESSAGE_END 0x3FFF
534 static const value_string ldp_message_types[] = {
535 {LDP_NOTIFICATION, "Notification Message"},
536 {LDP_HELLO, "Hello Message"},
537 {LDP_INITIALIZATION, "Initialization Message"},
538 {LDP_KEEPALIVE, "Keep Alive Message"},
539 {LDP_ADDRESS, "Address Message"},
540 {LDP_ADDRESS_WITHDRAWAL, "Address Withdrawal Message"},
541 {LDP_LABEL_MAPPING, "Label Mapping Message"},
542 {LDP_LABEL_REQUEST, "Label Request Message"},
543 {LDP_LABEL_WITHDRAWAL, "Label Withdrawal Message"},
544 {LDP_LABEL_RELEASE, "Label Release Message"},
545 {LDP_LABEL_ABORT_REQUEST, "Label Abort Request Message"},
546 {LDP_VENDOR_PRIVATE_START, "Vendor-Private Message"},
547 {LDP_EXPERIMENTAL_MESSAGE_START, "Experimental Message"},
548 {0, NULL}
551 static const true_false_string ldp_message_ubit = {
552 "Unknown bit set",
553 "Unknown bit not set"
556 static const true_false_string hello_targeted_vals = {
557 "Targeted Hello",
558 "Link Hello"
561 static const value_string tlv_unknown_vals[] = {
562 {0, "Known TLV, do not Forward"},
563 {1, "Known TLV, do Forward"},
564 {2, "Unknown TLV, do not Forward"},
565 {3, "Unknown TLV, do Forward"},
566 {0, NULL}
569 #define WILDCARD_FEC 1
570 #define PREFIX_FEC 2
571 #define HOST_FEC 3
572 #define CRLSP_FEC 4
573 #define VC_FEC 0x80 /* draft-martini-l2circuit-trans-mpls */
574 #define GEN_FEC 0x81
575 #define P2MP_FEC 0x06
577 static const value_string fec_types[] = {
578 {WILDCARD_FEC, "Wildcard FEC"},
579 {PREFIX_FEC, "Prefix FEC"},
580 {HOST_FEC, "Host Address FEC"},
581 {CRLSP_FEC, "CR LSP FEC"},
582 {VC_FEC, "Virtual Circuit FEC"},
583 {GEN_FEC, "Generalized PWid FEC"},
584 {P2MP_FEC, "P2MP FEC"},
585 {0, NULL}
589 const value_string fec_vc_types_vals[] = {
590 {0x0001, "Frame Relay DLCI"},
591 {0x0002, "ATM AAL5 SDU VCC transport"},
592 {0x0003, "ATM transparent cell transport"},
593 {0x0004, "Ethernet VLAN"},
594 {0x0005, "Ethernet"},
595 {0x0006, "HDLC"},
596 {0x0007, "PPP"},
597 {0x0008, "SONET/SDH Circuit Emulation Service"},
598 {0x0009, "ATM n-to-one VCC cell transport"},
599 {0x000A, "ATM n-to-one VPC cell transport"},
600 {0x000B, "IP layer2 transport"},
601 {0x000C, "ATM one-to-one VCC Cell Mode"},
602 {0x000D, "ATM one-to-one VPC Cell Mode"},
603 {0x000E, "ATM AAL5 PDU VCC transport"},
604 {0x000F, "Frame-Relay Port mode"},
605 {0x0010, "SONET/SDH Circuit Emulation over Packet"},
606 {0x0011, "Structure-agnostic E1 over Packet"},
607 {0x0012, "Structure-agnostic T1 (DS1) over Packet"},
608 {0x0013, "Structure-agnostic E3 over Packet"},
609 {0x0014, "Structure-agnostic T3 (DS3) over Packet"},
610 {0x0015, "CESoPSN basic mode"},
611 {0x0016, "TDMoIP basic mode"},
612 {0x0017, "CESoPSN TDM with CAS"},
613 {0x0018, "TDMoIP TDM with CAS"},
614 {0, NULL}
618 static const value_string fec_vc_ceptype_vals[] = {
619 {0, "SPE mode (STS-1/STS-Mc)"},
620 {1, "VT mode (VT1.5/VT2/VT3/VT6)"},
621 {2, "Fractional SPE (STS-1/VC-3/VC-4)"},
622 {0, NULL}
625 static const true_false_string fec_vc_tdmopt_r = {
626 "Expects to receive RTP Header",
627 "Does not expect to receive RTP Header"
630 static const true_false_string fec_vc_tdmopt_d = {
631 "Expects the peer to use Differential timestamping",
632 "Does not expect the peer to use Differential timestamping"
635 static const true_false_string fec_vc_tdmopt_f = {
636 "Expects TDMoIP encapsulation",
637 "Expects CESoPSN encapsulation"
641 #define FEC_VC_INTERFACEPARAM_MTU 0x01
642 #define FEC_VC_INTERFACEPARAM_MAXCATMCELLS 0x02
643 #define FEC_VC_INTERFACEPARAM_DESCRIPTION 0x03
644 #define FEC_VC_INTERFACEPARAM_CEPBYTES 0x04
645 #define FEC_VC_INTERFACEPARAM_CEPOPTIONS 0x05
646 #define FEC_VC_INTERFACEPARAM_VLANID 0x06
647 #define FEC_VC_INTERFACEPARAM_TDMBPS 0x07
648 #define FEC_VC_INTERFACEPARAM_FRDLCILEN 0x08
649 #define FEC_VC_INTERFACEPARAM_FRAGIND 0x09
650 #define FEC_VC_INTERFACEPARAM_FCSRETENT 0x0A
651 #define FEC_VC_INTERFACEPARAM_TDMOPTION 0x0B
652 #define FEC_VC_INTERFACEPARAM_VCCV 0x0C
653 #define FEC_VC_INTERFACEPARAM_FLOWLABEL 0x17
655 static const value_string fec_vc_interfaceparm[] = {
656 {FEC_VC_INTERFACEPARAM_MTU, "MTU"},
657 {FEC_VC_INTERFACEPARAM_MAXCATMCELLS, "Max Concatenated ATM cells"},
658 {FEC_VC_INTERFACEPARAM_DESCRIPTION, "Interface Description"},
659 {FEC_VC_INTERFACEPARAM_CEPBYTES, "CEP/TDM Payload Bytes"},
660 {FEC_VC_INTERFACEPARAM_CEPOPTIONS, "CEP options"},
661 {FEC_VC_INTERFACEPARAM_VLANID, "Requested VLAN ID"},
662 {FEC_VC_INTERFACEPARAM_TDMBPS, "CEP/TDM bit-rate"},
663 {FEC_VC_INTERFACEPARAM_FRDLCILEN, "Frame-Relay DLCI Length"},
664 {FEC_VC_INTERFACEPARAM_FRAGIND, "Fragmentation indicator"},
665 {FEC_VC_INTERFACEPARAM_FCSRETENT, "FCS retention indicator"},
666 {FEC_VC_INTERFACEPARAM_TDMOPTION, "TDM options"},
667 {FEC_VC_INTERFACEPARAM_VCCV, "VCCV"},
668 {FEC_VC_INTERFACEPARAM_FLOWLABEL, "Flow Label"},
669 {0, NULL},
672 static const true_false_string fec_vc_cbit = {
673 "Control Word Present",
674 "Control Word NOT Present"
677 #if 0
678 static const true_false_string fec_vc_ = {
679 "Control Word Present",
680 "Control Word NOT Present"
682 #endif
684 static const value_string tlv_atm_merge_vals[] = {
685 {0, "Merge not supported"},
686 {1, "VP merge supported"},
687 {2, "VC merge supported"},
688 {3, "VP & VC merge supported"},
689 {0, NULL}
692 static const value_string tlv_atm_vbits_vals[] = {
693 {0, "VPI & VCI Significant"},
694 {1, "Only VPI Significant"},
695 {2, "Only VCI Significant"},
696 {3, "VPI & VCI not Significant, nonsense"},
697 {0, NULL}
700 static const value_string tlv_fr_merge_vals[] = {
701 {0, "Merge not supported"},
702 {1, "Merge supported"},
703 {2, "Unspecified"},
704 {3, "Unspecified"},
705 {0, NULL}
708 static const value_string tlv_fr_len_vals[] = {
709 {0, "10 bits"},
710 {1, "Reserved"},
711 {2, "23 bits"},
712 {3, "Reserved"},
713 {0, NULL}
716 static const value_string tlv_ft_flags[] = {
717 { 0, "Invalid"},
718 { 1, "Using LDP Graceful Restart"},
719 { 2, "Check-Pointing of all labels"},
720 { 3, "Invalid"},
721 { 4, "Invalid"},
722 { 5, "Invalid"},
723 { 6, "Check-Pointing of all labels"},
724 { 7, "Invalid"},
725 { 8, "Full FT on selected labels"},
726 { 9, "Invalid"},
727 {10, "Full FT on selected labels"},
728 {11, "Invalid"},
729 {12, "Full FT on all labels"},
730 {13, "Invalid"},
731 {14, "Full FT on all labels"},
732 {15, "Invalid"},
733 {0, NULL}
736 static const true_false_string tlv_ft_r = {
737 "LSR has preserved state and resources for all FT-Labels",
738 "LSR has not preserved state and resources for all FT-Labels"
741 static const true_false_string tlv_ft_s = {
742 "FT Protection TLV supported on other than KeepAlive",
743 "FT Protection TLV not supported on other than KeepAlive"
746 static const true_false_string tlv_ft_a = {
747 "Treat all labels as Sequence Numbered FT Labels",
748 "May treat some labels as FT and others as non-FT"
751 static const true_false_string tlv_ft_c = {
752 "Check-Pointing procedures in use",
753 "Check-Pointing procedures not in use"
756 static const true_false_string tlv_ft_l = {
757 "Re-learn the state from the network",
758 "Do not re-learn the state from the network"
761 static const value_string ldp_act_flg_vals[] = {
762 {0, "indicates initial LSP setup"},
763 {1, "indicates modify LSP"},
764 {0, NULL}
767 static const value_string route_pinning_vals[] = {
768 {0, "route pinning is not requested"},
769 {1, "route pinning is requested"},
770 {0, NULL}
773 static const value_string diffserv_type_vals[] = {
774 {0, "E-LSP"},
775 {1, "L-LSP"},
776 {0, NULL}
779 static const value_string ldp_loose_vals[] = {
780 {0, "strict hop"},
781 {1, "loose hop"},
782 {0, NULL}
785 static const true_false_string tlv_negotiable = {
786 "Negotiable",
787 "Not negotiable"
790 static const value_string freq_values[] = {
791 {0, "Unspecified"},
792 {1, "Frequent"},
793 {2, "VeryFrequent"},
794 {0, NULL}
797 static const true_false_string tlv_atm_dirbit = {
798 "Bidirectional capability",
799 "Unidirectional capability"
802 static const true_false_string hello_requested_vals = {
803 "Source requests periodic hellos",
804 "Source does not request periodic hellos"
807 static const true_false_string tlv_sess_advbit_vals = {
808 "Downstream On Demand proposed",
809 "Downstream Unsolicited proposed"
812 static const true_false_string tlv_sess_ldetbit_vals = {
813 "Loop Detection Enabled",
814 "Loop Detection Disabled"
817 static const true_false_string tlv_status_ebit = {
818 "Fatal Error Notification",
819 "Advisory Notification"
822 static const true_false_string tlv_status_fbit = {
823 "Notification should be Forwarded",
824 "Notification should NOT be Forwarded"
827 static const value_string tlv_status_data[] = {
828 { 0, "Success"},
829 { 1, "Bad LDP Identifier"},
830 { 2, "Bad Protocol Version"},
831 { 3, "Bad PDU Length"},
832 { 4, "Unknown Message Type"},
833 { 5, "Bad Message Length"},
834 { 6, "Unknown TLV"},
835 { 7, "Bad TLV Length"},
836 { 8, "Malformed TLV Value"},
837 { 9, "Hold Timer Expired"},
838 {10, "Shutdown"},
839 {11, "Loop Detected"},
840 {12, "Unknown FEC"},
841 {13, "No Route"},
842 {14, "No Label Resources"},
843 {15, "Label Resources / Available"},
844 {16, "Session Rejected / No Hello"},
845 {17, "Session Rejected / Parameters Advertisement Mode"},
846 {18, "Session Rejected / Parameters Max PDU Length"},
847 {19, "Session Rejected / Parameters Label Range"},
848 {20, "KeepAlive Timer Expired"},
849 {21, "Label Request Aborted"},
850 {22, "Missing Message Parameters"},
851 {23, "Unsupported Address Family"},
852 {24, "Session Rejected / Bad KeepAlive Time"},
853 {25, "Internal Error"},
854 {26, "No LDP Session"},
855 {27, "Zero FT seqnum"},
856 {28, "Unexpected TLV / Session Not FT"},
857 {29, "Unexpected TLV / Label Not FT"},
858 {30, "Missing FT Protection TLV"},
859 {31, "FT ACK sequence error"},
860 {32, "Temporary Shutdown"},
861 {33, "FT Seq Numbers Exhausted"},
862 {34, "FT Session parameters / changed"},
863 {35, "Unexpected FT Cork TLV"},
864 {0x01000001, "Unexpected Diff-Serv TLV"},
865 {0x01000002, "Unsupported PHB"},
866 {0x01000003, "Invalid EXP<->PHB Mapping"},
867 {0x01000004, "Unsupported PSC"},
868 {0x01000005, "Per-LSP context allocation failure"},
869 {0x04000001, "Bad Explicit Routing TLV Error"},
870 {0x04000002, "Bad Strict Node Error"},
871 {0x04000003, "Bad Strict Node Error"},
872 {0x04000004, "Bad Initial ER-Hop Error"},
873 {0x04000005, "Resource Unavailable"},
874 {0x04000006, "Traffic Parameters Unavailable"},
875 {0x04000007, "LSP Preempted"},
876 {0x04000008, "Modify Request Not Supported"},
877 {0x20000001, "Illegal C-Bit"},
878 {0x20000002, "Wrong C-Bit"},
879 {0x00000028, "PW status"},
880 {0, NULL}
883 static const true_false_string tlv_upstr_sbit_vals = {
884 "LSR is advertising the capability to distribute and receive upstream-assigned label bindings",
885 "LSR is withdrawing the capability to distribute and receive upstream-assigned label bindings"
888 #define PW_NOT_FORWARDING 0x1
889 #define PW_LAC_INGRESS_RECV_FAULT 0x2
890 #define PW_LAC_EGRESS_TRANS_FAULT 0x4
891 #define PW_PSN_PW_INGRESS_RECV_FAULT 0x8
892 #define PW_PSN_PW_EGRESS_TRANS_FAULT 0x10
894 /* Define storage class for a string handler function
895 * with a const guint8 * argument, and returning a const gchar *
897 typedef const gchar *(string_handler_func)(const guint8 *);
899 /* Default handler for address to string conversion */
900 static const gchar *
901 default_str_handler(const guint8 * bytes _U_)
903 return "<Support for this Address Family not implemented>";
906 static void
907 dissect_subtlv_interface_parameters(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem, int *interface_parameters_hf[]);
909 static void
910 dissect_genpwid_fec_aai_type2_parameter(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem);
912 /* Dissect FEC TLV */
914 static void
915 dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
917 static int *interface_params_header_fields[] = {
918 &hf_ldp_tlv_fec_vc_intparam_length ,
919 &hf_ldp_tlv_fec_vc_intparam_mtu ,
920 &hf_ldp_tlv_fec_vc_intparam_tdmbps ,
921 &hf_ldp_tlv_fec_vc_intparam_id ,
922 &hf_ldp_tlv_fec_vc_intparam_maxcatmcells ,
923 &hf_ldp_tlv_fec_vc_intparam_desc ,
924 &hf_ldp_tlv_fec_vc_intparam_cepbytes ,
925 &hf_ldp_tlv_fec_vc_intparam_cepopt_ais ,
926 &hf_ldp_tlv_fec_vc_intparam_cepopt_une ,
927 &hf_ldp_tlv_fec_vc_intparam_cepopt_rtp ,
928 &hf_ldp_tlv_fec_vc_intparam_cepopt_ebm ,
929 &hf_ldp_tlv_fec_vc_intparam_cepopt_mah ,
930 &hf_ldp_tlv_fec_vc_intparam_cepopt_res ,
931 &hf_ldp_tlv_fec_vc_intparam_cepopt_ceptype ,
932 &hf_ldp_tlv_fec_vc_intparam_cepopt_t3 ,
933 &hf_ldp_tlv_fec_vc_intparam_cepopt_e3 ,
934 &hf_ldp_tlv_fec_vc_intparam_vlanid ,
935 &hf_ldp_tlv_fec_vc_intparam_dlcilen ,
936 &hf_ldp_tlv_fec_vc_intparam_fcslen ,
937 &hf_ldp_tlv_fec_vc_intparam_tdmopt_r ,
938 &hf_ldp_tlv_fec_vc_intparam_tdmopt_d ,
939 &hf_ldp_tlv_fec_vc_intparam_tdmopt_f ,
940 &hf_ldp_tlv_fec_vc_intparam_tdmopt_res1 ,
941 &hf_ldp_tlv_fec_vc_intparam_tdmopt_pt ,
942 &hf_ldp_tlv_fec_vc_intparam_tdmopt_res2 ,
943 &hf_ldp_tlv_fec_vc_intparam_tdmopt_freq ,
944 &hf_ldp_tlv_fec_vc_intparam_tdmopt_ssrc ,
945 &hf_ldp_tlv_fec_vc_intparam_vccv_cctype_cw ,
946 &hf_ldp_tlv_fec_vc_intparam_vccv_cctype_mplsra ,
947 &hf_ldp_tlv_fec_vc_intparam_vccv_cctype_ttl1 ,
948 &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_icmpping ,
949 &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_lspping ,
950 &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd1,
951 &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd2,
952 &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd3,
953 &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd4,
954 &hf_ldp_tlv_fec_vc_intparam_flowlabel_t,
955 &hf_ldp_tlv_fec_vc_intparam_flowlabel_r,
956 &hf_ldp_tlv_fec_vc_intparam_flowlabel_res,
959 proto_tree *ti, *ti2, *val_tree, *fec_tree=NULL;
960 proto_tree *agi_tree=NULL, *saii_tree=NULL, *taii_tree=NULL;
961 guint16 family, ix=1, ax;
962 guint16 op_length = tvb_get_bits16(tvb, ((offset+8)*8), 16, ENC_BIG_ENDIAN);
963 guint8 addr_size=0, *addr, implemented, prefix_len_octets, prefix_len, host_len, vc_len;
964 guint8 intparam_len, aai_type = 0;
965 string_handler_func *str_handler = default_str_handler;
966 const char *str;
967 guint8 gen_fec_id_len = 0;
969 ti=proto_tree_add_text(tree, tvb, offset, rem, "FEC Elements");
970 val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
972 while (rem > 0){
973 switch (tvb_get_guint8(tvb, offset)) {
974 case WILDCARD_FEC:
975 case CRLSP_FEC:
976 ti = proto_tree_add_text(val_tree, tvb, offset, 1, "FEC Element %u", ix);
977 fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
978 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc,tvb, offset, 1, ENC_BIG_ENDIAN);
979 rem -= 1;
980 offset += 1;
981 break;
983 case PREFIX_FEC:
984 if ( rem < 4 ){/*not enough*/
985 proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec, tvb, offset, rem, "Error in FEC Element %u", ix);
986 return;
988 family=tvb_get_ntohs(tvb, offset+1);
989 prefix_len=tvb_get_guint8(tvb, offset+3);
990 prefix_len_octets=(prefix_len+7)/8;
992 implemented=1;
993 switch(family) {
994 case AFNUM_INET: /*IPv4*/
995 addr_size=4;
996 str_handler=ip_to_str;
997 break;
998 case AFNUM_INET6: /*IPv6*/
999 addr_size=16;
1000 str_handler = (string_handler_func *) ip6_to_str;
1001 break;
1002 default:
1003 implemented=0;
1004 break;
1007 if ( !implemented ) {
1008 guint16 noctets;
1010 noctets= rem>4+prefix_len_octets?4+prefix_len_octets:rem;
1011 proto_tree_add_expert(val_tree, pinfo, &ei_ldp_address_family_not_implemented, tvb, offset, noctets);
1012 offset+=noctets;
1013 rem-=noctets;
1014 break;
1017 if ( rem < 4+MIN(addr_size, prefix_len_octets) ){
1018 proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec, tvb, offset, rem, "Error in FEC Element %u", ix);
1019 return;
1022 /*Add a subtree for this*/
1023 ti = proto_tree_add_text(val_tree, tvb, offset, 4+MIN(addr_size, prefix_len_octets), "FEC Element %u", ix);
1024 fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
1025 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
1026 offset += 1;
1028 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_af, tvb, offset, 2, ENC_BIG_ENDIAN);
1029 offset += 2;
1031 ti = proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_len, tvb, offset, 1, ENC_BIG_ENDIAN);
1032 offset += 1;
1035 if ( addr_size < prefix_len_octets) {
1036 offset+=addr_size;
1037 rem-=addr_size;
1038 expert_add_info_format(pinfo, ti, &ei_ldp_tlv_fec_len,
1039 "Invalid prefix %u length for family %s",
1040 prefix_len, val_to_str_const(family, afn_vals, "Unknown Family"));
1041 break;
1044 addr=(guint8 *)wmem_alloc0(wmem_packet_scope(), addr_size);
1046 for(ax=0; ax+1 <= prefix_len_octets; ax++)
1047 addr[ax]=tvb_get_guint8(tvb, offset+ax);
1048 if ( prefix_len % 8 )
1049 addr[ax-1] = addr[ax-1]&(0xFF<<(8-prefix_len%8));
1051 str = str_handler((const guint8 *)addr);
1052 proto_tree_add_string_format(fec_tree, hf_ldp_tlv_fec_pfval, tvb, offset, prefix_len_octets,
1053 str, "Prefix: %s", str);
1055 offset += prefix_len_octets;
1056 rem -= 4+prefix_len_octets;
1057 break;
1059 case HOST_FEC:
1060 if ( rem < 4 ){/*not enough*/
1061 proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec, tvb, offset, rem, "Error in FEC Element %u", ix);
1062 return;
1064 family=tvb_get_ntohs(tvb, offset+1);
1065 host_len=tvb_get_guint8(tvb, offset+3);
1067 implemented=1;
1068 switch(family) {
1069 case AFNUM_INET: /*IPv4*/
1070 addr_size=4;
1071 str_handler=ip_to_str;
1072 break;
1073 case AFNUM_INET6: /*IPv6*/
1074 addr_size=16;
1075 str_handler = (string_handler_func *) ip6_to_str;
1076 break;
1077 default:
1078 implemented=0;
1079 break;
1082 if ( !implemented ) {
1083 guint16 noctets;
1085 noctets= rem>4+host_len?4+host_len:rem;
1086 proto_tree_add_expert(val_tree, pinfo, &ei_ldp_address_family_not_implemented, tvb, offset, noctets);
1087 offset+=noctets;
1088 rem-=noctets;
1089 break;
1092 if ( rem < 4+addr_size ){
1093 proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec, tvb, offset, rem, "Error in FEC Element %u", ix);
1094 return;
1097 /*Add a subtree for this*/
1098 ti = proto_tree_add_text(val_tree, tvb, offset, 4+addr_size, "FEC Element %u", ix);
1099 fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
1100 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
1101 offset += 1;
1103 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_af, tvb, offset, 2, ENC_BIG_ENDIAN);
1104 offset += 2;
1106 ti = proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_len, tvb, offset, 1, ENC_BIG_ENDIAN);
1107 offset += 1;
1110 if ( addr_size != host_len) {
1111 offset+=addr_size;
1112 rem-=addr_size;
1113 expert_add_info_format(pinfo, ti, &ei_ldp_tlv_fec_len,
1114 "Invalid address length %u length for family %s",
1115 host_len, val_to_str_const(family, afn_vals, "Unknown Family"));
1116 break;
1119 addr=(guint8 *)wmem_alloc0(wmem_packet_scope(), addr_size);
1121 for(ax=0; ax+1 <= host_len; ax++)
1122 addr[ax]=tvb_get_guint8(tvb, offset+ax);
1124 str = str_handler((const guint8 *)addr);
1125 proto_tree_add_string_format(fec_tree, hf_ldp_tlv_fec_hoval, tvb, offset, host_len,
1126 str, "Address: %s", str);
1128 offset += host_len;
1129 rem -= 4+host_len;
1130 break;
1132 case VC_FEC:
1133 if ( rem < 8 ){/*not enough bytes for a minimal VC_FEC*/
1134 proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec, tvb, offset, rem, "Error in FEC Element %u", ix);
1135 return;
1137 vc_len = tvb_get_guint8 (tvb, offset+3);
1140 ti = proto_tree_add_text(val_tree, tvb, offset, 8+vc_len, "FEC Element %u", ix);
1141 fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
1142 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
1143 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_controlword, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1144 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_vctype, tvb, offset+1, 2, ENC_BIG_ENDIAN);
1145 ti2 = proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_infolength, tvb, offset+3,1,ENC_BIG_ENDIAN);
1146 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_groupid,tvb, offset +4, 4, ENC_BIG_ENDIAN);
1147 rem -=8;
1148 offset +=8;
1150 if ( (vc_len > 3) && ( rem > 3 ) ) { /* there is enough room for vcid */
1151 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_vcid,tvb, offset, 4, ENC_BIG_ENDIAN);
1152 proto_item_append_text (ti," VCID: %u",tvb_get_ntohl(tvb,offset));
1154 } else {
1155 expert_add_info(pinfo, ti2, &ei_ldp_tlv_fec_vc_infolength);
1156 return;
1158 rem -= 4;
1159 vc_len -= 4;
1160 offset += 4;
1162 while ( (vc_len > 1) && (rem > 1) ) { /* enough to include id and length */
1163 intparam_len = tvb_get_guint8(tvb, offset+1);
1164 if (intparam_len < 2){ /* At least Type and Len, protect against len = 0 */
1165 proto_tree_add_expert(fec_tree, pinfo, &ei_ldp_malformed_interface_parameter, tvb, offset +1, 1);
1166 return;
1169 if ( (vc_len -intparam_len) <0 && (rem -intparam_len) <0 ) { /* error condition */
1170 proto_tree_add_expert(fec_tree, pinfo, &ei_ldp_malformed_data, tvb, offset +2, MIN(vc_len,rem));
1171 return;
1173 dissect_subtlv_interface_parameters(tvb, offset, fec_tree, intparam_len, interface_params_header_fields);
1175 rem -= intparam_len;
1176 vc_len -= intparam_len;
1177 offset += intparam_len;
1179 break;
1180 case GEN_FEC:
1182 /* Ref: RFC 4447 */
1183 if ( rem < 4 ){/*not enough bytes for a minimal VC_FEC*/
1184 proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec, tvb, offset, rem, "Error in FEC Element %u", ix);
1185 return;
1187 vc_len = tvb_get_guint8 (tvb, offset+3);
1189 /* Add the FEC to the tree */
1190 ti = proto_tree_add_text(val_tree, tvb, offset, 8+vc_len, "FEC Element %u", ix);
1191 fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
1192 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
1193 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_controlword, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1194 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_vctype, tvb, offset+1, 2, ENC_BIG_ENDIAN);
1195 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_infolength, tvb, offset+3,1,ENC_BIG_ENDIAN);
1196 rem -= 4;
1197 offset += 4;
1199 if ( (vc_len > 1) && ( rem > 1 ) ) { /* there is enough room for AGI */
1200 gen_fec_id_len = tvb_get_guint8 (tvb, offset+1);
1201 /* Add AGI to the tree */
1202 ti = proto_tree_add_text(fec_tree, tvb, offset, 2 + gen_fec_id_len, "AGI");
1203 agi_tree = proto_item_add_subtree(ti, ett_ldp_gen_agi);
1204 proto_tree_add_item(agi_tree, hf_ldp_tlv_fec_gen_agi_type,tvb, offset, 1, ENC_BIG_ENDIAN);
1205 proto_tree_add_item(agi_tree, hf_ldp_tlv_fec_gen_agi_length,tvb, offset + 1, 1, ENC_BIG_ENDIAN);
1206 if ( gen_fec_id_len > 0)
1208 proto_tree_add_item(agi_tree, hf_ldp_tlv_fec_gen_agi_value, tvb, offset+2, gen_fec_id_len , ENC_NA );
1210 rem -= 2 + gen_fec_id_len;
1211 vc_len -= 2 + gen_fec_id_len;
1212 offset += 2 + gen_fec_id_len;
1214 } else {
1215 proto_tree_add_expert_format(fec_tree, pinfo, &ei_ldp_tlv_fec_vc_infolength, tvb, offset, 2 +vc_len, "Generalized FEC: AGI size format error");
1216 return;
1219 if ( (vc_len > 1) && ( rem > 1 ) ) { /* there is enough room for SAII */
1220 gen_fec_id_len = tvb_get_guint8 (tvb, offset+1);
1221 /* Add SAII to the tree */
1222 aai_type = tvb_get_guint8(tvb, offset);
1223 if ( aai_type == 2 && gen_fec_id_len != 12)
1225 /* According to RFC 5003, for Type 2 AAI, the length should be 12 bytes */
1226 proto_tree_add_expert_format(fec_tree, pinfo, &ei_ldp_tlv_fec_vc_infolength, tvb, offset, 2 + gen_fec_id_len, "Generalized FEC: SAII size format error");
1228 else
1230 ti = proto_tree_add_text(fec_tree, tvb, offset, 2 + gen_fec_id_len, "SAII");
1231 saii_tree = proto_item_add_subtree(ti, ett_ldp_gen_saii);
1232 proto_tree_add_item(saii_tree, hf_ldp_tlv_fec_gen_saii_type,tvb, offset, 1, ENC_BIG_ENDIAN);
1233 proto_tree_add_item(saii_tree, hf_ldp_tlv_fec_gen_saii_length,tvb, offset + 1, 1, ENC_BIG_ENDIAN);
1234 if ( gen_fec_id_len > 0)
1236 /* Get the AAI Type. */
1237 /* If it is Type 2 (RFC 5003), then the length is 12 bytes, */
1238 /* and the following fields exist. */
1239 /* 0 1 2 3 */
1240 /* 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 */
1241 /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1242 /* | AII Type=02 | Length | Global ID | */
1243 /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1244 /* | Global ID (contd.) | Prefix | */
1245 /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1246 /* | Prefix (contd.) | AC ID | */
1247 /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1248 /* | AC ID | */
1249 /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1251 if ( aai_type == 2)
1253 dissect_genpwid_fec_aai_type2_parameter(tvb, pinfo, offset +2, saii_tree, gen_fec_id_len);
1255 else
1257 proto_tree_add_item(saii_tree,
1258 hf_ldp_tlv_fec_gen_saii_value,
1259 tvb,
1260 offset+2,
1261 gen_fec_id_len ,
1262 ENC_NA );
1266 rem -= 2 + gen_fec_id_len;
1267 vc_len -= 2 + gen_fec_id_len;
1268 offset += 2 + gen_fec_id_len;
1270 } else {
1271 proto_tree_add_expert_format(fec_tree, pinfo, &ei_ldp_tlv_fec_vc_infolength, tvb, offset, 2 + vc_len, "Generalized FEC: SAII size format error");
1272 return;
1275 if ( (vc_len > 1) && ( rem > 1 ) ) { /* there is enough room for TAII */
1276 gen_fec_id_len = tvb_get_guint8 (tvb, offset+1);
1277 /* Add TAII to the tree */
1278 aai_type = tvb_get_guint8(tvb, offset);
1279 if ( aai_type == 2 && gen_fec_id_len != 12)
1281 /* According to RFC 5003, for Type 2 AAI, the length should be 12 bytes */
1282 proto_tree_add_expert_format(fec_tree, pinfo, &ei_ldp_tlv_fec_vc_infolength, tvb, offset, 2 + gen_fec_id_len, "Generalized FEC: TAII size format error");
1284 else
1286 ti = proto_tree_add_text(fec_tree, tvb, offset, 2 + gen_fec_id_len, "TAII");
1287 taii_tree = proto_item_add_subtree(ti, ett_ldp_gen_taii);
1288 proto_tree_add_item(taii_tree, hf_ldp_tlv_fec_gen_taii_type,tvb, offset, 1, ENC_BIG_ENDIAN);
1289 proto_tree_add_item(taii_tree, hf_ldp_tlv_fec_gen_taii_length,tvb, offset + 1, 1, ENC_BIG_ENDIAN);
1290 if ( gen_fec_id_len > 0)
1292 /* Get the AAI Type. */
1293 /* If it is Type 2 (RFC 5003), then the length is 12 bytes, */
1294 /* and the following fields exist. */
1295 /* 0 1 2 3 */
1296 /* 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 */
1297 /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1298 /* | AII Type=02 | Length | Global ID | */
1299 /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1300 /* | Global ID (contd.) | Prefix | */
1301 /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1302 /* | Prefix (contd.) | AC ID | */
1303 /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1304 /* | AC ID | */
1305 /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1307 if ( aai_type == 2)
1309 dissect_genpwid_fec_aai_type2_parameter(tvb, pinfo, offset +2, taii_tree, gen_fec_id_len);
1311 else
1313 proto_tree_add_item(taii_tree, hf_ldp_tlv_fec_gen_taii_value, tvb, offset+2, gen_fec_id_len , ENC_NA);
1317 rem -= 2 + gen_fec_id_len;
1318 /*vc_len -= 2 + gen_fec_id_len;*/
1319 offset += 2 + gen_fec_id_len;
1322 } else {
1323 proto_tree_add_expert_format(fec_tree, pinfo, &ei_ldp_tlv_fec_vc_infolength, tvb, offset, 2 +vc_len, "Generalized FEC: TAII size format error");
1324 return;
1327 break;
1329 case P2MP_FEC:
1330 { if (rem < 4 ){/*not enough*/
1331 proto_item* inv_length;
1332 inv_length = proto_tree_add_item(val_tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
1333 expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
1334 return;
1337 ti = proto_tree_add_text(val_tree, tvb, offset, 4+tvb_get_guint8 (tvb, offset+1), "FEC Element %u", ix);
1338 fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
1339 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
1340 offset += 1;
1342 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_af, tvb, offset, 2, ENC_BIG_ENDIAN);
1343 offset += 2;
1344 proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_len, tvb, offset, 1, ENC_BIG_ENDIAN);
1345 offset += 1;
1347 proto_tree_add_item(fec_tree, hf_ldp_tlv_ldp_p2mp_rtnodeaddr, tvb,offset, 4, ENC_BIG_ENDIAN);
1348 proto_tree_add_item(fec_tree, hf_ldp_tlv_ldp_p2mp_oplength, tvb,offset + 4, 2, ENC_BIG_ENDIAN);
1349 proto_tree_add_item(fec_tree, hf_ldp_tlv_ldp_p2mp_opvalue, tvb,offset + 6, op_length, ENC_NA);
1351 offset = offset + 6 + op_length;
1352 rem = rem - 10 - op_length;
1354 break;
1356 default: /* Unknown */
1357 /* XXX - do all FEC's have a length that's a multiple of 4? */
1358 /* Hmmm, don't think so. Will check. RJS. */
1359 /* If we don't know its structure, we have to exit */
1360 ti = proto_tree_add_text(val_tree, tvb, offset, 4, "FEC Element %u", ix);
1361 fec_tree = proto_item_add_subtree(ti, ett_ldp_fec);
1362 proto_tree_add_expert(fec_tree, pinfo, &ei_ldp_tlv_fec_type, tvb, offset, rem);
1363 return;
1365 ix++;
1369 /* Dissect Address List TLV */
1371 static void
1372 dissect_tlv_address_list(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1374 proto_tree *ti, *val_tree;
1375 guint16 family, ix;
1376 guint8 addr_size, *addr;
1377 string_handler_func *str_handler = default_str_handler;
1378 const char *str;
1380 if ( rem < 2 ) {
1381 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1382 "Error processing Address List TLV: length is %d, should be >= 2",
1383 rem);
1384 return;
1387 family=tvb_get_ntohs(tvb, offset);
1388 proto_tree_add_item(tree, hf_ldp_tlv_addrl_addr_family, tvb,
1389 offset, 2, ENC_BIG_ENDIAN);
1390 switch(family) {
1391 case AFNUM_INET: /*IPv4*/
1392 addr_size=4;
1393 str_handler=ip_to_str;
1394 break;
1395 case AFNUM_INET6: /*IPv6*/
1396 addr_size=16;
1397 str_handler = (string_handler_func *) ip6_to_str;
1398 break;
1399 default:
1400 proto_tree_add_expert(tree, pinfo, &ei_ldp_address_family_not_implemented, tvb, offset+2, rem-2);
1401 return;
1404 offset+=2; rem-=2;
1405 ti=proto_tree_add_text(tree, tvb, offset, rem, "Addresses");
1406 val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
1408 addr=(guint8 *)wmem_alloc(wmem_packet_scope(), addr_size);
1410 for(ix=1; rem >= addr_size; ix++, offset += addr_size,
1411 rem -= addr_size) {
1412 if ( (tvb_memcpy(tvb, addr, offset, addr_size))
1413 == NULL)
1414 break;
1416 str = str_handler((const guint8 *)addr);
1417 proto_tree_add_string_format(val_tree,
1418 hf_ldp_tlv_addrl_addr, tvb, offset, addr_size, str,
1419 "Address %u: %s", ix, str);
1421 if (rem)
1422 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem, "Error processing TLV: Extra data at end of address list");
1425 /* Dissect Path Vector TLV */
1427 static void
1428 dissect_tlv_path_vector(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1430 proto_tree *ti, *val_tree;
1431 guint8 ix;
1432 guint32 addr;
1434 ti=proto_tree_add_text(tree, tvb, offset, rem, "LSR IDs");
1435 val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
1437 for(ix=1; rem >= 4; ix++, offset += 4, rem -= 4) {
1438 addr = tvb_get_ipv4(tvb, offset);
1439 proto_tree_add_ipv4_format(val_tree,
1440 hf_ldp_tlv_pv_lsrid, tvb, offset, 4,
1441 addr, "LSR Id %u: %s", ix,
1442 ip_to_str((guint8 *)&addr));
1444 if (rem)
1445 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem, "Error processing TLV: Extra data at end of path vector");
1448 /* Dissect ATM Label TLV */
1450 static void
1451 dissect_tlv_atm_label(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1453 proto_tree *ti, *val_tree;
1455 if (rem != 4){
1456 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem, "Error processing ATM Label TLV: length is %d, should be 4", rem);
1457 return;
1459 ti=proto_tree_add_text(tree, tvb, offset, rem, "ATM Label");
1460 val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
1462 proto_tree_add_item(val_tree, hf_ldp_tlv_atm_label_vbits, tvb, offset, 1, ENC_BIG_ENDIAN);
1464 proto_tree_add_item(val_tree, hf_ldp_tlv_atm_label_vpi, tvb, offset, 2, ENC_BIG_ENDIAN);
1466 proto_tree_add_item(val_tree, hf_ldp_tlv_atm_label_vci, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1469 /* Dissect FRAME RELAY Label TLV */
1471 static void
1472 dissect_tlv_frame_label(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1474 proto_tree *ti, *val_tree;
1475 guint8 len;
1477 if (rem != 4){
1478 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1479 "Error processing Frame Relay Label TLV: length is %d, should be 4",
1480 rem);
1481 return;
1483 ti=proto_tree_add_text(tree, tvb, offset, rem, "Frame Relay Label");
1484 val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
1486 len=(guint8)(tvb_get_ntohs(tvb, offset)>>7) & 0x03;
1487 proto_tree_add_uint_format_value(val_tree, hf_ldp_tlv_fr_label_len, tvb, offset, 2, len,
1488 "%s (%u)", val_to_str_const(len, tlv_fr_len_vals, "Unknown Length"), len);
1490 proto_tree_add_item(val_tree,
1491 hf_ldp_tlv_fr_label_dlci, tvb, offset+1, 3, ENC_BIG_ENDIAN);
1494 /* Dissect STATUS TLV */
1496 static void
1497 dissect_tlv_status(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1499 proto_tree *ti, *val_tree;
1500 guint32 data;
1502 if (rem != 10){
1503 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1504 "Error processing Status TLV: length is %d, should be 10",
1505 rem);
1506 return;
1509 ti=proto_tree_add_text(tree, tvb, offset, rem, "Status");
1510 val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
1512 proto_tree_add_item(val_tree, hf_ldp_tlv_status_ebit, tvb, offset, 1, ENC_BIG_ENDIAN);
1513 proto_tree_add_item(val_tree, hf_ldp_tlv_status_fbit, tvb, offset, 1, ENC_BIG_ENDIAN);
1515 data=tvb_get_ntohl(tvb, offset)&0x3FFFFFFF;
1516 proto_tree_add_uint_format_value(val_tree, hf_ldp_tlv_status_data, tvb, offset, 4,
1517 data, "%s (0x%X)", val_to_str_const(data, tlv_status_data, "Unknown Status Data"), data);
1519 proto_tree_add_item(val_tree, hf_ldp_tlv_status_msg_id, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1520 proto_tree_add_item(val_tree, hf_ldp_tlv_status_msg_type, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1523 /* Dissect Returned PDU TLV */
1525 static void
1526 dissect_tlv_returned_pdu(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1528 proto_tree *ti, *val_tree;
1530 if (rem < 10){
1531 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1532 "Error processing Returned PDU TLV: length is %d, should be >= 10",
1533 rem);
1534 return;
1536 ti=proto_tree_add_text(tree, tvb, offset, rem, "Returned PDU");
1537 val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
1539 proto_tree_add_item(val_tree, hf_ldp_tlv_returned_version, tvb, offset, 2, ENC_BIG_ENDIAN);
1540 proto_tree_add_item(val_tree, hf_ldp_tlv_returned_pdu_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1541 proto_tree_add_item(val_tree, hf_ldp_tlv_returned_lsr, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1542 proto_tree_add_item(val_tree, hf_ldp_tlv_returned_ls_id, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1543 offset += 10;
1544 rem -= 10;
1546 if ( rem > 0 ) {
1547 /*XXX - dissect returned pdu data*/
1548 proto_tree_add_text(val_tree, tvb, offset, rem, "Returned PDU Data");
1552 /* Dissect Returned MESSAGE TLV */
1554 static void
1555 dissect_tlv_returned_message(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1557 proto_tree *ti, *val_tree;
1558 guint16 type;
1560 if (rem < 4) {
1561 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1562 "Error processing Returned Message TLV: length is %d, should be >= 4",
1563 rem);
1564 return;
1566 ti=proto_tree_add_text(tree, tvb, offset, rem, "Returned Message");
1567 val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
1569 proto_tree_add_item(val_tree, hf_ldp_tlv_returned_msg_ubit, tvb, offset, 1, ENC_BIG_ENDIAN);
1571 type=tvb_get_ntohs(tvb, offset)&0x7FFF;
1572 /*chk for vendor-private*/
1573 if (type>=LDP_VENDOR_PRIVATE_START && type<=LDP_VENDOR_PRIVATE_END){
1574 proto_tree_add_uint_format(val_tree, hf_ldp_tlv_returned_msg_type, tvb, offset, 2,
1575 type, "Message Type: Vendor Private (0x%X)", type);
1576 /*chk for experimental*/
1577 } else if (type>=LDP_EXPERIMENTAL_MESSAGE_START && type<=LDP_EXPERIMENTAL_MESSAGE_END){
1578 proto_tree_add_uint_format(val_tree, hf_ldp_tlv_returned_msg_type, tvb, offset, 2,
1579 type, "Message Type: Experimental (0x%X)", type);
1580 } else {
1581 proto_tree_add_uint_format(val_tree, hf_ldp_tlv_returned_msg_type, tvb, offset, 2,
1582 type, "Message Type: %s (0x%X)", val_to_str_const(type, ldp_message_types,"Unknown Message Type"), type);
1585 proto_tree_add_item(val_tree, hf_ldp_tlv_returned_msg_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1586 offset += 4;
1587 rem -= 4;
1589 if ( rem >= 4 ) { /*have msg_id*/
1590 proto_tree_add_item(val_tree, hf_ldp_tlv_returned_msg_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1591 offset += 4;
1592 rem -= 4;
1595 if ( rem > 0 ) {
1596 /*XXX - dissect returned msg parameters*/
1597 proto_tree_add_text(val_tree, tvb, offset, rem, "Returned Message Parameters");
1601 /* Dissect the common hello params */
1603 static void
1604 #if 0
1605 dissect_tlv_common_hello_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1606 #else
1607 dissect_tlv_common_hello_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree)
1608 #endif
1610 #if 0
1611 proto_tree *ti;
1612 #endif
1613 proto_tree *val_tree;
1614 proto_item *gtsm_flag_item;
1615 guint16 gtsm_flag_buffer;
1616 #if 0
1617 ti = proto_tree_add_item(tree, hf_ldp_tlv_value, tvb, offset, rem, ENC_NA);
1618 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
1619 #else
1620 val_tree=tree;
1621 #endif
1622 proto_tree_add_item(val_tree, hf_ldp_tlv_val_hold, tvb, offset, 2, ENC_BIG_ENDIAN);
1623 proto_tree_add_item(val_tree, hf_ldp_tlv_val_target, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
1624 proto_tree_add_item(val_tree, hf_ldp_tlv_val_request, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
1625 gtsm_flag_item = proto_tree_add_item(val_tree, hf_ldp_tlv_val_gtsm_flag, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
1627 gtsm_flag_buffer = tvb_get_bits16(tvb, ((offset+2)*8), 16, ENC_BIG_ENDIAN);
1629 if ( gtsm_flag_buffer & 0x2000 ) {
1630 if ( gtsm_flag_buffer & 0x8000 ) {
1631 expert_add_info(pinfo, gtsm_flag_item, &ei_ldp_dtsm_and_target);
1632 } else {
1633 expert_add_info(pinfo, gtsm_flag_item, &ei_ldp_gtsm_supported);
1635 } else {
1636 if ( gtsm_flag_buffer & 0x8000 ) {
1637 expert_add_info(pinfo, gtsm_flag_item, &ei_ldp_gtsm_not_supported_basic_discovery);
1638 } else {
1639 expert_add_info(pinfo, gtsm_flag_item, &ei_ldp_gtsm_not_supported);
1643 proto_tree_add_item(val_tree, hf_ldp_tlv_val_res, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
1646 /* Dissect MAC TLV */
1648 static void
1649 dissect_tlv_mac(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1651 proto_tree *ti, *val_tree;
1652 guint8 ix;
1654 ti = proto_tree_add_text(tree, tvb, offset, rem, "MAC addresses");
1655 val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
1657 for(ix=1; rem >= 6; ix++, offset += 6, rem -= 6) {
1658 proto_tree_add_item(val_tree, hf_ldp_tlv_mac, tvb, offset, 6, ENC_NA);
1660 if (rem)
1661 proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem, "Error processing TLV: Extra data at end of path vector");
1666 /* Dissect the common session params */
1668 static void
1669 dissect_tlv_common_session_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1671 proto_tree *ti, *val_tree;
1673 if ( rem != 14) { /*length of Comm Sess Parms tlv*/
1674 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem, "Error processing Common Session Parameters TLV: length is %d, should be 14", rem);
1675 return;
1677 ti = proto_tree_add_text(tree, tvb, offset, rem, "Parameters");
1678 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
1680 /*Protocol Version*/
1681 proto_tree_add_item(val_tree, hf_ldp_tlv_sess_ver, tvb,offset, 2, ENC_BIG_ENDIAN);
1683 /*KeepAlive Time*/
1684 proto_tree_add_item(val_tree, hf_ldp_tlv_sess_ka, tvb,offset + 2, 2, ENC_BIG_ENDIAN);
1686 /*A bit*/
1687 proto_tree_add_item(val_tree, hf_ldp_tlv_sess_advbit,tvb, offset + 4, 1, ENC_BIG_ENDIAN);
1689 /*D bit*/
1690 proto_tree_add_item(val_tree, hf_ldp_tlv_sess_ldetbit,tvb, offset + 4, 1, ENC_BIG_ENDIAN);
1692 /*Path Vector Limit*/
1693 proto_tree_add_item(val_tree, hf_ldp_tlv_sess_pvlim,tvb, offset + 5, 1, ENC_BIG_ENDIAN);
1695 /*Max PDU Length*/
1696 proto_tree_add_item(val_tree, hf_ldp_tlv_sess_mxpdu,tvb, offset + 6, 2, ENC_BIG_ENDIAN);
1698 /*Rx LSR*/
1699 proto_tree_add_item(val_tree, hf_ldp_tlv_sess_rxlsr,tvb, offset + 8, 4, ENC_BIG_ENDIAN);
1701 /*Rx LS*/
1702 proto_tree_add_item(val_tree, hf_ldp_tlv_sess_rxls,tvb, offset + 12, 2, ENC_BIG_ENDIAN);
1705 /* Dissect the atm session params */
1707 static void
1708 dissect_tlv_atm_session_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1710 proto_tree *ti, *val_tree, *lbl_tree;
1711 guint8 numlr, ix;
1713 if (rem < 4) {
1714 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1715 "Error processing ATM Parameters TLV: length is %d, should be >= 4",
1716 rem);
1717 return;
1720 ti = proto_tree_add_text(tree, tvb, offset, rem,"ATM Parameters");
1721 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
1723 proto_tree_add_item(val_tree, hf_ldp_tlv_sess_atm_merge,tvb, offset, 1, ENC_BIG_ENDIAN);
1725 /*get the number of label ranges*/
1726 numlr=(tvb_get_guint8(tvb, offset)>>2) & 0x0F;
1727 proto_tree_add_uint_format(val_tree, hf_ldp_tlv_sess_atm_lr,
1728 tvb, offset, 1, numlr, "Number of Label Range components: %u",
1729 numlr);
1731 proto_tree_add_item(val_tree, hf_ldp_tlv_sess_atm_dir,tvb, offset, 1, ENC_BIG_ENDIAN);
1733 /*move into range components*/
1734 offset += 4;
1735 rem -= 4;
1736 ti = proto_tree_add_text(val_tree, tvb, offset, rem,"ATM Label Range Components");
1738 if (numlr) {
1739 val_tree=proto_item_add_subtree(ti,ett_ldp_tlv_val);
1740 if ( ! val_tree ) return;
1742 /*now dissect ranges*/
1743 for(ix=1; numlr > 0 && rem >= 8; ix++, rem-=8, numlr--) {
1744 ti=proto_tree_add_text(val_tree, tvb, offset, 8,
1745 "ATM Label Range Component %u", ix);
1746 lbl_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
1748 proto_tree_add_item(lbl_tree,
1749 hf_ldp_tlv_sess_atm_minvpi,
1750 tvb, offset, 2,
1751 ENC_BIG_ENDIAN);
1752 proto_tree_add_item(lbl_tree,
1753 hf_ldp_tlv_sess_atm_maxvpi,
1754 tvb, (offset+4), 2, ENC_BIG_ENDIAN);
1756 proto_tree_add_item(lbl_tree,
1757 hf_ldp_tlv_sess_atm_minvci,
1758 tvb, offset+2, 2, ENC_BIG_ENDIAN);
1759 proto_tree_add_item(lbl_tree,
1760 hf_ldp_tlv_sess_atm_maxvci,
1761 tvb, offset+6, 2, ENC_BIG_ENDIAN);
1763 offset += 8;
1765 if( rem || numlr)
1766 proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1767 "Error processing TLV: Extra data at end of TLV");
1770 /* Dissect the frame relay session params */
1772 static void
1773 dissect_tlv_frame_relay_session_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1775 proto_tree *ti, *val_tree, *lbl_tree;
1776 guint8 numlr, ix, len;
1778 if(rem < 4) {
1779 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1780 "Error processing Frame Relay Parameters TLV: length is %d, should be >= 4",
1781 rem);
1782 return;
1785 ti = proto_tree_add_text(tree, tvb, offset, rem, "Frame Relay Parameters");
1786 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
1788 proto_tree_add_item(val_tree, hf_ldp_tlv_sess_fr_merge,
1789 tvb, offset, 1, ENC_BIG_ENDIAN);
1791 /*get the number of label ranges*/
1792 numlr=(tvb_get_guint8(tvb, offset)>>2) & 0x0F;
1793 proto_tree_add_uint_format(val_tree, hf_ldp_tlv_sess_fr_lr,
1794 tvb, offset, 1, numlr, "Number of Label Range components: %u",
1795 numlr);
1797 proto_tree_add_item(val_tree, hf_ldp_tlv_sess_fr_dir,
1798 tvb, offset, 1, ENC_BIG_ENDIAN);
1800 /*move into range components*/
1801 offset += 4;
1802 rem -= 4;
1803 ti = proto_tree_add_text(val_tree, tvb, offset, rem,
1804 "Frame Relay Label Range Components");
1806 if(numlr) {
1807 val_tree=proto_item_add_subtree(ti,
1808 ett_ldp_tlv_val);
1809 if( ! val_tree ) return;
1812 /*now dissect ranges*/
1813 for(ix=1; numlr > 0 && rem >= 8; ix++, rem-=8, numlr--) {
1814 ti=proto_tree_add_text(val_tree, tvb, offset, 8,
1815 "Frame Relay Label Range Component %u", ix);
1816 lbl_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
1818 len=(guint8)(tvb_get_ntohs(tvb, offset)>>7) & 0x03;
1819 proto_tree_add_uint_format_value(lbl_tree, hf_ldp_tlv_sess_fr_len, tvb, offset, 2, len,
1820 "%s (%u)", val_to_str_const(len, tlv_fr_len_vals, "Unknown Length"), len);
1822 proto_tree_add_item(lbl_tree, hf_ldp_tlv_sess_fr_mindlci, tvb, offset+1, 3, ENC_BIG_ENDIAN);
1823 proto_tree_add_item(lbl_tree, hf_ldp_tlv_sess_fr_maxdlci, tvb, offset+5, 3, ENC_BIG_ENDIAN);
1825 offset += 8;
1828 if( rem || numlr)
1829 proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1830 "Error processing TLV: Extra data at end of TLV");
1833 /* Dissect the Fault Tolerant (FT) Session TLV */
1835 static void
1836 dissect_tlv_ft_session(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1838 proto_tree *ti, *val_tree, *flags_tree;
1839 guint16 flags;
1841 if(rem != 12){
1842 /* error, length must be 12 bytes */
1843 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1844 "Error processing FT Session TLV: length is %d, should be 12",
1845 rem);
1846 return;
1849 ti = proto_tree_add_text(tree, tvb, offset, rem, "FT Session Parameters");
1850 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
1852 /* Flags */
1853 ti = proto_tree_add_item(val_tree, hf_ldp_tlv_ft_sess_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
1854 flags_tree = proto_item_add_subtree(ti, ett_ldp_tlv_ft_flags);
1856 flags = tvb_get_ntohs(tvb, offset);
1857 proto_item_append_text(ti, " (%s%s)", (flags & 0x8000) ? "R, " : "",
1858 val_to_str_const(flags & 0xF, tlv_ft_flags, "Invalid"));
1859 proto_tree_add_item(flags_tree, hf_ldp_tlv_ft_sess_flag_r, tvb, offset, 2, ENC_BIG_ENDIAN);
1860 proto_tree_add_item(flags_tree, hf_ldp_tlv_ft_sess_flag_res, tvb, offset, 2, ENC_BIG_ENDIAN);
1861 proto_tree_add_item(flags_tree, hf_ldp_tlv_ft_sess_flag_s, tvb, offset, 2, ENC_BIG_ENDIAN);
1862 proto_tree_add_item(flags_tree, hf_ldp_tlv_ft_sess_flag_a, tvb, offset, 2, ENC_BIG_ENDIAN);
1863 proto_tree_add_item(flags_tree, hf_ldp_tlv_ft_sess_flag_c, tvb, offset, 2, ENC_BIG_ENDIAN);
1864 proto_tree_add_item(flags_tree, hf_ldp_tlv_ft_sess_flag_l, tvb, offset, 2, ENC_BIG_ENDIAN);
1866 /* Reserved */
1867 proto_tree_add_item(val_tree, hf_ldp_tlv_ft_sess_res, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
1869 /* FT Reconnect TO */
1870 proto_tree_add_item(val_tree, hf_ldp_tlv_ft_sess_reconn_to, tvb, offset + 4,
1871 4, ENC_BIG_ENDIAN);
1873 /* Recovery Time */
1874 proto_tree_add_item(val_tree, hf_ldp_tlv_ft_sess_recovery_time, tvb, offset + 8,
1875 4, ENC_BIG_ENDIAN);
1878 static void
1879 dissect_tlv_lspid(tvbuff_t *tvb, packet_info *pinfo, guint offset,proto_tree *tree, int rem)
1881 proto_tree *ti, *val_tree;
1883 if(rem != 8) {
1884 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1885 "Error processing LSP ID TLV: length is %d, should be 8",
1886 rem);
1887 return;
1890 ti = proto_tree_add_text(tree, tvb, offset, rem, "LSP ID");
1891 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
1893 proto_tree_add_item(val_tree, hf_ldp_tlv_lspid_act_flg,
1894 tvb, offset, 2, ENC_BIG_ENDIAN);
1895 offset += 2;
1896 proto_tree_add_item(val_tree, hf_ldp_tlv_lspid_cr_lsp,
1897 tvb, offset, 2, ENC_BIG_ENDIAN);
1898 offset += 2;
1899 proto_tree_add_item(val_tree, hf_ldp_tlv_lspid_ldpid,
1900 tvb, offset, 4, ENC_BIG_ENDIAN);
1903 static void
1904 dissect_tlv_er_hop_ipv4(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1906 proto_tree *ti, *val_tree;
1908 if(rem != 8) {
1909 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1910 "Error processing ER HOP IPv4 TLV: length is %d, should be 8",
1911 rem);
1912 return;
1914 ti = proto_tree_add_text(tree, tvb, offset, rem, "ER HOP IPv4");
1915 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
1917 if(val_tree != NULL) {
1918 proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_loose,
1919 tvb, offset, 3, ENC_BIG_ENDIAN);
1920 offset += 3;
1921 proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_prelen,
1922 tvb, offset, 1, ENC_BIG_ENDIAN);
1923 offset ++;
1924 proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_prefix4,
1925 tvb, offset, 4, ENC_BIG_ENDIAN);
1929 static void
1930 dissect_tlv_er_hop_ipv6(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1932 proto_tree *ti, *val_tree;
1934 if(rem != 20) {
1935 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1936 "Error processing ER HOP IPv6 TLV: length is %d, should be 20",
1937 rem);
1938 return;
1940 ti = proto_tree_add_text(tree, tvb, offset, rem, "ER HOP IPv6");
1941 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
1943 if(val_tree != NULL) {
1944 proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_loose,
1945 tvb, offset, 3, ENC_BIG_ENDIAN);
1946 offset += 3;
1947 proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_prelen,
1948 tvb, offset, 1, ENC_BIG_ENDIAN);
1949 offset ++;
1950 proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_prefix6,
1951 tvb, offset, 16, ENC_NA);
1955 static void
1956 dissect_tlv_er_hop_as(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1958 proto_tree *ti, *val_tree;
1960 if(rem != 4) {
1961 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1962 "Error processing ER HOP AS TLV: length is %d, should be 4",
1963 rem);
1964 return;
1966 ti = proto_tree_add_text(tree, tvb, offset, rem, "ER HOP AS");
1967 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
1969 if(val_tree != NULL) {
1970 proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_loose,
1971 tvb, offset, 2, ENC_BIG_ENDIAN);
1972 offset += 2;
1973 proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_as,
1974 tvb, offset, 2, ENC_BIG_ENDIAN);
1978 static void
1979 dissect_tlv_er_hop_lspid(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
1981 proto_tree *ti, *val_tree;
1983 if(rem != 8) {
1984 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1985 "Error processing ER HOP LSPID TLV: length is %d, should be 8",
1986 rem);
1987 return;
1989 ti = proto_tree_add_text(tree, tvb, offset, rem, "ER HOP LSPID");
1990 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
1992 if(val_tree != NULL) {
1993 proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_loose,
1994 tvb, offset, 2, ENC_BIG_ENDIAN);
1995 offset += 2;
1996 proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_cr_lsp,
1997 tvb, offset, 2, ENC_BIG_ENDIAN);
1998 offset += 2;
1999 proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_ldpid,
2000 tvb, offset, 4, ENC_BIG_ENDIAN);
2004 static void
2005 dissect_tlv_traffic(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2007 proto_tree *ti, *val_tree;
2008 guint8 val_8;
2009 float val_f;
2010 proto_item *pi;
2012 if(rem != 24) {
2013 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2014 "Error processing Traffic Parameters TLV: length is %d, should be 24",
2015 rem);
2016 return;
2018 ti = proto_tree_add_text(tree, tvb, offset, rem, "Traffic parameters");
2019 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
2021 if(val_tree != NULL) {
2022 /* flags */
2023 proto_tree_add_item(val_tree, hf_ldp_tlv_flags_reserv, tvb, offset, 1, ENC_BIG_ENDIAN);
2024 proto_tree_add_item(val_tree, hf_ldp_tlv_flags_weight, tvb, offset, 1, ENC_BIG_ENDIAN);
2025 proto_tree_add_item(val_tree, hf_ldp_tlv_flags_ebs, tvb, offset, 1, ENC_BIG_ENDIAN);
2026 proto_tree_add_item(val_tree, hf_ldp_tlv_flags_cbs, tvb, offset, 1, ENC_BIG_ENDIAN);
2027 proto_tree_add_item(val_tree, hf_ldp_tlv_flags_cdr, tvb, offset, 1, ENC_BIG_ENDIAN);
2028 proto_tree_add_item(val_tree, hf_ldp_tlv_flags_pbs, tvb, offset, 1, ENC_BIG_ENDIAN);
2029 proto_tree_add_item(val_tree, hf_ldp_tlv_flags_pdr, tvb, offset, 1, ENC_BIG_ENDIAN);
2031 offset ++;
2032 /* frequency */
2033 proto_tree_add_item(val_tree, hf_ldp_tlv_frequency, tvb, offset, 1, ENC_BIG_ENDIAN);
2034 offset ++;
2036 /* reserver byte */
2037 offset ++;
2039 /* weight */
2040 pi = proto_tree_add_item(val_tree, hf_ldp_tlv_weight, tvb, offset, 1, ENC_BIG_ENDIAN);
2041 val_8 = tvb_get_guint8(tvb, offset);
2042 if (val_8 == 0)
2043 proto_item_set_text(pi, "Weight: Not applicable");
2044 offset ++;
2046 /* PDR */
2047 val_f = tvb_get_ntohieee_float (tvb, offset);
2048 proto_tree_add_double_format_value(val_tree, hf_ldp_tlv_pdr, tvb, offset,
2049 4, val_f, "%.10g Bps", val_f);
2050 offset += 4;
2051 /* PBS */
2052 val_f = tvb_get_ntohieee_float (tvb, offset);
2053 proto_tree_add_double_format_value(val_tree, hf_ldp_tlv_pbs, tvb, offset,
2054 4, val_f, "%.10g Bytes", val_f);
2055 offset += 4;
2057 /* CDR */
2058 val_f = tvb_get_ntohieee_float (tvb, offset);
2059 proto_tree_add_double_format_value(val_tree, hf_ldp_tlv_cdr, tvb, offset,
2060 4, val_f, "%.10g Bps", val_f);
2061 offset += 4;
2063 /* CBS */
2064 val_f = tvb_get_ntohieee_float (tvb, offset);
2065 proto_tree_add_double_format_value(val_tree, hf_ldp_tlv_cbs, tvb, offset,
2066 4, val_f, "%.10g Bytes", val_f);
2067 offset += 4;
2069 /* EBS */
2070 val_f = tvb_get_ntohieee_float (tvb, offset);
2071 proto_tree_add_double_format_value(val_tree, hf_ldp_tlv_ebs, tvb, offset,
2072 4, val_f, "%.10g Bytes", val_f);
2077 static void
2078 dissect_tlv_route_pinning(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2080 proto_tree *ti, *val_tree;
2082 if(rem != 4) {
2083 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2084 "Error processing Route Pinning TLV: length is %d, should be 4",
2085 rem);
2086 return;
2088 ti = proto_tree_add_text(tree, tvb, offset, rem, "Route Pinning");
2089 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
2091 if(val_tree != NULL) {
2092 proto_tree_add_item(val_tree, hf_ldp_tlv_route_pinning,
2093 tvb, offset, 4, ENC_BIG_ENDIAN);
2098 static void
2099 dissect_tlv_resource_class(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2101 proto_tree *ti, *val_tree;
2103 if(rem != 4) {
2104 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2105 "Error processing Resource Class TLV: length is %d, should be 4",
2106 rem);
2107 return;
2109 ti = proto_tree_add_text(tree, tvb, offset, rem, "Resource Class");
2110 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
2112 if(val_tree != NULL) {
2113 proto_tree_add_item(val_tree, hf_ldp_tlv_resource_class,
2114 tvb, offset, 4, ENC_BIG_ENDIAN);
2119 static void
2120 dissect_tlv_preemption(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2122 proto_tree *ti, *val_tree;
2124 if(rem != 4) {
2125 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2126 "Error processing Preemption TLV: length is %d, should be 4",
2127 rem);
2128 return;
2130 ti = proto_tree_add_text(tree, tvb, offset, rem, "Preemption");
2131 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
2133 if(val_tree != NULL) {
2134 proto_tree_add_item(val_tree, hf_ldp_tlv_set_prio,
2135 tvb, offset, 1, ENC_BIG_ENDIAN);
2136 offset += 1;
2137 proto_tree_add_item(val_tree, hf_ldp_tlv_hold_prio,
2138 tvb, offset, 1, ENC_BIG_ENDIAN);
2143 static void
2144 dissect_tlv_diffserv(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2146 static int *hfindexes[] = {
2147 &hf_ldp_tlv_diffserv_map,
2148 &hf_ldp_tlv_diffserv_map_exp,
2149 &hf_ldp_tlv_diffserv_phbid,
2150 &hf_ldp_tlv_diffserv_phbid_dscp,
2151 &hf_ldp_tlv_diffserv_phbid_code,
2152 &hf_ldp_tlv_diffserv_phbid_bit14,
2153 &hf_ldp_tlv_diffserv_phbid_bit15
2155 static gint *etts[] = {
2156 &ett_ldp_diffserv_map,
2157 &ett_ldp_diffserv_map_phbid
2159 int type, mapnb, count;
2161 if (rem < 4) {
2162 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2163 "Error processing Diff-Serv TLV: length is %d, should be >= 4", rem);
2164 return;
2166 proto_tree_add_uint(tree, hf_ldp_tlv_diffserv_type, tvb, offset, 1,
2167 type = tvb_get_guint8(tvb, offset));
2168 type = (type >> 7) + 1;
2169 if (type == 1) {
2170 /* E-LSP */
2171 offset += 3;
2172 proto_tree_add_uint(tree, hf_ldp_tlv_diffserv_mapnb, tvb, offset,
2173 1, mapnb = tvb_get_guint8(tvb, offset) & 15);
2174 offset += 1;
2175 for (count = 0; count < mapnb; count++) {
2176 dissect_diffserv_mpls_common(tvb, tree, type, offset, hfindexes, etts);
2177 offset += 4;
2180 else if (type == 2) {
2181 /* L-LSP */
2182 dissect_diffserv_mpls_common(tvb, tree, type, offset + 2, hfindexes, etts);
2187 static int
2188 dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem);
2190 static void
2191 dissect_tlv_er(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2193 proto_tree *ti, *val_tree;
2194 int len;
2196 ti = proto_tree_add_text(tree, tvb, offset, rem, "Explicit route");
2197 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
2199 if(val_tree != NULL) {
2200 while (rem > 0) {
2201 len = dissect_tlv (tvb, pinfo, offset, val_tree, rem);
2202 offset += len;
2203 rem -= len;
2209 static void
2210 dissect_tlv_pw_status(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem);
2212 static void
2213 dissect_tlv_pw_grouping(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem);
2215 /* Dissect Upstream Label Assignment Capability TLV */
2216 static void
2217 dissect_tlv_upstrm_lbl_ass_cap(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2219 proto_tree *ti, *val_tree;
2221 if ( rem != 1)
2223 proto_item* inv_length;
2224 inv_length = proto_tree_add_item(tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
2225 expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
2226 return;
2229 /*State bit*/
2230 ti = proto_tree_add_text(tree, tvb, offset, rem, "State Bit");
2231 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
2232 proto_tree_add_item(val_tree, hf_ldp_tlv_upstr_sbit, tvb,offset, 1, ENC_BIG_ENDIAN);
2234 /*Dissect Upstream Assigned Label Request TLV*/
2235 static void
2236 dissect_tlv_upstrm_ass_lbl_req(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2238 if ( rem != 4)
2240 proto_item* inv_length;
2241 inv_length = proto_tree_add_item(tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
2242 expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
2243 return;
2246 /*Reserved Bits*/
2247 proto_tree_add_item(tree, hf_ldp_tlv_upstr_lbl_req_resvbit, tvb,offset, 4, ENC_BIG_ENDIAN);
2250 /*Dissect Upstream Assigned Label TLV*/
2251 static void
2252 dissect_tlv_upstrm_ass_lbl(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2254 proto_tree *ti, *val_tree;
2256 if ( rem != 8)
2258 proto_item* inv_length;
2259 inv_length = proto_tree_add_item(tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
2260 expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
2261 return;
2263 /*Value Field starts here*/
2264 ti = proto_tree_add_text(tree, tvb, offset, rem, "Upstream-Assigned Label");
2266 /*Reserved bits*/
2267 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
2268 proto_tree_add_item(val_tree, hf_ldp_tlv_upstr_lbl_resvbit, tvb,offset, 4, ENC_BIG_ENDIAN);
2270 /*The Upstream Label*/
2271 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
2272 proto_tree_add_item(val_tree, hf_ldp_tlv_upstr_ass_lbl, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
2274 /*Dissect IPv4 Interface ID TLV*/
2275 static void
2276 dissect_tlv_ipv4_interface_id(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2278 proto_tree *ti, *val_tree, *sub_tree = NULL;
2279 ti = proto_tree_add_text(tree, tvb, offset, rem, "IPv4 Interface ID");
2280 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
2282 /*Dissect IPv4 Next/Previous Hop Address*/
2283 proto_tree_add_item(val_tree, hf_ldp_tlv_ipv4_intID_hop_addr, tvb,offset, 4, ENC_BIG_ENDIAN);
2285 /*Dissect Logical Interface ID*/
2286 proto_tree_add_item(val_tree, hf_ldp_tlv_logical_intID, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
2288 ti = proto_tree_add_text(val_tree, tvb, offset + 8, rem, "Sub TLV");
2289 sub_tree = proto_item_add_subtree(ti, ett_ldp_sub_tlv);
2291 if(rem != 20 && rem != 24 && rem != 28 && rem != 29)
2293 /*rem = 20 >> Length of IP Multicast Tunnel TLV
2294 rem = 29 >> Length of LDP P2MP LSV TLV
2295 rem = 24 >> Length of RSVP-TE P2MP LSP TLV
2296 rem = 28 >> Length of MPLS Context Label TLV*/
2298 proto_item* inv_length;
2299 inv_length = proto_tree_add_item(val_tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
2300 expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
2302 else
2304 rem = rem - 8;
2305 dissect_tlv(tvb, pinfo, offset + 8, sub_tree, rem);
2308 /*Dissect IP Multicast Tunnel TLV*/
2309 static void
2310 dissect_tlv_ip_multicast_tunnel(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem)
2312 proto_tree *ti, *val_tree;
2314 ti = proto_tree_add_text(tree, tvb, offset, rem, "IP Multicast Label");
2315 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
2316 proto_tree_add_item(val_tree, hf_ldp_tlv_ip_multicast_srcaddr, tvb,offset, 4, ENC_BIG_ENDIAN);
2317 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
2318 proto_tree_add_item(val_tree, hf_ldp_tlv_ip_multicast_mltcstaddr, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
2321 static void
2322 dissect_tlv_mpls_context_lbl(tvbuff_t *tvb,packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2324 proto_tree *ti, *val_tree;
2326 proto_tree_add_item(tree, hf_ldp_tlv_ip_mpls_context_srcaddr, tvb,offset, 4, ENC_BIG_ENDIAN);
2327 ti = proto_tree_add_text(tree, tvb, offset, rem, "MPLS Context Label");
2328 val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
2329 dissect_tlv(tvb, pinfo, offset + 4, val_tree, rem);
2332 static void
2333 dissect_tlv_ldp_p2mp_lsp(tvbuff_t *tvb, guint offset, proto_tree *tree)
2335 guint16 addr_length = tvb_get_bits16(tvb, ((offset+3)*8), 8, ENC_BIG_ENDIAN);
2336 guint16 opcode_length = tvb_get_bits16(tvb, ((offset + 4 + addr_length)*8), 16, ENC_BIG_ENDIAN);
2338 proto_tree_add_item(tree, hf_ldp_tlv_ldp_p2mp_lsptype, tvb,offset, 1, ENC_BIG_ENDIAN);
2339 proto_tree_add_item(tree, hf_ldp_tlv_ldp_p2mp_addrfam, tvb,offset + 1, 2, ENC_BIG_ENDIAN);
2340 proto_tree_add_item(tree, hf_ldp_tlv_ldp_p2mp_addrlen, tvb,offset + 3, 1, ENC_BIG_ENDIAN);
2341 proto_tree_add_item(tree, hf_ldp_tlv_ldp_p2mp_rtnodeaddr, tvb,offset + 4, addr_length, ENC_BIG_ENDIAN);
2342 proto_tree_add_item(tree, hf_ldp_tlv_ldp_p2mp_oplength, tvb,offset + 4 + addr_length, 2, ENC_BIG_ENDIAN);
2343 proto_tree_add_item(tree, hf_ldp_tlv_ldp_p2mp_opvalue, tvb,offset + 4 + addr_length + 2, opcode_length, ENC_NA);
2346 static void
2347 dissect_tlv_rsvp_te_p2mp_lsp(tvbuff_t *tvb, guint offset, proto_tree *tree)
2350 proto_tree_add_item(tree, hf_ldp_tlv_rsvp_te_p2mp_id, tvb,offset, 4, ENC_BIG_ENDIAN);
2351 proto_tree_add_item(tree, hf_ldp_tlv_must_be_zero, tvb,offset + 4, 2, ENC_BIG_ENDIAN);
2352 proto_tree_add_item(tree, hf_ldp_tlv_tunnel_id, tvb,offset + 6, 2, ENC_BIG_ENDIAN);
2353 proto_tree_add_item(tree, hf_ldp_tlv_ext_tunnel_id, tvb,offset + 8, 4, ENC_BIG_ENDIAN);
2356 /* Dissect a TLV and return the number of bytes consumed ... */
2358 static int
2359 dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2361 guint16 type, typebak;
2362 int length;
2364 length=tvb_reported_length_remaining(tvb, offset);
2365 rem=MIN(rem, length);
2367 if( rem < 4 ) {/*chk for minimum header*/
2368 if (tree) {
2369 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2370 "Error processing TLV: length is %d, should be >= 4",
2371 rem);
2373 return rem;
2375 type = tvb_get_ntohs(tvb, offset) & 0x3FFF;
2377 length = tvb_get_ntohs(tvb, offset + 2);
2378 rem -= 4; /*do not count header*/
2379 length = MIN(length, rem); /* Don't go haywire if a problem ... */
2381 if (tree) {
2382 proto_tree *ti = NULL, *tlv_tree;
2383 /*chk for vendor-private*/
2384 if(type>=TLV_VENDOR_PRIVATE_START && type<=TLV_VENDOR_PRIVATE_END){
2385 typebak=type; /*keep type*/
2386 type=TLV_VENDOR_PRIVATE_START;
2387 ti = proto_tree_add_text(tree, tvb, offset, length + 4, "Vendor Private TLV");
2388 /*chk for experimental*/
2389 } else if(type>=TLV_EXPERIMENTAL_START && type<=TLV_EXPERIMENTAL_END){
2390 typebak=type; /*keep type*/
2391 type=TLV_EXPERIMENTAL_START;
2392 ti = proto_tree_add_text(tree, tvb, offset, length + 4, "Experimental TLV");
2393 } else {
2394 typebak=0;
2395 ti = proto_tree_add_text(tree, tvb, offset, length + 4, "%s",
2396 val_to_str(type, tlv_type_names, "Unknown TLV type (0x%04X)"));
2399 tlv_tree = proto_item_add_subtree(ti, ett_ldp_tlv);
2401 proto_tree_add_item(tlv_tree, hf_ldp_tlv_unknown, tvb, offset, 1, ENC_BIG_ENDIAN);
2403 switch (type) {
2404 case TLV_VENDOR_PRIVATE_START:
2405 proto_tree_add_uint_format_value(tlv_tree, hf_ldp_tlv_type, tvb, offset, 2,
2406 typebak, "Vendor Private (0x%X)", typebak);
2407 break;
2408 case TLV_EXPERIMENTAL_START:
2409 proto_tree_add_uint_format_value(tlv_tree, hf_ldp_tlv_type, tvb, offset, 2,
2410 typebak, "Experimental (0x%X)", typebak);
2411 break;
2412 default:
2413 proto_tree_add_uint_format(tlv_tree, hf_ldp_tlv_type, tvb, offset, 2,
2414 type, "TLV Type: %s (0x%X)", val_to_str_const(type, tlv_type_names, "Unknown TLV type"), type );
2417 proto_tree_add_item(tlv_tree, hf_ldp_tlv_len, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
2419 switch (type) {
2421 case TLV_FEC:
2422 dissect_tlv_fec(tvb, pinfo, offset + 4, tlv_tree, length);
2423 break;
2425 case TLV_ADDRESS_LIST:
2426 dissect_tlv_address_list(tvb, pinfo, offset + 4, tlv_tree, length);
2427 break;
2429 case TLV_HOP_COUNT:
2430 if( length != 1 ) /*error, only one byte*/
2431 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4,length,
2432 "Error processing Hop Count TLV: length is %d, should be 1",
2433 length);
2434 else
2435 proto_tree_add_item(tlv_tree, hf_ldp_tlv_hc_value, tvb,offset + 4, length, ENC_BIG_ENDIAN);
2436 break;
2438 case TLV_PATH_VECTOR:
2439 dissect_tlv_path_vector(tvb, pinfo, offset + 4, tlv_tree, length);
2440 break;
2442 case TLV_GENERIC_LABEL:
2443 if( length != 4 ) /*error, need only label*/
2444 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2445 "Error processing Generic Label TLV: length is %d, should be 4",
2446 length);
2447 else {
2448 guint32 label=tvb_get_ntohl(tvb, offset+4) & 0x000FFFFF;
2450 proto_tree_add_uint(tlv_tree, hf_ldp_tlv_generic_label,
2451 tvb, offset+4, length, label);
2453 break;
2455 case TLV_ATM_LABEL:
2456 dissect_tlv_atm_label(tvb, pinfo, offset + 4, tlv_tree, length);
2457 break;
2459 case TLV_FRAME_LABEL:
2460 dissect_tlv_frame_label(tvb, pinfo, offset + 4, tlv_tree, length);
2461 break;
2463 case TLV_FT_PROTECTION:
2464 if( length != 4 ) /* Length must be 4 bytes */
2465 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2466 "Error processing FT Protection TLV: length is %d, should be 4",
2467 length);
2468 else
2469 proto_tree_add_item(tlv_tree, hf_ldp_tlv_ft_protect_sequence_num, tvb,
2470 offset + 4,length, ENC_BIG_ENDIAN);
2471 break;
2473 case TLV_STATUS:
2474 dissect_tlv_status(tvb, pinfo, offset + 4, tlv_tree, length);
2475 break;
2477 case TLV_EXTENDED_STATUS:
2478 if( length != 4 ) /*error, need only status_code(guint32)*/
2479 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2480 "Error processing Extended Status TLV: length is %d, should be 4",
2481 length);
2482 else {
2483 proto_tree_add_item(tlv_tree, hf_ldp_tlv_extstatus_data, tvb, offset + 4, length, ENC_BIG_ENDIAN);
2485 break;
2487 case TLV_RETURNED_PDU:
2488 dissect_tlv_returned_pdu(tvb, pinfo, offset + 4, tlv_tree, length);
2489 break;
2491 case TLV_RETURNED_MESSAGE:
2492 dissect_tlv_returned_message(tvb, pinfo, offset + 4, tlv_tree, length);
2493 break;
2495 case TLV_COMMON_HELLO_PARMS:
2496 #if 0
2497 dissect_tlv_common_hello_parms(tvb, pinfo, offset + 4, tlv_tree, length);
2498 #else
2499 dissect_tlv_common_hello_parms(tvb, pinfo, offset + 4, tlv_tree);
2500 #endif
2501 break;
2503 case TLV_IPV4_TRANSPORT_ADDRESS:
2504 if( length != 4 ) /*error, need only ipv4*/
2505 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2506 "Error processing IPv4 Transport Address TLV: length is %d, should be 4",
2507 length);
2508 else {
2509 proto_tree_add_item(tlv_tree, hf_ldp_tlv_ipv4_taddr, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
2511 break;
2513 case TLV_CONFIGURATION_SEQNO:
2514 if( length != 4 ) /*error, need only seq_num(guint32)*/
2515 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2516 "Error processing Configuration Sequence Number TLV: length is %d, should be 4",
2517 length);
2518 else {
2519 proto_tree_add_item(tlv_tree, hf_ldp_tlv_config_seqno, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
2521 break;
2523 case TLV_IPV6_TRANSPORT_ADDRESS:
2524 if( length != 16 ) /*error, need only ipv6*/
2525 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2526 "Error processing IPv6 Transport Address TLV: length is %d, should be 16",
2527 length);
2528 else {
2529 proto_tree_add_item(tlv_tree, hf_ldp_tlv_ipv6_taddr, tvb, offset + 4, 16, ENC_NA);
2531 break;
2533 case TLV_MAC: /* draft-lasserre-vkompella-ppvpn-vpls-02.txt */
2534 dissect_tlv_mac(tvb, pinfo, offset + 4, tlv_tree, length);
2535 break;
2537 case TLV_COMMON_SESSION_PARMS:
2538 dissect_tlv_common_session_parms(tvb, pinfo, offset + 4, tlv_tree, length);
2539 break;
2541 case TLV_ATM_SESSION_PARMS:
2542 dissect_tlv_atm_session_parms(tvb, pinfo, offset + 4, tlv_tree, length);
2543 break;
2545 case TLV_FRAME_RELAY_SESSION_PARMS:
2546 dissect_tlv_frame_relay_session_parms(tvb, pinfo, offset + 4, tlv_tree, length);
2547 break;
2549 case TLV_FT_SESSION:
2550 /* Used in RFC3478 LDP Graceful Restart */
2551 dissect_tlv_ft_session(tvb, pinfo, offset + 4, tlv_tree, length);
2552 break;
2554 case TLV_FT_ACK:
2555 if( length != 4 ) /* Length must be 4 bytes */
2556 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2557 "Error processing FT ACK TLV: length is %d, should be 4",
2558 length);
2559 else
2560 proto_tree_add_item(tlv_tree, hf_ldp_tlv_ft_ack_sequence_num, tvb,
2561 offset + 4,length, ENC_BIG_ENDIAN);
2562 break;
2564 case TLV_FT_CORK:
2565 if( length != 0 ) /* Length must be 0 bytes */
2566 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2567 "Error processing FT Cork TLV: length is %d, should be 0",
2568 length);
2569 break;
2571 case TLV_LABEL_REQUEST_MESSAGE_ID:
2572 if( length != 4 ) /*error, need only one msgid*/
2573 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2574 "Error processing Label Request Message ID TLV: length is %d, should be 4",
2575 length);
2576 else
2577 proto_tree_add_item(tlv_tree, hf_ldp_tlv_lbl_req_msg_id, tvb,offset + 4,length, ENC_BIG_ENDIAN);
2578 break;
2580 case TLV_LSPID:
2581 dissect_tlv_lspid(tvb, pinfo, offset + 4, tlv_tree, length);
2582 break;
2584 case TLV_ER:
2585 dissect_tlv_er(tvb, pinfo, offset + 4, tlv_tree, length);
2586 break;
2588 case TLV_ER_HOP_IPV4:
2589 dissect_tlv_er_hop_ipv4(tvb, pinfo, offset + 4, tlv_tree, length);
2590 break;
2592 case TLV_ER_HOP_IPV6:
2593 dissect_tlv_er_hop_ipv6(tvb, pinfo, offset +4, tlv_tree, length);
2594 break;
2596 case TLV_ER_HOP_AS:
2597 dissect_tlv_er_hop_as(tvb, pinfo, offset + 4, tlv_tree, length);
2598 break;
2600 case TLV_ER_HOP_LSPID:
2601 dissect_tlv_er_hop_lspid(tvb, pinfo, offset +4, tlv_tree, length);
2602 break;
2604 case TLV_TRAFFIC_PARAM:
2605 dissect_tlv_traffic(tvb, pinfo, offset +4, tlv_tree, length);
2606 break;
2608 case TLV_PREEMPTION:
2609 dissect_tlv_preemption(tvb, pinfo, offset +4, tlv_tree, length);
2610 break;
2612 case TLV_RESOURCE_CLASS:
2613 dissect_tlv_resource_class(tvb, pinfo, offset +4, tlv_tree, length);
2614 break;
2616 case TLV_ROUTE_PINNING:
2617 dissect_tlv_route_pinning(tvb, pinfo, offset +4, tlv_tree, length);
2618 break;
2620 case TLV_DIFFSERV:
2621 dissect_tlv_diffserv(tvb, pinfo, offset +4, tlv_tree, length);
2622 break;
2624 case TLV_VENDOR_PRIVATE_START:
2625 if( length < 4 ) /*error, at least Vendor ID*/
2626 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2627 "Error processing Vendor Private Start TLV: length is %d, should be >= 4",
2628 length);
2629 else {
2630 proto_tree_add_item(tlv_tree, hf_ldp_tlv_vendor_id, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
2631 if( length > 4 ) /*have data*/
2632 proto_tree_add_text(tlv_tree, tvb, offset + 8, length-4,"Data");
2634 break;
2636 case TLV_EXPERIMENTAL_START:
2637 if( length < 4 ) /*error, at least Experiment ID*/
2638 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2639 "Error processing Experimental Start TLV: length is %d, should be >= 4",
2640 length);
2641 else {
2642 proto_tree_add_item(tlv_tree, hf_ldp_tlv_experiment_id, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
2643 if( length > 4 ) /*have data*/
2644 proto_tree_add_text(tlv_tree, tvb, offset + 8, length-4,"Data");
2646 break;
2648 case TLV_PW_STATUS:
2650 /* Ref: RFC 4447 and 4446*/
2651 dissect_tlv_pw_status(tvb, pinfo, offset +4, tlv_tree, length);
2652 break;
2654 case TLV_PW_INTERFACE_PARAMETERS:
2656 /* Ref: RFC 4447 */
2657 static int *interface_params_header_fields[] = {
2658 &hf_ldp_tlv_intparam_length ,
2659 &hf_ldp_tlv_intparam_mtu ,
2660 &hf_ldp_tlv_intparam_tdmbps ,
2661 &hf_ldp_tlv_intparam_id ,
2662 &hf_ldp_tlv_intparam_maxcatmcells ,
2663 &hf_ldp_tlv_intparam_desc ,
2664 &hf_ldp_tlv_intparam_cepbytes ,
2665 &hf_ldp_tlv_intparam_cepopt_ais ,
2666 &hf_ldp_tlv_intparam_cepopt_une ,
2667 &hf_ldp_tlv_intparam_cepopt_rtp ,
2668 &hf_ldp_tlv_intparam_cepopt_ebm ,
2669 &hf_ldp_tlv_intparam_cepopt_mah ,
2670 &hf_ldp_tlv_intparam_cepopt_res ,
2671 &hf_ldp_tlv_intparam_cepopt_ceptype ,
2672 &hf_ldp_tlv_intparam_cepopt_t3 ,
2673 &hf_ldp_tlv_intparam_cepopt_e3 ,
2674 &hf_ldp_tlv_intparam_vlanid ,
2675 &hf_ldp_tlv_intparam_dlcilen ,
2676 &hf_ldp_tlv_intparam_fcslen ,
2677 &hf_ldp_tlv_intparam_tdmopt_r ,
2678 &hf_ldp_tlv_intparam_tdmopt_d ,
2679 &hf_ldp_tlv_intparam_tdmopt_f ,
2680 &hf_ldp_tlv_intparam_tdmopt_res1 ,
2681 &hf_ldp_tlv_intparam_tdmopt_pt ,
2682 &hf_ldp_tlv_intparam_tdmopt_res2 ,
2683 &hf_ldp_tlv_intparam_tdmopt_freq ,
2684 &hf_ldp_tlv_intparam_tdmopt_ssrc ,
2685 &hf_ldp_tlv_intparam_vccv_cctype_cw ,
2686 &hf_ldp_tlv_intparam_vccv_cctype_mplsra ,
2687 &hf_ldp_tlv_intparam_vccv_cctype_ttl1 ,
2688 &hf_ldp_tlv_intparam_vccv_cvtype_icmpping ,
2689 &hf_ldp_tlv_intparam_vccv_cvtype_lspping ,
2690 &hf_ldp_tlv_intparam_vccv_cvtype_bfd,
2691 &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd2,
2692 &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd3,
2693 &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd4,
2694 &hf_ldp_tlv_fec_vc_intparam_flowlabel_t,
2695 &hf_ldp_tlv_fec_vc_intparam_flowlabel_r,
2696 &hf_ldp_tlv_fec_vc_intparam_flowlabel_res
2698 int vc_len = length;
2699 offset += 4;
2700 while ( (vc_len > 1) && (rem > 1) ) { /* enough to include id and length */
2701 int intparam_len = tvb_get_guint8(tvb, offset+1);
2702 if (intparam_len < 2){ /* At least Type and Len, protect against len = 0 */
2703 proto_tree_add_expert(tlv_tree, pinfo, &ei_ldp_malformed_interface_parameter, tvb, offset +1, 1);
2704 break;
2707 if ( (vc_len -intparam_len) <0 && (rem -intparam_len) <0 ) { /* error condition */
2708 proto_tree_add_expert(tlv_tree, pinfo, &ei_ldp_malformed_data, tvb, offset +2, MIN(vc_len,rem));
2709 break;
2711 dissect_subtlv_interface_parameters(tvb, offset, tlv_tree, intparam_len, interface_params_header_fields);
2713 rem -= intparam_len;
2714 vc_len -= intparam_len;
2715 offset += intparam_len;
2717 break;
2719 case TLV_PW_GROUPING:
2721 /* Ref: RFC 4447 */
2722 dissect_tlv_pw_grouping(tvb, offset +4, tlv_tree, length);
2723 break;
2725 case TLV_UPSTRM_LBL_ASS_CAP:
2726 dissect_tlv_upstrm_lbl_ass_cap(tvb, pinfo, offset + 4, tlv_tree, length);
2727 break;
2728 case TLV_UPSTRM_ASS_LBL_REQ:
2729 dissect_tlv_upstrm_ass_lbl_req(tvb, pinfo, offset + 4, tlv_tree, length);
2730 break;
2731 case TLV_UPSTRM_ASS_LBL:
2732 dissect_tlv_upstrm_ass_lbl(tvb, pinfo, offset + 4, tlv_tree, length);
2733 break;
2734 case TLV_IPV4_INTERFACE_ID:
2735 dissect_tlv_ipv4_interface_id(tvb, pinfo, offset + 4, tlv_tree, length);
2736 /*dissect_tlv_ipv4_interface_id(tvb, offset + 4, tlv_tree, length);*/
2737 break;
2738 case TLV_IP_MULTICAST_TUNNEL:
2739 dissect_tlv_ip_multicast_tunnel(tvb, offset + 4, tlv_tree, rem);
2740 break;
2741 case TLV_MPLS_CONTEXT_LBL:
2742 dissect_tlv_mpls_context_lbl(tvb, pinfo, offset + 4, tlv_tree, rem);
2743 break;
2744 case TLV_LDP_P2MP_LSP:
2745 dissect_tlv_ldp_p2mp_lsp(tvb, offset + 4, tlv_tree);
2746 break;
2747 case TLV_RSVP_TE_P2MP_LSP:
2748 dissect_tlv_rsvp_te_p2mp_lsp(tvb, offset + 4, tlv_tree);
2749 break;
2750 default:
2751 proto_tree_add_item(tlv_tree, hf_ldp_tlv_value, tvb, offset + 4, length, ENC_NA);
2752 break;
2756 return length + 4; /* Length of the value field + header */
2760 /* Dissect a Message and return the number of bytes consumed ... */
2762 static int
2763 dissect_msg(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree)
2765 guint16 type, typebak;
2766 guint8 extra=0;
2767 int length, rem, ao=0, co;
2768 proto_tree *msg_tree = NULL;
2770 rem=tvb_reported_length_remaining(tvb, offset);
2772 if( rem < 8 ) {/*chk for minimum header = type + length + msg_id*/
2773 col_append_str(pinfo->cinfo, COL_INFO, "Bad Message");
2774 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_inv_length, tvb, offset, rem,
2775 "Error processing Message: length is %d, should be >= 8",
2776 rem);
2777 return rem;
2779 type = tvb_get_ntohs(tvb, offset) & 0x7FFF;
2781 /*chk for vendor-private*/
2782 if(type>=LDP_VENDOR_PRIVATE_START && type<=LDP_VENDOR_PRIVATE_END){
2783 typebak=type; /*keep type*/
2784 type=LDP_VENDOR_PRIVATE_START;
2785 extra=4;
2786 /*chk for experimental*/
2787 } else if(type>=LDP_EXPERIMENTAL_MESSAGE_START && type<=LDP_EXPERIMENTAL_MESSAGE_END){
2788 typebak=type; /*keep type*/
2789 type=LDP_EXPERIMENTAL_MESSAGE_START;
2790 extra=4;
2791 } else {
2792 typebak=0;
2793 extra=0;
2796 if( (length = tvb_get_ntohs(tvb, offset + 2)) < (4+extra) ) {/*not enough data for type*/
2797 col_append_str(pinfo->cinfo, COL_INFO, "Bad Message Length ");
2798 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_inv_length, tvb, offset, rem,
2799 "Error processing Message Length: length is %d, should be >= %u",
2800 length, 4+extra);
2801 return rem;
2803 rem -= 4;
2804 length = MIN(length, rem); /* Don't go haywire if a problem ... */
2806 switch (type) {
2807 case LDP_VENDOR_PRIVATE_START:
2808 col_append_fstr(pinfo->cinfo, COL_INFO, "Vendor-Private Message (0x%04X) ", typebak);
2809 break;
2810 case LDP_EXPERIMENTAL_MESSAGE_START:
2811 col_append_fstr(pinfo->cinfo, COL_INFO, "Experimental Message (0x%04X) ", typebak);
2812 break;
2813 default:
2814 col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(type, ldp_message_types, "Unknown Message (0x%04X)"));
2817 if (tree) {
2818 proto_tree *ti = NULL;
2820 switch (type) {
2821 case LDP_VENDOR_PRIVATE_START:
2822 ti = proto_tree_add_text(tree, tvb, offset, length + 4, "Vendor-Private Message");
2823 break;
2824 case LDP_EXPERIMENTAL_MESSAGE_START:
2825 ti = proto_tree_add_text(tree, tvb, offset, length + 4, "Experimental Message");
2826 break;
2827 default:
2828 ti = proto_tree_add_text(tree, tvb, offset, length + 4, "%s",
2829 val_to_str(type, ldp_message_types, "Unknown Message type (0x%04X)"));
2832 msg_tree = proto_item_add_subtree(ti, ett_ldp_message);
2834 proto_tree_add_item(msg_tree, hf_ldp_msg_ubit, tvb, offset, 1, ENC_BIG_ENDIAN);
2836 switch (type) {
2837 case LDP_VENDOR_PRIVATE_START:
2838 proto_tree_add_uint_format_value(msg_tree, hf_ldp_msg_type, tvb, offset, 2,
2839 typebak, "Vendor Private (0x%X)", typebak);
2840 break;
2841 case LDP_EXPERIMENTAL_MESSAGE_START:
2842 proto_tree_add_uint_format_value(msg_tree, hf_ldp_msg_type, tvb, offset, 2,
2843 typebak, "Experimental (0x%X)", typebak);
2844 break;
2845 default:
2846 proto_tree_add_uint_format(msg_tree, hf_ldp_msg_type, tvb, offset, 2,
2847 type, "Message Type: %s (0x%X)", val_to_str_const(type, ldp_message_types,"Unknown Message Type"), type);
2850 proto_tree_add_item(msg_tree, hf_ldp_msg_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
2851 proto_tree_add_item(msg_tree, hf_ldp_msg_id, tvb, offset+4, 4, ENC_BIG_ENDIAN);
2852 if(extra){
2853 proto_tree_add_item(msg_tree, (type == LDP_VENDOR_PRIVATE_START) ?
2854 hf_ldp_msg_vendor_id : hf_ldp_msg_experiment_id, tvb, offset+8,
2855 extra, ENC_BIG_ENDIAN);
2859 offset += (8+extra);
2860 length -= (4+extra);
2862 if (tree) {
2863 while ( (length-ao) > 0 ) {
2864 co = dissect_tlv(tvb, pinfo, offset, msg_tree, length-ao);
2865 offset += co;
2866 ao += co;
2870 return length+8+extra;
2873 /* Dissect a PDU */
2874 static void
2875 dissect_ldp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2877 int offset = 0, co;
2878 int rem, length;
2879 proto_tree *ti=NULL, *pdu_tree = NULL;
2881 col_set_str(pinfo->cinfo, COL_PROTOCOL, "LDP");
2883 col_clear(pinfo->cinfo, COL_INFO);
2885 if (tree) {
2886 ti=proto_tree_add_item(tree, proto_ldp, tvb, 0, -1, ENC_NA);
2887 pdu_tree = proto_item_add_subtree(ti, ett_ldp);
2889 proto_tree_add_item(pdu_tree, hf_ldp_version, tvb, offset, 2, ENC_BIG_ENDIAN);
2892 length = tvb_get_ntohs(tvb, offset+2);
2893 if (tree) {
2894 proto_tree_add_uint(pdu_tree, hf_ldp_pdu_len, tvb, offset+2, 2, length);
2897 length += 4; /* add the version and type sizes */
2898 rem = tvb_reported_length_remaining(tvb, offset);
2899 if (length < rem)
2900 tvb_set_reported_length(tvb, length);
2902 if (tree) {
2903 proto_tree_add_item(pdu_tree, hf_ldp_lsr, tvb, offset+4, 4, ENC_BIG_ENDIAN);
2904 proto_tree_add_item(pdu_tree, hf_ldp_ls_id, tvb, offset+8, 2, ENC_BIG_ENDIAN);
2906 offset += 10;
2908 while ( tvb_reported_length_remaining(tvb, offset) > 0 ) {
2909 co = dissect_msg(tvb, offset, pinfo, pdu_tree);
2910 offset += co;
2914 static int
2915 dissect_ldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2918 * Make sure the first PDU has a version number of 1;
2919 * if not, reject this, so we don't get confused by
2920 * packets that happen to be going to or from the
2921 * LDP port but that aren't LDP packets.
2923 if (tvb_length(tvb) < 2) {
2925 * Not enough information to tell.
2927 return 0;
2929 if (tvb_get_ntohs(tvb, 0) != 1) {
2931 * Not version 1.
2933 return 0;
2936 dissect_ldp_pdu(tvb, pinfo, tree);
2939 * XXX - return minimum of this and the length of the PDU?
2941 return tvb_length(tvb);
2944 static void
2945 dissect_tlv_pw_status(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
2947 proto_tree *ti, *val_tree;
2949 if(rem != 4){
2950 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2951 "Error processing PW Status TLV: length is %d, should be 4",
2952 rem);
2953 return;
2956 ti = proto_tree_add_item(tree, hf_ldp_tlv_pw_status_data, tvb, offset, rem, ENC_BIG_ENDIAN);
2958 val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
2959 /* Display the bits 0-4 if they are set or not set */
2960 proto_tree_add_item(val_tree, hf_ldp_tlv_pw_not_forwarding, tvb, offset, 4, ENC_BIG_ENDIAN);
2961 proto_tree_add_item(val_tree, hf_ldp_tlv_pw_lac_ingress_recv_fault, tvb, offset, 4, ENC_BIG_ENDIAN);
2962 proto_tree_add_item(val_tree, hf_ldp_tlv_pw_lac_egress_recv_fault, tvb, offset, 4, ENC_BIG_ENDIAN);
2963 proto_tree_add_item(val_tree, hf_ldp_tlv_pw_psn_pw_ingress_recv_fault, tvb, offset, 4, ENC_BIG_ENDIAN);
2964 proto_tree_add_item(val_tree, hf_ldp_tlv_pw_psn_pw_egress_recv_fault, tvb, offset, 4, ENC_BIG_ENDIAN);
2967 static void
2968 dissect_tlv_pw_grouping(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem _U_)
2970 proto_tree_add_item(tree,hf_ldp_tlv_pw_grouping_value,tvb,offset,4,ENC_BIG_ENDIAN);
2973 static void
2974 dissect_subtlv_interface_parameters(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem, int *interface_parameters_hf[])
2976 #if 0
2977 static int interface_parameters_hf[] = {
2978 0 - hf_ldp_tlv_fec_vc_intparam_length ,
2979 1 - hf_ldp_tlv_fec_vc_intparam_mtu ,
2980 2 - hf_ldp_tlv_fec_vc_intparam_tdmbps ,
2981 3 - hf_ldp_tlv_fec_vc_intparam_id ,
2982 4 - hf_ldp_tlv_fec_vc_intparam_maxcatmcells ,
2983 5 - hf_ldp_tlv_fec_vc_intparam_desc ,
2984 6 - hf_ldp_tlv_fec_vc_intparam_cepbytes ,
2985 7 - hf_ldp_tlv_fec_vc_intparam_cepopt_ais ,
2986 8 - hf_ldp_tlv_fec_vc_intparam_cepopt_une ,
2987 9 - hf_ldp_tlv_fec_vc_intparam_cepopt_rtp ,
2988 10 - hf_ldp_tlv_fec_vc_intparam_cepopt_ebm ,
2989 11 - hf_ldp_tlv_fec_vc_intparam_cepopt_mah ,
2990 12 - hf_ldp_tlv_fec_vc_intparam_cepopt_res ,
2991 13 - hf_ldp_tlv_fec_vc_intparam_cepopt_ceptype ,
2992 14 - hf_ldp_tlv_fec_vc_intparam_cepopt_t3 ,
2993 15 - hf_ldp_tlv_fec_vc_intparam_cepopt_e3 ,
2994 16 - hf_ldp_tlv_fec_vc_intparam_vlanid ,
2995 17 - hf_ldp_tlv_fec_vc_intparam_dlcilen ,
2996 18 - hf_ldp_tlv_fec_vc_intparam_fcslen ,
2997 19 - hf_ldp_tlv_fec_vc_intparam_tdmopt_r ,
2998 20 - hf_ldp_tlv_fec_vc_intparam_tdmopt_d ,
2999 21 - hf_ldp_tlv_fec_vc_intparam_tdmopt_f ,
3000 22 - hf_ldp_tlv_fec_vc_intparam_tdmopt_res1 ,
3001 23 - hf_ldp_tlv_fec_vc_intparam_tdmopt_pt ,
3002 24 - hf_ldp_tlv_fec_vc_intparam_tdmopt_res2 ,
3003 25 - hf_ldp_tlv_fec_vc_intparam_tdmopt_freq ,
3004 26 - hf_ldp_tlv_fec_vc_intparam_tdmopt_ssrc ,
3005 27 - hf_ldp_tlv_fec_vc_intparam_vccv_cctype_cw ,
3006 28 - hf_ldp_tlv_fec_vc_intparam_vccv_cctype_mplsra ,
3007 29 - hf_ldp_tlv_fec_vc_intparam_vccv_cctype_ttl1 ,
3008 30 - hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_icmpping ,
3009 31 - hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_lspping ,
3010 32 - hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd1,
3011 33 - hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd2,
3012 34 - hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd3,
3013 35 - hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd4,
3014 36 - hf_ldp_tlv_fec_vc_intparam_flowlabel_t,
3015 37 - hf_ldp_tlv_fec_vc_intparam_flowlabel_r,
3016 38 - hf_ldp_tlv_fec_vc_intparam_flowlabel_res
3018 #endif
3019 proto_tree *ti = proto_tree_add_text(tree, tvb, offset, rem, "Interface Parameter");
3020 proto_tree *cepopt_tree=NULL, *vccvtype_tree=NULL;
3021 proto_tree *vcintparam_tree = proto_item_add_subtree(ti, ett_ldp_fec_vc_interfaceparam);
3023 guint8 intparam_len = rem;
3024 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[3],tvb,offset,1,ENC_BIG_ENDIAN);
3025 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[0],tvb, offset+1, 1, ENC_BIG_ENDIAN);
3027 switch (tvb_get_guint8(tvb, offset)) {
3028 case FEC_VC_INTERFACEPARAM_MTU:
3029 proto_item_append_text(ti,": MTU %u", tvb_get_ntohs(tvb,offset+2));
3030 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[1],tvb, offset+2, 2, ENC_BIG_ENDIAN);
3031 break;
3032 case FEC_VC_INTERFACEPARAM_TDMBPS:
3033 /* draft-ietf-pwe3-control-protocol-06.txt */
3034 proto_item_append_text(ti,": BPS %u", tvb_get_ntohl(tvb,offset+2));
3035 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[2],tvb, offset+2, 4, ENC_BIG_ENDIAN);
3036 break;
3037 case FEC_VC_INTERFACEPARAM_MAXCATMCELLS:
3038 proto_item_append_text(ti,": Max ATM Concat Cells %u", tvb_get_ntohs(tvb,offset+2));
3039 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[4],tvb, offset+2, 2, ENC_BIG_ENDIAN);
3040 break;
3041 case FEC_VC_INTERFACEPARAM_DESCRIPTION:
3042 proto_item_append_text(ti,": Description");
3043 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[5],tvb, offset+2, (intparam_len -2), ENC_ASCII|ENC_NA);
3044 break;
3045 case FEC_VC_INTERFACEPARAM_CEPBYTES:
3046 proto_item_append_text(ti,": CEP/TDM Payload Bytes %u", tvb_get_ntohs(tvb,offset+2));
3047 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[6],tvb, offset+2, 2, ENC_BIG_ENDIAN);
3048 break;
3049 case FEC_VC_INTERFACEPARAM_CEPOPTIONS:
3050 /* draft-ietf-pwe3-sonet-05.txt */
3051 proto_item_append_text(ti,": CEP Options");
3052 ti = proto_tree_add_text(vcintparam_tree, tvb, offset + 2, 2, "CEP Options");
3053 cepopt_tree = proto_item_add_subtree(ti, ett_ldp_fec_vc_interfaceparam_cepopt);
3054 proto_tree_add_item(cepopt_tree, *interface_parameters_hf[7], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3055 proto_tree_add_item(cepopt_tree, *interface_parameters_hf[8], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3056 proto_tree_add_item(cepopt_tree, *interface_parameters_hf[9], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3057 proto_tree_add_item(cepopt_tree, *interface_parameters_hf[10], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3058 proto_tree_add_item(cepopt_tree, *interface_parameters_hf[11], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3059 proto_tree_add_item(cepopt_tree, *interface_parameters_hf[12], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3060 proto_tree_add_item(cepopt_tree, *interface_parameters_hf[13], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3061 proto_tree_add_item(cepopt_tree, *interface_parameters_hf[14], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3062 proto_tree_add_item(cepopt_tree, *interface_parameters_hf[15], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3063 break;
3064 case FEC_VC_INTERFACEPARAM_VLANID:
3065 proto_item_append_text(ti,": VLAN Id %u", tvb_get_ntohs(tvb,offset+2));
3066 proto_tree_add_item(vcintparam_tree, *interface_parameters_hf[16], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3067 break;
3068 case FEC_VC_INTERFACEPARAM_FRDLCILEN:
3069 proto_item_append_text(ti,": DLCI Length %u", tvb_get_ntohs(tvb,offset+2));
3070 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[17], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3071 break;
3072 case FEC_VC_INTERFACEPARAM_FRAGIND:
3073 /* draft-ietf-pwe3-fragmentation-05.txt */
3074 proto_item_append_text(ti,": Fragmentation");
3075 break;
3076 case FEC_VC_INTERFACEPARAM_FCSRETENT:
3077 /* draft-ietf-pwe3-fcs-retention-02.txt */
3078 proto_item_append_text(ti,": FCS retention, FCS Length %u Bytes", tvb_get_ntohs(tvb,offset+2));
3079 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[18], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3080 break;
3081 case FEC_VC_INTERFACEPARAM_TDMOPTION:
3082 /* draft-vainshtein-pwe3-tdm-control-protocol-extensions */
3083 proto_item_append_text(ti,": TDM Options");
3084 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[19], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3085 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[20], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3086 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[21], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3087 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[22], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3088 if (intparam_len >= 8){
3089 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[23], tvb, offset+4, 1, ENC_BIG_ENDIAN);
3090 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[24], tvb, offset+5, 1, ENC_BIG_ENDIAN);
3091 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[25], tvb, offset+6, 2, ENC_BIG_ENDIAN);
3093 if (intparam_len >= 12){
3094 proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[26], tvb, offset+8, 4, ENC_BIG_ENDIAN);
3096 break;
3097 case FEC_VC_INTERFACEPARAM_VCCV:
3098 /* draft-ietf-pwe3-vccv-03.txt */
3099 proto_item_append_text(ti,": VCCV");
3100 ti = proto_tree_add_text(vcintparam_tree, tvb, offset + 2, 1, "CC Type");
3101 vccvtype_tree = proto_item_add_subtree(ti, ett_ldp_fec_vc_interfaceparam_vccvtype);
3102 proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[27], tvb, offset+2, 1, ENC_BIG_ENDIAN);
3103 proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[28], tvb, offset+2, 1, ENC_BIG_ENDIAN);
3104 proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[29], tvb, offset+2, 1, ENC_BIG_ENDIAN);
3105 ti = proto_tree_add_text(vcintparam_tree, tvb, offset + 3, 1, "CV Type");
3106 vccvtype_tree = proto_item_add_subtree(ti, ett_ldp_fec_vc_interfaceparam_vccvtype);
3107 proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[30], tvb, offset+3, 1, ENC_BIG_ENDIAN);
3108 proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[31], tvb, offset+3, 1, ENC_BIG_ENDIAN);
3109 proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[32], tvb, offset+3, 1, ENC_BIG_ENDIAN);
3110 break;
3111 case FEC_VC_INTERFACEPARAM_FLOWLABEL:
3112 proto_item_append_text(ti,": Flow Label for Pseudowire");
3113 proto_tree_add_item(vcintparam_tree, *interface_parameters_hf[36], tvb, offset+2, 1, ENC_BIG_ENDIAN);
3114 proto_tree_add_item(vcintparam_tree, *interface_parameters_hf[37], tvb, offset+2, 1, ENC_BIG_ENDIAN);
3115 proto_tree_add_item(vcintparam_tree, *interface_parameters_hf[38], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3116 break;
3117 default: /* unknown */
3118 proto_item_append_text(ti," unknown");
3119 proto_tree_add_text(vcintparam_tree,tvb, offset+2, (intparam_len -2), "Unknown data");
3121 break;
3125 static void
3126 dissect_genpwid_fec_aai_type2_parameter(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
3128 proto_tree *ti = proto_tree_add_text(tree, tvb, offset, rem, "AAI");
3129 proto_tree *aai_param_tree = proto_item_add_subtree(ti, ett_ldp_gen_aai_type2);
3130 /* check if the remaining length is 12 bytes or not... */
3131 if ( rem != 12)
3133 proto_tree_add_expert_format(tree, pinfo, &ei_ldp_inv_length, tvb, offset, rem,
3134 "Error processing AAI Parameter: length is %d, should be 12 bytes for Type 2.",
3135 rem);
3136 return;
3140 proto_tree_add_item(aai_param_tree,hf_ldp_tlv_fec_gen_aai_globalid,tvb,offset,4,ENC_BIG_ENDIAN);
3141 proto_tree_add_item(aai_param_tree,hf_ldp_tlv_fec_gen_aai_prefix,tvb, offset+4, 4, ENC_BIG_ENDIAN);
3142 proto_tree_add_item(aai_param_tree,hf_ldp_tlv_fec_gen_aai_ac_id,tvb, offset+4, 4, ENC_BIG_ENDIAN);
3145 static int
3146 dissect_ldp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
3148 volatile gboolean first = TRUE;
3149 volatile int offset = 0;
3150 int length_remaining;
3151 guint16 plen;
3152 int length;
3153 tvbuff_t *volatile next_tvb;
3154 void *pd_save;
3156 while (tvb_reported_length_remaining(tvb, offset) != 0) {
3157 length_remaining = tvb_length_remaining(tvb, offset);
3160 * Make sure the first PDU has a version number of 1;
3161 * if not, reject this, so we don't get confused by
3162 * packets that happen to be going to or from the
3163 * LDP port but that aren't LDP packets.
3165 * XXX - this means we can't handle an LDP PDU of which
3166 * only one byte appears in a TCP segment. If that's
3167 * a problem, we'll either have to completely punt on
3168 * rejecting non-LDP packets, or will have to assume
3169 * that if we have only one byte, it's an LDP packet.
3171 if (first) {
3172 if (length_remaining < 2) {
3174 * Not enough information to tell.
3176 return 0;
3178 if (tvb_get_ntohs(tvb, offset) != 1) {
3180 * Not version 1.
3182 return 0;
3184 first = FALSE;
3188 * Can we do reassembly?
3190 if (ldp_desegment && pinfo->can_desegment) {
3192 * Yes - is the LDP header split across segment
3193 * boundaries?
3195 if (length_remaining < 4) {
3197 * Yes. Tell the TCP dissector where the data for this message
3198 * starts in the data it handed us and that we need "some more
3199 * data." Don't tell it exactly how many bytes we need because
3200 * if/when we ask for even more (after the header) that will
3201 * break reassembly.
3203 pinfo->desegment_offset = offset;
3204 pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
3205 return -((gint32) pinfo->desegment_len);
3210 * Get the length of the rest of the LDP packet.
3211 * XXX - check for a version of 1 first?
3213 plen = tvb_get_ntohs(tvb, offset + 2);
3216 * Can we do reassembly?
3218 if (ldp_desegment && pinfo->can_desegment) {
3220 * Yes - is the LDP packet split across segment
3221 * boundaries?
3223 if (length_remaining < plen + 4) {
3225 * Yes. Tell the TCP dissector where the
3226 * data for this message starts in the data
3227 * it handed us, and how many more bytes we
3228 * need, and return.
3230 pinfo->desegment_offset = offset;
3231 pinfo->desegment_len = (plen + 4) - length_remaining;
3232 return -((gint32) pinfo->desegment_len);
3237 * Construct a tvbuff containing the amount of the payload
3238 * we have available. Make its reported length the
3239 * amount of data in the DNS-over-TCP packet.
3241 * XXX - if reassembly isn't enabled. the subdissector
3242 * will throw a BoundsError exception, rather than a
3243 * ReportedBoundsError exception. We really want
3244 * a tvbuff where the length is "length", the reported
3245 * length is "plen + 4", and the "if the snapshot length
3246 * were infinite" length is the minimum of the
3247 * reported length of the tvbuff handed to us and "plen+4",
3248 * with a new type of exception thrown if the offset is
3249 * within the reported length but beyond that third length,
3250 * with that exception getting the "Unreassembled Packet"
3251 * error.
3253 length = length_remaining;
3254 if (length > plen + 4)
3255 length = plen + 4;
3256 next_tvb = tvb_new_subset(tvb, offset, length, plen + 4);
3259 * Dissect the LDP packet.
3261 * If it gets an error that means there's no point in
3262 * dissecting any more PDUs, rethrow the exception in
3263 * question.
3265 * If it gets any other error, report it and continue, as that
3266 * means that PDU got an error, but that doesn't mean we should
3267 * stop dissecting PDUs within this frame or chunk of reassembled
3268 * data.
3270 pd_save = pinfo->private_data;
3271 TRY {
3272 dissect_ldp_pdu(next_tvb, pinfo, tree);
3274 CATCH_NONFATAL_ERRORS {
3275 /* Restore the private_data structure in case one of the
3276 * called dissectors modified it (and, due to the exception,
3277 * was unable to restore it).
3279 pinfo->private_data = pd_save;
3280 show_exception(tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
3282 ENDTRY;
3285 * Skip the LDP header and the payload.
3287 offset += plen + 4;
3289 return tvb_length(tvb);
3292 /* Register all the bits needed with the filtering engine */
3294 void
3295 proto_register_ldp(void)
3297 static hf_register_info hf[] = {
3298 #if 0
3299 { &hf_ldp_req,
3300 /* Change the following to the type you need */
3301 { "Request", "ldp.req", FT_BOOLEAN, BASE_NONE,
3302 NULL, 0x0, NULL, HFILL }},
3303 #endif
3305 #if 0
3306 { &hf_ldp_rsp,
3307 { "Response", "ldp.rsp", FT_BOOLEAN, BASE_NONE,
3308 NULL, 0x0, NULL, HFILL }},
3309 #endif
3311 { &hf_ldp_version,
3312 { "Version", "ldp.hdr.version", FT_UINT16, BASE_DEC,
3313 NULL, 0x0, "LDP Version Number", HFILL }},
3315 { &hf_ldp_pdu_len,
3316 { "PDU Length", "ldp.hdr.pdu_len", FT_UINT16, BASE_DEC,
3317 NULL, 0x0, "LDP PDU Length", HFILL }},
3319 { &hf_ldp_lsr,
3320 { "LSR ID", "ldp.hdr.ldpid.lsr", FT_IPv4, BASE_NONE,
3321 NULL, 0x0, "LDP Label Space Router ID", HFILL }},
3323 { &hf_ldp_ls_id,
3324 { "Label Space ID", "ldp.hdr.ldpid.lsid", FT_UINT16, BASE_DEC,
3325 NULL, 0, "LDP Label Space ID", HFILL }},
3327 { &hf_ldp_msg_ubit,
3328 { "U bit", "ldp.msg.ubit", FT_BOOLEAN, 8,
3329 TFS(&ldp_message_ubit), 0x80, "Unknown Message Bit", HFILL }},
3331 { &hf_ldp_msg_type,
3332 { "Message Type", "ldp.msg.type", FT_UINT16, BASE_HEX,
3333 VALS(ldp_message_types), 0x7FFF, "LDP message type", HFILL }},
3335 { &hf_ldp_msg_len,
3336 { "Message Length", "ldp.msg.len", FT_UINT16, BASE_DEC,
3337 NULL, 0x0, "LDP Message Length (excluding message type and len)", HFILL }},
3339 { &hf_ldp_msg_id,
3340 { "Message ID", "ldp.msg.id", FT_UINT32, BASE_HEX,
3341 NULL, 0x0, "LDP Message ID", HFILL }},
3343 { &hf_ldp_msg_vendor_id,
3344 { "Vendor ID", "ldp.msg.vendor.id", FT_UINT32, BASE_HEX,
3345 NULL, 0x0, "LDP Vendor-private Message ID", HFILL }},
3347 { &hf_ldp_msg_experiment_id,
3348 { "Experiment ID", "ldp.msg.experiment.id", FT_UINT32, BASE_HEX,
3349 NULL, 0x0, "LDP Experimental Message ID", HFILL }},
3351 { &hf_ldp_tlv_unknown,
3352 { "TLV Unknown bits", "ldp.msg.tlv.unknown", FT_UINT8, BASE_HEX,
3353 VALS(tlv_unknown_vals), 0xC0, "TLV Unknown bits Field", HFILL }},
3355 { &hf_ldp_tlv_type,
3356 { "TLV Type", "ldp.msg.tlv.type", FT_UINT16, BASE_HEX,
3357 VALS(tlv_type_names), 0x3FFF, "TLV Type Field", HFILL }},
3359 { &hf_ldp_tlv_len,
3360 { "TLV Length", "ldp.msg.tlv.len", FT_UINT16, BASE_DEC,
3361 NULL, 0x0, "TLV Length Field", HFILL }},
3363 { &hf_ldp_tlv_value,
3364 { "TLV Value", "ldp.msg.tlv.value", FT_BYTES, BASE_NONE,
3365 NULL, 0x0, "TLV Value Bytes", HFILL }},
3367 { &hf_ldp_tlv_val_hold,
3368 { "Hold Time", "ldp.msg.tlv.hello.hold", FT_UINT16, BASE_DEC,
3369 NULL, 0x0, "Hello Common Parameters Hold Time", HFILL }},
3371 { &hf_ldp_tlv_val_target,
3372 { "Targeted Hello", "ldp.msg.tlv.hello.targeted", FT_BOOLEAN, 16,
3373 TFS(&hello_targeted_vals), 0x8000, "Hello Common Parameters Targeted Bit", HFILL }},
3375 { &hf_ldp_tlv_val_request,
3376 { "Hello Requested", "ldp.msg.tlv.hello.requested", FT_BOOLEAN, 16,
3377 TFS(&hello_requested_vals), 0x4000, "Hello Common Parameters Hello Requested Bit", HFILL }},
3379 { &hf_ldp_tlv_val_gtsm_flag,
3380 { "GTSM Flag", "ldp.msg.tlv.hello.gtsm", FT_BOOLEAN, 16,
3381 TFS(&tfs_set_notset), 0x2000, "Hello Common Parameters GTSM bit", HFILL }},
3383 { &hf_ldp_tlv_val_res,
3384 { "Reserved", "ldp.msg.tlv.hello.res", FT_UINT16, BASE_HEX,
3385 NULL, 0x1FFF, "Hello Common Parameters Reserved Field", HFILL }},
3387 { &hf_ldp_tlv_ipv4_taddr,
3388 { "IPv4 Transport Address", "ldp.msg.tlv.ipv4.taddr", FT_IPv4, BASE_NONE,
3389 NULL, 0x0, NULL, HFILL }},
3391 { &hf_ldp_tlv_config_seqno,
3392 { "Configuration Sequence Number", "ldp.msg.tlv.hello.cnf_seqno", FT_UINT32, BASE_DEC,
3393 NULL, 0x0, "Hello Configuration Sequence Number", HFILL }},
3395 { &hf_ldp_tlv_ipv6_taddr,
3396 { "IPv6 Transport Address", "ldp.msg.tlv.ipv6.taddr", FT_IPv6, BASE_NONE,
3397 NULL, 0x0, NULL, HFILL }},
3399 { &hf_ldp_tlv_fec_wc,
3400 { "FEC Element Type", "ldp.msg.tlv.fec.type", FT_UINT8, BASE_DEC,
3401 VALS(fec_types), 0x0, "Forwarding Equivalence Class Element Types", HFILL }},
3403 { &hf_ldp_tlv_fec_af,
3404 { "FEC Element Address Type", "ldp.msg.tlv.fec.af", FT_UINT16, BASE_DEC,
3405 VALS(afn_vals), 0x0, "Forwarding Equivalence Class Element Address Family", HFILL }},
3407 { &hf_ldp_tlv_fec_len,
3408 { "FEC Element Length", "ldp.msg.tlv.fec.len", FT_UINT8, BASE_DEC,
3409 NULL, 0x0, "Forwarding Equivalence Class Element Length", HFILL }},
3411 { &hf_ldp_tlv_fec_pfval,
3412 { "FEC Element Prefix Value", "ldp.msg.tlv.fec.pfval", FT_STRING, BASE_NONE,
3413 NULL, 0x0, "Forwarding Equivalence Class Element Prefix", HFILL }},
3415 { &hf_ldp_tlv_fec_hoval,
3416 { "FEC Element Host Address Value", "ldp.msg.tlv.fec.hoval", FT_STRING, BASE_NONE,
3417 NULL, 0x0, "Forwarding Equivalence Class Element Address", HFILL }},
3419 { &hf_ldp_tlv_addrl_addr_family,
3420 { "Address Family", "ldp.msg.tlv.addrl.addr_family", FT_UINT16, BASE_DEC,
3421 VALS(afn_vals), 0x0, "Address Family List", HFILL }},
3423 { &hf_ldp_tlv_addrl_addr,
3424 { "Address", "ldp.msg.tlv.addrl.addr", FT_STRING, BASE_NONE,
3425 NULL, 0x0, NULL, HFILL }},
3427 { &hf_ldp_tlv_hc_value,
3428 { "Hop Count Value", "ldp.msg.tlv.hc.value", FT_UINT8, BASE_DEC,
3429 NULL, 0x0, "Hop Count", HFILL }},
3431 { &hf_ldp_tlv_pv_lsrid,
3432 { "LSR Id", "ldp.msg.tlv.pv.lsrid", FT_IPv4, BASE_NONE,
3433 NULL, 0x0, "Path Vector LSR Id", HFILL }},
3435 { &hf_ldp_tlv_sess_ver,
3436 { "Session Protocol Version", "ldp.msg.tlv.sess.ver", FT_UINT16, BASE_DEC,
3437 NULL, 0x0, "Common Session Parameters Protocol Version", HFILL }},
3439 { &hf_ldp_tlv_sess_ka,
3440 { "Session KeepAlive Time", "ldp.msg.tlv.sess.ka", FT_UINT16, BASE_DEC,
3441 NULL, 0x0, "Common Session Parameters KeepAlive Time", HFILL }},
3443 { &hf_ldp_tlv_sess_advbit,
3444 { "Session Label Advertisement Discipline", "ldp.msg.tlv.sess.advbit", FT_BOOLEAN, 8,
3445 TFS(&tlv_sess_advbit_vals), 0x80, "Common Session Parameters Label Advertisement Discipline", HFILL }},
3447 { &hf_ldp_tlv_sess_ldetbit,
3448 { "Session Loop Detection", "ldp.msg.tlv.sess.ldetbit", FT_BOOLEAN, 8,
3449 TFS(&tlv_sess_ldetbit_vals), 0x40, "Common Session Parameters Loop Detection", HFILL }},
3451 { &hf_ldp_tlv_sess_pvlim,
3452 { "Session Path Vector Limit", "ldp.msg.tlv.sess.pvlim", FT_UINT8, BASE_DEC,
3453 NULL, 0x0, "Common Session Parameters Path Vector Limit", HFILL }},
3455 { &hf_ldp_tlv_sess_mxpdu,
3456 { "Session Max PDU Length", "ldp.msg.tlv.sess.mxpdu", FT_UINT16, BASE_DEC,
3457 NULL, 0x0, "Common Session Parameters Max PDU Length", HFILL }},
3459 { &hf_ldp_tlv_sess_rxlsr,
3460 { "Session Receiver LSR Identifier", "ldp.msg.tlv.sess.rxlsr", FT_IPv4, BASE_NONE,
3461 NULL, 0x0, "Common Session Parameters LSR Identifier", HFILL }},
3463 { &hf_ldp_tlv_sess_rxls,
3464 { "Session Receiver Label Space Identifier", "ldp.msg.tlv.sess.rxls", FT_UINT16, BASE_DEC,
3465 NULL, 0x0, "Common Session Parameters Receiver Label Space Identifier", HFILL }},
3467 { &hf_ldp_tlv_sess_atm_merge,
3468 { "Session ATM Merge Parameter", "ldp.msg.tlv.sess.atm.merge", FT_UINT8, BASE_DEC,
3469 VALS(tlv_atm_merge_vals), 0xC0, "Merge ATM Session Parameters", HFILL }},
3471 { &hf_ldp_tlv_sess_atm_lr,
3472 { "Number of ATM Label Ranges", "ldp.msg.tlv.sess.atm.lr", FT_UINT8, BASE_DEC,
3473 NULL, 0x3C, "Number of Label Ranges", HFILL }},
3475 { &hf_ldp_tlv_sess_atm_dir,
3476 { "Directionality", "ldp.msg.tlv.sess.atm.dir", FT_BOOLEAN, 8,
3477 TFS(&tlv_atm_dirbit), 0x02, "Label Directionality", HFILL }},
3479 { &hf_ldp_tlv_sess_atm_minvpi,
3480 { "Minimum VPI", "ldp.msg.tlv.sess.atm.minvpi", FT_UINT16, BASE_DEC,
3481 NULL, 0x0FFF, NULL, HFILL }},
3483 { &hf_ldp_tlv_sess_atm_minvci,
3484 { "Minimum VCI", "ldp.msg.tlv.sess.atm.minvci", FT_UINT16, BASE_DEC,
3485 NULL, 0x0, NULL, HFILL }},
3487 { &hf_ldp_tlv_sess_atm_maxvpi,
3488 { "Maximum VPI", "ldp.msg.tlv.sess.atm.maxvpi", FT_UINT16, BASE_DEC,
3489 NULL, 0x0FFF, NULL, HFILL }},
3491 { &hf_ldp_tlv_sess_atm_maxvci,
3492 { "Maximum VCI", "ldp.msg.tlv.sess.atm.maxvci", FT_UINT16, BASE_DEC,
3493 NULL, 0x0, NULL, HFILL }},
3495 { &hf_ldp_tlv_sess_fr_merge,
3496 { "Session Frame Relay Merge Parameter", "ldp.msg.tlv.sess.fr.merge", FT_UINT8, BASE_DEC,
3497 VALS(tlv_fr_merge_vals), 0xC0, "Merge Frame Relay Session Parameters", HFILL }},
3499 { &hf_ldp_tlv_sess_fr_lr,
3500 { "Number of Frame Relay Label Ranges", "ldp.msg.tlv.sess.fr.lr", FT_UINT8, BASE_DEC,
3501 NULL, 0x3C, "Number of Label Ranges", HFILL }},
3503 { &hf_ldp_tlv_sess_fr_dir,
3504 { "Directionality", "ldp.msg.tlv.sess.fr.dir", FT_BOOLEAN, 8,
3505 TFS(&tlv_atm_dirbit), 0x02, "Label Directionality", HFILL }},
3507 { &hf_ldp_tlv_sess_fr_len,
3508 { "Number of DLCI bits", "ldp.msg.tlv.sess.fr.len", FT_UINT16, BASE_DEC,
3509 VALS(tlv_fr_len_vals), 0x0180, "DLCI Number of bits", HFILL }},
3511 { &hf_ldp_tlv_sess_fr_mindlci,
3512 { "Minimum DLCI", "ldp.msg.tlv.sess.fr.mindlci", FT_UINT24, BASE_DEC,
3513 NULL, 0x7FFFFF, NULL, HFILL }},
3515 { &hf_ldp_tlv_sess_fr_maxdlci,
3516 { "Maximum DLCI", "ldp.msg.tlv.sess.fr.maxdlci", FT_UINT24, BASE_DEC,
3517 NULL, 0x7FFFFF, NULL, HFILL }},
3519 { &hf_ldp_tlv_ft_sess_flags,
3520 { "Flags", "ldp.msg.tlv.ft_sess.flags", FT_UINT16, BASE_HEX,
3521 NULL, 0x0, "FT Session Flags", HFILL }},
3523 { &hf_ldp_tlv_ft_sess_flag_r,
3524 { "R bit", "ldp.msg.tlv.ft_sess.flag_r", FT_BOOLEAN, 16,
3525 TFS(&tlv_ft_r), 0x8000, "FT Reconnect Flag", HFILL }},
3527 { &hf_ldp_tlv_ft_sess_flag_res,
3528 { "Reserved", "ldp.msg.tlv.ft_sess.flag_res", FT_UINT16, BASE_HEX,
3529 NULL, 0x7FF0, "Reserved bits", HFILL }},
3531 { &hf_ldp_tlv_ft_sess_flag_s,
3532 { "S bit", "ldp.msg.tlv.ft_sess.flag_s", FT_BOOLEAN, 16,
3533 TFS(&tlv_ft_s), 0x8, "Save State Flag", HFILL }},
3535 { &hf_ldp_tlv_ft_sess_flag_a,
3536 { "A bit", "ldp.msg.tlv.ft_sess.flag_a", FT_BOOLEAN, 16,
3537 TFS(&tlv_ft_a), 0x4, "All-Label protection Required", HFILL }},
3539 { &hf_ldp_tlv_ft_sess_flag_c,
3540 { "C bit", "ldp.msg.tlv.ft_sess.flag_c", FT_BOOLEAN, 16,
3541 TFS(&tlv_ft_c), 0x2, "Check-Pointint Flag", HFILL }},
3543 { &hf_ldp_tlv_ft_sess_flag_l,
3544 { "L bit", "ldp.msg.tlv.ft_sess.flag_l", FT_BOOLEAN, 16,
3545 TFS(&tlv_ft_l), 0x1, "Learn From network Flag", HFILL }},
3547 { &hf_ldp_tlv_ft_sess_res,
3548 { "Reserved", "ldp.msg.tlv.ft_sess.res", FT_UINT16, BASE_HEX,
3549 NULL, 0x0, NULL, HFILL }},
3551 { &hf_ldp_tlv_ft_sess_reconn_to,
3552 { "Reconnect Timeout", "ldp.msg.tlv.ft_sess.reconn_to", FT_UINT32, BASE_DEC,
3553 NULL, 0x0, "FT Reconnect Timeout", HFILL }},
3555 { &hf_ldp_tlv_ft_sess_recovery_time,
3556 { "Recovery Time", "ldp.msg.tlv.ft_sess.recovery_time", FT_UINT32, BASE_DEC,
3557 NULL, 0x0, NULL, HFILL }},
3559 { &hf_ldp_tlv_ft_ack_sequence_num,
3560 { "FT ACK Sequence Number", "ldp.msg.tlv.ft_ack.sequence_num", FT_UINT32, BASE_HEX,
3561 NULL, 0x0, NULL, HFILL }},
3563 { &hf_ldp_tlv_lbl_req_msg_id,
3564 { "Label Request Message ID", "ldp.msg.tlv.lbl_req_msg_id", FT_UINT32, BASE_HEX,
3565 NULL, 0x0, "Label Request Message to be aborted", HFILL }},
3567 { &hf_ldp_tlv_vendor_id,
3568 { "Vendor ID", "ldp.msg.tlv.vendor_id", FT_UINT32, BASE_HEX,
3569 NULL, 0, "IEEE 802 Assigned Vendor ID", HFILL }},
3571 { &hf_ldp_tlv_experiment_id,
3572 { "Experiment ID", "ldp.msg.tlv.experiment_id", FT_UINT32, BASE_HEX,
3573 NULL, 0, NULL, HFILL }},
3575 { &hf_ldp_tlv_generic_label,
3576 { "Generic Label", "ldp.msg.tlv.generic.label", FT_UINT32, BASE_HEX,
3577 NULL, 0x000FFFFF, NULL, HFILL }},
3579 { &hf_ldp_tlv_atm_label_vbits,
3580 { "V-bits", "ldp.msg.tlv.atm.label.vbits", FT_UINT8, BASE_HEX,
3581 VALS(tlv_atm_vbits_vals), 0x30, "ATM Label V Bits", HFILL }},
3583 { &hf_ldp_tlv_atm_label_vpi,
3584 { "VPI", "ldp.msg.tlv.atm.label.vpi", FT_UINT16, BASE_DEC,
3585 NULL, 0x0FFF, "ATM Label VPI", HFILL }},
3587 { &hf_ldp_tlv_atm_label_vci,
3588 { "VCI", "ldp.msg.tlv.atm.label.vci", FT_UINT16, BASE_DEC,
3589 NULL, 0, "ATM Label VCI", HFILL }},
3591 { &hf_ldp_tlv_fr_label_len,
3592 { "Number of DLCI bits", "ldp.msg.tlv.fr.label.len", FT_UINT16, BASE_DEC,
3593 VALS(tlv_fr_len_vals), 0x0180, "DLCI Number of bits", HFILL }},
3595 { &hf_ldp_tlv_fr_label_dlci,
3596 { "DLCI", "ldp.msg.tlv.fr.label.dlci", FT_UINT24, BASE_DEC,
3597 NULL, 0x7FFFFF, "FRAME RELAY Label DLCI", HFILL }},
3599 { &hf_ldp_tlv_ft_protect_sequence_num,
3600 { "FT Sequence Number", "ldp.msg.tlv.ft_protect.sequence_num", FT_UINT32, BASE_HEX,
3601 NULL, 0x0, NULL, HFILL }},
3603 { &hf_ldp_tlv_status_ebit,
3604 { "E Bit", "ldp.msg.tlv.status.ebit", FT_BOOLEAN, 8,
3605 TFS(&tlv_status_ebit), 0x80, "Fatal Error Bit", HFILL }},
3607 { &hf_ldp_tlv_status_fbit,
3608 { "F Bit", "ldp.msg.tlv.status.fbit", FT_BOOLEAN, 8,
3609 TFS(&tlv_status_fbit), 0x40, "Forward Bit", HFILL }},
3611 { &hf_ldp_tlv_status_data,
3612 { "Status Data", "ldp.msg.tlv.status.data", FT_UINT32, BASE_HEX,
3613 VALS(tlv_status_data), 0x3FFFFFFF, NULL, HFILL }},
3615 { &hf_ldp_tlv_status_msg_id,
3616 { "Message ID", "ldp.msg.tlv.status.msg.id", FT_UINT32, BASE_HEX,
3617 NULL, 0x0, "Identifies peer message to which Status TLV refers", HFILL }},
3619 { &hf_ldp_tlv_status_msg_type,
3620 { "Message Type", "ldp.msg.tlv.status.msg.type", FT_UINT16, BASE_HEX,
3621 VALS(ldp_message_types), 0x0, "Type of peer message to which Status TLV refers", HFILL }},
3623 { &hf_ldp_tlv_extstatus_data,
3624 { "Extended Status Data", "ldp.msg.tlv.extstatus.data", FT_UINT32, BASE_HEX,
3625 NULL, 0x0, NULL, HFILL }},
3627 { &hf_ldp_tlv_returned_version,
3628 { "Returned PDU Version", "ldp.msg.tlv.returned.version", FT_UINT16, BASE_DEC,
3629 NULL, 0x0, "LDP Version Number", HFILL }},
3631 { &hf_ldp_tlv_returned_pdu_len,
3632 { "Returned PDU Length", "ldp.msg.tlv.returned.pdu_len", FT_UINT16, BASE_DEC,
3633 NULL, 0x0, "LDP PDU Length", HFILL }},
3635 { &hf_ldp_tlv_returned_lsr,
3636 { "Returned PDU LSR ID", "ldp.msg.tlv.returned.ldpid.lsr", FT_IPv4, BASE_NONE,
3637 NULL, 0x0, "LDP Label Space Router ID", HFILL }},
3639 { &hf_ldp_tlv_returned_ls_id,
3640 { "Returned PDU Label Space ID", "ldp.msg.tlv.returned.ldpid.lsid", FT_UINT16, BASE_HEX,
3641 NULL, 0x0, "LDP Label Space ID", HFILL }},
3643 { &hf_ldp_tlv_returned_msg_ubit,
3644 { "Returned Message Unknown bit", "ldp.msg.tlv.returned.msg.ubit", FT_BOOLEAN, 8,
3645 TFS(&ldp_message_ubit), 0x80, "Message Unknown bit", HFILL }},
3647 { &hf_ldp_tlv_returned_msg_type,
3648 { "Returned Message Type", "ldp.msg.tlv.returned.msg.type", FT_UINT16, BASE_HEX,
3649 VALS(ldp_message_types), 0x7FFF, "LDP message type", HFILL }},
3651 { &hf_ldp_tlv_returned_msg_len,
3652 { "Returned Message Length", "ldp.msg.tlv.returned.msg.len", FT_UINT16, BASE_DEC,
3653 NULL, 0x0, "LDP Message Length (excluding message type and len)", HFILL }},
3655 { &hf_ldp_tlv_returned_msg_id,
3656 { "Returned Message ID", "ldp.msg.tlv.returned.msg.id", FT_UINT32, BASE_HEX,
3657 NULL, 0x0, "LDP Message ID", HFILL }},
3659 { &hf_ldp_tlv_mac,
3660 { "MAC address", "ldp.msg.tlv.mac", FT_ETHER, BASE_NONE,
3661 NULL, 0x0, NULL, HFILL}},
3663 { &hf_ldp_tlv_fec_vc_controlword,
3664 { "C-bit", "ldp.msg.tlv.fec.vc.controlword", FT_BOOLEAN, 8,
3665 TFS(&fec_vc_cbit), 0x80, "Control Word Present", HFILL }},
3667 { &hf_ldp_tlv_fec_vc_vctype,
3668 { "VC Type", "ldp.msg.tlv.fec.vc.vctype", FT_UINT16, BASE_HEX,
3669 VALS(fec_vc_types_vals), 0x7FFF, "Virtual Circuit Type", HFILL }},
3671 { &hf_ldp_tlv_fec_vc_infolength,
3672 { "VC Info Length", "ldp.msg.tlv.fec.vc.infolength", FT_UINT8, BASE_DEC,
3673 NULL, 0x0, "VC FEC Info Length", HFILL }},
3675 { &hf_ldp_tlv_fec_vc_groupid,
3676 { "Group ID", "ldp.msg.tlv.fec.vc.groupid", FT_UINT32, BASE_DEC,
3677 NULL, 0x0, "VC FEC Group ID", HFILL }},
3679 { &hf_ldp_tlv_fec_vc_vcid,
3680 { "VC ID", "ldp.msg.tlv.fec.vc.vcid", FT_UINT32, BASE_DEC,
3681 NULL, 0x0, "VC FEC VCID", HFILL }},
3683 { &hf_ldp_tlv_fec_vc_intparam_length,
3684 { "Length", "ldp.msg.tlv.fec.vc.intparam.length", FT_UINT8, BASE_DEC,
3685 NULL, 0x0, "VC FEC Interface Parameter Length", HFILL }},
3687 { &hf_ldp_tlv_fec_vc_intparam_mtu,
3688 { "MTU", "ldp.msg.tlv.fec.vc.intparam.mtu", FT_UINT16, BASE_DEC,
3689 NULL, 0x0, "VC FEC Interface Parameter MTU", HFILL }},
3691 { &hf_ldp_tlv_fec_vc_intparam_tdmbps,
3692 { "BPS", "ldp.msg.tlv.fec.vc.intparam.tdmbps", FT_UINT32, BASE_DEC,
3693 NULL, 0x0, "VC FEC Interface Parameter CEP/TDM bit-rate", HFILL }},
3695 { &hf_ldp_tlv_fec_vc_intparam_id,
3696 { "ID", "ldp.msg.tlv.fec.vc.intparam.id", FT_UINT8, BASE_HEX,
3697 VALS(fec_vc_interfaceparm), 0x0, "VC FEC Interface Parameter ID", HFILL }},
3699 { &hf_ldp_tlv_fec_vc_intparam_maxcatmcells,
3700 { "Number of Cells", "ldp.msg.tlv.fec.vc.intparam.maxatm", FT_UINT16, BASE_DEC,
3701 NULL, 0x0, "VC FEC Interface Param Max ATM Concat Cells", HFILL }},
3703 { &hf_ldp_tlv_fec_vc_intparam_desc,
3704 { "Description", "ldp.msg.tlv.fec.vc.intparam.desc", FT_STRING, BASE_NONE,
3705 NULL, 0, "VC FEC Interface Description", HFILL }},
3707 { &hf_ldp_tlv_fec_vc_intparam_cepbytes,
3708 { "Payload Bytes", "ldp.msg.tlv.fec.vc.intparam.cepbytes", FT_UINT16, BASE_DEC,
3709 NULL, 0x0, "VC FEC Interface Param CEP/TDM Payload Bytes", HFILL }},
3711 { &hf_ldp_tlv_fec_vc_intparam_cepopt_ais,
3712 { "AIS", "ldp.msg.tlv.fec.vc.intparam.cepopt_ais", FT_BOOLEAN, 16,
3713 NULL, 0x8000, "VC FEC Interface Param CEP Option AIS", HFILL }},
3715 { &hf_ldp_tlv_fec_vc_intparam_cepopt_une,
3716 { "UNE", "ldp.msg.tlv.fec.vc.intparam.cepopt_une", FT_BOOLEAN, 16,
3717 NULL, 0x4000, "VC FEC Interface Param CEP Option Unequipped", HFILL }},
3719 { &hf_ldp_tlv_fec_vc_intparam_cepopt_rtp,
3720 { "RTP", "ldp.msg.tlv.fec.vc.intparam.cepopt_rtp", FT_BOOLEAN, 16,
3721 NULL, 0x2000, "VC FEC Interface Param CEP Option RTP Header", HFILL }},
3723 { &hf_ldp_tlv_fec_vc_intparam_cepopt_ebm,
3724 { "EBM", "ldp.msg.tlv.fec.vc.intparam.cepopt_ebm", FT_BOOLEAN, 16,
3725 NULL, 0x1000, "VC FEC Interface Param CEP Option EBM Header", HFILL }},
3727 { &hf_ldp_tlv_fec_vc_intparam_cepopt_mah,
3728 { "MAH", "ldp.msg.tlv.fec.vc.intparam.cepopt_mah", FT_BOOLEAN, 16,
3729 NULL, 0x0800, "VC FEC Interface Param CEP Option MPLS Adaptation header", HFILL }},
3731 { &hf_ldp_tlv_fec_vc_intparam_cepopt_res,
3732 { "Reserved", "ldp.msg.tlv.fec.vc.intparam.cepopt_res", FT_UINT16, BASE_HEX,
3733 NULL , 0x07E0, "VC FEC Interface Param CEP Option Reserved", HFILL }},
3735 { &hf_ldp_tlv_fec_vc_intparam_cepopt_ceptype,
3736 { "CEP Type", "ldp.msg.tlv.fec.vc.intparam.cepopt_ceptype", FT_UINT16, BASE_HEX,
3737 VALS(fec_vc_ceptype_vals), 0x001C, "VC FEC Interface Param CEP Option CEP Type", HFILL }},
3739 { &hf_ldp_tlv_fec_vc_intparam_cepopt_t3,
3740 { "Async T3", "ldp.msg.tlv.fec.vc.intparam.cepopt_t3", FT_BOOLEAN, 16,
3741 NULL, 0x0002, "VC FEC Interface Param CEP Option Async T3", HFILL }},
3743 { &hf_ldp_tlv_fec_vc_intparam_cepopt_e3,
3744 { "Async E3", "ldp.msg.tlv.fec.vc.intparam.cepopt_e3", FT_BOOLEAN, 16,
3745 NULL, 0x0001, "VC FEC Interface Param CEP Option Async E3", HFILL }},
3747 { &hf_ldp_tlv_fec_vc_intparam_vlanid,
3748 { "VLAN Id", "ldp.msg.tlv.fec.vc.intparam.vlanid", FT_UINT16, BASE_DEC,
3749 NULL, 0x0, "VC FEC Interface Param VLAN Id", HFILL }},
3751 { &hf_ldp_tlv_fec_vc_intparam_dlcilen,
3752 { "DLCI Length", "ldp.msg.tlv.fec.vc.intparam.dlcilen", FT_UINT16, BASE_DEC,
3753 NULL, 0x0, "VC FEC Interface Parameter Frame-Relay DLCI Length", HFILL }},
3755 { &hf_ldp_tlv_fec_vc_intparam_fcslen,
3756 { "FCS Length", "ldp.msg.tlv.fec.vc.intparam.fcslen", FT_UINT16, BASE_DEC,
3757 NULL, 0x0, "VC FEC Interface Parameter FCS Length", HFILL }},
3759 { &hf_ldp_tlv_fec_vc_intparam_tdmopt_r,
3760 { "R Bit", "ldp.msg.tlv.fec.vc.intparam.tdmopt_r", FT_BOOLEAN, 16,
3761 TFS(&fec_vc_tdmopt_r), 0x8000, "VC FEC Interface Param TDM Options RTP Header", HFILL }},
3763 { &hf_ldp_tlv_fec_vc_intparam_tdmopt_d,
3764 { "D Bit", "ldp.msg.tlv.fec.vc.intparam.tdmopt_d", FT_BOOLEAN, 16,
3765 TFS(&fec_vc_tdmopt_d), 0x4000, "VC FEC Interface Param TDM Options Dynamic Timestamp", HFILL }},
3767 { &hf_ldp_tlv_fec_vc_intparam_tdmopt_f,
3768 { "F Bit", "ldp.msg.tlv.fec.vc.intparam.tdmopt_f", FT_BOOLEAN, 16,
3769 TFS(&fec_vc_tdmopt_f), 0x2000, "VC FEC Interface Param TDM Options Flavor bit", HFILL }},
3771 { &hf_ldp_tlv_fec_vc_intparam_tdmopt_res1,
3772 { "RSVD-1", "ldp.msg.tlv.fec.vc.intparam.tdmopt_res1", FT_UINT16, BASE_HEX,
3773 NULL, 0x1FFF, "VC FEC Interface Param TDM Options Reserved", HFILL }},
3775 { &hf_ldp_tlv_fec_vc_intparam_tdmopt_pt,
3776 { "PT", "ldp.msg.tlv.fec.vc.intparam.tdmopt_pt", FT_UINT8, BASE_DEC,
3777 NULL, 0x7F, "VC FEC Interface Param TDM Options Payload Type", HFILL }},
3779 { &hf_ldp_tlv_fec_vc_intparam_tdmopt_res2,
3780 { "RSVD-2", "ldp.msg.tlv.fec.vc.intparam.tdmopt_res2", FT_UINT8, BASE_HEX,
3781 NULL, 0x00, "VC FEC Interface Param TDM Options Reserved", HFILL }},
3783 { &hf_ldp_tlv_fec_vc_intparam_tdmopt_freq,
3784 { "FREQ", "ldp.msg.tlv.fec.vc.intparam.tdmopt_freq", FT_UINT16, BASE_DEC,
3785 NULL, 0x00, "VC FEC Interface Param TDM Options Frequency", HFILL }},
3787 { &hf_ldp_tlv_fec_vc_intparam_tdmopt_ssrc,
3788 { "SSRC", "ldp.msg.tlv.fec.vc.intparam.tdmopt_ssrc", FT_UINT32, BASE_HEX,
3789 NULL, 0x00, "VC FEC Interface Param TDM Options SSRC", HFILL }},
3791 { &hf_ldp_tlv_fec_vc_intparam_vccv_cctype_cw,
3792 { "PWE3 Control Word", "ldp.msg.tlv.fec.vc.intparam.vccv.cctype_cw", FT_BOOLEAN, 8,
3793 NULL, 0x01, "VC FEC Interface Param VCCV CC Type PWE3 CW", HFILL }},
3795 { &hf_ldp_tlv_fec_vc_intparam_vccv_cctype_mplsra,
3796 { "MPLS Router Alert", "ldp.msg.tlv.fec.vc.intparam.vccv.cctype_mplsra", FT_BOOLEAN, 8,
3797 NULL, 0x02, "VC FEC Interface Param VCCV CC Type MPLS Router Alert", HFILL }},
3799 { &hf_ldp_tlv_fec_vc_intparam_vccv_cctype_ttl1,
3800 { "MPLS Inner Label TTL = 1", "ldp.msg.tlv.fec.vc.intparam.vccv.cctype_ttl1", FT_BOOLEAN, 8,
3801 NULL, 0x04, "VC FEC Interface Param VCCV CC Type Inner Label TTL 1", HFILL }},
3803 { &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_icmpping,
3804 { "ICMP Ping", "ldp.msg.tlv.fec.vc.intparam.vccv.cvtype_icmpping", FT_BOOLEAN, 8,
3805 NULL, 0x01, "VC FEC Interface Param VCCV CV Type ICMP Ping", HFILL }},
3807 { &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_lspping,
3808 { "LSP Ping", "ldp.msg.tlv.fec.vc.intparam.vccv.cvtype_lspping", FT_BOOLEAN, 8,
3809 NULL, 0x02, "VC FEC Interface Param VCCV CV Type LSP Ping", HFILL }},
3811 { &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd1,
3812 { "BFD IP/UDP-encapsulated, for PW Fault Detection only", "ldp.msg.tlv.fec.vc.intparam.vccv.cvtype_bfd1", FT_BOOLEAN, 8,
3813 NULL, 0x04, "VC FEC Interface Param VCCV CV Type BFD IP/UDP-encapsulated, for PW Fault Detection only", HFILL }},
3815 { &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd2,
3816 { "BFD IP/UDP-encapsulated, for PW Fault Detection and AC/PW Fault Status Signaling", "ldp.msg.tlv.fec.vc.intparam.vccv.cvtype_bfd2", FT_BOOLEAN, 8,
3817 NULL, 0x08, "VC FEC Interface Param VCCV CV Type BFD IP/UDP-encapsulated, for PW Fault Detection and AC/PW Fault Status Signaling", HFILL }},
3819 { &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd3,
3820 { "BFD BFD PW-ACH-encapsulated, for PW Fault Detection only", "ldp.msg.tlv.fec.vc.intparam.vccv.cvtype_bfd3", FT_BOOLEAN, 8,
3821 NULL, 0x10, "VC FEC Interface Param VCCV CV Type BFD PW-ACH-encapsulated, for PW Fault Detection only", HFILL }},
3823 { &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd4,
3824 { "BFD BFD PW-ACH-encapsulated, for PW Fault Detection and AC/PW Fault Status Signaling", "ldp.msg.tlv.fec.vc.intparam.vccv.cvtype_bfd4", FT_BOOLEAN, 8,
3825 NULL, 0x20, "VC FEC Interface Param VCCV CV Type BFD PW-ACH-encapsulated, for PW Fault Detection and AC/PW Fault Status Signaling", HFILL }},
3827 { &hf_ldp_tlv_fec_vc_intparam_flowlabel_t,
3828 { "Flow Label Transmit bit", "ldp.msg.tlv.fec.vc.intparam.flowlabel.t", FT_UINT8, BASE_DEC, NULL, 0x80, NULL, HFILL}},
3830 { &hf_ldp_tlv_fec_vc_intparam_flowlabel_r,
3831 { "Flow Label Receive bit", "ldp.msg.tlv.fec.vc.intparam.flowlabel.r", FT_UINT8, BASE_DEC, NULL, 0x40, NULL, HFILL}},
3833 { &hf_ldp_tlv_fec_vc_intparam_flowlabel_res,
3834 { "Flow Label Reserved", "ldp.msg.tlv.fec.vc.intparam.flowlabel.res", FT_UINT16, BASE_HEX, NULL, 0x3FFF, NULL, HFILL}},
3836 { &hf_ldp_tlv_lspid_act_flg,
3837 { "Action Indicator Flag", "ldp.msg.tlv.lspid.actflg", FT_UINT16, BASE_HEX,
3838 VALS(ldp_act_flg_vals), 0x000F, NULL, HFILL}},
3840 { &hf_ldp_tlv_lspid_cr_lsp,
3841 { "Local CR-LSP ID", "ldp.msg.tlv.lspid.locallspid", FT_UINT16, BASE_HEX,
3842 NULL, 0x0, NULL, HFILL}},
3844 { &hf_ldp_tlv_lspid_ldpid,
3845 { "Ingress LSR Router ID", "ldp.msg.tlv.lspid.lsrid", FT_IPv4, BASE_NONE,
3846 NULL, 0x0, NULL, HFILL}},
3848 { &hf_ldp_tlv_er_hop_loose,
3849 { "Loose route bit", "ldp.msg.tlv.er_hop.loose", FT_UINT24, BASE_HEX,
3850 VALS(ldp_loose_vals), 0x800000, NULL, HFILL}},
3852 { &hf_ldp_tlv_er_hop_prelen,
3853 { "Prefix length", "ldp.msg.tlv.er_hop.prefixlen", FT_UINT8, BASE_DEC,
3854 NULL, 0x0, "Prefix len", HFILL}},
3856 { &hf_ldp_tlv_er_hop_prefix4,
3857 { "IPv4 Address", "ldp.msg.tlv.er_hop.prefix4", FT_IPv4, BASE_NONE,
3858 NULL, 0x0, NULL, HFILL}},
3860 { &hf_ldp_tlv_er_hop_prefix6,
3861 { "IPv6 Address", "ldp.msg.tlv.er_hop.prefix6", FT_IPv6, BASE_NONE,
3862 NULL, 0x0, NULL, HFILL}},
3864 { &hf_ldp_tlv_er_hop_as,
3865 { "AS Number", "ldp.msg.tlv.er_hop.as", FT_UINT16, BASE_DEC,
3866 NULL, 0x0, NULL, HFILL}},
3868 { &hf_ldp_tlv_er_hop_cr_lsp,
3869 { "Local CR-LSP ID", "ldp.msg.tlv.er_hop.locallspid", FT_UINT16, BASE_DEC,
3870 NULL, 0x0, NULL, HFILL}},
3872 { &hf_ldp_tlv_er_hop_ldpid,
3873 { "Local CR-LSP ID", "ldp.msg.tlv.er_hop.lsrid", FT_IPv4, BASE_NONE,
3874 NULL, 0x0, NULL, HFILL}},
3876 { &hf_ldp_tlv_flags_reserv,
3877 { "Reserved", "ldp.msg.tlv.flags_reserv", FT_UINT8, BASE_HEX,
3878 NULL, 0xC0, NULL, HFILL}},
3880 { &hf_ldp_tlv_flags_pdr,
3881 { "PDR", "ldp.msg.tlv.flags_pdr", FT_BOOLEAN, 8,
3882 TFS(&tlv_negotiable), 0x1, "PDR negotiability flag", HFILL}},
3884 { &hf_ldp_tlv_flags_pbs,
3885 { "PBS", "ldp.msg.tlv.flags_pbs", FT_BOOLEAN, 8,
3886 TFS(&tlv_negotiable), 0x2, "PBS negotiability flag", HFILL}},
3888 { &hf_ldp_tlv_flags_cdr,
3889 { "CDR", "ldp.msg.tlv.flags_cdr", FT_BOOLEAN, 8,
3890 TFS(&tlv_negotiable), 0x4, "CDR negotiability flag", HFILL}},
3892 { &hf_ldp_tlv_flags_cbs,
3893 { "CBS", "ldp.msg.tlv.flags_cbs", FT_BOOLEAN, 8,
3894 TFS(&tlv_negotiable), 0x8, "CBS negotiability flag", HFILL}},
3896 { &hf_ldp_tlv_flags_ebs,
3897 { "EBS", "ldp.msg.tlv.flags_ebs", FT_BOOLEAN, 8,
3898 TFS(&tlv_negotiable), 0x10, "EBS negotiability flag", HFILL}},
3900 { &hf_ldp_tlv_flags_weight,
3901 { "Weight", "ldp.msg.tlv.flags_weight", FT_BOOLEAN, 8,
3902 TFS(&tlv_negotiable), 0x20, "Weight negotiability flag", HFILL}},
3904 { &hf_ldp_tlv_frequency,
3905 { "Frequency", "ldp.msg.tlv.frequency", FT_UINT8, BASE_DEC,
3906 VALS(freq_values), 0, NULL, HFILL}},
3908 { &hf_ldp_tlv_weight,
3909 { "Weight", "ldp.msg.tlv.weight", FT_UINT8, BASE_DEC,
3910 NULL, 0, "Weight of the CR-LSP", HFILL}},
3912 { &hf_ldp_tlv_pdr,
3913 { "PDR", "ldp.msg.tlv.pdr", FT_DOUBLE, BASE_NONE,
3914 NULL, 0, "Peak Data Rate", HFILL}},
3916 { &hf_ldp_tlv_pbs,
3917 { "PBS", "ldp.msg.tlv.pbs", FT_DOUBLE, BASE_NONE,
3918 NULL, 0, "Peak Burst Size", HFILL}},
3920 { &hf_ldp_tlv_cdr,
3921 { "CDR", "ldp.msg.tlv.cdr", FT_DOUBLE, BASE_NONE,
3922 NULL, 0, "Committed Data Rate", HFILL}},
3924 { &hf_ldp_tlv_cbs,
3925 { "CBS", "ldp.msg.tlv.cbs", FT_DOUBLE, BASE_NONE,
3926 NULL, 0, "Committed Burst Size", HFILL}},
3928 { &hf_ldp_tlv_ebs,
3929 { "EBS", "ldp.msg.tlv.ebs", FT_DOUBLE, BASE_NONE,
3930 NULL, 0, "Excess Burst Size", HFILL}},
3932 { &hf_ldp_tlv_set_prio,
3933 { "Set Prio", "ldp.msg.tlv.set_prio", FT_UINT8, BASE_DEC,
3934 NULL, 0, "LSP setup priority", HFILL}},
3936 { &hf_ldp_tlv_hold_prio,
3937 { "Hold Prio", "ldp.msg.tlv.hold_prio", FT_UINT8, BASE_DEC,
3938 NULL, 0, "LSP hold priority", HFILL}},
3940 { &hf_ldp_tlv_route_pinning,
3941 { "Route Pinning", "ldp.msg.tlv.route_pinning", FT_UINT32, BASE_DEC,
3942 VALS(route_pinning_vals), 0x80000000, NULL, HFILL}},
3944 { &hf_ldp_tlv_resource_class,
3945 { "Resource Class", "ldp.msg.tlv.resource_class", FT_UINT32, BASE_HEX,
3946 NULL, 0, "Resource Class (Color)", HFILL}},
3948 #if 0
3949 { &hf_ldp_tlv_diffserv,
3950 { "Diff-Serv TLV", "ldp.msg.tlv.diffserv", FT_NONE, BASE_NONE,
3951 NULL, 0, "Diffserv TLV", HFILL}},
3952 #endif
3954 { &hf_ldp_tlv_diffserv_type,
3955 { "LSP Type", "ldp.msg.tlv.diffserv.type", FT_UINT8, BASE_DEC,
3956 VALS(diffserv_type_vals), 0x80, NULL, HFILL}},
3958 { &hf_ldp_tlv_diffserv_mapnb,
3959 { "MAPnb", "ldp.msg.tlv.diffserv.mapnb", FT_UINT8, BASE_DEC,
3960 NULL, 0, MAPNB_DESCRIPTION, HFILL}},
3962 { &hf_ldp_tlv_diffserv_map,
3963 { "MAP", "ldp.msg.tlv.diffserv.map", FT_NONE, BASE_NONE,
3964 NULL, 0, MAP_DESCRIPTION, HFILL}},
3966 { &hf_ldp_tlv_diffserv_map_exp,
3967 { "EXP", "ldp.msg.tlv.diffserv.map.exp", FT_UINT8, BASE_DEC,
3968 NULL, 0, EXP_DESCRIPTION, HFILL}},
3970 { &hf_ldp_tlv_diffserv_phbid,
3971 { PHBID_DESCRIPTION, "ldp.msg.tlv.diffserv.phbid", FT_NONE, BASE_NONE,
3972 NULL, 0, NULL, HFILL}},
3974 { &hf_ldp_tlv_diffserv_phbid_dscp,
3975 { PHBID_DSCP_DESCRIPTION, "ldp.msg.tlv.diffserv.phbid.dscp", FT_UINT16, BASE_DEC,
3976 NULL, PHBID_DSCP_MASK, NULL, HFILL}},
3978 { &hf_ldp_tlv_diffserv_phbid_code,
3979 { PHBID_CODE_DESCRIPTION, "ldp.msg.tlv.diffserv.phbid.code", FT_UINT16, BASE_DEC,
3980 NULL, PHBID_CODE_MASK, NULL, HFILL}},
3982 { &hf_ldp_tlv_diffserv_phbid_bit14,
3983 { PHBID_BIT14_DESCRIPTION, "ldp.msg.tlv.diffserv.phbid.bit14", FT_UINT16, BASE_DEC,
3984 VALS(phbid_bit14_vals), PHBID_BIT14_MASK, NULL, HFILL}},
3986 { &hf_ldp_tlv_diffserv_phbid_bit15,
3987 { PHBID_BIT15_DESCRIPTION, "ldp.msg.tlv.diffserv.phbid.bit15", FT_UINT16, BASE_DEC,
3988 VALS(phbid_bit15_vals), PHBID_BIT15_MASK, NULL, HFILL}},
3990 { &hf_ldp_tlv_fec_gen_agi_type,
3991 { "AGI Type", "ldp.msg.tlv.fec.gen.agi.type", FT_UINT8, BASE_DEC,
3992 NULL, 0x0, "Attachment Group Identifier Type", HFILL}},
3994 { &hf_ldp_tlv_fec_gen_agi_length,
3995 { "AGI Length", "ldp.msg.tlv.fec.gen.agi.length", FT_UINT8, BASE_DEC,
3996 NULL, 0x0, "Attachment Group Identifier Length", HFILL}},
3998 { &hf_ldp_tlv_fec_gen_agi_value,
3999 { "AGI Value", "ldp.msg.tlv.fec.gen.agi.value", FT_BYTES, BASE_NONE,
4000 NULL, 0x0, "Attachment Group Identifier Value", HFILL}},
4002 { &hf_ldp_tlv_fec_gen_saii_type,
4003 { "SAII Type", "ldp.msg.tlv.fec.gen.saii.type", FT_UINT8, BASE_DEC,
4004 NULL, 0x0, "Source Attachment Individual Identifier Type", HFILL}},
4006 { &hf_ldp_tlv_fec_gen_saii_length,
4007 { "SAII Length", "ldp.msg.tlv.fec.gen.saii.length", FT_UINT8, BASE_DEC,
4008 NULL, 0x0, "Source Attachment Individual Identifier Length", HFILL}},
4010 { &hf_ldp_tlv_fec_gen_saii_value,
4011 { "SAII Value", "ldp.msg.tlv.fec.gen.saii.value", FT_BYTES, BASE_NONE,
4012 NULL, 0x0, "Source Attachment Individual Identifier Value", HFILL}},
4014 { &hf_ldp_tlv_fec_gen_taii_type,
4015 { "TAII Type", "ldp.msg.tlv.fec.gen.taii.type", FT_UINT8, BASE_DEC,
4016 NULL, 0x0, "Target Attachment Individual Identifier Type", HFILL}},
4018 { &hf_ldp_tlv_fec_gen_taii_length,
4019 { "TAII length", "ldp.msg.tlv.fec.gen.taii.length", FT_UINT8, BASE_DEC,
4020 NULL, 0x0, "Target Attachment Individual Identifier Length", HFILL}},
4022 { &hf_ldp_tlv_fec_gen_taii_value,
4023 { "TAII Value", "ldp.msg.tlv.fec.gen.taii.value", FT_BYTES, BASE_NONE,
4024 NULL, 0x0, "Target Attachment Individual Identifier Value", HFILL}},
4026 { &hf_ldp_tlv_fec_gen_aai_globalid,
4027 { "Global Id", "ldp.msg.tlv.fec.gen.aii.globalid", FT_UINT32, BASE_DEC,
4028 NULL, 0x0, "Attachment Individual Identifier Global Id", HFILL}},
4030 { &hf_ldp_tlv_fec_gen_aai_prefix,
4031 { "Prefix", "ldp.msg.tlv.fec.gen.aii.prefix", FT_UINT32, BASE_DEC,
4032 NULL, 0x0, "Attachment Individual Identifier Prefix", HFILL}},
4034 { &hf_ldp_tlv_fec_gen_aai_ac_id,
4035 { "Prefix", "ldp.msg.tlv.fec.gen.aii.acid", FT_UINT32, BASE_DEC,
4036 NULL, 0x0, "Attachment Individual Identifier AC Id", HFILL}},
4038 { &hf_ldp_tlv_pw_status_data,
4039 { "PW Status", "ldp.msg.tlv.pwstatus.code", FT_UINT32, BASE_HEX,
4040 NULL, 0, NULL, HFILL }},
4042 { &hf_ldp_tlv_pw_not_forwarding,
4043 { "Pseudowire Not Forwarding", "ldp.msg.tlv.pwstatus.code.pwnotforward", FT_BOOLEAN, 32,
4044 TFS(&tfs_set_notset), PW_NOT_FORWARDING, NULL, HFILL }},
4046 { &hf_ldp_tlv_pw_lac_ingress_recv_fault,
4047 { "Local Attachment Circuit (ingress) Receive Fault", "ldp.msg.tlv.pwstatus.code.pwlacingressrecvfault",
4048 FT_BOOLEAN, 32, TFS(&tfs_set_notset), PW_LAC_INGRESS_RECV_FAULT, NULL, HFILL }},
4050 { &hf_ldp_tlv_pw_lac_egress_recv_fault,
4051 { "Local Attachment Circuit (egress) Transmit Fault", "ldp.msg.tlv.pwstatus.code.pwlacegresstransfault",
4052 FT_BOOLEAN, 32, TFS(&tfs_set_notset), PW_LAC_EGRESS_TRANS_FAULT, NULL, HFILL }},
4054 { &hf_ldp_tlv_pw_psn_pw_ingress_recv_fault,
4055 { "Local PSN-facing PW (ingress) Receive Fault", "ldp.msg.tlv.pwstatus.code.pwpsnpwingressrecvfault",
4056 FT_BOOLEAN, 32, TFS(&tfs_set_notset), PW_PSN_PW_INGRESS_RECV_FAULT, NULL, HFILL }},
4058 { &hf_ldp_tlv_pw_psn_pw_egress_recv_fault,
4059 { "Local PSN-facing PW (egress) Transmit Fault", "ldp.msg.tlv.pwstatus.code.pwpsnpwegresstransfault",
4060 FT_BOOLEAN, 32, TFS(&tfs_set_notset), PW_PSN_PW_EGRESS_TRANS_FAULT, NULL, HFILL }},
4062 { &hf_ldp_tlv_pw_grouping_value,
4063 { "Value", "ldp.msg.tlv.pwgrouping.value",
4064 FT_UINT32, BASE_DEC, NULL, 0x0,
4065 "PW Grouping Value", HFILL }},
4067 { &hf_ldp_tlv_intparam_length,
4068 { "Length", "ldp.msg.tlv.intparam.length", FT_UINT8, BASE_DEC,
4069 NULL, 0x0, "VC FEC Interface Parameter Length", HFILL }},
4071 { &hf_ldp_tlv_intparam_mtu,
4072 { "MTU", "ldp.msg.tlv.intparam.mtu", FT_UINT16, BASE_DEC,
4073 NULL, 0x0, "VC FEC Interface Parameter MTU", HFILL }},
4075 { &hf_ldp_tlv_intparam_tdmbps,
4076 { "BPS", "ldp.msg.tlv.intparam.tdmbps", FT_UINT32, BASE_DEC,
4077 NULL, 0x0, "VC FEC Interface Parameter CEP/TDM bit-rate", HFILL }},
4079 { &hf_ldp_tlv_intparam_id,
4080 { "ID", "ldp.msg.tlv.intparam.id", FT_UINT8, BASE_HEX,
4081 VALS(fec_vc_interfaceparm), 0x0, "VC FEC Interface Parameter ID", HFILL }},
4083 { &hf_ldp_tlv_intparam_maxcatmcells,
4084 { "Number of Cells", "ldp.msg.tlv.intparam.maxatm", FT_UINT16, BASE_DEC,
4085 NULL, 0x0, "VC FEC Interface Param Max ATM Concat Cells", HFILL }},
4087 { &hf_ldp_tlv_intparam_desc,
4088 { "Description", "ldp.msg.tlv.intparam.desc", FT_STRING, BASE_NONE,
4089 NULL, 0, "VC FEC Interface Description", HFILL }},
4091 { &hf_ldp_tlv_intparam_cepbytes,
4092 { "Payload Bytes", "ldp.msg.tlv.intparam.cepbytes", FT_UINT16, BASE_DEC,
4093 NULL, 0x0, "VC FEC Interface Param CEP/TDM Payload Bytes", HFILL }},
4095 { &hf_ldp_tlv_intparam_cepopt_ais,
4096 { "AIS", "ldp.msg.tlv.intparam.cepopt_ais", FT_BOOLEAN, 16,
4097 NULL, 0x8000, "VC FEC Interface Param CEP Option AIS", HFILL }},
4099 { &hf_ldp_tlv_intparam_cepopt_une,
4100 { "UNE", "ldp.msg.tlv.intparam.cepopt_une", FT_BOOLEAN, 16,
4101 NULL, 0x4000, "VC FEC Interface Param CEP Option Unequipped", HFILL }},
4103 { &hf_ldp_tlv_intparam_cepopt_rtp,
4104 { "RTP", "ldp.msg.tlv.intparam.cepopt_rtp", FT_BOOLEAN, 16,
4105 NULL, 0x2000, "VC FEC Interface Param CEP Option RTP Header", HFILL }},
4107 { &hf_ldp_tlv_intparam_cepopt_ebm,
4108 { "EBM", "ldp.msg.tlv.intparam.cepopt_ebm", FT_BOOLEAN, 16,
4109 NULL, 0x1000, "VC FEC Interface Param CEP Option EBM Header", HFILL }},
4111 { &hf_ldp_tlv_intparam_cepopt_mah,
4112 { "MAH", "ldp.msg.tlv.intparam.cepopt_mah", FT_BOOLEAN, 16,
4113 NULL, 0x0800, "VC FEC Interface Param CEP Option MPLS Adaptation header", HFILL }},
4115 { &hf_ldp_tlv_intparam_cepopt_res,
4116 { "Reserved", "ldp.msg.tlv.intparam.cepopt_res", FT_UINT16, BASE_HEX,
4117 NULL , 0x07E0, "VC FEC Interface Param CEP Option Reserved", HFILL }},
4119 { &hf_ldp_tlv_intparam_cepopt_ceptype,
4120 { "CEP Type", "ldp.msg.tlv.intparam.cepopt_ceptype", FT_UINT16, BASE_HEX,
4121 VALS(fec_vc_ceptype_vals), 0x001C, "VC FEC Interface Param CEP Option CEP Type", HFILL }},
4123 { &hf_ldp_tlv_intparam_cepopt_t3,
4124 { "Async T3", "ldp.msg.tlv.intparam.cepopt_t3", FT_BOOLEAN, 16,
4125 NULL, 0x0002, "VC FEC Interface Param CEP Option Async T3", HFILL }},
4127 { &hf_ldp_tlv_intparam_cepopt_e3,
4128 { "Async E3", "ldp.msg.tlv.intparam.cepopt_e3", FT_BOOLEAN, 16,
4129 NULL, 0x0001, "VC FEC Interface Param CEP Option Async E3", HFILL }},
4131 { &hf_ldp_tlv_intparam_vlanid,
4132 { "VLAN Id", "ldp.msg.tlv.intparam.vlanid", FT_UINT16, BASE_DEC,
4133 NULL, 0x0, "VC FEC Interface Param VLAN Id", HFILL }},
4135 { &hf_ldp_tlv_intparam_dlcilen,
4136 { "DLCI Length", "ldp.msg.tlv.intparam.dlcilen", FT_UINT16, BASE_DEC,
4137 NULL, 0x0, "VC FEC Interface Parameter Frame-Relay DLCI Length", HFILL }},
4139 { &hf_ldp_tlv_intparam_fcslen,
4140 { "FCS Length", "ldp.msg.tlv.intparam.fcslen", FT_UINT16, BASE_DEC,
4141 NULL, 0x0, "VC FEC Interface Parameter FCS Length", HFILL }},
4143 { &hf_ldp_tlv_intparam_tdmopt_r,
4144 { "R Bit", "ldp.msg.tlv.intparam.tdmopt_r", FT_BOOLEAN, 16,
4145 TFS(&fec_vc_tdmopt_r), 0x8000, "VC FEC Interface Param TDM Options RTP Header", HFILL }},
4147 { &hf_ldp_tlv_intparam_tdmopt_d,
4148 { "D Bit", "ldp.msg.tlv.intparam.tdmopt_d", FT_BOOLEAN, 16,
4149 TFS(&fec_vc_tdmopt_d), 0x4000, "VC FEC Interface Param TDM Options Dynamic Timestamp", HFILL }},
4151 { &hf_ldp_tlv_intparam_tdmopt_f,
4152 { "F Bit", "ldp.msg.tlv.intparam.tdmopt_f", FT_BOOLEAN, 16,
4153 TFS(&fec_vc_tdmopt_f), 0x2000, "VC FEC Interface Param TDM Options Flavor bit", HFILL }},
4155 { &hf_ldp_tlv_intparam_tdmopt_res1,
4156 { "RSVD-1", "ldp.msg.tlv.intparam.tdmopt_res1", FT_UINT16, BASE_HEX,
4157 NULL, 0x1FFF, "VC FEC Interface Param TDM Options Reserved", HFILL }},
4159 { &hf_ldp_tlv_intparam_tdmopt_pt,
4160 { "PT", "ldp.msg.tlv.intparam.tdmopt_pt", FT_UINT8, BASE_DEC,
4161 NULL, 0x7F, "VC FEC Interface Param TDM Options Payload Type", HFILL }},
4163 { &hf_ldp_tlv_intparam_tdmopt_res2,
4164 { "RSVD-2", "ldp.msg.tlv.intparam.tdmopt_res2", FT_UINT8, BASE_HEX,
4165 NULL, 0x00, "VC FEC Interface Param TDM Options Reserved", HFILL }},
4167 { &hf_ldp_tlv_intparam_tdmopt_freq,
4168 { "FREQ", "ldp.msg.tlv.intparam.tdmopt_freq", FT_UINT16, BASE_DEC,
4169 NULL, 0x00, "VC FEC Interface Param TDM Options Frequency", HFILL }},
4171 { &hf_ldp_tlv_intparam_tdmopt_ssrc,
4172 { "SSRC", "ldp.msg.tlv.intparam.tdmopt_ssrc", FT_UINT32, BASE_HEX,
4173 NULL, 0x00, "VC FEC Interface Param TDM Options SSRC", HFILL }},
4175 { &hf_ldp_tlv_intparam_vccv_cctype_cw,
4176 { "PWE3 Control Word", "ldp.msg.tlv.intparam.vccv.cctype_cw", FT_BOOLEAN, 8,
4177 NULL, 0x01, "VC FEC Interface Param VCCV CC Type PWE3 CW", HFILL }},
4179 { &hf_ldp_tlv_intparam_vccv_cctype_mplsra,
4180 { "MPLS Router Alert", "ldp.msg.tlv.intparam.vccv.cctype_mplsra", FT_BOOLEAN, 8,
4181 NULL, 0x02, "VC FEC Interface Param VCCV CC Type MPLS Router Alert", HFILL }},
4183 { &hf_ldp_tlv_intparam_vccv_cctype_ttl1,
4184 { "MPLS Inner Label TTL = 1", "ldp.msg.tlv.intparam.vccv.cctype_ttl1", FT_BOOLEAN, 8,
4185 NULL, 0x04, "VC FEC Interface Param VCCV CC Type Inner Label TTL 1", HFILL }},
4187 { &hf_ldp_tlv_intparam_vccv_cvtype_icmpping,
4188 { "ICMP Ping", "ldp.msg.tlv.intparam.vccv.cvtype_icmpping", FT_BOOLEAN, 8,
4189 NULL, 0x01, "VC FEC Interface Param VCCV CV Type ICMP Ping", HFILL }},
4191 { &hf_ldp_tlv_intparam_vccv_cvtype_lspping,
4192 { "LSP Ping", "ldp.msg.tlv.intparam.vccv.cvtype_lspping", FT_BOOLEAN, 8,
4193 NULL, 0x02, "VC FEC Interface Param VCCV CV Type LSP Ping", HFILL }},
4195 { &hf_ldp_tlv_intparam_vccv_cvtype_bfd,
4196 { "BFD", "ldp.msg.tlv.intparam.vccv.cvtype_bfd", FT_BOOLEAN, 8,
4197 NULL, 0x04, "VC FEC Interface Param VCCV CV Type BFD", HFILL }},
4199 { &hf_ldp_tlv_upstr_sbit,
4200 { "S-Bit", "ldp.msg.tlv.upstream.sbit", FT_BOOLEAN, 8,
4201 TFS(&tlv_upstr_sbit_vals), 0x80, "Upstream Label Assignment Capability State Bit", HFILL }},
4203 { &hf_ldp_tlv_upstr_lbl_req_resvbit,
4204 { "Reserved Bits", "ldp.msg.tlv.upstream_label_req.resvbit", FT_UINT32, BASE_HEX,
4205 NULL, 0x0, NULL, HFILL }},
4207 { &hf_ldp_tlv_upstr_ass_lbl,
4208 { "Upstream-Assigned Label", "ldp.msg.tlv.upstream.label", FT_UINT32, BASE_HEX,
4209 NULL, 0x0, NULL, HFILL }},
4211 { &hf_ldp_tlv_upstr_lbl_resvbit,
4212 { "Reserved Bits", "ldp.msg.tlv.upstream.resvbit", FT_UINT32, BASE_HEX,
4213 NULL, 0x0, NULL, HFILL }},
4215 { &hf_ldp_tlv_ipv4_intID_hop_addr,
4216 { "IPv4 Next/Previous Hop Address", "ldp.msg.tlv.ipv4_interface_ID.hop_addr", FT_IPv4, BASE_NONE,
4217 NULL, 0x0, NULL, HFILL }},
4219 { &hf_ldp_tlv_logical_intID,
4220 { "Logical Interface ID", "ldp.msg.tlv.interface_ID.logical_intID", FT_UINT32, BASE_HEX,
4221 NULL, 0x0, NULL, HFILL }},
4223 { &hf_ldp_tlv_ip_multicast_srcaddr,
4224 { "Source Address", "ldp.msg.tlv.ip_multicast.ipv4_srcaddr", FT_IPv4, BASE_NONE,
4225 NULL, 0x0, NULL, HFILL }},
4227 { &hf_ldp_tlv_ip_multicast_mltcstaddr,
4228 { "Multicast Group Address", "ldp.msg.tlv.ip_multicast.ipv4_maddr", FT_IPv4, BASE_NONE,
4229 NULL, 0x0, NULL, HFILL }},
4231 { &hf_ldp_tlv_ip_mpls_context_srcaddr,
4232 { "Source Address", "ldp.msg.tlv.ip_mpls_context.ipv4_srcaddr", FT_IPv4, BASE_NONE,
4233 NULL, 0x0, NULL, HFILL }},
4235 { &hf_ldp_tlv_ldp_p2mp_lsptype,
4236 { "P2MP Type", "ldp.msg.tlv.ldp_p2mp.type", FT_UINT8, BASE_HEX,
4237 NULL, 0x0, "TLV Type", HFILL }},
4239 { &hf_ldp_tlv_ldp_p2mp_addrfam,
4240 { "Address Family", "ldp.msg.tlv.ldp_p2mp.addr_family", FT_UINT16, BASE_HEX,
4241 NULL, 0x0, NULL, HFILL }},
4243 { &hf_ldp_tlv_ldp_p2mp_addrlen,
4244 { "Address Length", "ldp.msg.tlv.ldp_p2mp.addr_len", FT_UINT8, BASE_HEX,
4245 NULL, 0x0, NULL, HFILL }},
4247 { &hf_ldp_tlv_ldp_p2mp_rtnodeaddr,
4248 { "Root Node Address", "ldp.msg.tlv.ldp_p2mp.ipv4_rtnodeaddr", FT_IPv4, BASE_NONE,
4249 NULL, 0x0, NULL, HFILL }},
4251 { &hf_ldp_tlv_ldp_p2mp_oplength,
4252 { "Opaque Length", "ldp.msg.tlv.ldp_p2mp.oplength", FT_UINT16, BASE_DEC,
4253 NULL, 0x0, NULL, HFILL }},
4255 { &hf_ldp_tlv_ldp_p2mp_opvalue,
4256 { "Opaque Value", "ldp.msg.tlv.ldp_p2mp.opvalue", FT_BYTES, BASE_NONE,
4257 NULL, 0x0, NULL, HFILL }},
4259 { &hf_ldp_tlv_rsvp_te_p2mp_id,
4260 { "P2MP ID", "ldp.msg.tlv.rsvp_te_p2mp.id", FT_UINT32, BASE_HEX,
4261 NULL, 0x0, NULL, HFILL }},
4263 { &hf_ldp_tlv_must_be_zero,
4264 { "MUST be zero", "ldp.msg.tlv.rsvp_te_p2mp.zero", FT_UINT16, BASE_HEX,
4265 NULL, 0x0, NULL, HFILL }},
4267 { &hf_ldp_tlv_tunnel_id,
4268 { "Tunnel ID", "ldp.msg.tlv.rsvp_te_p2mp.tunnel_id", FT_UINT16, BASE_HEX,
4269 NULL, 0x0, NULL, HFILL }},
4271 { &hf_ldp_tlv_ext_tunnel_id,
4272 { "Extended Tunnel ID", "ldp.msg.tlv.rsvp_te_p2mp.ipv4_ext_tunnel_id", FT_IPv4, BASE_NONE,
4273 NULL, 0x0, NULL, HFILL }},
4275 { &hf_ldp_tlv_inv_length,
4276 { "Invalid length", "ldp.msg.tlv.invalid.length", FT_UINT16, BASE_HEX,
4277 NULL, 0x0, NULL, HFILL }},
4280 static gint *ett[] = {
4281 &ett_ldp,
4282 &ett_ldp_header,
4283 &ett_ldp_ldpid,
4284 &ett_ldp_message,
4285 &ett_ldp_tlv,
4286 &ett_ldp_tlv_val,
4287 &ett_ldp_tlv_ft_flags,
4288 &ett_ldp_fec,
4289 &ett_ldp_fec_vc_interfaceparam,
4290 &ett_ldp_fec_vc_interfaceparam_cepopt,
4291 &ett_ldp_fec_vc_interfaceparam_vccvtype,
4292 &ett_ldp_diffserv_map,
4293 &ett_ldp_diffserv_map_phbid,
4294 &ett_ldp_gen_agi,
4295 &ett_ldp_gen_saii,
4296 &ett_ldp_gen_taii,
4297 &ett_ldp_gen_aai_type2,
4298 &ett_ldp_sub_tlv
4301 static ei_register_info ei[] = {
4302 { &ei_ldp_dtsm_and_target, { "ldp.dtsm_and_target", PI_PROTOCOL, PI_WARN,"ERROR - Both GTSM and Target Flag are enabled.", EXPFILL }},
4303 { &ei_ldp_gtsm_supported, { "ldp.gtsm_supported", PI_PROTOCOL, PI_CHAT,"GTSM is supported by the source", EXPFILL }},
4304 { &ei_ldp_gtsm_not_supported_basic_discovery, { "ldp.gtsm_not_supported_basic_discovery", PI_PROTOCOL, PI_WARN,"GTSM is not supported by the source, since basic discovery is not enabled", EXPFILL }},
4305 { &ei_ldp_gtsm_not_supported, { "ldp.gtsm_not_supported", PI_PROTOCOL, PI_CHAT,"GTSM is not supported by the source", EXPFILL }},
4306 { &ei_ldp_inv_length, { "ldp.invalid_length", PI_MALFORMED, PI_ERROR,"Length of the packet is malformed", EXPFILL }},
4307 { &ei_ldp_address_family_not_implemented, { "ldp.address_family_not_implemented", PI_UNDECODED, PI_WARN, "Support for Address Family not implemented", EXPFILL }},
4308 { &ei_ldp_tlv_fec, { "ldp.msg.tlv.fec.error", PI_PROTOCOL, PI_ERROR, "Error in FEC Element %u", EXPFILL }},
4309 { &ei_ldp_tlv_fec_len, { "ldp.msg.tlv.fec.len.invalid", PI_PROTOCOL, PI_ERROR, "Invalid prefix %u length for family %s", EXPFILL }},
4310 { &ei_ldp_tlv_fec_vc_infolength, { "ldp.msg.tlv.fec.vc.infolength.invalid", PI_PROTOCOL, PI_ERROR, "VC FEC size format error", EXPFILL }},
4311 { &ei_ldp_malformed_interface_parameter, { "ldp.malformed_interface_parameter", PI_MALFORMED, PI_ERROR, "Malformed interface parameter", EXPFILL }},
4312 { &ei_ldp_malformed_data, { "ldp.malformed_data", PI_MALFORMED, PI_ERROR, "Malformed data", EXPFILL }},
4313 { &ei_ldp_tlv_fec_type, { "ldp.msg.tlv.fec.unknown", PI_PROTOCOL, PI_WARN, "Unknown FEC TLV type", EXPFILL }},
4317 module_t *ldp_module;
4318 expert_module_t* expert_ldp;
4320 proto_ldp = proto_register_protocol("Label Distribution Protocol",
4321 "LDP", "ldp");
4323 proto_register_field_array(proto_ldp, hf, array_length(hf));
4324 proto_register_subtree_array(ett, array_length(ett));
4325 expert_ldp = expert_register_protocol(proto_ldp);
4326 expert_register_field_array(expert_ldp, ei, array_length(ei));
4328 /* Register our configuration options for , particularly our port */
4330 ldp_module = prefs_register_protocol(proto_ldp, proto_reg_handoff_ldp);
4332 prefs_register_uint_preference(ldp_module, "tcp.port", "LDP TCP Port",
4333 "Set the TCP port for messages (if other"
4334 " than the default of 646)",
4335 10, &global_ldp_tcp_port);
4337 prefs_register_uint_preference(ldp_module, "udp.port", "LDP UDP Port",
4338 "Set the UDP port for messages (if other"
4339 " than the default of 646)",
4340 10, &global_ldp_udp_port);
4342 prefs_register_bool_preference(ldp_module, "desegment_ldp_messages",
4343 "Reassemble LDP messages spanning multiple TCP segments",
4344 "Whether the LDP dissector should reassemble messages spanning multiple TCP segments."
4345 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\""
4346 " in the TCP protocol settings.",
4347 &ldp_desegment);
4350 /* The registration hand-off routine */
4351 void
4352 proto_reg_handoff_ldp(void)
4354 static gboolean ldp_prefs_initialized = FALSE;
4355 static dissector_handle_t ldp_tcp_handle, ldp_handle;
4356 static int tcp_port;
4357 static int udp_port;
4360 if (!ldp_prefs_initialized) {
4362 ldp_tcp_handle = new_create_dissector_handle(dissect_ldp_tcp, proto_ldp);
4363 ldp_handle = new_create_dissector_handle(dissect_ldp, proto_ldp);
4365 ldp_prefs_initialized = TRUE;
4368 else {
4370 dissector_delete_uint("tcp.port", tcp_port, ldp_tcp_handle);
4371 dissector_delete_uint("udp.port", udp_port, ldp_handle);
4375 /* Set our port number for future use */
4377 tcp_port = global_ldp_tcp_port;
4378 udp_port = global_ldp_udp_port;
4380 dissector_add_uint("tcp.port", global_ldp_tcp_port, ldp_tcp_handle);
4381 dissector_add_uint("udp.port", global_ldp_udp_port, ldp_handle);