#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;
/* PacketCable Types */
-//static dissector_handle_t sdp_handle;
+/* static dissector_handle_t sdp_handle; */
#define COPS_CLIENT_PC_DQOS 0x8008
#define COPS_CLIENT_PC_MM 0x800a
static const value_string cops_client_type_vals[] = {
+ {0, "None"},
+ {1, "RSVP"},
+ {2, "DiffServ QoS"},
+ {0x8001, "IP Highway"},
+ {0x8002, "IP Highway"},
+ {0x8003, "IP Highway"},
+ {0x8004, "IP Highway"},
+ {0x8005, "Fujitsu"},
+ {0x8006, "HP OpenView PolicyXpert"},
+ {0x8007, "HP OpenView PolicyXpert"},
{COPS_CLIENT_PC_DQOS, "PacketCable Dynamic Quality-of-Service"},
+ {0x8009, "3GPP"},
{COPS_CLIENT_PC_MM, "PacketCable Multimedia"},
{0, NULL},
};
{ 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 gint hf_cops_pc_dfccc_ip = -1;
static gint hf_cops_pc_dfcdc_ip_port = -1;
static gint hf_cops_pc_dfccc_ip_port = -1;
+static gint hf_cops_pc_dfccc_id = -1;
/* PacketCable Multimedia */
static gint hf_cops_pcmm_amid = -1;
static guint get_cops_pdu_len(tvbuff_t *tvb, int offset);
static void dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-static int dissect_cops_object(tvbuff_t *tvb, guint32 offset, proto_tree *tree, guint16 client_type);
-static void dissect_cops_object_data(tvbuff_t *tvb, guint32 offset, proto_tree *tree,
- guint16 client_type, guint8 c_num, guint8 c_type, guint16 len);
+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, 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 */
-proto_tree *info_to_cops_subtree(tvbuff_t *, proto_tree *, int, int, char *);
-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 *, proto_tree *, guint, guint32);
+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 void cops_subscriber_id_v6(tvbuff_t *, proto_tree *, guint, guint32);
static void cops_gate_id(tvbuff_t *, proto_tree *, guint, guint32);
static void decode_docsis_request_transmission_policy(tvbuff_t *tvb, guint32 offset, proto_tree *tree, gint hf);
-static void cops_analyze_packetcable_dqos_obj(tvbuff_t *, proto_tree *, guint32);
-static void cops_analyze_packetcable_mm_obj(tvbuff_t *, proto_tree *, guint32);
+static void cops_analyze_packetcable_dqos_obj(tvbuff_t *, packet_info *, proto_tree *, guint8, guint32);
+static void cops_analyze_packetcable_mm_obj(tvbuff_t *, packet_info *, proto_tree *, guint8, guint32);
-static packet_info *cpinfo;
-static guint8 opcode_idx;
static gboolean cops_packetcable = TRUE;
/* End of addition for PacketCable */
/* Currently used by PacketCable */
client_type = tvb_get_ntohs(tvb, 2);
- /* PacketCable: Remember the next two values to manipulate the info field in the Gui */
- cpinfo = pinfo;
- opcode_idx = op_code;
-
if (tree) {
proto_item *ti, *tv;
proto_tree *cops_tree, *ver_flags_tree;
offset += 4;
while (tvb_reported_length_remaining(tvb, offset) >= COPS_OBJECT_HDR_SIZE) {
- object_len = dissect_cops_object(tvb, offset, cops_tree, client_type);
+ object_len = dissect_cops_object(tvb, pinfo, op_code, offset, cops_tree, client_type);
if (object_len < 0)
return;
offset += object_len;
}
}
-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:
return "";
}
-static int dissect_cops_object(tvbuff_t *tvb, guint32 offset, proto_tree *tree, guint16 client_type)
+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) {
offset++;
contents_len = object_len - COPS_OBJECT_HDR_SIZE;
- dissect_cops_object_data(tvb, offset, obj_tree, client_type, c_num, c_type, contents_len);
+ dissect_cops_object_data(tvb, pinfo, offset, obj_tree, op_code, client_type, c_num, c_type, contents_len);
/* Pad to 32bit boundary */
if (object_len % sizeof (guint32))
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, guint32 offset, proto_tree *tree,
- guint16 client_type, guint8 c_num, guint8 c_type, guint16 len)
+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, 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);
}
/* PacketCable : Analyze the remaining data if available */
if (client_type == COPS_CLIENT_PC_DQOS && c_type == 4) {
- cops_analyze_packetcable_dqos_obj(tvb, tree, offset);
+ cops_analyze_packetcable_dqos_obj(tvb, pinfo, tree, op_code, offset);
} else if (client_type == COPS_CLIENT_PC_MM && c_type == 4) {
- cops_analyze_packetcable_mm_obj(tvb, tree, offset);
+ cops_analyze_packetcable_mm_obj(tvb, pinfo, tree, op_code, offset);
}
break;
/* For PacketCable */
if (client_type == COPS_CLIENT_PC_DQOS && c_type == 1) {
- cops_analyze_packetcable_dqos_obj(tvb, tree, offset);
+ cops_analyze_packetcable_dqos_obj(tvb, pinfo, tree, op_code, offset);
break;
} else if (client_type == COPS_CLIENT_PC_MM && c_type == 1) {
- cops_analyze_packetcable_mm_obj(tvb, tree, offset);
+ cops_analyze_packetcable_mm_obj(tvb, pinfo, tree, op_code, offset);
break;
}
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,
FT_UINT16, BASE_HEX, NULL, 0x00,
"DF IP Port CCC", HFILL }
},
+ { &hf_cops_pc_dfccc_id,
+ { "CCC ID", "cops.pc_dfccc_id",
+ FT_UINT32, BASE_DEC, NULL, 0x00,
+ "CCC ID", HFILL }
+ },
{ &hf_cops_pc_activity_count,
{ "Count", "cops.pc_activity_count",
FT_UINT32, BASE_HEX, NULL, 0x00,
},
{ &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,
*
*/
-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)
+static proto_item *
+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 */
-proto_tree *info_to_cops_subtree(tvbuff_t *tvb, proto_tree *st, int n, int offset, char *str) {
+static proto_tree *
+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);
/* Cops - Section : D-QoS Transaction ID */
static void
-cops_transaction_id(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
+cops_transaction_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *st, guint8 op_code, guint n, guint32 offset) {
proto_tree *stt;
guint16 code16;
/* 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(opcode_idx,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(cpinfo->cinfo, COL_INFO)) {
- col_clear(cpinfo->cinfo, COL_INFO);
- col_add_str(cpinfo->cinfo, COL_INFO,info);
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_clear(pinfo->cinfo, COL_INFO);
+ col_add_str(pinfo->cinfo, COL_INFO,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 += 2;
/* CCCID */
- info_to_display(tvb,stt,offset,4,"CCCID", NULL,FMT_IPv4,&hf_cops_pc_srks_ip);
+ info_to_display(tvb,stt,offset,4,"CCCID", NULL,FMT_DEC,&hf_cops_pc_dfccc_id);
offset += 4;
/* BCID Timestamp */
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);
/* Cops - Section : Multimedia Transaction ID */
static void
-cops_mm_transaction_id(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) {
+cops_mm_transaction_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *st, guint8 op_code, guint n, guint32 offset) {
proto_tree *stt;
guint16 code16;
/* 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(opcode_idx,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(cpinfo->cinfo, COL_INFO)) {
- col_clear(cpinfo->cinfo, COL_INFO);
- col_add_str(cpinfo->cinfo, COL_INFO,info);
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_clear(pinfo->cinfo, COL_INFO);
+ col_add_str(pinfo->cinfo, COL_INFO,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);
proto_tree *stt;
/* Create a subtree */
- stt = info_to_cops_subtree(tvb,st,n,offset,"Gate State");
+ 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);
#define PCDQ_SESSION_DESCRIPTION 0x0b01
/* Analyze the PacketCable objects */
-void cops_analyze_packetcable_dqos_obj(tvbuff_t *tvb, proto_tree *tree, guint32 offset) {
+static void
+cops_analyze_packetcable_dqos_obj(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 op_code, guint32 offset) {
gint remdata;
guint16 object_len;
/* 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:
- cops_transaction_id(tvb, tree, object_len, offset);
+ cops_transaction_id(tvb, pinfo, tree, op_code, object_len, offset);
break;
case PCDQ_SUBSCRIBER_IDv4:
cops_subscriber_id_v4(tvb, tree, object_len, offset);
}
/* Tune offset */
- offset += object_len-4;
+ offset += object_len;
/* See what we can still get from the buffer */
remdata = tvb_length_remaining(tvb, offset);
#define PCMM_VERSION_INFO 0x1001
-void
-cops_analyze_packetcable_mm_obj(tvbuff_t *tvb, proto_tree *tree, guint32 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:
- cops_mm_transaction_id(tvb, tree, object_len, offset);
+ cops_mm_transaction_id(tvb, pinfo, tree, op_code, object_len, offset);
break;
case PCMM_AMID:
cops_amid(tvb, tree, object_len, offset);
}
/* Tune offset */
- offset += object_len-4;
-
- /* See what we can still get from the buffer */
- remdata = tvb_length_remaining(tvb, offset);
+ offset += object_len;
}
}
/* End of PacketCable Addition */
-
-