#endif /* HAVE_NET_SNMP */
#endif /* HAVE_SOME_SNMP */
-#include "asn1.h"
-#include "format-oid.h"
+#include <epan/asn1.h>
+#include <epan/dissectors/format-oid.h>
#include <epan/prefs.h>
+#include <epan/emem.h>
/* XXX - The "plain" COPS port (3288) can be overridden in the prefs.
The PacketCable port cannot - should this be the case? */
guint class;
guint tag;
gint syntax;
- gchar *name;
+ const gchar *name;
};
static COPS_CNV CopsCnv [] =
{0, 0, -1, NULL}
};
-static gchar *
+static const gchar *
cops_tag_cls2syntax ( guint tag, guint cls, gushort *syntax)
{
COPS_CNV *cnv;
{ 0xc, "Gate Delete Err" },
{ 0xd, "Gate Open" },
{ 0xe, "Gate Close" },
- { 0xFF, NULL },
+ { 0, NULL },
};
/* Direction */
{
{ 0x0, "Downstream gate" },
{ 0x1, "Upstream gate" },
- { 0xFF, NULL },
+ { 0, NULL },
};
/* Session Class */
{ 0x1, "Normal priority VoIP session" },
{ 0x2, "High priority VoIP session" },
{ 0x3, "Reserved" },
- { 0xFF, NULL },
+ { 0, NULL },
};
/* Reason Code */
{
{ 0x0, "Gate Delete Operation" },
{ 0x1, "Gate Close Operation" },
- { 0xFF, NULL },
+ { 0, NULL },
};
/* Reason Sub Code - Delete */
{ 0x4, "Unexpected Gate-Open" },
{ 0x5, "Local Gate-Close failure" },
{ 0x127,"Unspecified error" },
- { 0xFF, NULL },
+ { 0, NULL },
};
/* Reason Sub Code - Close */
{ 0x6, "Timer T7 expiration; Service Flow reservation timeout" },
{ 0x7, "Timer T8 expiration; Service Flow inactivity in the upstream direction" },
{ 0x127,"Unspecified error" },
- { 0xFF, NULL },
+ { 0, NULL },
};
/* PacketCable Error */
{ 0x6, "Missing Required Object" },
{ 0x7, "Invalid Object" },
{ 0x127,"Unspecified error" },
- { 0xFF, NULL },
+ { 0, NULL },
};
static int dissect_cops_object(tvbuff_t *tvb, packet_info *pinfo, guint8 op_code, guint32 offset, proto_tree *tree, guint16 client_type);
static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 offset, proto_tree *tree,
- guint8 op_code, guint16 client_type, guint8 c_num, guint8 c_type, guint16 len);
+ guint8 op_code, guint16 client_type, guint8 c_num, guint8 c_type, int len);
-static void dissect_cops_pr_objects(tvbuff_t *tvb, guint32 offset, proto_tree *tree, guint16 pr_len);
+static void dissect_cops_pr_objects(tvbuff_t *tvb, guint32 offset, proto_tree *tree, int pr_len);
static int dissect_cops_pr_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *tree,
- guint8 s_num, guint8 s_type, guint16 len);
+ guint8 s_num, guint8 s_type, int len);
/* Added for PacketCable */
-static proto_tree *info_to_cops_subtree(tvbuff_t *, proto_tree *, int, int, char *);
-static proto_item *info_to_display(tvbuff_t *, proto_item *, int, int, char *, const value_string *, int, gint *);
+static proto_tree *info_to_cops_subtree(tvbuff_t *, proto_tree *, int, int, const char *);
+static proto_item *info_to_display(tvbuff_t *, proto_item *, int, int, const char *, const value_string *, int, gint *);
static void cops_transaction_id(tvbuff_t *, packet_info *, proto_tree *, guint8, guint, guint32);
static void cops_subscriber_id_v4(tvbuff_t *, proto_tree *, guint, guint32);
}
}
-static char *cops_c_type_to_str(guint8 c_num, guint8 c_type)
+static const char *cops_c_type_to_str(guint8 c_num, guint8 c_type)
{
switch (c_num) {
case COPS_OBJ_HANDLE:
static int dissect_cops_object(tvbuff_t *tvb, packet_info *pinfo, guint8 op_code, guint32 offset, proto_tree *tree, guint16 client_type)
{
- guint16 object_len, contents_len;
+ int object_len, contents_len;
guint8 c_num, c_type;
proto_item *ti;
proto_tree *obj_tree;
- char *type_str;
+ const char *type_str;
object_len = tvb_get_ntohs(tvb, offset);
if (object_len < COPS_OBJECT_HDR_SIZE) {
return object_len;
}
-static void dissect_cops_pr_objects(tvbuff_t *tvb, guint32 offset, proto_tree *tree, guint16 pr_len)
+static void dissect_cops_pr_objects(tvbuff_t *tvb, guint32 offset, proto_tree *tree, int pr_len)
{
- guint16 object_len, contents_len;
+ int object_len, contents_len;
guint8 s_num, s_type;
- char *type_str;
+ const char *type_str;
int ret;
proto_tree *cops_pr_tree, *obj_tree;
proto_item *ti;
}
static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 offset, proto_tree *tree,
- guint8 op_code, guint16 client_type, guint8 c_num, guint8 c_type, guint16 len)
+ guint8 op_code, guint16 client_type, guint8 c_num, guint8 c_type, int len)
{
proto_item *ti;
proto_tree *r_type_tree, *itf_tree, *reason_tree, *dec_tree, *error_tree, *clientsi_tree, *pdp_tree;
case COPS_OBJ_IN_INT:
case COPS_OBJ_OUT_INT:
if (c_type == 1) { /* IPv4 */
- tvb_memcpy(tvb, (guint8 *)&ipv4addr, offset, 4);
+ ipv4addr = tvb_get_ipv4(tvb, offset);
ifindex = tvb_get_ntohl(tvb, offset + 4);
ti = proto_tree_add_text(tree, tvb, offset, 8, "Contents: IPv4 address %s, ifIndex: %u",
ip_to_str((guint8 *)&ipv4addr), ifindex);
tvb, offset, 4, ipv4addr);
offset += 4;
} else if (c_type == 2) { /* IPv6 */
- tvb_memcpy(tvb, (guint8 *)&ipv6addr, offset, sizeof ipv6addr);
+ tvb_get_ipv6(tvb, offset, &ipv6addr);
ifindex = tvb_get_ntohl(tvb, offset + sizeof ipv6addr);
ti = proto_tree_add_text(tree, tvb, offset, 20, "Contents: IPv6 address %s, ifIndex: %u",
ip6_to_str(&ipv6addr), ifindex);
offset += 2;
proto_tree_add_uint(dec_tree, hf_cops_dec_flags, tvb, offset, 2, cmd_flags);
} else if (c_type == 5) { /*COPS-PR Data*/
- ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: %u bytes", len);
+ ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: %d bytes", len);
dec_tree = proto_item_add_subtree(ti, ett_cops_decision);
dissect_cops_pr_objects(tvb, offset, dec_tree, len);
}
if (c_type != 2) /*Not COPS-PR data*/
break;
- ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: %u bytes", len);
+ ti = proto_tree_add_text(tree, tvb, offset, 4, "Contents: %d bytes", len);
clientsi_tree = proto_item_add_subtree(ti, ett_cops_clientsi);
dissect_cops_pr_objects(tvb, offset, clientsi_tree, len);
case COPS_OBJ_PDPREDIRADDR:
case COPS_OBJ_LASTPDPADDR:
if (c_type == 1) { /* IPv4 */
- tvb_memcpy(tvb, (guint8 *)&ipv4addr, offset, 4);
+ ipv4addr = tvb_get_ipv4(tvb, offset);
tcp_port = tvb_get_ntohs(tvb, offset + 4 + 2);
ti = proto_tree_add_text(tree, tvb, offset, 8, "Contents: IPv4 address %s, TCP Port Number: %u",
ip_to_str((guint8 *)&ipv4addr), tcp_port);
tvb, offset, 4, ipv4addr);
offset += 4;
} else if (c_type == 2) { /* IPv6 */
- tvb_memcpy(tvb, (guint8 *)&ipv6addr, offset, sizeof ipv6addr);
+ tvb_get_ipv6(tvb, offset, &ipv6addr);
tcp_port = tvb_get_ntohs(tvb, offset + sizeof ipv6addr + 2);
ti = proto_tree_add_text(tree, tvb, offset, 20, "Contents: IPv6 address %s, TCP Port Number: %u",
ip6_to_str(&ipv6addr), tcp_port);
break;
default:
- proto_tree_add_text(tree, tvb, offset, len, "Contents: %u bytes", len);
+ proto_tree_add_text(tree, tvb, offset, len, "Contents: %d bytes", len);
break;
}
variable->type= type_from_packet;
buf_len = SPRINT_MAX_LEN; /*defined in NET-SNMP's snmp-impl.h*/
- buf = g_malloc(buf_len);
+ buf = ep_alloc(buf_len);
*buf = '\0';
out_len = 0;
variable->type=mib_to_asn_type(subtree->type);
if (!sprint_realloc_by_type(&buf, &buf_len, &out_len, TRUE, variable, subtree->enums, subtree->hint, NULL))
- sprintf(buf,"%s","sprint_realloc_by_type failed");
+ g_snprintf(buf,SPRINT_MAX_LEN,"%s","sprint_realloc_by_type failed");
return buf;
}
guint vb_length;
gushort vb_type;
- gchar *vb_type_name;
+ const gchar *vb_type_name;
int ret;
guint cls, con, tag;
unsigned int i;
gchar *buf;
- int len;
while (asnlen > 0) { /*while there is ASN stuff to be decoded*/
proto_tree_add_text(tree, asn1.tvb, offset, length,
"Value: %s", vb_display_string);
- g_free(vb_display_string);
}
else
#endif /* HAVE_NET_SNMP */
proto_tree_add_text(tree, asn1.tvb, offset, length, "Value %s: %s",vb_type_name, vb_display_string);
- g_free(vb_display_string);
}
else
#endif /* HAVE_NET_SNMP */
proto_tree_add_text(tree, asn1.tvb, offset, length,
"Value: %s (ASN.1 type from packet: %s)", vb_display_string, vb_type_name);
- g_free(vb_display_string);
}
else
{
* We stopped, due to a non-printable character, before we got
* to the end of the string.
*/
- vb_display_string = g_malloc(4*vb_length);
- buf = &vb_display_string[0];
- len = sprintf(buf, "%03u", vb_octet_string[0]);
- buf += len;
+ vb_display_string = ep_alloc(4*vb_length);
+ buf = vb_display_string;
+ buf += g_snprintf(buf, 4*vb_length, "%03u", vb_octet_string[0]);
for (i = 1; i < vb_length; i++) {
- len = sprintf(buf, ".%03u", vb_octet_string[i]);
- buf += len;
+ buf += g_snprintf(buf, 4*vb_length-(buf-vb_display_string), ".%03u", vb_octet_string[i]);
}
proto_tree_add_text(tree, asn1.tvb, offset, length,
"Value: %s: %s", vb_type_name, vb_display_string);
- g_free(vb_display_string);
} else {
proto_tree_add_text(tree, asn1.tvb, offset, length,
"Value: %s: %.*s", vb_type_name, (int)vb_length,
last_decoded_prid_oid_length=vb_oid_length;
}
#endif /* HAVE_NET_SNMP */
-
- g_free(vb_display_string);
- if(vb_display_string2)
- g_free(vb_display_string2);
}
g_free(vb_oid);
break;
default:
- g_assert_not_reached();
+ DISSECTOR_ASSERT_NOT_REACHED();
return ASN1_ERR_WRONG_TYPE;
}
}
static int dissect_cops_pr_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *tree,
- guint8 s_num, guint8 s_type, guint16 len)
+ guint8 s_num, guint8 s_type, int len)
{
proto_item *ti;
proto_tree *asn1_object_tree, *gperror_tree, *cperror_tree;
break;
default:
- proto_tree_add_text(tree, tvb, offset, len, "Contents: %u bytes", len);
+ proto_tree_add_text(tree, tvb, offset, len, "Contents: %d bytes", len);
break;
}
},
{ &hf_cops_in_int_ipv4,
{ "IPv4 address", "cops.in-int.ipv4",
- FT_IPv4, 0, NULL, 0xFFFF,
+ FT_IPv4, 0, NULL, 0,
"IPv4 address in COPS IN-Int object", HFILL }
},
{ &hf_cops_in_int_ipv6,
{ "IPv6 address", "cops.in-int.ipv6",
- FT_IPv6, 0, NULL, 0xFFFF,
+ FT_IPv6, 0, NULL, 0,
"IPv6 address in COPS IN-Int object", HFILL }
},
{ &hf_cops_out_int_ipv4,
{ "IPv4 address", "cops.out-int.ipv4",
- FT_IPv4, 0, NULL, 0xFFFF,
+ FT_IPv4, 0, NULL, 0,
"IPv4 address in COPS OUT-Int object", HFILL }
},
{ &hf_cops_out_int_ipv6,
{ "IPv6 address", "cops.out-int.ipv6",
- FT_IPv6, 0, NULL, 0xFFFF,
+ FT_IPv6, 0, NULL, 0,
"IPv6 address in COPS OUT-Int", HFILL }
},
{ &hf_cops_int_ifindex,
},
{ &hf_cops_pdprediraddr_ipv4,
{ "IPv4 address", "cops.pdprediraddr.ipv4",
- FT_IPv4, 0, NULL, 0xFFFF,
+ FT_IPv4, 0, NULL, 0,
"IPv4 address in COPS PDPRedirAddr object", HFILL }
},
{ &hf_cops_pdprediraddr_ipv6,
{ "IPv6 address", "cops.pdprediraddr.ipv6",
- FT_IPv6, 0, NULL, 0xFFFF,
+ FT_IPv6, 0, NULL, 0,
"IPv6 address in COPS PDPRedirAddr object", HFILL }
},
{ &hf_cops_lastpdpaddr_ipv4,
{ "IPv4 address", "cops.lastpdpaddr.ipv4",
- FT_IPv4, 0, NULL, 0xFFFF,
+ FT_IPv4, 0, NULL, 0,
"IPv4 address in COPS LastPDPAddr object", HFILL }
},
{ &hf_cops_lastpdpaddr_ipv6,
{ "IPv6 address", "cops.lastpdpaddr.ipv6",
- FT_IPv6, 0, NULL, 0xFFFF,
+ FT_IPv6, 0, NULL, 0,
"IPv6 address in COPS LastPDPAddr object", HFILL }
},
{ &hf_cops_pdp_tcp_port,
},
{ &hf_cops_pcmm_classifier_src_addr,
{ "Source address", "cops.pc_mm_classifier_src_addr",
- FT_IPv4, 0, NULL, 0xFFFF,
+ FT_IPv4, 0, NULL, 0,
"PacketCable Multimedia Classifier Source IP Address", HFILL }
},
{ &hf_cops_pcmm_classifier_dst_addr,
{ "Destination address", "cops.pc_mm_classifier_dst_addr",
- FT_IPv4, 0, NULL, 0xFFFF,
+ FT_IPv4, 0, NULL, 0,
"PacketCable Multimedia Classifier Destination IP Address", HFILL }
},
{ &hf_cops_pcmm_classifier_src_port,
*/
static proto_item *
-info_to_display(tvbuff_t *tvb, proto_item *stt, int offset, int octets, char *str, const value_string *vsp, int mode,gint *hf_proto_parameter)
+info_to_display(tvbuff_t *tvb, proto_item *stt, int offset, int octets, const char *str, const value_string *vsp, int mode,gint *hf_proto_parameter)
{
proto_item *pi = NULL;
guint8 code8 = 0;
guint16 code16 = 0;
+ guint32 codeipv4 = 0;
guint32 code32 = 0;
float codefl = 0.0;
switch (mode) {
case FMT_FLT: codefl = tvb_get_ntohieee_float(tvb,offset);
break;
- case FMT_IPv4: tvb_memcpy(tvb, (guint8 *)&code32, offset, 4);
+ case FMT_IPv4: codeipv4 = tvb_get_ipv4(tvb, offset);
break;
default: code32 = tvb_get_ntohl(tvb,offset);
}
}
/* Ip address format*/
if (mode==FMT_IPv4) {
- pi = proto_tree_add_ipv4(stt, *hf_proto_parameter,tvb, offset, octets, code32);
+ pi = proto_tree_add_ipv4(stt, *hf_proto_parameter,tvb, offset, octets, codeipv4);
break;
}
/* Ieee float format */
/* Print the subtree information for cops */
static proto_tree *
-info_to_cops_subtree(tvbuff_t *tvb, proto_tree *st, int n, int offset, char *str) {
+info_to_cops_subtree(tvbuff_t *tvb, proto_tree *st, int n, int offset, const char *str) {
proto_item *tv;
tv = proto_tree_add_uint_format( st, hf_cops_subtree, tvb, offset, n, (guint)NULL, str);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"D-QoS Transaction ID");
+ offset += 4;
/* Transaction Identifier */
info_to_display(tvb,stt,offset,2,"D-QoS Transaction Identifier", NULL,FMT_DEC,&hf_cops_pc_transaction_id);
val_to_str(code16,table_cops_dqos_transaction_id, "Unknown (0x%04x)"),code16);
/* Write the right data into the 'info field' on the Gui */
- sprintf(info,"COPS %-20s - ",val_to_str(op_code,cops_op_code_vals, "Unknown"));
+ g_snprintf(info,sizeof(info),"COPS %-20s - ",val_to_str(op_code,cops_op_code_vals, "Unknown"));
strcat(info,val_to_str(code16,table_cops_dqos_transaction_id, "Unknown"));
if (check_col(pinfo->cinfo, COL_INFO)) {
/* Create a subtree */
tv = info_to_cops_subtree(tvb,st,n,offset,"Subscriber ID (IPv4)");
+ offset += 4;
/* Subscriber Identifier */
info_to_display(tvb,tv,offset,4,"Subscriber Identifier (IPv4)", NULL,FMT_IPv4,&hf_cops_pc_subscriber_id_ipv4);
/* Create a subtree */
tv = info_to_cops_subtree(tvb,st,n,offset,"Subscriber ID (IPv6)");
+ offset += 4;
/* Subscriber Identifier */
info_to_display(tvb,tv,offset,16,"Subscriber Identifier (IPv6)", NULL,FMT_IPv6,&hf_cops_pc_subscriber_id_ipv6);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Gate ID");
+ offset += 4;
/* Gate Identifier */
info_to_display(tvb,stt,offset,4,"Gate Identifier", NULL,FMT_HEX,&hf_cops_pc_gate_id);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Activity Count");
+ offset += 4;
/* Activity Count */
info_to_display(tvb,stt,offset,4,"Count", NULL,FMT_DEC,&hf_cops_pc_activity_count);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Gate Specifications");
+ offset += 4;
/* Direction */
info_to_display(tvb,stt,offset,1,"Direction",table_cops_direction,FMT_DEC,&hf_cops_pc_direction);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Electronic Surveillance Parameters");
+ offset += 4;
/* DF IP Address for CDC */
info_to_display(tvb,stt,offset,4,"DF IP Address for CDC", NULL,FMT_IPv4,&hf_cops_pc_dfcdc_ip);
offset += 4;
/* BCID Element ID */
- bcid_str = tvb_get_string(tvb, offset, 8);
+ bcid_str = tvb_format_text(tvb, offset, 8);
proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Element ID",bcid_str);
offset += 8;
/* BCID Time Zone */
- bcid_str = tvb_get_string(tvb, offset, 8);
+ bcid_str = tvb_format_text(tvb, offset, 8);
proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Time Zone",bcid_str);
offset += 8;
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Event Generation Info");
+ offset += 4;
/* Primary Record Keeping Server IP Address */
info_to_display(tvb,stt,offset,4,"PRKS IP Address", NULL,FMT_IPv4,&hf_cops_pc_prks_ip);
offset += 4;
/* BCID Element ID */
- bcid_str = tvb_get_string(tvb, offset, 8);
+ bcid_str = tvb_format_text(tvb, offset, 8);
proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Element ID",bcid_str);
offset += 8;
/* BCID Time Zone */
- bcid_str = tvb_get_string(tvb, offset, 8);
+ bcid_str = tvb_format_text(tvb, offset, 8);
proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Time Zone",bcid_str);
offset += 8;
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Remote Gate Info");
+ offset += 4;
/* CMTS IP Address */
info_to_display(tvb,stt,offset,4,"CMTS IP Address", NULL,FMT_IPv4,&hf_cops_pc_cmts_ip);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"PacketCable Reason");
+ offset += 4;
/* Reason Code */
code16 = tvb_get_ntohs(tvb,offset);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"PacketCable Error");
+ offset += 4;
/* Error Code */
info_to_display(tvb,stt,offset,2,"Error Code",table_cops_packetcable_error,FMT_DEC,&hf_cops_pc_packetcable_err_code);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"MM Transaction ID");
+ offset += 4;
/* Transaction Identifier */
info_to_display(tvb,stt,offset,2,"Multimedia Transaction Identifier", NULL,FMT_DEC,&hf_cops_pc_transaction_id);
val_to_str(code16,table_cops_mm_transaction_id, "Unknown (0x%04x)"),code16);
/* Write the right data into the 'info field' on the Gui */
- sprintf(info,"COPS %-20s - ",val_to_str(op_code,cops_op_code_vals, "Unknown"));
+ g_snprintf(info,sizeof(info),"COPS %-20s - ",val_to_str(op_code,cops_op_code_vals, "Unknown"));
strcat(info,val_to_str(code16,table_cops_mm_transaction_id, "Unknown"));
if (check_col(pinfo->cinfo, COL_INFO)) {
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"AMID");
+ offset += 4;
/* Gate Identifier */
info_to_display(tvb,stt,offset,4,"Application Manager ID", NULL,FMT_DEC,&hf_cops_pcmm_amid);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Gate Spec");
+ offset += 4;
/* Flags */
gs_flags = tvb_get_guint8(tvb, offset);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Classifier");
+ offset += 4;
/* Protocol ID */
info_to_display(tvb,stt,offset,2,"Protocol ID",NULL,FMT_DEC,&hf_cops_pcmm_classifier_protocol_id);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Flow Spec");
+ offset += 4;
/* Envelope */
info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_flow_spec_envelope);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,object_len,offset,"DOCSIS Service Class Name");
+ offset += 4;
/* Envelope */
info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Best Effort Service");
+ offset += 4;
/* Envelope */
info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Non-Real-Time Polling Service");
+ offset += 4;
/* Envelope */
info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Real-Time Polling Service");
+ offset += 4;
/* Envelope */
info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Unsolicited Grant Service");
+ offset += 4;
/* Envelope */
info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Unsolicited Grant Service with Activity Detection");
+ offset += 4;
/* Envelope */
info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Downstream Service");
+ offset += 4;
/* Envelope */
info_to_display(tvb,stt,offset,1,"Envelope",NULL,FMT_DEC,&hf_cops_pcmm_envelope);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Event Generation Info");
+ offset += 4;
/* Primary Record Keeping Server IP Address */
info_to_display(tvb,stt,offset,4,"PRKS IP Address", NULL,FMT_IPv4,&hf_cops_pc_prks_ip);
offset += 4;
/* BCID Element ID */
- bcid_str = tvb_get_string(tvb, offset, 8);
+ bcid_str = tvb_format_text(tvb, offset, 8);
proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Element ID",bcid_str);
offset += 8;
/* BCID Time Zone */
- bcid_str = tvb_get_string(tvb, offset, 8);
+ bcid_str = tvb_format_text(tvb, offset, 8);
proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Time Zone",bcid_str);
offset += 8;
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,object_len,offset,"Volume-Based Usage Limit");
+ offset += 4;
/* Usage Limit */
proto_tree_add_item(stt, hf_cops_pcmm_volume_based_usage_limit, tvb, offset, 8,
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Time-Based Usage Limit");
+ offset += 4;
/* Time Limit */
info_to_display(tvb,stt,offset,4,"Time Limit", NULL,FMT_DEC,&hf_cops_pcmm_time_based_usage_limit);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,object_len,offset,"Opaque Data");
+ offset += 4;
/* Opaque Data */
proto_tree_add_text(stt, tvb, offset, 8,"Opaque Data");
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Gate Time Info");
+ offset += 4;
/* Gate Time Info */
info_to_display(tvb,stt,offset,4,"Time Committed", NULL,FMT_DEC,&hf_cops_pcmm_gate_time_info);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Gate Usage Info");
+ offset += 4;
/* Gate Time Info */
info_to_display(tvb,stt,offset,4,"Octet Count", NULL,FMT_DEC,&hf_cops_pcmm_gate_usage_info);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"PacketCable Error");
+ offset += 4;
code = tvb_get_ntohs(tvb, offset);
proto_tree_add_uint_format(stt, hf_cops_pcmm_packetcable_error_code, tvb, offset, 2, code,
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Gate State");
+ offset += 4;
/* State */
info_to_display(tvb,stt,offset,2,"State",pcmm_gate_state,FMT_DEC,&hf_cops_pcmm_packetcable_gate_state);
/* Create a subtree */
stt = info_to_cops_subtree(tvb,st,n,offset,"Version Info");
+ offset += 4;
/* State */
info_to_display(tvb,stt,offset,2,"Major Version Number",NULL,FMT_DEC,&hf_cops_pcmm_packetcable_version_info_major);
/* Glom the s_num and s_type together to make switching easier */
num_type_glob = s_num << 8 | s_type;
- /* Tune offset */
- offset += 4;
-
/* Perform the appropriate functions */
switch (num_type_glob){
case PCDQ_TRANSACTION_ID:
}
/* Tune offset */
- offset += object_len-4;
+ offset += object_len;
/* See what we can still get from the buffer */
remdata = tvb_length_remaining(tvb, offset);
static void
cops_analyze_packetcable_mm_obj(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 op_code, guint32 offset) {
- gint remdata;
guint16 object_len;
guint8 s_num, s_type;
guint16 num_type_glob;
}
/* Do the remaining client specific objects */
- remdata = tvb_length_remaining(tvb, offset);
- while (remdata > 4) {
+ while (tvb_reported_length_remaining(tvb, offset) > 4) {
/* In case we have remaining data, then lets try to get this analyzed */
object_len = tvb_get_ntohs(tvb, offset);
/* Glom the s_num and s_type together to make switching easier */
num_type_glob = s_num << 8 | s_type;
- /* Tune offset */
- offset += 4;
-
/* Perform the appropriate functions */
switch (num_type_glob){
case PCMM_TRANSACTION_ID:
}
/* Tune offset */
- offset += object_len-4;
-
- /* See what we can still get from the buffer */
- remdata = tvb_length_remaining(tvb, offset);
+ offset += object_len;
}
}