/src/wireshark/epan/dissectors/packet-mrp-mmrp.c
Line | Count | Source |
1 | | /* packet-mrp-mmrp.c |
2 | | * Routines for MMRP (MRP Multiple Mac Registration Protocol) dissection |
3 | | * Copyright 2011, Johannes Jochen <johannes.jochen[AT]belden.com> |
4 | | * |
5 | | * |
6 | | * Based on the code from packet-mrp-msrp.c (MSRP) from |
7 | | * Torrey Atcitty <tatcitty[AT]harman.com> and Craig Gunther <craig.gunther[AT]harman.com> |
8 | | * Copyright 2010 |
9 | | * |
10 | | * Wireshark - Network traffic analyzer |
11 | | * By Gerald Combs <gerald[AT]wireshark.org> |
12 | | * Copyright 1998 Gerald Combs |
13 | | * |
14 | | * SPDX-License-Identifier: GPL-2.0-or-later |
15 | | * |
16 | | * The MMRP Protocol specification can be found at the following: |
17 | | * http://standards.ieee.org/about/get/802/802.1.html |
18 | | * |
19 | | */ |
20 | | |
21 | | #include "config.h" |
22 | | |
23 | | #include <epan/packet.h> |
24 | | #include <epan/etypes.h> |
25 | | |
26 | | void proto_register_mrp_mmrp(void); |
27 | | void proto_reg_handoff_mrp_mmrp(void); |
28 | | |
29 | | static dissector_handle_t mmrp_handle; |
30 | | |
31 | | /* MMRP End Mark Sequence */ |
32 | 32 | #define MMRP_END_MARK 0x0000 |
33 | | |
34 | | /**********************************************************/ |
35 | | /* Offsets of fields within an MMRP packet */ |
36 | | /**********************************************************/ |
37 | 123 | #define MMRP_PROTOCOL_VERSION_OFFSET 0 |
38 | | |
39 | | /* Next comes the MMRP Message group */ |
40 | 116 | #define MMRP_MESSAGE_GROUP_OFFSET (MMRP_PROTOCOL_VERSION_OFFSET + 1) /* Message is a group of fields */ |
41 | 108 | #define MMRP_ATTRIBUTE_TYPE_OFFSET (MMRP_MESSAGE_GROUP_OFFSET) |
42 | 77 | #define MMRP_ATTRIBUTE_LENGTH_OFFSET (MMRP_ATTRIBUTE_TYPE_OFFSET + 1) |
43 | | |
44 | | /* Next comes the MMRP AttributeList group */ |
45 | 61 | #define MMRP_ATTRIBUTE_LIST_GROUP_OFFSET (MMRP_ATTRIBUTE_LENGTH_OFFSET + 1) /* AttributeList is a group of fields */ |
46 | | |
47 | | /* Next comes the MMRP VectorAttribute group */ |
48 | 53 | #define MMRP_VECTOR_ATTRIBUTE_GROUP_OFFSET (MMRP_ATTRIBUTE_LIST_GROUP_OFFSET) /* VectorAttribute is a group of fields */ |
49 | 44 | #define MMRP_VECTOR_HEADER_OFFSET (MMRP_VECTOR_ATTRIBUTE_GROUP_OFFSET) /* contains the following two fields */ |
50 | | #define MMRP_LEAVE_ALL_EVENT_OFFSET (MMRP_VECTOR_HEADER_OFFSET) |
51 | 15 | #define MMRP_LEAVE_ALL_EVENT_MASK 0xE000 |
52 | 9 | #define MMRP_NUMBER_OF_VALUES_OFFSET (MMRP_VECTOR_HEADER_OFFSET) |
53 | 24 | #define MMRP_NUMBER_OF_VALUES_MASK 0x1fff |
54 | | |
55 | | /* Next comes the MMRP FirstValue group */ |
56 | 9 | #define MMRP_FIRST_VALUE_GROUP_OFFSET (MMRP_VECTOR_HEADER_OFFSET + 2) /* FirstValue is a group of fields */ |
57 | | |
58 | 1 | #define MMRP_SERVICE_THREE_PACKED_OFFSET (MMRP_FIRST_VALUE_GROUP_OFFSET + 1) |
59 | 2 | #define MMRP_MAC_THREE_PACKED_OFFSET (MMRP_FIRST_VALUE_GROUP_OFFSET + 6) |
60 | | |
61 | | /**********************************************************/ |
62 | | /* Valid field contents */ |
63 | | /**********************************************************/ |
64 | | |
65 | | /* Attribute Type definitions */ |
66 | 7 | #define MMRP_ATTRIBUTE_TYPE_SERVICE 0x01 |
67 | 9 | #define MMRP_ATTRIBUTE_TYPE_MAC 0x02 |
68 | | static const value_string attribute_type_vals[] = { |
69 | | { MMRP_ATTRIBUTE_TYPE_SERVICE, "Service Requirement" }, |
70 | | { MMRP_ATTRIBUTE_TYPE_MAC, "MAC" }, |
71 | | { 0, NULL } |
72 | | }; |
73 | | |
74 | | /* Leave All Event definitions */ |
75 | | #define MMRP_NULLLEAVEALL 0 |
76 | | #define MMRP_LEAVEALL 1 |
77 | | static const value_string leave_all_vals[] = { |
78 | | { MMRP_NULLLEAVEALL, "Null" }, |
79 | | { MMRP_LEAVEALL, "Leave All" }, |
80 | | { 0, NULL } |
81 | | }; |
82 | | |
83 | | /* Three Packed Event definitions */ |
84 | | static const value_string three_packed_vals[] = { |
85 | | { 0, "New" }, |
86 | | { 1, "JoinIn" }, |
87 | | { 2, "In" }, |
88 | | { 3, "JoinMt" }, |
89 | | { 4, "Mt" }, |
90 | | { 5, "Lv" }, |
91 | | { 0, NULL } |
92 | | }; |
93 | | |
94 | | /**********************************************************/ |
95 | | /* Initialize the protocol and registered fields */ |
96 | | /**********************************************************/ |
97 | | static int proto_mmrp; |
98 | | static int hf_mmrp_proto_id; |
99 | | static int hf_mmrp_message; /* Message is a group of fields */ |
100 | | static int hf_mmrp_attribute_type; |
101 | | static int hf_mmrp_attribute_length; |
102 | | static int hf_mmrp_attribute_list; /* AttributeList is a group of fields */ |
103 | | static int hf_mmrp_vector_attribute; /* VectorAttribute is a group of fields */ |
104 | | |
105 | | /* The following VectorHeader contains the LeaveAllEvent and NumberOfValues */ |
106 | | static int hf_mmrp_vector_header; |
107 | | static int hf_mmrp_leave_all_event; |
108 | | static int hf_mmrp_number_of_values; |
109 | | static int ett_vector_header; |
110 | | static int * const vector_header_fields[] = { |
111 | | &hf_mmrp_leave_all_event, |
112 | | &hf_mmrp_number_of_values, |
113 | | NULL |
114 | | }; |
115 | | |
116 | | static int hf_mmrp_first_value; /* FirstValue is a group of fields */ |
117 | | |
118 | | static int hf_mmrp_mac; |
119 | | static int hf_mmrp_ser_req; |
120 | | |
121 | | static int hf_mmrp_three_packed_event; |
122 | | |
123 | | static int hf_mmrp_end_mark; |
124 | | |
125 | | /* Initialize the subtree pointers */ |
126 | | static int ett_mmrp; |
127 | | static int ett_msg; |
128 | | static int ett_attr_list; |
129 | | static int ett_vect_attr; |
130 | | static int ett_first_value; |
131 | | |
132 | | |
133 | | |
134 | | /**********************************************************/ |
135 | | /* Dissector starts here */ |
136 | | /**********************************************************/ |
137 | | |
138 | | /* dissect_mmrp_common1 (called from dissect_mmrp) |
139 | | * |
140 | | * dissect the following fields which are common to all MMRP attributes: |
141 | | * Attribute Type |
142 | | * Attribute Length |
143 | | * Attribute List Length |
144 | | */ |
145 | | static void |
146 | | dissect_mmrp_common1(proto_tree *msg_tree, tvbuff_t *tvb, int msg_offset) |
147 | 8 | { |
148 | 8 | proto_tree_add_item(msg_tree, hf_mmrp_attribute_type, tvb, |
149 | 8 | MMRP_ATTRIBUTE_TYPE_OFFSET + msg_offset, 1, ENC_BIG_ENDIAN); |
150 | 8 | proto_tree_add_item(msg_tree, hf_mmrp_attribute_length, tvb, |
151 | 8 | MMRP_ATTRIBUTE_LENGTH_OFFSET + msg_offset, 1, ENC_BIG_ENDIAN); |
152 | 8 | } |
153 | | |
154 | | |
155 | | /* dissect_mmrp_common2 (called from dissect_mmrp) |
156 | | * |
157 | | * dissect the following fields which are common to all MMRP attributes: |
158 | | * Leave All Event |
159 | | * Number of Values fields |
160 | | */ |
161 | | static void |
162 | | dissect_mmrp_common2(proto_tree *vect_attr_tree, tvbuff_t *tvb, int msg_offset) |
163 | 9 | { |
164 | 9 | proto_tree_add_bitmask(vect_attr_tree, tvb, MMRP_VECTOR_HEADER_OFFSET + msg_offset, |
165 | 9 | hf_mmrp_vector_header, ett_vector_header, vector_header_fields, ENC_BIG_ENDIAN); |
166 | 9 | } |
167 | | |
168 | | /* dissect_mmrp_three_packed_event (called from dissect_mmrp) |
169 | | * |
170 | | * dissect one or more ThreePackedEvents |
171 | | */ |
172 | | static unsigned |
173 | | dissect_mmrp_three_packed_event(proto_tree *vect_attr_tree, tvbuff_t *tvb, unsigned offset, uint16_t number_of_values) |
174 | 3 | { |
175 | 3 | unsigned counter; |
176 | | |
177 | 290 | for ( counter = 0; counter < number_of_values; ) { |
178 | 287 | uint8_t value; |
179 | 287 | uint8_t three_packed_event[3]; |
180 | | |
181 | 287 | value = tvb_get_uint8(tvb, offset); |
182 | 287 | three_packed_event[0] = value / 36; |
183 | 287 | value -= 36 * three_packed_event[0]; |
184 | 287 | three_packed_event[1] = value / 6; |
185 | 287 | value -= 6 * three_packed_event[1]; |
186 | 287 | three_packed_event[2] = value; |
187 | | |
188 | 287 | proto_tree_add_uint(vect_attr_tree, hf_mmrp_three_packed_event, tvb, offset, sizeof(uint8_t), |
189 | 287 | three_packed_event[0]); |
190 | 287 | counter++; |
191 | 287 | if ( counter < number_of_values ) { |
192 | 285 | proto_tree_add_uint(vect_attr_tree, hf_mmrp_three_packed_event, tvb, offset, sizeof(uint8_t), |
193 | 285 | three_packed_event[1]); |
194 | 285 | counter++; |
195 | 285 | } |
196 | 287 | if ( counter < number_of_values ) { |
197 | 285 | proto_tree_add_uint(vect_attr_tree, hf_mmrp_three_packed_event, tvb, offset, sizeof(uint8_t), |
198 | 285 | three_packed_event[2]); |
199 | 285 | counter++; |
200 | 285 | } |
201 | | |
202 | 287 | offset++; |
203 | 287 | } |
204 | 3 | return offset; |
205 | 3 | } |
206 | | |
207 | | /* dissect_main |
208 | | * |
209 | | * main dissect function that calls the other functions listed above as necessary |
210 | | */ |
211 | | static int |
212 | 7 | dissect_mmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { |
213 | | /* Set up structures needed to add the protocol subtrees and manage them */ |
214 | 7 | proto_item *ti, *msg_ti, *attr_list_ti, *vect_attr_ti, *first_value_ti; |
215 | 7 | proto_tree *mmrp_tree, *msg_tree, *attr_list_tree, *vect_attr_tree, *first_value_tree; |
216 | | |
217 | | /* Make entries in Protocol column and Info column on summary display */ |
218 | 7 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "MRP-MMRP"); |
219 | | |
220 | 7 | col_set_str(pinfo->cinfo, COL_INFO, "Multiple Mac Registration Protocol"); |
221 | | |
222 | 7 | if (tree) { |
223 | 7 | uint8_t attribute_type; |
224 | 7 | uint8_t attribute_length; |
225 | 7 | uint16_t number_of_values; |
226 | 7 | unsigned offset = 0; |
227 | 7 | int vect_attr_len; |
228 | 7 | int msg_offset; /* Use when handling multiple messages. This points to current msg being decoded. */ |
229 | 7 | int vect_offset; /* Use when handling multiple vector attributes. This points to the current vector attribute being decoded. */ |
230 | | |
231 | 7 | ti = proto_tree_add_item(tree, proto_mmrp, tvb, 0, -1, ENC_NA); |
232 | 7 | mmrp_tree = proto_item_add_subtree(ti, ett_mmrp); |
233 | | |
234 | 7 | proto_tree_add_item(mmrp_tree, hf_mmrp_proto_id, tvb, MMRP_PROTOCOL_VERSION_OFFSET, 1, ENC_BIG_ENDIAN); |
235 | | |
236 | | /* MMRP supports multiple MRP Messages per frame. Handle those Messages in |
237 | | * the following while() loop. You will know you are at the end of the list |
238 | | * of messages when the EndMark (0x0000) is encountered instead of an |
239 | | * Attribute Type and Attribute Length (guaranteed to not be 0x0000). |
240 | | */ |
241 | 7 | msg_offset = 0; |
242 | 15 | while (tvb_get_ntohs(tvb, MMRP_ATTRIBUTE_TYPE_OFFSET + msg_offset) != MMRP_END_MARK) { |
243 | | |
244 | 8 | attribute_type = tvb_get_uint8(tvb, MMRP_ATTRIBUTE_TYPE_OFFSET + msg_offset); |
245 | 8 | attribute_length = tvb_get_uint8(tvb, MMRP_ATTRIBUTE_LENGTH_OFFSET + msg_offset); |
246 | | |
247 | | /* MMRP Message is a group of fields |
248 | | * |
249 | | * Contains AttributeType (1 byte) |
250 | | * + AttributeLength (1 byte) |
251 | | * + AttributeList (AttributeListLength bytes) |
252 | | * bytes of data |
253 | | */ |
254 | 8 | msg_ti = proto_tree_add_item(mmrp_tree, hf_mmrp_message, tvb, |
255 | 8 | MMRP_MESSAGE_GROUP_OFFSET + msg_offset, |
256 | 8 | -1, ENC_NA); |
257 | 8 | msg_tree = proto_item_add_subtree(msg_ti, ett_msg); |
258 | | |
259 | | /* Append AttributeType description to the end of the "Message" heading */ |
260 | 8 | proto_item_append_text(msg_tree, ": %s (%d)", |
261 | 8 | val_to_str_const(attribute_type, attribute_type_vals, "<Unknown>"), |
262 | 8 | attribute_type); |
263 | | |
264 | 8 | dissect_mmrp_common1(msg_tree, tvb, msg_offset); |
265 | | |
266 | | /* MMRP AttributeList is a group of fields |
267 | | * |
268 | | * Contains AttributeListLength bytes of data NOT |
269 | | */ |
270 | 8 | attr_list_ti = proto_tree_add_item(msg_tree, hf_mmrp_attribute_list, tvb, |
271 | 8 | MMRP_ATTRIBUTE_LIST_GROUP_OFFSET + msg_offset, |
272 | 8 | -1, ENC_NA); |
273 | 8 | attr_list_tree = proto_item_add_subtree(attr_list_ti, ett_attr_list); |
274 | | |
275 | | |
276 | | /* MMRP supports multiple MRP Vector Attributes per Attribute List. Handle those |
277 | | * Vector Attributes in the following while() loop. You will know you are at the |
278 | | * end of the list of Vector Attributes when the EndMark (0x0000) is encountered |
279 | | * instead of a Vector Header (guaranteed to not be 0x0000). |
280 | | */ |
281 | 8 | vect_offset = 0; |
282 | 17 | while (tvb_get_ntohs(tvb, MMRP_VECTOR_HEADER_OFFSET + msg_offset + vect_offset) != MMRP_END_MARK) { |
283 | | /* MMRP VectorAttribute is a group of fields |
284 | | * |
285 | | * Contains VectorHeader (2 bytes) |
286 | | * + FirstValue (AttributeLength bytes) |
287 | | * + VectorThreePacked (NumberOfValues @ 3/vector bytes) |
288 | | * + VectorFourPacked (NumberOfValues @ 4/vector bytes only for Listener attributes) |
289 | | * bytes of data |
290 | | */ |
291 | 9 | number_of_values = tvb_get_ntohs(tvb, MMRP_NUMBER_OF_VALUES_OFFSET + msg_offset + vect_offset) |
292 | 9 | & MMRP_NUMBER_OF_VALUES_MASK; |
293 | | |
294 | 9 | vect_attr_len = 2 + attribute_length + (number_of_values + 2)/3; /* stores 3 values per byte */ |
295 | | |
296 | 9 | vect_attr_ti = proto_tree_add_item(attr_list_tree, hf_mmrp_vector_attribute, tvb, |
297 | 9 | MMRP_VECTOR_ATTRIBUTE_GROUP_OFFSET + msg_offset + vect_offset, |
298 | 9 | vect_attr_len, ENC_NA); |
299 | | |
300 | 9 | vect_attr_tree = proto_item_add_subtree(vect_attr_ti, ett_vect_attr); |
301 | | |
302 | 9 | dissect_mmrp_common2(vect_attr_tree, tvb, msg_offset + vect_offset); |
303 | | |
304 | 9 | if (attribute_type == MMRP_ATTRIBUTE_TYPE_MAC) { |
305 | | /* MMRP FirstValue is a Mac Address*/ |
306 | 2 | first_value_ti = proto_tree_add_item(vect_attr_tree, hf_mmrp_first_value, tvb, |
307 | 2 | MMRP_FIRST_VALUE_GROUP_OFFSET + msg_offset + vect_offset, |
308 | 2 | attribute_length, ENC_NA); |
309 | 2 | first_value_tree = proto_item_add_subtree(first_value_ti, ett_first_value); |
310 | | |
311 | | /* Add MAC components to First Value tree */ |
312 | 2 | proto_tree_add_item(first_value_tree, hf_mmrp_mac, tvb, |
313 | 2 | MMRP_FIRST_VALUE_GROUP_OFFSET + msg_offset + vect_offset, 6, ENC_NA); |
314 | | |
315 | | /* Decode three packed events. */ |
316 | 2 | offset = dissect_mmrp_three_packed_event(vect_attr_tree, tvb, |
317 | 2 | MMRP_MAC_THREE_PACKED_OFFSET + msg_offset + vect_offset, |
318 | 2 | number_of_values); |
319 | 2 | } |
320 | 7 | else if (attribute_type == MMRP_ATTRIBUTE_TYPE_SERVICE) { |
321 | | /* MMRP Service Requirement*/ |
322 | 1 | first_value_ti = proto_tree_add_item(vect_attr_tree, hf_mmrp_first_value, tvb, |
323 | 1 | MMRP_FIRST_VALUE_GROUP_OFFSET + msg_offset + vect_offset, |
324 | 1 | attribute_length, ENC_NA); |
325 | 1 | first_value_tree = proto_item_add_subtree(first_value_ti, ett_first_value); |
326 | | |
327 | | /* Add ServiceRequirement components to First Value tree */ |
328 | 1 | proto_tree_add_item(first_value_tree, hf_mmrp_ser_req, tvb, |
329 | 1 | MMRP_FIRST_VALUE_GROUP_OFFSET + msg_offset + vect_offset, 1, ENC_BIG_ENDIAN); |
330 | | |
331 | 1 | offset = dissect_mmrp_three_packed_event(vect_attr_tree, tvb, |
332 | 1 | MMRP_SERVICE_THREE_PACKED_OFFSET + msg_offset + vect_offset, |
333 | 1 | number_of_values); |
334 | 1 | } |
335 | | |
336 | 9 | vect_offset += vect_attr_len; /* Move to next Vector Attribute, if there is one */ |
337 | 9 | } /* Multiple VectorAttribute while() */ |
338 | | |
339 | 8 | proto_tree_add_item(attr_list_tree, hf_mmrp_end_mark, tvb, offset, 2, ENC_BIG_ENDIAN); /* VectorAttribute EndMark */ |
340 | | |
341 | 8 | msg_offset += vect_offset + 2/* + VectorHeader */ + 2/* + endmark */; |
342 | | |
343 | 8 | } /* Multiple Message while() */ |
344 | | |
345 | 7 | proto_tree_add_item(mmrp_tree, hf_mmrp_end_mark, tvb, offset+2, 2, ENC_BIG_ENDIAN); /* Message EndMark */ |
346 | 7 | } |
347 | 7 | return tvb_captured_length(tvb); |
348 | 7 | } |
349 | | |
350 | | |
351 | | /* Register the protocol with Wireshark */ |
352 | | void |
353 | | proto_register_mrp_mmrp(void) |
354 | 15 | { |
355 | 15 | static hf_register_info hf[] = { |
356 | 15 | { &hf_mmrp_proto_id, |
357 | 15 | { "Protocol Version", "mrp-mmrp.protocol_version", |
358 | 15 | FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } |
359 | 15 | }, |
360 | 15 | { &hf_mmrp_message, /* Message is a group of fields */ |
361 | 15 | { "Message", "mrp-mmrp.message", |
362 | 15 | FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } |
363 | 15 | }, |
364 | 15 | { &hf_mmrp_attribute_type, |
365 | 15 | { "Attribute Type", "mrp-mmrp.attribute_type", |
366 | 15 | FT_UINT8, BASE_DEC, VALS(attribute_type_vals), 0x0, NULL, HFILL } |
367 | 15 | }, |
368 | 15 | { &hf_mmrp_attribute_length, |
369 | 15 | { "Attribute Length", "mrp-mmrp.attribute_length", |
370 | 15 | FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } |
371 | 15 | }, |
372 | 15 | { &hf_mmrp_attribute_list, /* AttributeList is a group of fields */ |
373 | 15 | { "Attribute List", "mrp-mmrp.attribute_list", |
374 | 15 | FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } |
375 | 15 | }, |
376 | 15 | { &hf_mmrp_vector_attribute, /* VectorAttribute is a group of fields */ |
377 | 15 | { "Vector Attribute", "mrp-mmrp.vector_attribute", |
378 | 15 | FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } |
379 | 15 | }, |
380 | 15 | { &hf_mmrp_vector_header, |
381 | 15 | { "Vector Header", "mrp-mmrp.vector_header", |
382 | 15 | FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } |
383 | 15 | }, |
384 | 15 | { &hf_mmrp_leave_all_event, |
385 | 15 | { "Leave All Event", "mrp-mmrp.leave_all_event", |
386 | 15 | FT_UINT16, BASE_DEC, VALS(leave_all_vals), MMRP_LEAVE_ALL_EVENT_MASK, NULL, HFILL } |
387 | 15 | }, |
388 | 15 | { &hf_mmrp_number_of_values, |
389 | 15 | { "Number of Values", "mrp-mmrp.number_of_values", |
390 | 15 | FT_UINT16, BASE_DEC, NULL, MMRP_NUMBER_OF_VALUES_MASK, NULL, HFILL } |
391 | 15 | }, |
392 | 15 | { &hf_mmrp_first_value, /* FirstValue is a group of fields */ |
393 | 15 | { "First Value", "mrp-mmrp.first_value", |
394 | 15 | FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } |
395 | 15 | }, |
396 | 15 | { &hf_mmrp_mac, |
397 | 15 | { "MAC", "mrp-mmrp.mac", |
398 | 15 | FT_ETHER, BASE_NONE, NULL, 0x00, NULL, HFILL } |
399 | 15 | }, |
400 | 15 | { &hf_mmrp_ser_req, |
401 | 15 | { "Service Requirement", "mrp-mmrp.service_requirement", |
402 | 15 | FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } |
403 | 15 | }, |
404 | 15 | { &hf_mmrp_three_packed_event, |
405 | 15 | { "Attribute Event", "mrp-mmrp.three_packed_event", |
406 | 15 | FT_UINT8, BASE_DEC, VALS(three_packed_vals), 0x0, NULL, HFILL } |
407 | 15 | }, |
408 | 15 | { &hf_mmrp_end_mark, |
409 | 15 | { "End Mark", "mrp-mmrp.end_mark", |
410 | 15 | FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } |
411 | 15 | }, |
412 | 15 | }; |
413 | | |
414 | | /* Setup protocol subtree array */ |
415 | 15 | static int *ett[] = { |
416 | 15 | &ett_mmrp, |
417 | 15 | &ett_msg, |
418 | 15 | &ett_attr_list, |
419 | 15 | &ett_vect_attr, |
420 | 15 | &ett_vector_header, |
421 | 15 | &ett_first_value |
422 | 15 | }; |
423 | | |
424 | | /* Register the protocol name and description */ |
425 | 15 | proto_mmrp = proto_register_protocol("Multiple Mac Registration Protocol", |
426 | 15 | "MRP-MMRP", "mrp-mmrp"); |
427 | | |
428 | | /* Required function calls to register the header fields and subtrees used */ |
429 | 15 | proto_register_field_array(proto_mmrp, hf, array_length(hf)); |
430 | 15 | proto_register_subtree_array(ett, array_length(ett)); |
431 | | |
432 | | /* Register the dissector */ |
433 | 15 | mmrp_handle = register_dissector("mrp-mmrp", dissect_mmrp, proto_mmrp); |
434 | 15 | } |
435 | | |
436 | | void |
437 | | proto_reg_handoff_mrp_mmrp(void) |
438 | 15 | { |
439 | 15 | dissector_add_uint("ethertype", ETHERTYPE_MMRP, mmrp_handle); |
440 | 15 | } |
441 | | |
442 | | /* |
443 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
444 | | * |
445 | | * Local variables: |
446 | | * c-basic-offset: 4 |
447 | | * tab-width: 8 |
448 | | * indent-tabs-mode: nil |
449 | | * End: |
450 | | * |
451 | | * vi: set shiftwidth=4 tabstop=8 expandtab: |
452 | | * :indentSize=4:tabSize=8:noTabs=true: |
453 | | */ |