Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-slimp3.c
blob9fda7cff3af550d15a7af64c430a8381632b2d2e
1 /* packet-slimp3.c
2 * Routines for SliMP3 protocol dissection
4 * Ashok Narayanan <ashokn@cisco.com>
6 * Adds support for the data packet protocol for the SliMP3
7 * See www.slimdevices.com for details.
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * SPDX-License-Identifier: GPL-2.0-or-later
16 #include "config.h"
18 #include <epan/packet.h>
19 #include <epan/unit_strings.h>
21 #include <wsutil/array.h>
22 #include <epan/to_str.h>
24 void proto_register_slimp3(void);
25 void proto_reg_handoff_slimp3(void);
27 static dissector_handle_t slimp3_handle;
29 static int proto_slimp3;
30 static int hf_slimp3_opcode;
31 static int hf_slimp3_control;
32 static int hf_slimp3_uptime;
33 static int hf_slimp3_code_id;
34 static int hf_slimp3_code_bits;
35 static int hf_slimp3_infrared_slimp3;
36 static int hf_slimp3_infrared_jvc;
37 static int hf_slimp3_infrared;
38 static int hf_slimp3_device_id;
39 static int hf_slimp3_fw_rev;
40 static int hf_slimp3_data_offset;
41 static int hf_slimp3_data_command;
42 static int hf_slimp3_data_write_pointer;
43 static int hf_slimp3_data_sequence;
44 static int hf_slimp3_disc_rsp_server_ip;
45 static int hf_slimp3_disc_rsp_server_port;
46 static int hf_slimp3_data_ack_write_pointer;
47 static int hf_slimp3_data_ack_read_pointer;
48 static int hf_slimp3_data_ack_sequence;
49 static int hf_slimp3_data_req_offset;
50 /* Generated from convert_proto_tree_add_text.pl */
51 static int hf_slimp3_display_delay;
52 static int hf_slimp3_display_string;
53 static int hf_slimp3_display_command;
54 static int hf_slimp3_display_unknown;
55 static int hf_slimp3_hello_response_client_server;
56 static int hf_slimp3_hello_request_server_client;
57 static int hf_slimp3_i2c_response_client_server;
58 static int hf_slimp3_i2c_request_server_client;
59 static int hf_slimp3_data_length;
60 static int hf_slimp3_data_data;
62 static int ett_slimp3;
64 #define UDP_PORT_SLIMP3_V1 1069 /* Not IANA registered */
65 #define UDP_PORT_SLIMP3_V2 3483
66 #define UDP_PORT_SLIMP3_RANGE "1069,3483"
68 #define SLIMP3_IR 'i'
69 #define SLIMP3_CONTROL 's'
70 #define SLIMP3_HELLO 'h'
71 #define SLIMP3_DATA 'm'
72 #define SLIMP3_DATA_REQ 'r'
73 #define SLIMP3_DISPLAY 'l'
74 #define SLIMP3_I2C '2'
75 #define SLIMP3_DISC_REQ 'd'
76 #define SLIMP3_DISC_RSP 'D'
77 #define SLIMP3_DATA_ACK 'a'
79 static const value_string slimp3_opcode_vals[] = {
80 { SLIMP3_IR, "Infrared Remote Code" },
81 { SLIMP3_CONTROL, "Stream Control" },
82 { SLIMP3_DATA, "MPEG Data" },
83 { SLIMP3_DATA_REQ, "Data Request" },
84 { SLIMP3_HELLO, "Hello" },
85 { SLIMP3_DISPLAY, "Display" },
86 { SLIMP3_I2C, "I2C" },
87 { SLIMP3_DISC_REQ, "Discovery Request" },
88 { SLIMP3_DISC_RSP, "Discovery Response" },
89 { SLIMP3_DATA_ACK, "Ack" },
90 { 0, NULL }
93 /* IR remote control types */
94 static const value_string slimp3_ir_types[] = {
95 { 0x02, "SLIMP3" },
96 { 0xff, "JVC DVD Player" },
98 { 0, NULL }
101 /* IR codes for the custom SLIMP3 remote control */
102 static const value_string slimp3_ir_codes_slimp3[] = {
103 { 0x768900ff, "voldown" },
104 { 0x768904fb, "brightness" },
105 { 0x768908f7, "2" },
106 { 0x768910ef, "play" },
107 { 0x768920df, "pause" },
108 { 0x768928d7, "6" },
109 { 0x768938c7, "repeat" },
110 { 0x768940bf, "power" },
111 { 0x768948b7, "4" },
112 { 0x768958a7, "search" },
113 { 0x7689609f, "add" },
114 { 0x76896897, "8" },
115 { 0x76897887, "now_playing" },
116 { 0x7689807f, "volup" },
117 { 0x76898877, "3" },
118 { 0x7689906f, "arrow_left" },
119 { 0x76899867, "0" },
120 { 0x7689a05f, "fwd" },
121 { 0x7689a857, "7" },
122 { 0x7689b04f, "arrow_down" },
123 { 0x7689b847, "sleep" },
124 { 0x7689c03f, "rew" },
125 { 0x7689c837, "5" },
126 { 0x7689d02f, "arrow_right" },
127 { 0x7689d827, "shuffle" },
128 { 0x7689e01f, "arrow_up" },
129 { 0x7689e817, "9" },
130 { 0x7689f00f, "1" },
131 { 0x7689f807, "size" },
133 { 0, NULL }
135 static value_string_ext slimp3_ir_codes_slimp3_ext = VALUE_STRING_EXT_INIT(slimp3_ir_codes_slimp3);
137 /* IR codes for the JVC remote control */
138 static const value_string slimp3_ir_codes_jvc[] = {
139 { 0xf786, "One" },
140 { 0xf746, "Two" },
141 { 0xf7c6, "Three" },
142 { 0xf726, "Four" },
143 { 0xf7a6, "Five" },
144 { 0xf766, "Six" },
145 { 0xf7e6, "Seven" },
146 { 0xf716, "Eight" },
147 { 0xf796, "Nine" },
148 { 0xf776, "Ten" },
150 { 0xf7f6, "Picture-In-Picture" },
151 /* { 0xf7XX, "Enter" }, */
152 { 0xf70e, "Back" },
153 { 0xf732, "Play" },
154 { 0xf76e, "Forward" },
155 { 0xf743, "Record" },
156 { 0xf7c2, "Stop" },
157 { 0xf7b2, "Pause" },
158 /* { 0xf7XX, "TV/Video" }, */
159 { 0xf703, "Display" },
160 { 0xf7b3, "Sleep" },
161 { 0xf7b6, "Guide" },
162 { 0xf70b, "Up" },
163 { 0xf74b, "Left" },
164 { 0xf7cb, "Right" },
165 { 0xf78b, "Down" },
166 { 0xf783, "Menu" },
167 { 0xf72b, "OK" },
168 { 0xf778, "Volume Up" },
169 { 0xf7f8, "Volume Down" },
170 { 0xf70d, "Channel Up" },
171 { 0xf78d, "Channel Down" },
172 /* { 0xf7XX, "Mute" }, */
173 { 0xf7ab, "Recall" },
174 { 0xf702, "Power" },
176 { 0, NULL }
180 static const value_string slimp3_display_commands[] = {
181 { 0x1, "Clear Display"},
182 { 0x2, "Cursor to 1st Line Home"},
184 { 0x4, "Mode: Decrement Address, Shift Cursor"},
185 { 0x5, "Mode: Decrement Address, Shift Display"},
186 { 0x6, "Mode: Increment Address, Shift Cursor"},
187 { 0x7, "Mode: Increment Address, Shift Display"},
189 { 0x8, "Display Off"},
190 { 0xd, "Display On, With Blinking"},
191 { 0xe, "Display On, With Cursor"},
192 { 0xf, "Display On, With Cursor And Blinking"},
194 { 0x10, "Move Cursor Left"},
195 { 0x14, "Move Cursor Right"},
196 { 0x18, "Shift Display Left"},
197 { 0x1b, "Shift Display Right"},
199 { 0x30, "Set (8-bit)"},
200 { 0x20, "Set (4-bit)"},
202 { 0xa0, "Cursor to Top Right"},
203 { 0xc0, "Cursor to 2nd Line Home"},
205 { 0, NULL},
208 static const value_string slimp3_display_fset8[] = {
209 { 0x0, "Brightness 100%"},
210 { 0x1, "Brightness 75%"},
211 { 0x2, "Brightness 50%"},
212 { 0x3, "Brightness 25%"},
214 { 0, NULL },
217 static const value_string slimp3_stream_control[] = {
218 { 1, "Reset buffer, Start New Stream"},
219 { 2, "Pause Playback"},
220 { 4, "Resume Playback"},
221 { 0, NULL },
225 static const value_string slimp3_mpg_control[] = {
226 { 0, "Go"}, /* Run the decoder */
227 { 1, "Stop"}, /* Halt decoder but don't reset rptr */
228 { 3, "Reset"}, /* Halt decoder and reset rptr */
230 { 0, NULL }
233 #define MAX_LCD_STR_LEN 128
234 static int
235 dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
237 const char *opcode_str;
238 proto_tree *slimp3_tree;
239 proto_item *ti;
240 int i1;
241 int offset = 0;
242 uint16_t opcode;
243 unsigned char lcd_char;
244 char lcd_str[MAX_LCD_STR_LEN + 1];
245 bool to_server = false;
246 bool old_protocol = false;
247 address tmp_addr;
248 bool in_str;
249 int lcd_strlen;
252 * If it doesn't begin with a known opcode, reject it, so that
253 * traffic that happens to be do or from one of our ports
254 * doesn't get misidentified as SliMP3 traffic.
256 if (!tvb_bytes_exist(tvb, offset, 1))
257 return 0; /* not even an opcode */
258 opcode = tvb_get_uint8(tvb, offset);
259 opcode_str = try_val_to_str(opcode, slimp3_opcode_vals);
260 if (opcode_str == NULL)
261 return 0;
263 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SliMP3");
264 col_add_str(pinfo->cinfo, COL_INFO, opcode_str);
266 ti = proto_tree_add_item(tree, proto_slimp3, tvb, offset, -1, ENC_NA);
267 slimp3_tree = proto_item_add_subtree(ti, ett_slimp3);
269 proto_tree_add_uint(slimp3_tree, hf_slimp3_opcode, tvb,
270 offset, 1, opcode);
272 /* The new protocol (v1.3 and later) uses an IANA-assigned port number.
273 * It usually uses the same number for both sizes of the conversation, so
274 * the port numbers can't always be used to determine client and server.
275 * The new protocol places the clients MAC address in the packet, so that
276 * is used to identify packets originating at the client.
278 if ((pinfo->destport == UDP_PORT_SLIMP3_V2) && (pinfo->srcport == UDP_PORT_SLIMP3_V2)) {
279 set_address_tvb(&tmp_addr, AT_ETHER, 6, tvb, offset+12);
280 to_server = addresses_equal(&tmp_addr, &pinfo->dl_src);
282 else if (pinfo->destport == UDP_PORT_SLIMP3_V2) {
283 to_server = true;
285 else if (pinfo->srcport == UDP_PORT_SLIMP3_V2) {
286 to_server = false;
288 if (pinfo->destport == UDP_PORT_SLIMP3_V1) {
289 to_server = true;
290 old_protocol = true;
292 else if (pinfo->srcport == UDP_PORT_SLIMP3_V1) {
293 to_server = false;
294 old_protocol = true;
297 switch (opcode) {
299 case SLIMP3_IR:
300 /* IR code
302 * [0] 'i' as in "IR"
303 * [1] 0x00
304 * [2..5] player's time since startup in ticks @625 KHz
305 * [6] IR code id, ff=JVC, 02=SLIMP3
306 * [7] number of meaningful bits - 16 for JVC, 32 for SLIMP3
307 * [8..11] the 32-bit IR code
308 * [12..17] reserved
310 if (tree) {
311 i1 = tvb_get_ntohl(tvb, offset+2);
312 proto_tree_add_uint_format_value(slimp3_tree, hf_slimp3_uptime, tvb, offset+2, 4, i1,
313 "%u sec (%u ticks)", i1/625000, i1);
315 proto_tree_add_item(slimp3_tree, hf_slimp3_code_id, tvb, offset+6, 1, ENC_BIG_ENDIAN);
316 proto_tree_add_item(slimp3_tree, hf_slimp3_code_bits, tvb, offset+7, 1, ENC_BIG_ENDIAN);
318 i1 = tvb_get_ntohl(tvb, offset+8);
319 /* Check the code to figure out which remote is being used. */
320 if (tvb_get_uint8(tvb, offset+6) == 0x02 &&
321 tvb_get_uint8(tvb, offset+7) == 32) {
322 /* This is the custom SLIMP3 remote. */
323 proto_tree_add_item(slimp3_tree, hf_slimp3_infrared_slimp3, tvb, offset+8, 4, ENC_BIG_ENDIAN);
324 col_append_fstr(pinfo->cinfo, COL_INFO, ", SLIMP3: %s",
325 val_to_str_ext(i1, &slimp3_ir_codes_slimp3_ext, "Unknown (0x%0x)"));
327 else if (tvb_get_uint8(tvb, offset+6) == 0xff &&
328 tvb_get_uint8(tvb, offset+7) == 16) {
329 /* This is a JVC DVD player remote */
330 proto_tree_add_item(slimp3_tree, hf_slimp3_infrared_jvc, tvb, offset+8, 4, ENC_BIG_ENDIAN);
331 col_append_fstr(pinfo->cinfo, COL_INFO, ", JVC: %s",
332 val_to_str(i1, slimp3_ir_codes_jvc, "Unknown (0x%0x)"));
333 } else {
334 /* Unknown code; just write it */
335 proto_tree_add_item(slimp3_tree, hf_slimp3_infrared, tvb, offset+8, 4, ENC_BIG_ENDIAN);
336 col_append_fstr(pinfo->cinfo, COL_INFO, ", 0x%0x", i1);
339 break;
341 case SLIMP3_DISPLAY:
342 if (tree) {
343 uint8_t value;
345 /* Loop through the commands */
346 i1 = 18;
347 in_str = false;
348 lcd_strlen = 0;
349 while (i1 < tvb_reported_length_remaining(tvb, offset)) {
350 switch(tvb_get_uint8(tvb, offset + i1)) {
351 case 0:
352 in_str = false;
353 lcd_strlen = 0;
354 proto_tree_add_item(slimp3_tree, hf_slimp3_display_delay, tvb, offset + i1, 2, ENC_NA);
355 i1 += 2;
356 break;
357 case 3:
358 lcd_char = tvb_get_uint8(tvb, offset + i1 + 1);
359 if (!g_ascii_isprint(lcd_char))
360 lcd_char = '.';
361 if (ti && in_str) {
362 lcd_strlen += 2;
363 proto_item_append_text(ti, "%c", lcd_char);
364 proto_item_set_len(ti, lcd_strlen);
365 } else {
366 ti = proto_tree_add_uint_format_value(slimp3_tree, hf_slimp3_display_string, tvb, offset + i1, 2,
367 lcd_char, "%c", lcd_char);
368 in_str = true;
369 lcd_strlen = 2;
371 i1 += 2;
372 break;
374 case 2:
375 in_str = false;
376 lcd_strlen = 0;
377 value = tvb_get_uint8(tvb, offset + i1 + 1);
378 ti = proto_tree_add_uint(slimp3_tree, hf_slimp3_display_command, tvb, offset + i1, 2, value);
379 if ((tvb_get_uint8(tvb, offset + i1 + 1) & 0xf0) == 0x30) {
380 proto_item_append_text(ti, ": %s",
381 val_to_str(tvb_get_uint8(tvb, offset + i1 + 2),
382 slimp3_display_fset8,
383 "Unknown (0x%0x)"));
384 i1 += 2;
386 i1 += 2;
387 break;
389 default:
390 proto_tree_add_item(slimp3_tree, hf_slimp3_display_unknown, tvb, offset + i1, 2, ENC_NA);
391 i1 += 2;
392 break;
397 i1 = 18;
398 lcd_strlen = 0;
399 while (tvb_offset_exists(tvb, offset + i1) &&
400 lcd_strlen < MAX_LCD_STR_LEN) {
401 switch (tvb_get_uint8(tvb, offset + i1)) {
403 case 0:
404 lcd_str[lcd_strlen++] = '.';
405 break;
407 case 2:
408 lcd_str[lcd_strlen++] = '|';
409 if (tvb_offset_exists(tvb, offset + i1 + 1) &&
410 (tvb_get_uint8(tvb, offset + i1 + 1) & 0xf0) == 0x30)
411 i1 += 2;
412 break;
414 case 3:
415 if (tvb_offset_exists(tvb, offset + i1 + 1)) {
416 if ((lcd_strlen < 1) ||
417 (lcd_str[lcd_strlen-1] != ' ') ||
418 (tvb_get_uint8(tvb, offset + i1 + 1) != ' ')) {
419 lcd_char = tvb_get_uint8(tvb, offset + i1 + 1);
420 lcd_str[lcd_strlen++] = g_ascii_isprint(lcd_char) ? lcd_char : '.';
425 i1 += 2;
427 lcd_str[lcd_strlen] = '\0';
428 if (lcd_strlen > 0)
429 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", lcd_str);
430 break;
432 case SLIMP3_CONTROL:
433 proto_tree_add_item(slimp3_tree, hf_slimp3_control, tvb, offset+1, 1, ENC_BIG_ENDIAN);
434 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
435 val_to_str(tvb_get_uint8(tvb, offset+1),
436 slimp3_stream_control, "Unknown (0x%0x)"));
437 break;
439 case SLIMP3_HELLO:
440 if (tree) {
441 if (to_server) {
442 uint8_t fw_ver;
443 /* Hello response; client->server */
444 proto_tree_add_item(slimp3_tree, hf_slimp3_hello_response_client_server, tvb, offset, 1, ENC_NA);
445 proto_tree_add_item(slimp3_tree, hf_slimp3_device_id, tvb, offset+1, 1, ENC_BIG_ENDIAN);
446 fw_ver = tvb_get_uint8(tvb, offset+2);
447 proto_tree_add_uint_format_value(slimp3_tree, hf_slimp3_fw_rev, tvb, offset+2, 1, fw_ver,
448 "%u.%u (0x%0x)", fw_ver>>4, fw_ver & 0xf, fw_ver);
449 } else {
450 /* Hello request; server->client */
451 proto_tree_add_item(slimp3_tree, hf_slimp3_hello_request_server_client, tvb, offset, 1, ENC_NA);
454 break;
456 case SLIMP3_I2C:
457 if (to_server) {
458 /* Hello response; client->server */
459 proto_tree_add_item(slimp3_tree, hf_slimp3_i2c_response_client_server, tvb, offset, -1, ENC_NA);
460 col_append_str(pinfo->cinfo, COL_INFO, ", Response");
461 } else {
462 /* Hello request; server->client */
463 proto_tree_add_item(slimp3_tree, hf_slimp3_i2c_request_server_client, tvb, offset, -1, ENC_NA);
464 col_append_str(pinfo->cinfo, COL_INFO, ", Request");
466 break;
468 case SLIMP3_DATA_REQ:
469 proto_tree_add_item(slimp3_tree, hf_slimp3_data_req_offset, tvb, offset+2, 2, ENC_BIG_ENDIAN);
470 col_append_fstr(pinfo->cinfo, COL_INFO, ", Offset: %u bytes",
471 tvb_get_ntohs(tvb, offset+2)*2);
472 break;
474 case SLIMP3_DATA:
475 /* MPEG data (v1.3 and later)
477 * [0] 'm'
478 * [1..5] reserved
479 * [6..7] Write pointer (in words)
480 * [8..9] reserved
481 * [10..11] Sequence number
482 * [12..17] reserved
483 * [18..] MPEG data
485 if (old_protocol) {
486 unsigned offset_buffer;
487 proto_tree_add_bytes_format(slimp3_tree, hf_slimp3_data_length, tvb, offset, -1,
488 NULL, "Length: %d bytes",
489 tvb_reported_length_remaining(tvb, offset+18));
490 offset_buffer = tvb_get_ntohs(tvb, offset+2) * 2;
491 proto_tree_add_uint(slimp3_tree, hf_slimp3_data_offset, tvb, offset+2, 2, offset_buffer);
493 col_append_fstr(pinfo->cinfo, COL_INFO,
494 ", Length: %d bytes, Offset: %u bytes.",
495 tvb_reported_length_remaining(tvb, offset+18),
496 offset_buffer);
498 else {
499 unsigned write_pointer;
500 proto_tree_add_item(slimp3_tree, hf_slimp3_data_command, tvb, offset+1, 1, ENC_BIG_ENDIAN);
501 proto_tree_add_bytes_format(slimp3_tree, hf_slimp3_data_length, tvb, offset, -1,
502 NULL, "Length: %d bytes",
503 tvb_reported_length_remaining(tvb, offset+18));
504 write_pointer = tvb_get_ntohs(tvb, offset+6) * 2;
505 proto_tree_add_uint(slimp3_tree, hf_slimp3_data_write_pointer, tvb, offset+6, 2, write_pointer);
506 proto_tree_add_item(slimp3_tree, hf_slimp3_data_sequence, tvb, offset+10, 2, ENC_BIG_ENDIAN);
508 col_append_fstr(pinfo->cinfo, COL_INFO,
509 ", %s, %d bytes at %u, Sequence: %u",
510 val_to_str(tvb_get_uint8(tvb, offset+1),
511 slimp3_mpg_control, "Unknown (0x%0x)"),
512 tvb_reported_length_remaining(tvb, offset+18),
513 write_pointer,
514 tvb_get_ntohs(tvb, offset+10));
516 break;
518 case SLIMP3_DISC_REQ:
520 uint8_t fw_ver;
521 proto_tree_add_item(slimp3_tree, hf_slimp3_device_id, tvb, offset+1, 1, ENC_BIG_ENDIAN);
522 fw_ver = tvb_get_uint8(tvb, offset+2);
523 proto_tree_add_uint_format_value(slimp3_tree, hf_slimp3_fw_rev, tvb, offset+2, 1, fw_ver,
524 "%u.%u (0x%0x)", fw_ver>>4, fw_ver & 0xf, fw_ver);
525 col_append_fstr(pinfo->cinfo, COL_INFO, ", Device ID: %u. Firmware: %u.%u",
526 tvb_get_uint8(tvb, offset+1), fw_ver>>4, fw_ver & 0xf);
528 break;
530 case SLIMP3_DISC_RSP:
531 if (tree) {
532 proto_tree_add_item(slimp3_tree, hf_slimp3_disc_rsp_server_ip, tvb, offset+2, 4, ENC_BIG_ENDIAN);
533 proto_tree_add_item(slimp3_tree, hf_slimp3_disc_rsp_server_port, tvb, offset+6, 2, ENC_BIG_ENDIAN);
536 col_append_fstr(pinfo->cinfo, COL_INFO, ", Server Address: %s. Server Port: %u",
537 tvb_ip_to_str(pinfo->pool, tvb, offset+2),
538 tvb_get_ntohs(tvb, offset + 6));
539 break;
541 case SLIMP3_DATA_ACK:
542 /* Acknowledge MPEG data
544 * [0] 'a'
545 * [1..5]
546 * [6..7] Write pointer (in words)
547 * [8..9] Read pointer (in words)
548 * [10..11] Sequence number
549 * [12..17] client MAC address (v1.3 and later)
551 if (tree) {
552 unsigned pointer;
554 pointer = tvb_get_ntohs(tvb, offset+6) * 2;
555 proto_tree_add_uint(slimp3_tree, hf_slimp3_data_ack_write_pointer, tvb, offset+6, 2, pointer);
556 pointer = tvb_get_ntohs(tvb, offset+8) * 2;
557 proto_tree_add_uint(slimp3_tree, hf_slimp3_data_ack_read_pointer, tvb, offset+8, 2, pointer);
558 proto_tree_add_item(slimp3_tree, hf_slimp3_data_ack_sequence, tvb, offset+10, 2, ENC_BIG_ENDIAN);
561 col_append_fstr(pinfo->cinfo, COL_INFO, ", Sequence: %u",
562 tvb_get_ntohs(tvb, offset+10));
563 break;
565 default:
566 if (tree) {
567 proto_tree_add_item(slimp3_tree, hf_slimp3_data_data, tvb, offset, -1, ENC_NA);
569 break;
572 return tvb_reported_length(tvb);
575 void
576 proto_register_slimp3(void)
578 static hf_register_info hf[] = {
579 { &hf_slimp3_opcode,
580 { "Opcode", "slimp3.opcode",
581 FT_UINT8, BASE_DEC, VALS(slimp3_opcode_vals), 0x0,
582 "SLIMP3 message type", HFILL }},
584 { &hf_slimp3_control,
585 { "Control Packet", "slimp3.control",
586 FT_UINT8, BASE_DEC, VALS(slimp3_stream_control), 0x0,
587 "SLIMP3 control", HFILL }},
589 { &hf_slimp3_uptime,
590 { "Uptime", "slimp3.uptime",
591 FT_UINT32, BASE_DEC, NULL, 0x0,
592 NULL, HFILL }},
594 { &hf_slimp3_code_id,
595 { "Code identifier", "slimp3.code_id",
596 FT_UINT8, BASE_DEC, VALS(slimp3_ir_types), 0x0,
597 NULL, HFILL }},
599 { &hf_slimp3_code_bits,
600 { "Code bits", "slimp3.code_bits",
601 FT_UINT8, BASE_DEC, NULL, 0x0,
602 NULL, HFILL }},
604 { &hf_slimp3_infrared_slimp3,
605 { "Infrared Code", "slimp3.infrared",
606 FT_UINT32, BASE_HEX | BASE_EXT_STRING, &slimp3_ir_codes_slimp3_ext, 0x0,
607 NULL, HFILL }},
609 { &hf_slimp3_infrared_jvc,
610 { "Infrared Code", "slimp3.infrared",
611 FT_UINT32, BASE_HEX, VALS(slimp3_ir_codes_jvc), 0x0,
612 NULL, HFILL }},
614 { &hf_slimp3_infrared,
615 { "Infrared Code", "slimp3.infrared",
616 FT_UINT32, BASE_HEX, NULL, 0x0,
617 NULL, HFILL }},
619 { &hf_slimp3_device_id,
620 { "Device ID", "slimp3.device_id",
621 FT_UINT8, BASE_DEC, NULL, 0x0,
622 NULL, HFILL }},
624 { &hf_slimp3_fw_rev,
625 { "Firmware Revision", "slimp3.fw_rev",
626 FT_UINT8, BASE_HEX, NULL, 0x0,
627 NULL, HFILL }},
629 { &hf_slimp3_data_offset,
630 { "Buffer offset", "slimp3.data.offset",
631 FT_UINT16, BASE_DEC, NULL, 0x0,
632 NULL, HFILL }},
634 { &hf_slimp3_data_command,
635 { "Command", "slimp3.data.command",
636 FT_UINT8, BASE_HEX, VALS(slimp3_mpg_control), 0x0,
637 NULL, HFILL }},
639 { &hf_slimp3_data_write_pointer,
640 { "Write Pointer", "slimp3.data.write_pointer",
641 FT_UINT16, BASE_DEC, NULL, 0x0,
642 NULL, HFILL }},
644 { &hf_slimp3_data_sequence,
645 { "Sequence", "slimp3.data.sequence",
646 FT_UINT16, BASE_DEC, NULL, 0x0,
647 NULL, HFILL }},
649 { &hf_slimp3_disc_rsp_server_ip,
650 { "Server Address", "slimp3.disc_rsp.server_ip",
651 FT_IPv4, BASE_NONE, NULL, 0x0,
652 NULL, HFILL }},
654 { &hf_slimp3_disc_rsp_server_port,
655 { "Server Port", "slimp3.disc_rsp.server_port",
656 FT_UINT16, BASE_DEC, NULL, 0x0,
657 NULL, HFILL }},
659 { &hf_slimp3_data_ack_write_pointer,
660 { "Write Pointer", "slimp3.data_ack.write_pointer",
661 FT_UINT16, BASE_DEC, NULL, 0x0,
662 NULL, HFILL }},
664 { &hf_slimp3_data_ack_read_pointer,
665 { "Read Pointer", "slimp3.data_ack.read_pointer",
666 FT_UINT16, BASE_DEC, NULL, 0x0,
667 NULL, HFILL }},
669 { &hf_slimp3_data_ack_sequence,
670 { "Sequence", "slimp3.data_ack.sequence",
671 FT_UINT16, BASE_DEC, NULL, 0x0,
672 NULL, HFILL }},
674 { &hf_slimp3_data_req_offset,
675 { "Requested offset", "slimp3.data_req.offset",
676 FT_UINT16, BASE_DEC, NULL, 0x0,
677 NULL, HFILL }},
679 /* Generated from convert_proto_tree_add_text.pl */
680 { &hf_slimp3_display_delay, { "Delay", "slimp3.display_delay", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0, NULL, HFILL }},
681 { &hf_slimp3_display_string, { "String", "slimp3.display_string", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
682 { &hf_slimp3_display_command, { "Command", "slimp3.display_command", FT_UINT8, BASE_DEC, VALS(slimp3_display_commands), 0x0, NULL, HFILL }},
683 { &hf_slimp3_display_unknown, { "Unknown", "slimp3.display_unknown", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
684 { &hf_slimp3_hello_response_client_server, { "Hello Response (Client --> Server)", "slimp3.hello_response_client_server", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
685 { &hf_slimp3_hello_request_server_client, { "Hello Request (Server --> Client)", "slimp3.hello_request_server_client", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
686 { &hf_slimp3_i2c_response_client_server, { "I2C Response (Client --> Server)", "slimp3.i2c_response_client_server", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
687 { &hf_slimp3_i2c_request_server_client, { "I2C Request (Server --> Client)", "slimp3.i2c_request_server_client", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
688 { &hf_slimp3_data_length, { "Length", "slimp3.data.length", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
689 { &hf_slimp3_data_data, { "Data", "slimp3.data.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
692 static int *ett[] = {
693 &ett_slimp3,
696 proto_slimp3 = proto_register_protocol("SliMP3 Communication Protocol", "SliMP3", "slimp3");
697 proto_register_field_array(proto_slimp3, hf, array_length(hf));
698 proto_register_subtree_array(ett, array_length(ett));
700 slimp3_handle = register_dissector("slimp3", dissect_slimp3, proto_slimp3);
703 void
704 proto_reg_handoff_slimp3(void)
706 dissector_add_uint_range_with_preference("udp.port", UDP_PORT_SLIMP3_RANGE, slimp3_handle);
710 * Editor modelines
712 * Local Variables:
713 * c-basic-offset: 4
714 * tab-width: 8
715 * indent-tabs-mode: nil
716 * End:
718 * ex: set shiftwidth=4 tabstop=8 expandtab:
719 * :indentSize=4:tabSize=8:noTabs=true: