forked from osmocom/wireshark
Convert proto_item_add_text to proto_item_add_item.
General whitespace cleanup, add modelines. svn path=/trunk/; revision=47949
This commit is contained in:
parent
aa659985a5
commit
7cf5c59d6e
|
@ -34,20 +34,27 @@
|
|||
#include <ctype.h>
|
||||
#include <epan/packet.h>
|
||||
|
||||
#include "isprint.h"
|
||||
|
||||
static int proto_slimp3 = -1;
|
||||
static int hf_slimp3_opcode = -1;
|
||||
static int hf_slimp3_ir = -1;
|
||||
static int hf_slimp3_display = -1;
|
||||
static int hf_slimp3_control = -1;
|
||||
static int hf_slimp3_hello = -1;
|
||||
static int hf_slimp3_i2c = -1;
|
||||
static int hf_slimp3_data_request = -1;
|
||||
static int hf_slimp3_data = -1;
|
||||
static int hf_slimp3_discover_request = -1;
|
||||
static int hf_slimp3_discover_response = -1;
|
||||
static int hf_slimp3_data_ack = -1;
|
||||
static int hf_slimp3_uptime = -1;
|
||||
static int hf_slimp3_code_id = -1;
|
||||
static int hf_slimp3_code_bits = -1;
|
||||
static int hf_slimp3_infrared_slimp3 = -1;
|
||||
static int hf_slimp3_infrared_jvc = -1;
|
||||
static int hf_slimp3_infrared = -1;
|
||||
static int hf_slimp3_device_id = -1;
|
||||
static int hf_slimp3_fw_rev = -1;
|
||||
static int hf_slimp3_data_offset = -1;
|
||||
static int hf_slimp3_data_command = -1;
|
||||
static int hf_slimp3_data_write_pointer = -1;
|
||||
static int hf_slimp3_data_sequence = -1;
|
||||
static int hf_slimp3_disc_rsp_server_ip = -1;
|
||||
static int hf_slimp3_disc_rsp_server_port = -1;
|
||||
static int hf_slimp3_data_ack_write_pointer = -1;
|
||||
static int hf_slimp3_data_ack_read_pointer = -1;
|
||||
static int hf_slimp3_data_ack_sequence = -1;
|
||||
static int hf_slimp3_data_req_offset = -1;
|
||||
|
||||
static gint ett_slimp3 = -1;
|
||||
|
||||
|
@ -223,8 +230,8 @@ static int
|
|||
dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
||||
{
|
||||
const char *opcode_str;
|
||||
proto_tree *slimp3_tree = NULL;
|
||||
proto_item *ti = NULL, *hidden_item;
|
||||
proto_tree *slimp3_tree;
|
||||
proto_item *ti;
|
||||
gint i1;
|
||||
gint offset = 0;
|
||||
guint16 opcode;
|
||||
|
@ -249,21 +256,13 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
return 0;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SliMP3");
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
|
||||
col_add_str(pinfo->cinfo, COL_INFO, opcode_str);
|
||||
|
||||
}
|
||||
|
||||
if (tree) {
|
||||
|
||||
ti = proto_tree_add_item(tree, proto_slimp3, tvb, offset, -1, ENC_NA);
|
||||
slimp3_tree = proto_item_add_subtree(ti, ett_slimp3);
|
||||
|
||||
proto_tree_add_uint(slimp3_tree, hf_slimp3_opcode, tvb,
|
||||
offset, 1, opcode);
|
||||
}
|
||||
|
||||
/* The new protocol (v1.3 and later) uses an IANA-assigned port number.
|
||||
* It usually uses the same number for both sizes of the conversation, so
|
||||
|
@ -304,51 +303,31 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
* [12..17] reserved
|
||||
*/
|
||||
if (tree) {
|
||||
hidden_item = proto_tree_add_item(slimp3_tree, hf_slimp3_ir, tvb, offset+8, 4, ENC_BIG_ENDIAN);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
|
||||
i1 = tvb_get_ntohl(tvb, offset+2);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+2, 4, "Uptime: %u sec (%u ticks)",
|
||||
i1/625000, i1);
|
||||
i1 = tvb_get_guint8(tvb, offset+6);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+6, 1, "Code identifier: 0x%0x: %s",
|
||||
i1, val_to_str_const(i1, slimp3_ir_types, "Unknown"));
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+7, 1, "Code bits: %d",
|
||||
tvb_get_guint8(tvb, offset+7));
|
||||
proto_tree_add_uint_format_value(tree, hf_slimp3_uptime, tvb, offset+2, 4, i1,
|
||||
"Uptime: %u sec (%u ticks)", i1/625000, i1);
|
||||
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_code_id, tvb, offset+6, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_code_bits, tvb, offset+7, 1, ENC_BIG_ENDIAN);
|
||||
|
||||
i1 = tvb_get_ntohl(tvb, offset+8);
|
||||
/* Check the code to figure out which remote is being used. */
|
||||
if (tvb_get_guint8(tvb, offset+6) == 0x02 &&
|
||||
tvb_get_guint8(tvb, offset+7) == 32) {
|
||||
/* This is the custom SLIMP3 remote. */
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+8, 4,
|
||||
"Infrared Code: %s: 0x%0x",
|
||||
val_to_str_const(i1, slimp3_ir_codes_slimp3, "Unknown"), i1);
|
||||
}
|
||||
else if (tvb_get_guint8(tvb, offset+6) == 0xff &&
|
||||
tvb_get_guint8(tvb, offset+7) == 16) {
|
||||
/* This is a JVC DVD player remote */
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+8, 4,
|
||||
"Infrared Code: %s: 0x%0x",
|
||||
val_to_str_const(i1, slimp3_ir_codes_jvc, "Unknown"), i1);
|
||||
} else {
|
||||
/* Unknown code; just write it */
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+8, 4, "Infrared Code: 0x%0x", i1);
|
||||
}
|
||||
}
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
i1 = tvb_get_ntohl(tvb, offset+8);
|
||||
if (tvb_get_guint8(tvb, offset+6) == 0x02 &&
|
||||
tvb_get_guint8(tvb, offset+7) == 32) {
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_infrared_slimp3, tvb, offset+8, 4, ENC_BIG_ENDIAN);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", SLIMP3: %s",
|
||||
val_to_str(i1, slimp3_ir_codes_slimp3, "Unknown (0x%0x)"));
|
||||
}
|
||||
else if (tvb_get_guint8(tvb, offset+6) == 0xff &&
|
||||
tvb_get_guint8(tvb, offset+7) == 16) {
|
||||
/* This is a JVC DVD player remote */
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_infrared_jvc, tvb, offset+8, 4, ENC_BIG_ENDIAN);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", JVC: %s",
|
||||
val_to_str(i1, slimp3_ir_codes_jvc, "Unknown (0x%0x)"));
|
||||
} else {
|
||||
/* Unknown code; just write it */
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_infrared, tvb, offset+8, 4, ENC_BIG_ENDIAN);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", 0x%0x", i1);
|
||||
}
|
||||
}
|
||||
|
@ -356,11 +335,6 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
|
||||
case SLIMP3_DISPLAY:
|
||||
if (tree) {
|
||||
|
||||
hidden_item = proto_tree_add_item(slimp3_tree, hf_slimp3_display,
|
||||
tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
|
||||
/* Loop through the commands */
|
||||
i1 = 18;
|
||||
in_str = FALSE;
|
||||
|
@ -376,7 +350,8 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
break;
|
||||
case 3:
|
||||
lcd_char = tvb_get_guint8(tvb, offset + i1 + 1);
|
||||
if (!isprint(lcd_char)) lcd_char = '.';
|
||||
if (!isprint(lcd_char))
|
||||
lcd_char = '.';
|
||||
if (ti && in_str) {
|
||||
lcd_strlen += 2;
|
||||
proto_item_append_text(ti, "%c", lcd_char);
|
||||
|
@ -419,7 +394,6 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
}
|
||||
}
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
i1 = 18;
|
||||
lcd_strlen = 0;
|
||||
while (tvb_offset_exists(tvb, offset + i1) &&
|
||||
|
@ -439,54 +413,39 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
|
||||
case 3:
|
||||
if (tvb_offset_exists(tvb, offset + i1 + 1)) {
|
||||
if (lcd_strlen < 1 ||
|
||||
lcd_str[lcd_strlen-1] != ' ' ||
|
||||
tvb_get_guint8(tvb, offset + i1 + 1) != ' ') {
|
||||
if ((lcd_strlen < 1) ||
|
||||
(lcd_str[lcd_strlen-1] != ' ') ||
|
||||
(tvb_get_guint8(tvb, offset + i1 + 1) != ' ')) {
|
||||
lcd_char = tvb_get_guint8(tvb, offset + i1 + 1);
|
||||
lcd_str[lcd_strlen++] = isprint(lcd_char) ? lcd_char : '.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i1 += 2;
|
||||
}
|
||||
lcd_str[lcd_strlen] = '\0';
|
||||
if (lcd_strlen > 0)
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", lcd_str);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SLIMP3_CONTROL:
|
||||
if (tree) {
|
||||
hidden_item = proto_tree_add_item(slimp3_tree, hf_slimp3_control,
|
||||
tvb, offset+1, 1, ENC_BIG_ENDIAN);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+1, 1, "Command: %s",
|
||||
val_to_str(tvb_get_guint8(tvb, offset+1),
|
||||
slimp3_stream_control, "Unknown (0x%0x)"));
|
||||
}
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_control, tvb, offset+1, 1, ENC_BIG_ENDIAN);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
|
||||
val_to_str(tvb_get_guint8(tvb, offset+1),
|
||||
slimp3_stream_control, "Unknown (0x%0x)"));
|
||||
}
|
||||
break;
|
||||
|
||||
case SLIMP3_HELLO:
|
||||
if (tree) {
|
||||
hidden_item = proto_tree_add_item(slimp3_tree, hf_slimp3_hello,
|
||||
tvb, offset+1, 1, ENC_BIG_ENDIAN);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
if (to_server) {
|
||||
guint8 fw_ver = 0;
|
||||
/* Hello response; client->server */
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset, 1, "Hello Response (Client --> Server)");
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+1, 1, "Device ID: %d",
|
||||
tvb_get_guint8(tvb, offset+1));
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_device_id, tvb, offset+1, 1, ENC_BIG_ENDIAN);
|
||||
fw_ver = tvb_get_guint8(tvb, offset+2);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+2, 1, "Firmware Revision: %d.%d (0x%0x)",
|
||||
fw_ver>>4, fw_ver & 0xf, fw_ver);
|
||||
proto_tree_add_uint_format_value(tree, hf_slimp3_fw_rev, tvb, offset+2, 1, fw_ver,
|
||||
"Firmware Revision: %d.%d (0x%0x)", fw_ver>>4, fw_ver & 0xf, fw_ver);
|
||||
} else {
|
||||
/* Hello request; server->client */
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset, 1, "Hello Request (Server --> Client)");
|
||||
|
@ -495,44 +454,23 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
break;
|
||||
|
||||
case SLIMP3_I2C:
|
||||
if (tree) {
|
||||
hidden_item = proto_tree_add_item(slimp3_tree, hf_slimp3_i2c,
|
||||
tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
if (to_server) {
|
||||
/* Hello response; client->server */
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset, -1,
|
||||
"I2C Response (Client --> Server)");
|
||||
col_append_str(pinfo->cinfo, COL_INFO, ", Response");
|
||||
} else {
|
||||
/* Hello request; server->client */
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset, -1,
|
||||
"I2C Request (Server --> Client)");
|
||||
}
|
||||
}
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
if (to_server) {
|
||||
col_append_str(pinfo->cinfo, COL_INFO, ", Response");
|
||||
} else {
|
||||
col_append_str(pinfo->cinfo, COL_INFO, ", Request");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SLIMP3_DATA_REQ:
|
||||
if (tree) {
|
||||
hidden_item = proto_tree_add_item(slimp3_tree, hf_slimp3_data_request,
|
||||
tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+2, 2,
|
||||
"Requested offset: %d bytes.",
|
||||
tvb_get_ntohs(tvb, offset+2)*2);
|
||||
}
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_data_req_offset, tvb, offset+2, 2, ENC_BIG_ENDIAN);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Offset: %d bytes",
|
||||
tvb_get_ntohs(tvb, offset+2)*2);
|
||||
}
|
||||
break;
|
||||
|
||||
case SLIMP3_DATA:
|
||||
|
@ -546,68 +484,46 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
* [12..17] reserved
|
||||
* [18..] MPEG data
|
||||
*/
|
||||
if (tree) {
|
||||
hidden_item = proto_tree_add_item(slimp3_tree, hf_slimp3_data,
|
||||
tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
if (old_protocol) {
|
||||
guint16 offset_buffer;
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset, -1,
|
||||
"Length: %d bytes",
|
||||
tvb_reported_length_remaining(tvb, offset+18));
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+2, 2,
|
||||
"Buffer offset: %d bytes.",
|
||||
tvb_get_ntohs(tvb, offset+2) * 2);
|
||||
}
|
||||
else {
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+1, 1, "Command: %s",
|
||||
val_to_str(tvb_get_guint8(tvb, offset+1),
|
||||
slimp3_mpg_control, "Unknown (0x%0x)"));
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset, -1,
|
||||
"Length: %d bytes",
|
||||
tvb_reported_length_remaining(tvb, offset+18));
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+6, 2,
|
||||
"Write Pointer: %d",
|
||||
tvb_get_ntohs(tvb, offset+6) * 2);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+10, 2,
|
||||
"Sequence: %d",
|
||||
tvb_get_ntohs(tvb, offset+10));
|
||||
}
|
||||
}
|
||||
offset_buffer = tvb_get_ntohs(tvb, offset+2) * 2;
|
||||
proto_tree_add_uint(slimp3_tree, hf_slimp3_data_offset, tvb, offset+2, 2, offset_buffer);
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
if (old_protocol) {
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO,
|
||||
", Length: %d bytes, Offset: %d bytes.",
|
||||
tvb_reported_length_remaining(tvb, offset+18),
|
||||
tvb_get_ntohs(tvb, offset+2) * 2);
|
||||
offset_buffer);
|
||||
}
|
||||
else {
|
||||
guint16 write_pointer;
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_data_command, tvb, offset+1, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset, -1,
|
||||
"Length: %d bytes",
|
||||
tvb_reported_length_remaining(tvb, offset+18));
|
||||
write_pointer = tvb_get_ntohs(tvb, offset+6) * 2;
|
||||
proto_tree_add_uint(slimp3_tree, hf_slimp3_data_write_pointer, tvb, offset+6, 2, write_pointer);
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_data_sequence, tvb, offset+10, 2, ENC_BIG_ENDIAN);
|
||||
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO,
|
||||
", %s, %d bytes at %d, Sequence: %d",
|
||||
val_to_str(tvb_get_guint8(tvb, offset+1),
|
||||
slimp3_mpg_control, "Unknown (0x%0x)"),
|
||||
tvb_reported_length_remaining(tvb, offset+18),
|
||||
tvb_get_ntohs(tvb, offset+6) * 2,
|
||||
write_pointer,
|
||||
tvb_get_ntohs(tvb, offset+10));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SLIMP3_DISC_REQ:
|
||||
if (tree) {
|
||||
{
|
||||
guint8 fw_ver;
|
||||
hidden_item = proto_tree_add_item(slimp3_tree, hf_slimp3_discover_request,
|
||||
tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+1, 1,
|
||||
"Device ID: %d.", tvb_get_guint8(tvb, offset+1));
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_device_id, tvb, offset+1, 1, ENC_BIG_ENDIAN);
|
||||
fw_ver = tvb_get_guint8(tvb, offset+2);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+2, 1, "Firmware Revision: %d.%d (0x%0x)",
|
||||
fw_ver>>4, fw_ver & 0xf, fw_ver);
|
||||
}
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
guint8 fw_ver = tvb_get_guint8(tvb, offset+2);
|
||||
proto_tree_add_uint_format_value(tree, hf_slimp3_fw_rev, tvb, offset+2, 1, fw_ver,
|
||||
"Firmware Revision: %d.%d (0x%0x)", fw_ver>>4, fw_ver & 0xf, fw_ver);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Device ID: %d. Firmware: %d.%d",
|
||||
tvb_get_guint8(tvb, offset+1), fw_ver>>4, fw_ver & 0xf);
|
||||
}
|
||||
|
@ -615,21 +531,13 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
|
||||
case SLIMP3_DISC_RSP:
|
||||
if (tree) {
|
||||
hidden_item = proto_tree_add_item(slimp3_tree, hf_slimp3_discover_response,
|
||||
tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+2, 4,
|
||||
"Server Address: %s.",
|
||||
tvb_ip_to_str(tvb, offset+2));
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+6, 2,
|
||||
"Server Port: %d", tvb_get_ntohs(tvb, offset + 6));
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_disc_rsp_server_ip, tvb, offset+2, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(slimp3_tree, hf_slimp3_disc_rsp_server_port, tvb, offset+6, 2, ENC_BIG_ENDIAN);
|
||||
}
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Server Address: %s. Server Port: %d",
|
||||
tvb_ip_to_str(tvb, offset+2),
|
||||
tvb_get_ntohs(tvb, offset + 6));
|
||||
}
|
||||
break;
|
||||
|
||||
case SLIMP3_DATA_ACK:
|
||||
|
@ -643,23 +551,17 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
* [12..17] client MAC address (v1.3 and later)
|
||||
*/
|
||||
if (tree) {
|
||||
hidden_item = proto_tree_add_item(slimp3_tree, hf_slimp3_data_ack,
|
||||
tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+6, 2,
|
||||
"Write Pointer: %d",
|
||||
tvb_get_ntohs(tvb, offset+6) * 2);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+8, 2,
|
||||
"Read Pointer: %d",
|
||||
tvb_get_ntohs(tvb, offset+8) * 2);
|
||||
proto_tree_add_text(slimp3_tree, tvb, offset+10, 2,
|
||||
"Sequence: %d",
|
||||
tvb_get_ntohs(tvb, offset+10));
|
||||
guint16 pointer;
|
||||
|
||||
pointer = tvb_get_ntohs(tvb, offset+6) * 2;
|
||||
proto_tree_add_uint(slimp3_tree, hf_slimp3_data_ack_write_pointer, tvb, offset+6, 2, pointer);
|
||||
pointer = tvb_get_ntohs(tvb, offset+8) * 2;
|
||||
proto_tree_add_uint(slimp3_tree, hf_slimp3_data_ack_read_pointer, tvb, offset+8, 2, pointer);
|
||||
proto_tree_add_uint(slimp3_tree, hf_slimp3_data_ack_sequence, tvb, offset+10, 2, pointer);
|
||||
}
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Sequence: %d",
|
||||
tvb_get_ntohs(tvb, offset+10));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -668,9 +570,9 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
"Data (%d bytes)", tvb_reported_length_remaining(tvb, offset));
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return tvb_length(tvb);
|
||||
|
||||
return tvb_reported_length(tvb);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -682,57 +584,102 @@ proto_register_slimp3(void)
|
|||
FT_UINT8, BASE_DEC, VALS(slimp3_opcode_vals), 0x0,
|
||||
"SLIMP3 message type", HFILL }},
|
||||
|
||||
{ &hf_slimp3_ir,
|
||||
{ "Infrared", "slimp3.ir",
|
||||
FT_UINT32, BASE_HEX, NULL, 0x0,
|
||||
"SLIMP3 Infrared command", HFILL }},
|
||||
|
||||
{ &hf_slimp3_control,
|
||||
{ "Control Packet", "slimp3.control",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
FT_UINT8, BASE_DEC, VALS(slimp3_stream_control), 0x0,
|
||||
"SLIMP3 control", HFILL }},
|
||||
|
||||
{ &hf_slimp3_display,
|
||||
{ "Display", "slimp3.display",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"SLIMP3 display", HFILL }},
|
||||
{ &hf_slimp3_uptime,
|
||||
{ "Uptime", "slimp3.uptime",
|
||||
FT_UINT32, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_hello,
|
||||
{ "Hello", "slimp3.hello",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"SLIMP3 hello", HFILL }},
|
||||
{ &hf_slimp3_code_id,
|
||||
{ "Code identifier", "slimp3.code_id",
|
||||
FT_UINT8, BASE_DEC, VALS(slimp3_ir_types), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_i2c,
|
||||
{ "I2C", "slimp3.i2c",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"SLIMP3 I2C", HFILL }},
|
||||
{ &hf_slimp3_code_bits,
|
||||
{ "Code bits", "slimp3.code_bits",
|
||||
FT_UINT8, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_data,
|
||||
{ "Data", "slimp3.data",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"SLIMP3 Data", HFILL }},
|
||||
{ &hf_slimp3_infrared_slimp3,
|
||||
{ "Infrared Code", "slimp3.infrared",
|
||||
FT_UINT32, BASE_HEX, VALS(slimp3_ir_codes_slimp3), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_data_request,
|
||||
{ "Data Request", "slimp3.data_req",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"SLIMP3 Data Request", HFILL }},
|
||||
{ &hf_slimp3_infrared_jvc,
|
||||
{ "Infrared Code", "slimp3.infrared",
|
||||
FT_UINT32, BASE_HEX, VALS(slimp3_ir_codes_jvc), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_discover_request,
|
||||
{ "Discovery Request", "slimp3.discovery_req",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"SLIMP3 Discovery Request", HFILL }},
|
||||
{ &hf_slimp3_infrared,
|
||||
{ "Infrared Code", "slimp3.infrared",
|
||||
FT_UINT32, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_discover_response,
|
||||
{ "Discovery Response", "slimp3.discovery_response",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"SLIMP3 Discovery Response", HFILL }},
|
||||
{ &hf_slimp3_device_id,
|
||||
{ "Device ID", "slimp3.device_id",
|
||||
FT_UINT8, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_data_ack,
|
||||
{ "Data Ack", "slimp3.data_ack",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"SLIMP3 Data Ack", HFILL }},
|
||||
{ &hf_slimp3_fw_rev,
|
||||
{ "Firmware Revision", "slimp3.fw_rev",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_data_offset,
|
||||
{ "Buffer offset", "slimp3.data.offset",
|
||||
FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_data_command,
|
||||
{ "Command", "slimp3.data.command",
|
||||
FT_UINT8, BASE_HEX, VALS(slimp3_mpg_control), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_data_write_pointer,
|
||||
{ "Write Pointer", "slimp3.data.write_pointer",
|
||||
FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_data_sequence,
|
||||
{ "Sequence", "slimp3.data.sequence",
|
||||
FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_disc_rsp_server_ip,
|
||||
{ "Server Address", "slimp3.disc_rsp.server_ip",
|
||||
FT_IPv4, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_disc_rsp_server_port,
|
||||
{ "Server Port", "slimp3.disc_rsp.server_port",
|
||||
FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_data_ack_write_pointer,
|
||||
{ "Write Pointer", "slimp3.data_ack.write_pointer",
|
||||
FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_data_ack_read_pointer,
|
||||
{ "Read Pointer", "slimp3.data_ack.read_pointer",
|
||||
FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_data_ack_sequence,
|
||||
{ "Sequence", "slimp3.data_ack.sequence",
|
||||
FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_slimp3_data_req_offset,
|
||||
{ "Requested offset", "slimp3.data_req.offset",
|
||||
FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
&ett_slimp3,
|
||||
};
|
||||
|
@ -752,3 +699,16 @@ proto_reg_handoff_slimp3(void)
|
|||
dissector_add_uint("udp.port", UDP_PORT_SLIMP3_V1, slimp3_handle);
|
||||
dissector_add_uint("udp.port", UDP_PORT_SLIMP3_V2, slimp3_handle);
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines
|
||||
*
|
||||
* Local Variables:
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*
|
||||
* ex: set shiftwidth=4 tabstop=4 expandtab:
|
||||
* :indentSize=4:tabSize=4:noTabs=true:
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue