MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / epan / dissectors / packet-slimp3.c
blob4efe2616f7ef02437041b9f612ef52d1126c5ab6
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 * $Id$
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include "config.h"
32 #include <glib.h>
33 #include <string.h>
34 #include <ctype.h>
35 #include <epan/packet.h>
36 #include <epan/to_str.h>
38 static int proto_slimp3 = -1;
39 static int hf_slimp3_opcode = -1;
40 static int hf_slimp3_control = -1;
41 static int hf_slimp3_uptime = -1;
42 static int hf_slimp3_code_id = -1;
43 static int hf_slimp3_code_bits = -1;
44 static int hf_slimp3_infrared_slimp3 = -1;
45 static int hf_slimp3_infrared_jvc = -1;
46 static int hf_slimp3_infrared = -1;
47 static int hf_slimp3_device_id = -1;
48 static int hf_slimp3_fw_rev = -1;
49 static int hf_slimp3_data_offset = -1;
50 static int hf_slimp3_data_command = -1;
51 static int hf_slimp3_data_write_pointer = -1;
52 static int hf_slimp3_data_sequence = -1;
53 static int hf_slimp3_disc_rsp_server_ip = -1;
54 static int hf_slimp3_disc_rsp_server_port = -1;
55 static int hf_slimp3_data_ack_write_pointer = -1;
56 static int hf_slimp3_data_ack_read_pointer = -1;
57 static int hf_slimp3_data_ack_sequence = -1;
58 static int hf_slimp3_data_req_offset = -1;
60 static gint ett_slimp3 = -1;
62 #define UDP_PORT_SLIMP3_V1 1069
63 #define UDP_PORT_SLIMP3_V2 3483
65 #define SLIMP3_IR 'i'
66 #define SLIMP3_CONTROL 's'
67 #define SLIMP3_HELLO 'h'
68 #define SLIMP3_DATA 'm'
69 #define SLIMP3_DATA_REQ 'r'
70 #define SLIMP3_DISPLAY 'l'
71 #define SLIMP3_I2C '2'
72 #define SLIMP3_DISC_REQ 'd'
73 #define SLIMP3_DISC_RSP 'D'
74 #define SLIMP3_DATA_ACK 'a'
76 static const value_string slimp3_opcode_vals[] = {
77 { SLIMP3_IR, "Infrared Remote Code" },
78 { SLIMP3_CONTROL, "Stream Control" },
79 { SLIMP3_DATA, "MPEG Data" },
80 { SLIMP3_DATA_REQ, "Data Request" },
81 { SLIMP3_HELLO, "Hello" },
82 { SLIMP3_DISPLAY, "Display" },
83 { SLIMP3_I2C, "I2C" },
84 { SLIMP3_DISC_REQ, "Discovery Request" },
85 { SLIMP3_DISC_RSP, "Discovery Response" },
86 { SLIMP3_DATA_ACK, "Ack" },
87 { 0, NULL }
90 /* IR remote control types */
91 static const value_string slimp3_ir_types[] = {
92 { 0x02, "SLIMP3" },
93 { 0xff, "JVC DVD Player" },
95 { 0, NULL }
98 /* IR codes for the custom SLIMP3 remote control */
99 static const value_string slimp3_ir_codes_slimp3[] = {
100 { 0x76899867, "0" },
101 { 0x7689f00f, "1" },
102 { 0x768908f7, "2" },
103 { 0x76898877, "3" },
104 { 0x768948b7, "4" },
105 { 0x7689c837, "5" },
106 { 0x768928d7, "6" },
107 { 0x7689a857, "7" },
108 { 0x76896897, "8" },
109 { 0x7689e817, "9" },
110 { 0x7689b04f, "arrow_down" },
111 { 0x7689906f, "arrow_left" },
112 { 0x7689d02f, "arrow_right" },
113 { 0x7689e01f, "arrow_up" },
114 { 0x768900ff, "voldown" },
115 { 0x7689807f, "volup" },
116 { 0x768940bf, "power" },
117 { 0x7689c03f, "rew" },
118 { 0x768920df, "pause" },
119 { 0x7689a05f, "fwd" },
120 { 0x7689609f, "add" },
121 { 0x768910ef, "play" },
122 { 0x768958a7, "search" },
123 { 0x7689d827, "shuffle" },
124 { 0x768938c7, "repeat" },
125 { 0x7689b847, "sleep" },
126 { 0x76897887, "now_playing" },
127 { 0x7689f807, "size" },
128 { 0x768904fb, "brightness" },
130 { 0, NULL }
133 /* IR codes for the JVC remote control */
134 static const value_string slimp3_ir_codes_jvc[] = {
135 { 0xf786, "One" },
136 { 0xf746, "Two" },
137 { 0xf7c6, "Three" },
138 { 0xf726, "Four" },
139 { 0xf7a6, "Five" },
140 { 0xf766, "Six" },
141 { 0xf7e6, "Seven" },
142 { 0xf716, "Eight" },
143 { 0xf796, "Nine" },
144 { 0xf776, "Ten" },
146 { 0xf7f6, "Picture-In-Picture" },
147 /* { 0xf7XX, "Enter" }, */
148 { 0xf70e, "Back" },
149 { 0xf732, "Play" },
150 { 0xf76e, "Forward" },
151 { 0xf743, "Record" },
152 { 0xf7c2, "Stop" },
153 { 0xf7b2, "Pause" },
154 /* { 0xf7XX, "TV/Video" }, */
155 { 0xf703, "Display" },
156 { 0xf7b3, "Sleep" },
157 { 0xf7b6, "Guide" },
158 { 0xf70b, "Up" },
159 { 0xf74b, "Left" },
160 { 0xf7cb, "Right" },
161 { 0xf78b, "Down" },
162 { 0xf783, "Menu" },
163 { 0xf72b, "OK" },
164 { 0xf778, "Volume Up" },
165 { 0xf7f8, "Volume Down" },
166 { 0xf70d, "Channel Up" },
167 { 0xf78d, "Channel Down" },
168 /* { 0xf7XX, "Mute" }, */
169 { 0xf7ab, "Recall" },
170 { 0xf702, "Power" },
172 { 0, NULL }
176 static const value_string slimp3_display_commands[] = {
177 { 0x1, "Clear Display"},
178 { 0x2, "Cursor to 1st Line Home"},
180 { 0x4, "Mode: Decrement Address, Shift Cursor"},
181 { 0x5, "Mode: Decrement Address, Shift Display"},
182 { 0x6, "Mode: Increment Address, Shift Cursor"},
183 { 0x7, "Mode: Increment Address, Shift Display"},
185 { 0x8, "Display Off"},
186 { 0xd, "Display On, With Blinking"},
187 { 0xe, "Display On, With Cursor"},
188 { 0xf, "Display On, With Cursor And Blinking"},
190 { 0x10, "Move Cursor Left"},
191 { 0x14, "Move Cursor Right"},
192 { 0x18, "Shift Display Left"},
193 { 0x1b, "Shift Display Right"},
195 { 0x30, "Set (8-bit)"},
196 { 0x20, "Set (4-bit)"},
198 { 0xa0, "Cursor to Top Right"},
199 { 0xc0, "Cursor to 2nd Line Home"},
201 { 0, NULL},
204 static const value_string slimp3_display_fset8[] = {
205 { 0x0, "Brightness 100%"},
206 { 0x1, "Brightness 75%"},
207 { 0x2, "Brightness 50%"},
208 { 0x3, "Brightness 25%"},
210 { 0, NULL },
213 static const value_string slimp3_stream_control[] = {
214 { 1, "Reset buffer, Start New Stream"},
215 { 2, "Pause Playback"},
216 { 4, "Resume Playback"},
217 { 0, NULL },
221 static const value_string slimp3_mpg_control[] = {
222 { 0, "Go"}, /* Run the decoder */
223 { 1, "Stop"}, /* Halt decoder but don't reset rptr */
224 { 3, "Reset"}, /* Halt decoder and reset rptr */
226 { 0, NULL }
229 #define MAX_LCD_STR_LEN 128
230 static int
231 dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
233 const char *opcode_str;
234 proto_tree *slimp3_tree;
235 proto_item *ti;
236 gint i1;
237 gint offset = 0;
238 guint16 opcode;
239 guchar lcd_char;
240 char lcd_str[MAX_LCD_STR_LEN + 1];
241 int to_server = FALSE;
242 int old_protocol = FALSE;
243 address tmp_addr;
244 gboolean in_str;
245 int lcd_strlen;
248 * If it doesn't begin with a known opcode, reject it, so that
249 * traffic that happens to be do or from one of our ports
250 * doesn't get misidentified as SliMP3 traffic.
252 if (!tvb_bytes_exist(tvb, offset, 1))
253 return 0; /* not even an opcode */
254 opcode = tvb_get_guint8(tvb, offset);
255 opcode_str = try_val_to_str(opcode, slimp3_opcode_vals);
256 if (opcode_str == NULL)
257 return 0;
259 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SliMP3");
260 col_add_str(pinfo->cinfo, COL_INFO, opcode_str);
262 ti = proto_tree_add_item(tree, proto_slimp3, tvb, offset, -1, ENC_NA);
263 slimp3_tree = proto_item_add_subtree(ti, ett_slimp3);
265 proto_tree_add_uint(slimp3_tree, hf_slimp3_opcode, tvb,
266 offset, 1, opcode);
268 /* The new protocol (v1.3 and later) uses an IANA-assigned port number.
269 * It usually uses the same number for both sizes of the conversation, so
270 * the port numbers can't always be used to determine client and server.
271 * The new protocol places the clients MAC address in the packet, so that
272 * is used to identify packets originating at the client.
274 if ((pinfo->destport == UDP_PORT_SLIMP3_V2) && (pinfo->srcport == UDP_PORT_SLIMP3_V2)) {
275 TVB_SET_ADDRESS(&tmp_addr, AT_ETHER, tvb, offset+12, 6);
276 to_server = ADDRESSES_EQUAL(&tmp_addr, &pinfo->dl_src);
278 else if (pinfo->destport == UDP_PORT_SLIMP3_V2) {
279 to_server = TRUE;
281 else if (pinfo->srcport == UDP_PORT_SLIMP3_V2) {
282 to_server = FALSE;
284 if (pinfo->destport == UDP_PORT_SLIMP3_V1) {
285 to_server = TRUE;
286 old_protocol = TRUE;
288 else if (pinfo->srcport == UDP_PORT_SLIMP3_V1) {
289 to_server = FALSE;
290 old_protocol = TRUE;
293 switch (opcode) {
295 case SLIMP3_IR:
296 /* IR code
298 * [0] 'i' as in "IR"
299 * [1] 0x00
300 * [2..5] player's time since startup in ticks @625 KHz
301 * [6] IR code id, ff=JVC, 02=SLIMP3
302 * [7] number of meaningful bits - 16 for JVC, 32 for SLIMP3
303 * [8..11] the 32-bit IR code
304 * [12..17] reserved
306 if (tree) {
307 i1 = tvb_get_ntohl(tvb, offset+2);
308 proto_tree_add_uint_format_value(slimp3_tree, hf_slimp3_uptime, tvb, offset+2, 4, i1,
309 "%u sec (%u ticks)", i1/625000, i1);
311 proto_tree_add_item(slimp3_tree, hf_slimp3_code_id, tvb, offset+6, 1, ENC_BIG_ENDIAN);
312 proto_tree_add_item(slimp3_tree, hf_slimp3_code_bits, tvb, offset+7, 1, ENC_BIG_ENDIAN);
314 i1 = tvb_get_ntohl(tvb, offset+8);
315 /* Check the code to figure out which remote is being used. */
316 if (tvb_get_guint8(tvb, offset+6) == 0x02 &&
317 tvb_get_guint8(tvb, offset+7) == 32) {
318 /* This is the custom SLIMP3 remote. */
319 proto_tree_add_item(slimp3_tree, hf_slimp3_infrared_slimp3, tvb, offset+8, 4, ENC_BIG_ENDIAN);
320 col_append_fstr(pinfo->cinfo, COL_INFO, ", SLIMP3: %s",
321 val_to_str(i1, slimp3_ir_codes_slimp3, "Unknown (0x%0x)"));
323 else if (tvb_get_guint8(tvb, offset+6) == 0xff &&
324 tvb_get_guint8(tvb, offset+7) == 16) {
325 /* This is a JVC DVD player remote */
326 proto_tree_add_item(slimp3_tree, hf_slimp3_infrared_jvc, tvb, offset+8, 4, ENC_BIG_ENDIAN);
327 col_append_fstr(pinfo->cinfo, COL_INFO, ", JVC: %s",
328 val_to_str(i1, slimp3_ir_codes_jvc, "Unknown (0x%0x)"));
329 } else {
330 /* Unknown code; just write it */
331 proto_tree_add_item(slimp3_tree, hf_slimp3_infrared, tvb, offset+8, 4, ENC_BIG_ENDIAN);
332 col_append_fstr(pinfo->cinfo, COL_INFO, ", 0x%0x", i1);
335 break;
337 case SLIMP3_DISPLAY:
338 if (tree) {
339 /* Loop through the commands */
340 i1 = 18;
341 in_str = FALSE;
342 lcd_strlen = 0;
343 while (i1 < tvb_reported_length_remaining(tvb, offset)) {
344 switch(tvb_get_guint8(tvb, offset + i1)) {
345 case 0:
346 in_str = FALSE;
347 lcd_strlen = 0;
348 proto_tree_add_text(slimp3_tree, tvb, offset + i1, 2,
349 "Delay (%u ms)", tvb_get_guint8(tvb, offset + i1 + 1));
350 i1 += 2;
351 break;
352 case 3:
353 lcd_char = tvb_get_guint8(tvb, offset + i1 + 1);
354 if (!isprint(lcd_char))
355 lcd_char = '.';
356 if (ti && in_str) {
357 lcd_strlen += 2;
358 proto_item_append_text(ti, "%c", lcd_char);
359 proto_item_set_len(ti, lcd_strlen);
360 } else {
361 ti = proto_tree_add_text(slimp3_tree, tvb, offset + i1, 2,
362 "String: %c", lcd_char);
363 in_str = TRUE;
364 lcd_strlen = 2;
366 i1 += 2;
367 break;
369 case 2:
370 in_str = FALSE;
371 lcd_strlen = 0;
372 ti = proto_tree_add_text(slimp3_tree, tvb, offset + i1, 2,
373 "Command: %s",
374 val_to_str(tvb_get_guint8(tvb, offset + i1 + 1),
375 slimp3_display_commands,
376 "Unknown (0x%0x)"));
377 if ((tvb_get_guint8(tvb, offset + i1 + 1) & 0xf0) == 0x30) {
378 proto_item_append_text(ti, ": %s",
379 val_to_str(tvb_get_guint8(tvb, offset + i1 + 2),
380 slimp3_display_fset8,
381 "Unknown (0x%0x)"));
382 i1 += 2;
384 i1 += 2;
385 break;
387 default:
388 proto_tree_add_text(slimp3_tree, tvb, offset + i1, 2,
389 "Unknown 0x%0x, 0x%0x",
390 tvb_get_guint8(tvb, offset + i1),
391 tvb_get_guint8(tvb, offset + i1 + 1));
392 i1 += 2;
393 break;
398 i1 = 18;
399 lcd_strlen = 0;
400 while (tvb_offset_exists(tvb, offset + i1) &&
401 lcd_strlen < MAX_LCD_STR_LEN) {
402 switch (tvb_get_guint8(tvb, offset + i1)) {
404 case 0:
405 lcd_str[lcd_strlen++] = '.';
406 break;
408 case 2:
409 lcd_str[lcd_strlen++] = '|';
410 if (tvb_offset_exists(tvb, offset + i1 + 1) &&
411 (tvb_get_guint8(tvb, offset + i1 + 1) & 0xf0) == 0x30)
412 i1 += 2;
413 break;
415 case 3:
416 if (tvb_offset_exists(tvb, offset + i1 + 1)) {
417 if ((lcd_strlen < 1) ||
418 (lcd_str[lcd_strlen-1] != ' ') ||
419 (tvb_get_guint8(tvb, offset + i1 + 1) != ' ')) {
420 lcd_char = tvb_get_guint8(tvb, offset + i1 + 1);
421 lcd_str[lcd_strlen++] = isprint(lcd_char) ? lcd_char : '.';
426 i1 += 2;
428 lcd_str[lcd_strlen] = '\0';
429 if (lcd_strlen > 0)
430 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", lcd_str);
431 break;
433 case SLIMP3_CONTROL:
434 proto_tree_add_item(slimp3_tree, hf_slimp3_control, tvb, offset+1, 1, ENC_BIG_ENDIAN);
435 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
436 val_to_str(tvb_get_guint8(tvb, offset+1),
437 slimp3_stream_control, "Unknown (0x%0x)"));
438 break;
440 case SLIMP3_HELLO:
441 if (tree) {
442 if (to_server) {
443 guint8 fw_ver;
444 /* Hello response; client->server */
445 proto_tree_add_text(slimp3_tree, tvb, offset, 1, "Hello Response (Client --> Server)");
446 proto_tree_add_item(slimp3_tree, hf_slimp3_device_id, tvb, offset+1, 1, ENC_BIG_ENDIAN);
447 fw_ver = tvb_get_guint8(tvb, offset+2);
448 proto_tree_add_uint_format_value(slimp3_tree, hf_slimp3_fw_rev, tvb, offset+2, 1, fw_ver,
449 "%u.%u (0x%0x)", fw_ver>>4, fw_ver & 0xf, fw_ver);
450 } else {
451 /* Hello request; server->client */
452 proto_tree_add_text(slimp3_tree, tvb, offset, 1, "Hello Request (Server --> Client)");
455 break;
457 case SLIMP3_I2C:
458 if (to_server) {
459 /* Hello response; client->server */
460 proto_tree_add_text(slimp3_tree, tvb, offset, -1,
461 "I2C Response (Client --> Server)");
462 col_append_str(pinfo->cinfo, COL_INFO, ", Response");
463 } else {
464 /* Hello request; server->client */
465 proto_tree_add_text(slimp3_tree, tvb, offset, -1,
466 "I2C Request (Server --> Client)");
467 col_append_str(pinfo->cinfo, COL_INFO, ", Request");
469 break;
471 case SLIMP3_DATA_REQ:
472 proto_tree_add_item(slimp3_tree, hf_slimp3_data_req_offset, tvb, offset+2, 2, ENC_BIG_ENDIAN);
473 col_append_fstr(pinfo->cinfo, COL_INFO, ", Offset: %u bytes",
474 tvb_get_ntohs(tvb, offset+2)*2);
475 break;
477 case SLIMP3_DATA:
478 /* MPEG data (v1.3 and later)
480 * [0] 'm'
481 * [1..5] reserved
482 * [6..7] Write pointer (in words)
483 * [8..9] reserved
484 * [10..11] Sequence number
485 * [12..17] reserved
486 * [18..] MPEG data
488 if (old_protocol) {
489 guint offset_buffer;
490 proto_tree_add_text(slimp3_tree, tvb, offset, -1,
491 "Length: %d bytes",
492 tvb_reported_length_remaining(tvb, offset+18));
493 offset_buffer = tvb_get_ntohs(tvb, offset+2) * 2;
494 proto_tree_add_uint(slimp3_tree, hf_slimp3_data_offset, tvb, offset+2, 2, offset_buffer);
496 col_append_fstr(pinfo->cinfo, COL_INFO,
497 ", Length: %d bytes, Offset: %u bytes.",
498 tvb_reported_length_remaining(tvb, offset+18),
499 offset_buffer);
501 else {
502 guint write_pointer;
503 proto_tree_add_item(slimp3_tree, hf_slimp3_data_command, tvb, offset+1, 1, ENC_BIG_ENDIAN);
504 proto_tree_add_text(slimp3_tree, tvb, offset, -1,
505 "Length: %d bytes",
506 tvb_reported_length_remaining(tvb, offset+18));
507 write_pointer = tvb_get_ntohs(tvb, offset+6) * 2;
508 proto_tree_add_uint(slimp3_tree, hf_slimp3_data_write_pointer, tvb, offset+6, 2, write_pointer);
509 proto_tree_add_item(slimp3_tree, hf_slimp3_data_sequence, tvb, offset+10, 2, ENC_BIG_ENDIAN);
511 col_append_fstr(pinfo->cinfo, COL_INFO,
512 ", %s, %d bytes at %u, Sequence: %u",
513 val_to_str(tvb_get_guint8(tvb, offset+1),
514 slimp3_mpg_control, "Unknown (0x%0x)"),
515 tvb_reported_length_remaining(tvb, offset+18),
516 write_pointer,
517 tvb_get_ntohs(tvb, offset+10));
519 break;
521 case SLIMP3_DISC_REQ:
523 guint8 fw_ver;
524 proto_tree_add_item(slimp3_tree, hf_slimp3_device_id, tvb, offset+1, 1, ENC_BIG_ENDIAN);
525 fw_ver = tvb_get_guint8(tvb, offset+2);
526 proto_tree_add_uint_format_value(slimp3_tree, hf_slimp3_fw_rev, tvb, offset+2, 1, fw_ver,
527 "%u.%u (0x%0x)", fw_ver>>4, fw_ver & 0xf, fw_ver);
528 col_append_fstr(pinfo->cinfo, COL_INFO, ", Device ID: %u. Firmware: %u.%u",
529 tvb_get_guint8(tvb, offset+1), fw_ver>>4, fw_ver & 0xf);
531 break;
533 case SLIMP3_DISC_RSP:
534 if (tree) {
535 proto_tree_add_item(slimp3_tree, hf_slimp3_disc_rsp_server_ip, tvb, offset+2, 4, ENC_BIG_ENDIAN);
536 proto_tree_add_item(slimp3_tree, hf_slimp3_disc_rsp_server_port, tvb, offset+6, 2, ENC_BIG_ENDIAN);
539 col_append_fstr(pinfo->cinfo, COL_INFO, ", Server Address: %s. Server Port: %u",
540 tvb_ip_to_str(tvb, offset+2),
541 tvb_get_ntohs(tvb, offset + 6));
542 break;
544 case SLIMP3_DATA_ACK:
545 /* Acknowledge MPEG data
547 * [0] 'a'
548 * [1..5]
549 * [6..7] Write pointer (in words)
550 * [8..9] Read pointer (in words)
551 * [10..11] Sequence number
552 * [12..17] client MAC address (v1.3 and later)
554 if (tree) {
555 guint pointer;
557 pointer = tvb_get_ntohs(tvb, offset+6) * 2;
558 proto_tree_add_uint(slimp3_tree, hf_slimp3_data_ack_write_pointer, tvb, offset+6, 2, pointer);
559 pointer = tvb_get_ntohs(tvb, offset+8) * 2;
560 proto_tree_add_uint(slimp3_tree, hf_slimp3_data_ack_read_pointer, tvb, offset+8, 2, pointer);
561 proto_tree_add_item(slimp3_tree, hf_slimp3_data_ack_sequence, tvb, offset+10, 2, ENC_BIG_ENDIAN);
564 col_append_fstr(pinfo->cinfo, COL_INFO, ", Sequence: %u",
565 tvb_get_ntohs(tvb, offset+10));
566 break;
568 default:
569 if (tree) {
570 proto_tree_add_text(slimp3_tree, tvb, offset, -1,
571 "Data (%d bytes)", tvb_reported_length_remaining(tvb, offset));
573 break;
576 return tvb_reported_length(tvb);
579 void
580 proto_register_slimp3(void)
582 static hf_register_info hf[] = {
583 { &hf_slimp3_opcode,
584 { "Opcode", "slimp3.opcode",
585 FT_UINT8, BASE_DEC, VALS(slimp3_opcode_vals), 0x0,
586 "SLIMP3 message type", HFILL }},
588 { &hf_slimp3_control,
589 { "Control Packet", "slimp3.control",
590 FT_UINT8, BASE_DEC, VALS(slimp3_stream_control), 0x0,
591 "SLIMP3 control", HFILL }},
593 { &hf_slimp3_uptime,
594 { "Uptime", "slimp3.uptime",
595 FT_UINT32, BASE_DEC, NULL, 0x0,
596 NULL, HFILL }},
598 { &hf_slimp3_code_id,
599 { "Code identifier", "slimp3.code_id",
600 FT_UINT8, BASE_DEC, VALS(slimp3_ir_types), 0x0,
601 NULL, HFILL }},
603 { &hf_slimp3_code_bits,
604 { "Code bits", "slimp3.code_bits",
605 FT_UINT8, BASE_DEC, NULL, 0x0,
606 NULL, HFILL }},
608 { &hf_slimp3_infrared_slimp3,
609 { "Infrared Code", "slimp3.infrared",
610 FT_UINT32, BASE_HEX, VALS(slimp3_ir_codes_slimp3), 0x0,
611 NULL, HFILL }},
613 { &hf_slimp3_infrared_jvc,
614 { "Infrared Code", "slimp3.infrared",
615 FT_UINT32, BASE_HEX, VALS(slimp3_ir_codes_jvc), 0x0,
616 NULL, HFILL }},
618 { &hf_slimp3_infrared,
619 { "Infrared Code", "slimp3.infrared",
620 FT_UINT32, BASE_HEX, NULL, 0x0,
621 NULL, HFILL }},
623 { &hf_slimp3_device_id,
624 { "Device ID", "slimp3.device_id",
625 FT_UINT8, BASE_DEC, NULL, 0x0,
626 NULL, HFILL }},
628 { &hf_slimp3_fw_rev,
629 { "Firmware Revision", "slimp3.fw_rev",
630 FT_UINT8, BASE_HEX, NULL, 0x0,
631 NULL, HFILL }},
633 { &hf_slimp3_data_offset,
634 { "Buffer offset", "slimp3.data.offset",
635 FT_UINT16, BASE_DEC, NULL, 0x0,
636 NULL, HFILL }},
638 { &hf_slimp3_data_command,
639 { "Command", "slimp3.data.command",
640 FT_UINT8, BASE_HEX, VALS(slimp3_mpg_control), 0x0,
641 NULL, HFILL }},
643 { &hf_slimp3_data_write_pointer,
644 { "Write Pointer", "slimp3.data.write_pointer",
645 FT_UINT16, BASE_DEC, NULL, 0x0,
646 NULL, HFILL }},
648 { &hf_slimp3_data_sequence,
649 { "Sequence", "slimp3.data.sequence",
650 FT_UINT16, BASE_DEC, NULL, 0x0,
651 NULL, HFILL }},
653 { &hf_slimp3_disc_rsp_server_ip,
654 { "Server Address", "slimp3.disc_rsp.server_ip",
655 FT_IPv4, BASE_NONE, NULL, 0x0,
656 NULL, HFILL }},
658 { &hf_slimp3_disc_rsp_server_port,
659 { "Server Port", "slimp3.disc_rsp.server_port",
660 FT_UINT16, BASE_DEC, NULL, 0x0,
661 NULL, HFILL }},
663 { &hf_slimp3_data_ack_write_pointer,
664 { "Write Pointer", "slimp3.data_ack.write_pointer",
665 FT_UINT16, BASE_DEC, NULL, 0x0,
666 NULL, HFILL }},
668 { &hf_slimp3_data_ack_read_pointer,
669 { "Read Pointer", "slimp3.data_ack.read_pointer",
670 FT_UINT16, BASE_DEC, NULL, 0x0,
671 NULL, HFILL }},
673 { &hf_slimp3_data_ack_sequence,
674 { "Sequence", "slimp3.data_ack.sequence",
675 FT_UINT16, BASE_DEC, NULL, 0x0,
676 NULL, HFILL }},
678 { &hf_slimp3_data_req_offset,
679 { "Requested offset", "slimp3.data_req.offset",
680 FT_UINT16, BASE_DEC, NULL, 0x0,
681 NULL, HFILL }},
684 static gint *ett[] = {
685 &ett_slimp3,
688 proto_slimp3 = proto_register_protocol("SliMP3 Communication Protocol",
689 "SliMP3", "slimp3");
690 proto_register_field_array(proto_slimp3, hf, array_length(hf));
691 proto_register_subtree_array(ett, array_length(ett));
694 void
695 proto_reg_handoff_slimp3(void)
697 dissector_handle_t slimp3_handle;
699 slimp3_handle = new_create_dissector_handle(dissect_slimp3, proto_slimp3);
700 dissector_add_uint("udp.port", UDP_PORT_SLIMP3_V1, slimp3_handle);
701 dissector_add_uint("udp.port", UDP_PORT_SLIMP3_V2, slimp3_handle);
705 * Editor modelines
707 * Local Variables:
708 * c-basic-offset: 4
709 * tab-width: 4
710 * indent-tabs-mode: nil
711 * End:
713 * ex: set shiftwidth=4 tabstop=4 expandtab:
714 * :indentSize=4:tabSize=4:noTabs=true: