#include <epan/packet.h>
#include <epan/prefs.h>
-#include <epan/emem.h>
#include <epan/packet.h>
#include <epan/ipv6-utils.h>
#include <string.h>
break;
case ACN_ADDR_IPV4:
/* Build tree and add type*/
- pi = proto_tree_add_text(tree, tvb, offset, 7, label);
+ pi = proto_tree_add_text(tree, tvb, offset, 7, "%s", label);
addr_tree = proto_item_add_subtree(pi, ett_acn_address);
proto_tree_add_item(addr_tree, hf_acn_ip_address_type, tvb, offset, 1, FALSE);
offset +=1;
break;
case ACN_ADDR_IPV6:
/* Build tree and add type*/
- pi = proto_tree_add_text(tree, tvb, offset, 19, label);
+ pi = proto_tree_add_text(tree, tvb, offset, 19, "%s", label);
addr_tree = proto_item_add_subtree(pi, ett_acn_address);
proto_tree_add_item(addr_tree, hf_acn_ip_address_type, tvb, offset, 1, FALSE);
offset +=1;
break;
case ACN_ADDR_IPPORT:
/* Build tree and add type*/
- pi = proto_tree_add_text(tree, tvb, offset, 3, label);
+ pi = proto_tree_add_text(tree, tvb, offset, 3, "%s", label);
addr_tree = proto_item_add_subtree(pi, ett_acn_address);
proto_tree_add_item(addr_tree, hf_acn_ip_address_type, tvb, offset, 1, FALSE);
offset +=1;
g_snprintf(buffer, BUFFER_SIZE, "Addr 0x%8.8X ->", data_address);
break;
default: /* and ACN_DMP_ADT_A_R, this reserved....so it has no meaning yet */
+ offset += data_size;
return offset;
}
switch (data_size) {
case 1:
data_value = tvb_get_guint8(tvb, offset);
- proto_tree_add_int_format(tree, hf_acn_data8, tvb, offset, 1, data_value, "%s %2.2X", buffer, data_value);
+ proto_tree_add_uint_format(tree, hf_acn_data8, tvb, offset, 1, data_value, "%s %2.2X", buffer, data_value);
break;
case 2:
data_value = tvb_get_ntohs(tvb, offset);
- proto_tree_add_int_format(tree, hf_acn_data16, tvb, offset, 2, data_value, "%s %4.4X", buffer, data_value);
+ proto_tree_add_uint_format(tree, hf_acn_data16, tvb, offset, 2, data_value, "%s %4.4X", buffer, data_value);
break;
case 3:
data_value = tvb_get_ntoh24(tvb, offset);
- proto_tree_add_int_format(tree, hf_acn_data24, tvb, offset, 3, data_value, "%s %6.6X", buffer, data_value);
+ proto_tree_add_uint_format(tree, hf_acn_data24, tvb, offset, 3, data_value, "%s %6.6X", buffer, data_value);
break;
case 4:
data_value = tvb_get_ntohl(tvb, offset);
- proto_tree_add_int_format(tree, hf_acn_data32, tvb, offset, 4, data_value, "%s %8.8X", buffer, data_value);
+ proto_tree_add_uint_format(tree, hf_acn_data32, tvb, offset, 4, data_value, "%s %8.8X", buffer, data_value);
break;
default:
/* build string of values */
switch (data_size) {
case 1:
data_value = tvb_get_guint8(tvb, offset);
- proto_tree_add_int_format(tree, hf_acn_data8, tvb, offset, 1, data_value, "%s %2.2X", buffer, data_value);
+ proto_tree_add_uint_format(tree, hf_acn_data8, tvb, offset, 1, data_value, "%s %2.2X", buffer, data_value);
break;
case 2:
data_value = tvb_get_ntohs(tvb, offset);
- proto_tree_add_int_format(tree, hf_acn_data8, tvb, offset, 2, data_value, "%s %4.4X", buffer, data_value);
+ proto_tree_add_uint_format(tree, hf_acn_data8, tvb, offset, 2, data_value, "%s %4.4X", buffer, data_value);
break;
case 3:
data_value = tvb_get_ntoh24(tvb, offset);
- proto_tree_add_int_format(tree, hf_acn_data8, tvb, offset, 3, data_value, "%s %6.6X", buffer, data_value);
+ proto_tree_add_uint_format(tree, hf_acn_data8, tvb, offset, 3, data_value, "%s %6.6X", buffer, data_value);
break;
case 4:
data_value = tvb_get_ntohl(tvb, offset);
- proto_tree_add_int_format(tree, hf_acn_data8, tvb, offset, 4, data_value, "%s %8.8X", buffer, data_value);
+ proto_tree_add_uint_format(tree, hf_acn_data8, tvb, offset, 4, data_value, "%s %8.8X", buffer, data_value);
break;
default:
/* build string of values */
switch (data_size) {
case 1:
data_value = tvb_get_guint8(tvb, offset);
- proto_tree_add_int_format(tree, hf_acn_data8, tvb, offset, 1, data_value, "%s %2.2X", buffer, data_value);
+ proto_tree_add_uint_format(tree, hf_acn_data8, tvb, offset, 1, data_value, "%s %2.2X", buffer, data_value);
break;
case 2:
data_value = tvb_get_ntohs(tvb, offset);
- proto_tree_add_int_format(tree, hf_acn_data8, tvb, offset, 2, data_value, "%s %4.4X", buffer, data_value);
+ proto_tree_add_uint_format(tree, hf_acn_data8, tvb, offset, 2, data_value, "%s %4.4X", buffer, data_value);
break;
case 3:
data_value = tvb_get_ntoh24(tvb, offset);
- proto_tree_add_int_format(tree, hf_acn_data8, tvb, offset, 3, data_value, "%s %6.6X", buffer, data_value);
+ proto_tree_add_uint_format(tree, hf_acn_data8, tvb, offset, 3, data_value, "%s %6.6X", buffer, data_value);
break;
case 4:
data_value = tvb_get_ntohl(tvb, offset);
- proto_tree_add_int_format(tree, hf_acn_data8, tvb, offset, 4, data_value, "%s %8.8X", buffer, data_value);
+ proto_tree_add_uint_format(tree, hf_acn_data8, tvb, offset, 4, data_value, "%s %8.8X", buffer, data_value);
break;
default:
/* build string of values */
/* convert to string */
name = val_to_str(data_value, acn_dmp_reason_code_vals, "reason not valid (%d)");
/* Add item */
- proto_tree_add_int_format(tree, hf_acn_data8, tvb, offset, 1, data_value, "%s %s", buffer, name);
+ proto_tree_add_uint_format(tree, hf_acn_data8, tvb, offset, 1, data_value, "%s %s", buffer, name);
offset++;
break;
/* convert to string */
name = val_to_str(data_value, acn_dmp_reason_code_vals, "reason not valid (%d)");
/* Add item */
- proto_tree_add_int_format(tree, hf_acn_data8, tvb, offset, 1, data_value, "%s %s", buffer, name);
+ proto_tree_add_uint_format(tree, hf_acn_data8, tvb, offset, 1, data_value, "%s %s", buffer, name);
data_address += adt->increment;
} /* of (x=0;x<adt->count;x++) */
/* convert to string */
name = val_to_str(data_value, acn_dmp_reason_code_vals, "reason not valid (%d)");
/* Add item */
- proto_tree_add_int_format(tree, hf_acn_data8, tvb, offset, 1, data_value, "%s %s", buffer, name);
+ proto_tree_add_uint_format(tree, hf_acn_data8, tvb, offset, 1, data_value, "%s %s", buffer, name);
data_address += adt->increment;
offset++;
} /* of (x=0;x<adt->count;x++) */
/* Add Vector item to tree*/
name = val_to_str(vector, acn_dmp_vector_vals, "not valid (%d)");
proto_item_append_text(ti, ": ");
- proto_item_append_text(ti, name);
+ proto_item_append_text(ti, "%s", name);
/* Set header offset */
if (pdu_flags & ACN_PDU_FLAG_H) {
/* Add Vector item to tree*/
name = val_to_str(vector, acn_sdt_vector_vals, "not valid (%d)");
proto_item_append_text(ti, ": ");
- proto_item_append_text(ti, name);
+ proto_item_append_text(ti, "%s", name);
/* NO HEADER DATA ON THESE* (at least so far) */
/* Add protocol to tree*/
name = val_to_str(protocol_id, acn_protocol_id_vals, "id not valid (%d)");
proto_item_append_text(ti, ": ");
- proto_item_append_text(ti, name);
+ proto_item_append_text(ti, "%s", name);
/* add association item */
association = tvb_get_ntohs(tvb, header_offset);
}
-/******************************************************************************/
-/* reverses the characters in a string */
-static void
-reverse(char *s)
-{
- char c;
- long i,j;
- for (i=0, j=strlen(s)-1; i < j; i++, j--) {
- c = s[i];
- s[i] = s[j];
- s[j] = c;
- }
-}
-
-
/******************************************************************************/
/* level to string (ascii) */
/* level : 8 bit value */
string[i] = '\0';
/* now reverse (and correct) the order */
- reverse(string);
+ g_strreverse(string);
/* add a space at the end (ok its at the start but it will be at the end)*/
string[i++] = ' ';
/* Add Vector item to tree*/
name = val_to_str(vector, acn_dmp_vector_vals, "not valid (%d)");
proto_item_append_text(ti, ": ");
- proto_item_append_text(ti, name);
+ proto_item_append_text(ti, "%s", name);
/* Set header offset */
if (pdu_flags & ACN_PDU_FLAG_H) {
}
}
*buf_ptr = '\0';
- proto_tree_add_text(pdu_tree, tvb, data_offset, dmx_count, buffer);
+ proto_tree_add_text(pdu_tree, tvb, data_offset, dmx_count, "%s", buffer);
/* start our line */
g_snprintf(buffer, BUFFER_SIZE, "001-%03d: ", perline);
if (item_cnt == perline || x == (end_offset-1)) {
/* add leader... */
- proto_tree_add_text(pdu_tree, tvb, data_offset, item_cnt, buffer);
+ proto_tree_add_text(pdu_tree, tvb, data_offset, item_cnt, "%s", buffer);
data_offset += perline;
g_snprintf(buffer, BUFFER_SIZE, "%03d-%03d: ",total_cnt, total_cnt+perline);
buf_ptr = buffer + 9;
/* Add Vector item to tree*/
name = val_to_str(vector, acn_sdt_vector_vals, "not valid (%d)");
proto_item_append_text(ti, ": ");
- proto_item_append_text(ti, name);
+ proto_item_append_text(ti, "%s", name);
/* NO HEADER DATA ON THESE* (at least so far) */
/* } */
/* Set the protocol column */
- if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "ACN");
- }
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "ACN");
/* Clear out stuff in the info column */
if(check_col(pinfo->cinfo,COL_INFO)){
/* DMP data */
{ &hf_acn_data,
{ "Data", "acn.dmp_data",
- FT_BYTES, BASE_HEX, NULL, 0x0,
+ FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_acn_data8,
{ &hf_acn_dmp_address_data_pairs,
{ "Address-Data Pairs", "acn.dmp_address_data_pairs",
- FT_BYTES, BASE_DEC, NULL, 0x0,
+ FT_BYTES, BASE_NONE, NULL, 0x0,
"More address-data pairs", HFILL }
},
};
module_t *acn_module;
- if (proto_acn == -1) {
- proto_acn = proto_register_protocol (
- "Architecture for Control Networks", /* name */
- "ACN", /* short name */
- "acn" /* abbrev */
- );
- }
-
+ proto_acn = proto_register_protocol (
+ "Architecture for Control Networks", /* name */
+ "ACN", /* short name */
+ "acn" /* abbrev */
+ );
+
proto_register_field_array(proto_acn, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));