static void dissect_rh (tvbuff_t*, int, proto_tree*);
static void dissect_control(tvbuff_t*, int, int, proto_tree*, int, enum parse);
-static gboolean sna_fid_to_str_buf(const address *addr, gchar *buf, int buf_len _U_)
+static int sna_fid_to_str_buf(const address *addr, gchar *buf, int buf_len _U_)
{
const guint8 *addrdata;
struct sna_fid_type_4_addr sna_fid_type_4_addr;
+ gchar *bufp = buf;
switch (addr->len) {
/* FID Type 4 */
memcpy(&sna_fid_type_4_addr, addr->data, SNA_FID_TYPE_4_ADDR_LEN);
- buf = dword_to_hex(buf, sna_fid_type_4_addr.saf);
- *buf++ = '.';
- buf = word_to_hex(buf, sna_fid_type_4_addr.ef);
- *buf++ = '\0'; /* NULL terminate */
+ bufp = dword_to_hex(bufp, sna_fid_type_4_addr.saf);
+ *bufp++ = '.';
+ bufp = word_to_hex(bufp, sna_fid_type_4_addr.ef);
+ *bufp++ = '\0'; /* NULL terminate */
break;
default:
buf[0] = '\0';
- return FALSE;
+ return 1;
}
- return TRUE;
+ return (int)strlen(buf)+1;
}
/* Set DST addr */
TVB_SET_ADDRESS(&pinfo->net_dst, sna_address_type, tvb, 2, SNA_FID01_ADDR_LEN);
- TVB_SET_ADDRESS(&pinfo->dst, sna_address_type, tvb, 2, SNA_FID01_ADDR_LEN);
+ COPY_ADDRESS_SHALLOW(&pinfo->dst, &pinfo->net_dst);
proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 4, 2, ENC_BIG_ENDIAN);
/* Set SRC addr */
TVB_SET_ADDRESS(&pinfo->net_src, sna_address_type, tvb, 4, SNA_FID01_ADDR_LEN);
- TVB_SET_ADDRESS(&pinfo->src, sna_address_type, tvb, 4, SNA_FID01_ADDR_LEN);
+ COPY_ADDRESS_SHALLOW(&pinfo->src, &pinfo->net_src);
proto_tree_add_item(tree, hf_sna_th_snf, tvb, 6, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_sna_th_dcf, tvb, 8, 2, ENC_BIG_ENDIAN);
/* Set DST addr */
TVB_SET_ADDRESS(&pinfo->net_dst, sna_address_type, tvb, 2, SNA_FID2_ADDR_LEN);
- TVB_SET_ADDRESS(&pinfo->dst, sna_address_type, tvb, 2, SNA_FID2_ADDR_LEN);
+ COPY_ADDRESS_SHALLOW(&pinfo->dst, &pinfo->net_dst);
/* Byte 3 */
proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 3, 1, ENC_BIG_ENDIAN);
/* Set SRC addr */
TVB_SET_ADDRESS(&pinfo->net_src, sna_address_type, tvb, 3, SNA_FID2_ADDR_LEN);
- TVB_SET_ADDRESS(&pinfo->src, sna_address_type, tvb, 3, SNA_FID2_ADDR_LEN);
+ COPY_ADDRESS_SHALLOW(&pinfo->src, &pinfo->net_src);
id = tvb_get_ntohs(tvb, 4);
proto_tree_add_item(tree, hf_sna_th_snf, tvb, 4, 2, ENC_BIG_ENDIAN);
dst->saf = dsaf;
dst->ef = def;
SET_ADDRESS(&pinfo->net_dst, sna_address_type, SNA_FID_TYPE_4_ADDR_LEN, dst);
- SET_ADDRESS(&pinfo->dst, sna_address_type, SNA_FID_TYPE_4_ADDR_LEN, dst);
+ COPY_ADDRESS_SHALLOW(&pinfo->dst, &pinfo->net_dst);
oef = tvb_get_ntohs(tvb, 20);
proto_tree_add_uint(tree, hf_sna_th_oef, tvb, offset+2, 2, oef);
src->saf = osaf;
src->ef = oef;
SET_ADDRESS(&pinfo->net_src, sna_address_type, SNA_FID_TYPE_4_ADDR_LEN, src);
- SET_ADDRESS(&pinfo->src, sna_address_type, SNA_FID_TYPE_4_ADDR_LEN, src);
+ COPY_ADDRESS_SHALLOW(&pinfo->src, &pinfo->net_src);
proto_tree_add_item(tree, hf_sna_th_snf, tvb, offset+4, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_sna_th_dcf, tvb, offset+6, 2, ENC_BIG_ENDIAN);
int len, key;
gint ett;
- length = tvb_length_remaining(parent_tvb, offset);
+ length = tvb_captured_length_remaining(parent_tvb, offset);
reported_length = tvb_reported_length_remaining(parent_tvb, offset);
if (control_len < length)
length = control_len;
&addresses_reassembly_table_functions);
}
+static void
+sna_cleanup(void)
+{
+ reassembly_table_destroy(&sna_reassembly_table);
+}
+
void
proto_register_sna(void)
"Systems Network Architecture XID", "SNA XID", "sna_xid");
register_dissector("sna_xid", dissect_sna_xid, proto_sna_xid);
- sna_address_type = address_type_dissector_register("AT_SNA", "SNA Address", sna_fid_to_str_buf, sna_address_str_len, NULL, NULL);
+ sna_address_type = address_type_dissector_register("AT_SNA", "SNA Address", sna_fid_to_str_buf, sna_address_str_len, NULL, NULL, NULL, NULL);
/* Register configuration options */
sna_module = prefs_register_protocol(proto_sna, NULL);
&sna_defragment);
register_init_routine(sna_init);
+ register_cleanup_routine(sna_cleanup);
}
void