|
1 Index: epan/oui.h |
|
2 =================================================================== |
|
3 --- epan/oui.h (revision 41973) |
|
4 +++ epan/oui.h (working copy) |
|
5 @@ -47,6 +47,7 @@ |
|
6 #define OUI_ERICSSON 0x0001EC /* Ericsson Group */ |
|
7 #define OUI_CATENA 0x00025A /* Catena Networks */ |
|
8 #define OUI_ATHEROS 0x00037F /* Atheros Communications */ |
|
9 +#define OUI_ORACLE 0x0003BA /* Oracle */ |
|
10 #define OUI_SONY_ERICSSON 0x000AD9 /* Sony Ericsson Mobile Communications AB */ |
|
11 #define OUI_SONY_ERICSSON_2 0x000E07 /* Sony Ericsson Mobile Communications AB */ |
|
12 #define OUI_PROFINET 0x000ECF /* PROFIBUS Nutzerorganisation e.V. */ |
|
13 Index: epan/etypes.h |
|
14 =================================================================== |
|
15 --- epan/etypes.h (revision 41973) |
|
16 +++ epan/etypes.h (working copy) |
|
17 @@ -463,6 +463,10 @@ |
|
18 #define ETHERTYPE_TTE_PCF 0x891D /* TTEthernet Protocol Control Frame */ |
|
19 #endif |
|
20 |
|
21 +#ifndef ETHERTYPE_ECP |
|
22 +#define ETHERTYPE_ECP 0x8940 /* Edge Control Protocol */ |
|
23 +#endif |
|
24 + |
|
25 #ifndef ETHERTYPE_LOOP |
|
26 #define ETHERTYPE_LOOP 0x9000 /* used for layer 2 testing (do i see my own frames on the wire) */ |
|
27 #endif |
|
28 Index: epan/dissectors/packet-ecp.c |
|
29 =================================================================== |
|
30 --- epan/dissectors/packet-ecp.c (revision 0) |
|
31 +++ epan/dissectors/packet-ecp.c (revision 0) |
|
32 @@ -0,0 +1,616 @@ |
|
33 +/* packet-ecp.c |
|
34 + * Routines for Solaris ECP/VDP dissection based on IEEE 802.1Qbg Draft 2.1 |
|
35 + * |
|
36 + * Wireshark - Network traffic analyzer |
|
37 + * By Gerald Combs <[email protected]> |
|
38 + * Copyright 1998 Gerald Combs |
|
39 + * |
|
40 + * This program is free software; you can redistribute it and/or |
|
41 + * modify it under the terms of the GNU General Public License |
|
42 + * as published by the Free Software Foundation; either version 2 |
|
43 + * of the License, or (at your option) any later version. |
|
44 + * |
|
45 + * This program is distributed in the hope that it will be useful, |
|
46 + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
47 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
48 + * GNU General Public License for more details. |
|
49 + * |
|
50 + * You should have received a copy of the GNU General Public License |
|
51 + * along with this program; if not, write to the Free Software |
|
52 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
53 + */ |
|
54 + |
|
55 +#ifdef HAVE_CONFIG_H |
|
56 +# include "config.h" |
|
57 +#endif |
|
58 + |
|
59 +#include <stdio.h> |
|
60 +#include <epan/packet.h> |
|
61 +#include <epan/etypes.h> |
|
62 +#include <epan/oui.h> |
|
63 + |
|
64 +static int proto_ecp = -1; |
|
65 +static int hf_ecp_version = -1; |
|
66 +static int hf_ecp_op = -1; |
|
67 +static int hf_ecp_subtype = -1; |
|
68 +static int hf_ecp_seqno = -1; |
|
69 + |
|
70 +static int proto_vdp = -1; |
|
71 +static int hf_vdp_tlv_type = -1; |
|
72 +static int hf_vdp_tlv_len = -1; |
|
73 +static int hf_vdp_tlv_assoc_reason = -1; |
|
74 +static int hf_vdp_tlv_org_oui = -1; |
|
75 +static int hf_vdp_vsitypeid = -1; |
|
76 +static int hf_vdp_vsiversion = -1; |
|
77 +static int hf_vdp_vsiid_format = -1; |
|
78 +static int hf_vdp_filter_format = -1; |
|
79 + |
|
80 +static int hf_oui_oracle_subtype = -1; |
|
81 +static int hf_oui_oracle_encoding = -1; |
|
82 + |
|
83 +static gint ett_ecp = -1; |
|
84 +static gint ett_vdp_tlv = -1; |
|
85 +static gint ett_vdp_tlv_mgrid = -1; |
|
86 +static gint ett_vdp_tlv_assoc = -1; |
|
87 +static gint ett_vdp_tlv_org = -1; |
|
88 + |
|
89 +static dissector_handle_t data_handle; |
|
90 + |
|
91 +#define ECP_OP_REQ 0x0 |
|
92 +#define ECP_OP_ACK 0x1 |
|
93 + |
|
94 +#define ECP_SUBTYPE_VDP 0x0001 |
|
95 +#define ECP_SUBTYPE_PECSP 0x0002 |
|
96 + |
|
97 +#define VDP_TLV_PREASSOC 0x01 |
|
98 +#define VDP_TLV_PREASSOCRR 0x02 |
|
99 +#define VDP_TLV_ASSOC 0x03 |
|
100 +#define VDP_TLV_DEASSOC 0x04 |
|
101 +#define VDP_TLV_MGRID 0x05 |
|
102 +#define VDP_TLV_ORG 0x7F |
|
103 + |
|
104 +#define VSI_FMT_IPv4 0x01 |
|
105 +#define VSI_FMT_IPv6 0x02 |
|
106 +#define VSI_FMT_MAC 0x03 |
|
107 +#define VSI_FMT_LOCAL 0x04 |
|
108 +#define VSI_FMT_UUID 0x05 |
|
109 + |
|
110 +#define VDP_FILTER_VID 0x01 |
|
111 +#define VDP_FILTER_MACVID 0x02 |
|
112 +#define VDP_FILTER_GRPVID 0x03 |
|
113 +#define VDP_FILTER_GRPMACVID 0x04 |
|
114 + |
|
115 +/* Masks - from packet-lldp.c */ |
|
116 +#define TLV_TYPE_MASK 0xFE00 |
|
117 +#define TLV_TYPE(value) (((value) & TLV_TYPE_MASK) >> 9) |
|
118 +#define TLV_INFO_LEN_MASK 0x01FF |
|
119 +#define TLV_INFO_LEN(value) ((value) & TLV_INFO_LEN_MASK) |
|
120 + |
|
121 +#define ECP_VERSION_MASK 0xF000 |
|
122 +#define ECP_OP_MASK 0x0C00 |
|
123 +#define ECP_SUBTYPE_MASK 0x03FF |
|
124 + |
|
125 +#define ECP_VERSION(value) (((value) & ECP_VERSION_MASK) >> 12) |
|
126 +#define ECP_OP(value) (((value) & ECP_OP_MASK) >> 10) |
|
127 +#define ECP_SUBTYPE(value) (((value) & ECP_SUBTYPE_MASK)) |
|
128 + |
|
129 +#define OUI_ORACLE_VSIMGR_SUBTYPE 0x01 |
|
130 + |
|
131 +/* |
|
132 + * Hash table for translating OUIs to a dissector table/field info pair; |
|
133 + * the dissector table maps PID values to dissectors, and the field |
|
134 + * corresponds to the PID for that OUI. |
|
135 + */ |
|
136 +typedef struct { |
|
137 + dissector_table_t table; |
|
138 + hf_register_info *field_info; |
|
139 +} oui_info_t; |
|
140 + |
|
141 +static GHashTable *oui_info_table = NULL; |
|
142 + |
|
143 +static const value_string ecp_op_vals[] = { |
|
144 + { ECP_OP_REQ, "ECP request" }, |
|
145 + { ECP_OP_ACK, "ECP acknowledgement" }, |
|
146 + { 0, NULL } |
|
147 +}; |
|
148 + |
|
149 +static const value_string ecp_subtype_vals[] = { |
|
150 + { ECP_SUBTYPE_VDP, "VDP" }, |
|
151 + { 0, NULL } |
|
152 +}; |
|
153 + |
|
154 +static const value_string vdp_tlv_type_vals[] = { |
|
155 + { VDP_TLV_PREASSOC, "PreAssociate" }, |
|
156 + { VDP_TLV_PREASSOCRR, "PreAssociate with RR" }, |
|
157 + { VDP_TLV_ASSOC, "Associate" }, |
|
158 + { VDP_TLV_DEASSOC, "DeAssociate" }, |
|
159 + { VDP_TLV_MGRID, "VSI Manager ID" }, |
|
160 + { VDP_TLV_ORG, "Orgnaizationally defined TLV" }, |
|
161 + { 0x0, NULL } |
|
162 +}; |
|
163 + |
|
164 +static const value_string vdp_tlv_oui_vals[] = { |
|
165 + { OUI_ORACLE, "Oracle" }, |
|
166 + { 0x0, NULL } |
|
167 +}; |
|
168 + |
|
169 +static const value_string oui_oracle_subtype_vals[] = { |
|
170 + { OUI_ORACLE_VSIMGR_SUBTYPE, "VSI Manager Subtype" }, |
|
171 + { 0x0, NULL } |
|
172 +}; |
|
173 + |
|
174 +static const value_string oui_oracle_encoding_vals[] = { |
|
175 + { 0x1, "oracle_vsi_v1" }, |
|
176 + { 0x0, NULL } |
|
177 +}; |
|
178 + |
|
179 +static const value_string vdp_response_error_type_vals[] = { |
|
180 + { 0x0, "Success" }, |
|
181 + { 0x1, "Invalid Format" }, |
|
182 + { 0x2, "Insufficient Resource" }, |
|
183 + { 0x3, "Unable to Contact VSI Manager" }, |
|
184 + { 0x4, "Other Failure" }, |
|
185 + { 0x5, "Invalid VID, GroupID, or Mac address" }, |
|
186 + { 0x0, NULL } |
|
187 +}; |
|
188 + |
|
189 +static const value_string vdp_vsiid_format_vals[] = { |
|
190 + { VSI_FMT_IPv4, "IPv4" }, |
|
191 + { VSI_FMT_IPv6, "IPv6" }, |
|
192 + { VSI_FMT_MAC, "MAC" }, |
|
193 + { VSI_FMT_LOCAL, "Local" }, |
|
194 + { VSI_FMT_UUID, "UUID" }, |
|
195 + { 0x0, NULL } |
|
196 +}; |
|
197 + |
|
198 +static const value_string vdp_filter_format_vals[] = { |
|
199 + { VDP_FILTER_VID, "VID" }, |
|
200 + { VDP_FILTER_MACVID, "MAC/VID" }, |
|
201 + { VDP_FILTER_GRPVID, "GroupID/VID" }, |
|
202 + { VDP_FILTER_GRPMACVID, "GroupID/MAC/VID" }, |
|
203 + { 0x0, NULL } |
|
204 +}; |
|
205 + |
|
206 +static void |
|
207 +vdp_add_vidstr(tvbuff_t *tvb, proto_tree *tree, guint32 offset, proto_item *ti) |
|
208 +{ |
|
209 + guint16 val; |
|
210 + guint ps, pcp, vid; |
|
211 + |
|
212 + val = tvb_get_ntohs(tvb, offset); |
|
213 + ps = (val >> 12) & 0x8; |
|
214 + pcp = (val >> 12) & 0x7; |
|
215 + vid = val & 0x0FFF; |
|
216 + if (tree) { |
|
217 + if (ti == NULL) |
|
218 + proto_tree_add_text(tree, tvb, offset, 2, |
|
219 + "PS %u, PCP %u, VID %u", ps, pcp, vid); |
|
220 + else |
|
221 + proto_item_append_text(ti, |
|
222 + "PS %u, PCP %u, VID %u", ps, pcp, vid); |
|
223 + } |
|
224 +} |
|
225 + |
|
226 +static gint32 |
|
227 +dissect_vdp_tlv_assoc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset, guint8 tlvtype) |
|
228 +{ |
|
229 + proto_tree *vdp_tlv_assoc_tree; |
|
230 + proto_item *ti; |
|
231 + guint16 tlvhdr; |
|
232 + guint32 tlvlen = 0; |
|
233 + guint8 reason, flags; |
|
234 + gboolean request; |
|
235 + |
|
236 + if (tree) { |
|
237 + if (tlvtype == VDP_TLV_ASSOC) |
|
238 + ti = proto_tree_add_text(tree, tvb, offset, 2, |
|
239 + "VDP Associate"); |
|
240 + else |
|
241 + ti = proto_tree_add_text(tree, tvb, offset, 2, |
|
242 + "VDP DeAssociate"); |
|
243 + vdp_tlv_assoc_tree = proto_item_add_subtree(ti, |
|
244 + ett_vdp_tlv_assoc); |
|
245 + } |
|
246 + |
|
247 + tlvhdr = tvb_get_ntohs(tvb, offset); |
|
248 + tlvlen = TLV_INFO_LEN(tlvhdr); |
|
249 + offset += 2; |
|
250 + |
|
251 + /* Reason */ |
|
252 + reason = tvb_get_bits8(tvb, offset, 8); |
|
253 + flags = reason >> 4; |
|
254 + request = !(flags & 0x4); |
|
255 + if (tree) { |
|
256 + ti = proto_tree_add_item(vdp_tlv_assoc_tree, |
|
257 + hf_vdp_tlv_assoc_reason, tvb, offset, 1, ENC_BIG_ENDIAN); |
|
258 + if (request) { |
|
259 + proto_item_append_text(ti, " Request"); |
|
260 + if (flags != 0) { |
|
261 + proto_item_append_text(ti, "; Flags (%x)", |
|
262 + flags); |
|
263 + if (flags & 0x1) |
|
264 + proto_item_append_text(ti, " M-Bit"); |
|
265 + if (flags & 0x2) |
|
266 + proto_item_append_text(ti, " S-Bit"); |
|
267 + } |
|
268 + } else { |
|
269 + guint8 error = reason & 0x0F; |
|
270 + const char *errorstr; |
|
271 + |
|
272 + proto_item_append_text(ti, " Response"); |
|
273 + errorstr = val_to_str(error, |
|
274 + vdp_response_error_type_vals, "Unknown error"); |
|
275 + proto_item_append_text(ti, "%s", errorstr); |
|
276 + if ((flags & 0x0F) != 0) { |
|
277 + proto_item_append_text(ti, "; Flags (%x)", |
|
278 + flags); |
|
279 + if (flags & 0x1) |
|
280 + proto_item_append_text(ti, |
|
281 + " Hard Error"); |
|
282 + if (flags & 0x2) |
|
283 + proto_item_append_text(ti, " Keep"); |
|
284 + } |
|
285 + } |
|
286 + } |
|
287 + offset++; |
|
288 + |
|
289 + if (tree) { |
|
290 + guint8 filter_format; |
|
291 + const char *str; |
|
292 + |
|
293 + /* VSITYPEID/VERSION */ |
|
294 + proto_tree_add_item(vdp_tlv_assoc_tree, |
|
295 + hf_vdp_vsitypeid, tvb, offset, 3, ENC_BIG_ENDIAN); |
|
296 + offset += 3; |
|
297 + proto_tree_add_item(vdp_tlv_assoc_tree, |
|
298 + hf_vdp_vsiversion, tvb, offset, 1, ENC_BIG_ENDIAN); |
|
299 + offset++; |
|
300 + |
|
301 + /* VSIID Format */ |
|
302 + proto_tree_add_item(vdp_tlv_assoc_tree, |
|
303 + hf_vdp_vsiid_format, tvb, offset, 1, ENC_BIG_ENDIAN); |
|
304 + offset++; |
|
305 + |
|
306 + /* VSIID */ |
|
307 + str = tvb_bytes_to_str_punct(tvb, offset, 16, ':'); |
|
308 + proto_tree_add_text(vdp_tlv_assoc_tree, tvb, offset, 16, |
|
309 + "VSIID: %s", str); |
|
310 + offset += 16; |
|
311 + |
|
312 + /* Filter Format */ |
|
313 + proto_tree_add_item(vdp_tlv_assoc_tree, |
|
314 + hf_vdp_filter_format, tvb, offset, 1, ENC_BIG_ENDIAN); |
|
315 + filter_format = tvb_get_guint8(tvb, offset); |
|
316 + offset++; |
|
317 + |
|
318 + switch (filter_format) { |
|
319 + case VDP_FILTER_VID: |
|
320 + vdp_add_vidstr(tvb, vdp_tlv_assoc_tree, offset, NULL); |
|
321 + offset += 2; |
|
322 + break; |
|
323 + case VDP_FILTER_MACVID: |
|
324 + str = tvb_ether_to_str(tvb, offset); |
|
325 + ti = proto_tree_add_text(vdp_tlv_assoc_tree, tvb, |
|
326 + offset, 6, "MAC %s. ", str); |
|
327 + offset += 6; |
|
328 + vdp_add_vidstr(tvb, vdp_tlv_assoc_tree, offset, ti); |
|
329 + offset += 2; |
|
330 + break; |
|
331 + } |
|
332 + } else { |
|
333 + offset += 30; |
|
334 + } |
|
335 + |
|
336 + return offset; |
|
337 +} |
|
338 + |
|
339 +static gint32 |
|
340 +dissect_vdp_tlv_mgrid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset) |
|
341 +{ |
|
342 + proto_tree *vdp_tlv_mgrid_tree = NULL; |
|
343 + proto_item *ti = NULL; |
|
344 + guint16 tlvhdr; |
|
345 + guint32 tlvlen = 0; |
|
346 + const char *str; |
|
347 + |
|
348 + if (tree) { |
|
349 + ti = proto_tree_add_text(tree, tvb, offset, 2, |
|
350 + "%s", "VDP Manager ID"); |
|
351 + vdp_tlv_mgrid_tree = proto_item_add_subtree(ti, |
|
352 + ett_vdp_tlv_mgrid); |
|
353 + } |
|
354 + |
|
355 + tlvhdr = tvb_get_ntohs(tvb, offset); |
|
356 + tlvlen = TLV_INFO_LEN(tlvhdr); |
|
357 + if (tlvlen != 16) { |
|
358 + if (tree) { |
|
359 + proto_tree_add_text(vdp_tlv_mgrid_tree, tvb, offset, 2, |
|
360 + "%s Invalid Length: %u", |
|
361 + decode_boolean_bitfield(tlvlen, TLV_INFO_LEN_MASK, |
|
362 + 16, "", ""), tlvlen); |
|
363 + } |
|
364 + return -1; |
|
365 + } |
|
366 + offset += 2; |
|
367 + |
|
368 + str = tvb_ip6_to_str(tvb, offset); |
|
369 + if (ti != NULL) { |
|
370 + proto_item_append_text(ti, ": %s", str); |
|
371 + } |
|
372 + offset += 16; |
|
373 + return offset; |
|
374 +} |
|
375 + |
|
376 +static gint32 |
|
377 +dissect_oracle_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset) |
|
378 +{ |
|
379 + if (tree) { |
|
380 + proto_tree_add_item(tree, hf_oui_oracle_encoding, tvb, |
|
381 + offset, 1, ENC_BIG_ENDIAN); |
|
382 + } |
|
383 + |
|
384 + return offset + 1; |
|
385 +} |
|
386 + |
|
387 +static gint32 |
|
388 +dissect_vdp_tlv_org(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset) |
|
389 +{ |
|
390 + guint16 tlvhdr; |
|
391 + guint32 tlvlen = 0; |
|
392 + guint32 oui; |
|
393 + guint8 subtype; |
|
394 + const char *ouistr; |
|
395 + const char *subtypestr; |
|
396 + |
|
397 + /* TLV header */ |
|
398 + tlvhdr = tvb_get_ntohs(tvb, offset); |
|
399 + tlvlen = TLV_INFO_LEN(tlvhdr); |
|
400 + if (tlvlen < 3) { |
|
401 + if (tree) { |
|
402 + proto_tree_add_text(tree, tvb, offset, 2, |
|
403 + "%s Invalid Length: %u", |
|
404 + decode_boolean_bitfield(tlvlen, TLV_INFO_LEN_MASK, |
|
405 + 16, "", ""), tlvlen); |
|
406 + } |
|
407 + return -1; |
|
408 + } |
|
409 + offset += 2; |
|
410 + |
|
411 + oui = tvb_get_ntoh24(tvb, offset); |
|
412 + ouistr = val_to_str(oui, vdp_tlv_oui_vals, "Unknown"); |
|
413 + |
|
414 + /* XXX only support Oracle OUI for now */ |
|
415 + if (oui != OUI_ORACLE) |
|
416 + return -1; |
|
417 + offset += 3; |
|
418 + |
|
419 + subtype = tvb_get_guint8(tvb, offset); |
|
420 + subtypestr = val_to_str(subtype, oui_oracle_subtype_vals, |
|
421 + "Unknown subtype 0x%x"); |
|
422 + offset++; |
|
423 + |
|
424 + if (tree) { |
|
425 + proto_tree_add_text(tree, tvb, offset, 0, "%s - %s", |
|
426 + ouistr, subtypestr); |
|
427 + /* XXX create a org tlv tree if neccessary */ |
|
428 + } |
|
429 + switch (subtype) { |
|
430 + case OUI_ORACLE_VSIMGR_SUBTYPE: |
|
431 + offset = dissect_oracle_tlv(tvb, pinfo, tree, offset); |
|
432 + break; |
|
433 + default: |
|
434 + return -1; |
|
435 + } |
|
436 + return offset; |
|
437 +} |
|
438 + |
|
439 +static void |
|
440 +dissect_vdp_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint32 offset) |
|
441 +{ |
|
442 + proto_tree *vdp_tlv_tree = NULL; |
|
443 + proto_item *ti; |
|
444 + guint8 tlvtype; |
|
445 + guint16 tlvhdr; |
|
446 + guint32 tlvlen = 0; |
|
447 + |
|
448 + while (offset > 0) { |
|
449 + tlvhdr = tvb_get_ntohs(tvb, offset); |
|
450 + tlvtype = TLV_TYPE(tlvhdr); |
|
451 + tlvlen = TLV_INFO_LEN(tlvhdr); |
|
452 + |
|
453 + if (tlvtype == 0) /* XXX most likely it's padding */ |
|
454 + break; |
|
455 + if (tree) { |
|
456 + ti = proto_tree_add_text(tree, tvb, offset, tlvlen + 2, |
|
457 + "VDP TLV"); |
|
458 + vdp_tlv_tree = proto_item_add_subtree(ti, ett_vdp_tlv); |
|
459 + proto_tree_add_item(vdp_tlv_tree, hf_vdp_tlv_type, tvb, |
|
460 + offset, 2, ENC_BIG_ENDIAN); |
|
461 + proto_tree_add_item(vdp_tlv_tree, hf_vdp_tlv_len, tvb, |
|
462 + offset, 2, ENC_BIG_ENDIAN); |
|
463 + } |
|
464 + |
|
465 + switch (tlvtype) { |
|
466 + case VDP_TLV_PREASSOC: |
|
467 + break; |
|
468 + case VDP_TLV_PREASSOCRR: |
|
469 + break; |
|
470 + case VDP_TLV_ASSOC: |
|
471 + case VDP_TLV_DEASSOC: |
|
472 + offset = dissect_vdp_tlv_assoc(tvb, pinfo, vdp_tlv_tree, |
|
473 + offset, tlvtype); |
|
474 + break; |
|
475 + case VDP_TLV_MGRID: |
|
476 + offset = dissect_vdp_tlv_mgrid(tvb, pinfo, vdp_tlv_tree, |
|
477 + offset); |
|
478 + break; |
|
479 + case VDP_TLV_ORG: |
|
480 + offset = dissect_vdp_tlv_org(tvb, pinfo, vdp_tlv_tree, |
|
481 + offset); |
|
482 + break; |
|
483 + default: |
|
484 + /* unknown type */ |
|
485 + goto done; |
|
486 + } |
|
487 + } |
|
488 +done: |
|
489 +} |
|
490 + |
|
491 +static void |
|
492 +dissect_ecp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
|
493 +{ |
|
494 + proto_item *ti; |
|
495 + proto_tree *ecp_tree = NULL; |
|
496 + int offset = 0; |
|
497 + guint16 hdr, ver, op, subtype, seqno; |
|
498 + |
|
499 + col_set_str(pinfo->cinfo, COL_PROTOCOL, "ECP"); |
|
500 + col_clear(pinfo->cinfo, COL_INFO); |
|
501 + |
|
502 + /* Version/OP/Subtype */ |
|
503 + hdr = tvb_get_ntohs(tvb, offset); |
|
504 + ver = ECP_VERSION(hdr); |
|
505 + op = ECP_OP(hdr); |
|
506 + subtype = ECP_SUBTYPE(hdr); |
|
507 + if (check_col(pinfo->cinfo, COL_INFO)) { |
|
508 + col_append_fstr(pinfo->cinfo, COL_INFO, |
|
509 + "PDU Version = %x OP = %x" |
|
510 + " Subtype = %x", ver, op, subtype); |
|
511 + } |
|
512 + if (tree) { |
|
513 + /* details */ |
|
514 + ti = proto_tree_add_item(tree, proto_ecp, tvb, 0, -1, ENC_NA); |
|
515 + ecp_tree = proto_item_add_subtree(ti, ett_ecp); |
|
516 + |
|
517 + proto_tree_add_item(ecp_tree, hf_ecp_version, tvb, offset, 2, |
|
518 + ENC_BIG_ENDIAN); |
|
519 + proto_tree_add_item(ecp_tree, hf_ecp_op, tvb, offset, 2, |
|
520 + ENC_BIG_ENDIAN); |
|
521 + proto_tree_add_item(ecp_tree, hf_ecp_subtype, tvb, offset, 2, |
|
522 + ENC_BIG_ENDIAN); |
|
523 + } |
|
524 + offset += 2; |
|
525 + |
|
526 + /* Seqno */ |
|
527 + if (tree) { |
|
528 + proto_tree_add_item(ecp_tree, hf_ecp_seqno, tvb, offset, 2, |
|
529 + ENC_BIG_ENDIAN); |
|
530 + } |
|
531 + seqno = tvb_get_ntohs(tvb, offset); |
|
532 + switch (op) { |
|
533 + case ECP_OP_REQ: |
|
534 + col_append_fstr(pinfo->cinfo, COL_INFO, |
|
535 + " SEQ = 0x%x", seqno); |
|
536 + break; |
|
537 + case ECP_OP_ACK: |
|
538 + col_append_fstr(pinfo->cinfo, COL_INFO, |
|
539 + " ACK = 0x%x", seqno); |
|
540 + break; |
|
541 + } |
|
542 + offset += 2; |
|
543 + |
|
544 + /* XXX todo: use sub-dissector */ |
|
545 + if (subtype == ECP_SUBTYPE_VDP) { |
|
546 + dissect_vdp_tlv(tvb, pinfo, ecp_tree, offset); |
|
547 + } |
|
548 +} |
|
549 + |
|
550 +void |
|
551 +proto_register_ecp(void) |
|
552 +{ |
|
553 + static hf_register_info hf_ecp[] = { |
|
554 + { &hf_ecp_version, |
|
555 + { "Version", "ecp.ver", FT_UINT16, BASE_DEC, |
|
556 + NULL, ECP_VERSION_MASK, NULL, HFILL }}, |
|
557 + { &hf_ecp_op, |
|
558 + { "Operation", "ecp.op", FT_UINT16, BASE_HEX, |
|
559 + VALS(ecp_op_vals), ECP_OP_MASK, NULL, HFILL }}, |
|
560 + { &hf_ecp_subtype, |
|
561 + { "Subtype", "ecp.subtype", FT_UINT16, BASE_HEX, |
|
562 + VALS(ecp_subtype_vals), ECP_SUBTYPE_MASK, NULL, HFILL }}, |
|
563 + { &hf_ecp_seqno, |
|
564 + { "Sequence number", "ecp.seqno", FT_UINT16, BASE_DEC, |
|
565 + NULL, 0x0, NULL, HFILL }}, |
|
566 + }; |
|
567 + |
|
568 + static hf_register_info hf_vdp[] = { |
|
569 + { &hf_vdp_tlv_type, |
|
570 + { "VDP TLV Type", "vdp.tlvtype", FT_UINT16, BASE_DEC, |
|
571 + VALS(vdp_tlv_type_vals), TLV_TYPE_MASK, NULL, HFILL }}, |
|
572 + { &hf_vdp_tlv_len, |
|
573 + { "VDP TLV Length", "vdp.tlvlen", FT_UINT16, BASE_DEC, |
|
574 + NULL, TLV_INFO_LEN_MASK, NULL, HFILL }}, |
|
575 + |
|
576 + { &hf_vdp_tlv_assoc_reason, |
|
577 + { "Reason/Status", "vdp.assoc.reason", FT_UINT8, BASE_HEX, |
|
578 + NULL, 0x0, NULL, HFILL }}, |
|
579 + { &hf_vdp_tlv_org_oui, |
|
580 + { "Org OUI", "vdp.org.oui", FT_UINT24, BASE_HEX, |
|
581 + VALS(vdp_tlv_oui_vals), 0x0, NULL, HFILL}}, |
|
582 + { &hf_oui_oracle_subtype, |
|
583 + { "Oracle Subtype", "vdp.oracle.subtype", FT_UINT8, BASE_HEX, |
|
584 + VALS(oui_oracle_subtype_vals), 0x0, NULL, HFILL}}, |
|
585 + { &hf_oui_oracle_encoding, |
|
586 + { "VSI Manager ID Encoding", "vdp.oracle.encoding", FT_UINT8, |
|
587 + BASE_HEX, VALS(oui_oracle_encoding_vals), |
|
588 + 0x0, NULL, HFILL}}, |
|
589 + { &hf_vdp_vsitypeid, |
|
590 + { "VSI Type ID", "vdp.vsitypeid", FT_UINT24, |
|
591 + BASE_HEX, NULL, 0x0, NULL, HFILL}}, |
|
592 + { &hf_vdp_vsiversion, |
|
593 + { "VSI Version", "vdp.vsiversion", FT_UINT8, |
|
594 + BASE_HEX, NULL, 0x0, NULL, HFILL}}, |
|
595 + { &hf_vdp_vsiid_format, |
|
596 + { "VSIID Format ", "vdp.vsiidformat", FT_UINT8, |
|
597 + BASE_HEX, VALS(vdp_vsiid_format_vals), 0x0, |
|
598 + NULL, HFILL}}, |
|
599 + { &hf_vdp_filter_format, |
|
600 + { "VDP Filter Format ", "vdp.filterformat", FT_UINT8, |
|
601 + BASE_HEX, VALS(vdp_filter_format_vals), 0x0, |
|
602 + NULL, HFILL}}, |
|
603 + |
|
604 + }; |
|
605 + |
|
606 + static gint *ett[] = { |
|
607 + &ett_ecp, |
|
608 + &ett_vdp_tlv, |
|
609 + &ett_vdp_tlv_assoc, |
|
610 + &ett_vdp_tlv_mgrid, |
|
611 + &ett_vdp_tlv_org, |
|
612 + }; |
|
613 + |
|
614 + proto_ecp = proto_register_protocol("Edge Control Protocol", |
|
615 + "ECP21", "ecp21"); |
|
616 + proto_register_field_array(proto_ecp, hf_ecp, array_length(hf_ecp)); |
|
617 + |
|
618 + proto_vdp = proto_register_protocol("VSI protocol", |
|
619 + "VDP21", "vdp21"); |
|
620 + proto_register_field_array(proto_vdp, hf_vdp, array_length(hf_vdp)); |
|
621 + |
|
622 + proto_register_subtree_array(ett, array_length(ett)); |
|
623 +} |
|
624 + |
|
625 +static void |
|
626 +register_hf(gpointer key _U_, gpointer value, gpointer user_data _U_) |
|
627 +{ |
|
628 + oui_info_t *info = value; |
|
629 + |
|
630 + proto_register_field_array(proto_ecp, info->field_info, 1); |
|
631 +} |
|
632 + |
|
633 +void |
|
634 +proto_reg_handoff_ecp_21(void) |
|
635 +{ |
|
636 + dissector_handle_t ecp_handle; |
|
637 + |
|
638 + data_handle = find_dissector("data"); |
|
639 + |
|
640 + ecp_handle = create_dissector_handle(dissect_ecp, proto_ecp); |
|
641 + dissector_add_uint("ethertype", ETHERTYPE_ECP, ecp_handle); |
|
642 + |
|
643 + /* |
|
644 + * Register all the fields for PIDs for various OUIs. |
|
645 + */ |
|
646 + if (oui_info_table != NULL) |
|
647 + g_hash_table_foreach(oui_info_table, register_hf, NULL); |
|
648 +} |
|
649 Index: epan/dissectors/Makefile.common |
|
650 =================================================================== |
|
651 --- epan/dissectors/Makefile.common (revision 41973) |
|
652 +++ epan/dissectors/Makefile.common (working copy) |
|
653 @@ -108,6 +108,7 @@ |
|
654 packet-dop.c \ |
|
655 packet-dsp.c \ |
|
656 packet-ess.c \ |
|
657 + packet-ecp.c \ |
|
658 packet-ftam.c \ |
|
659 packet-goose.c \ |
|
660 packet-h225.c \ |