forked from osmocom/wireshark
From beroset:
patch to remove C++ incompatibilities from packet-lmp.c renamed class to lmp_class remove C++ incompatibilities from packet-rcpap.c renamed class to inst_class (instruction class). remove C++ incompatibilities from emem.c and oids.c remove C++ incompatibilities from packet-radius.c remove C++ incompatibilities from packet-enip.c https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48299
This commit is contained in:
parent
041fbc05ed
commit
96e7b183fb
|
@ -644,22 +644,22 @@ enip_match_request( packet_info *pinfo, proto_tree *tree, enip_request_key_t *pr
|
|||
enip_request_info_t *request_info;
|
||||
|
||||
request_info = NULL;
|
||||
request_val = g_hash_table_lookup( enip_request_hashtable, prequest_key );
|
||||
request_val = (enip_request_val_t *)g_hash_table_lookup( enip_request_hashtable, prequest_key );
|
||||
if(!pinfo->fd->flags.visited)
|
||||
{
|
||||
if ( prequest_key && prequest_key->requesttype == ENIP_REQUEST_PACKET )
|
||||
{
|
||||
if ( request_val == NULL )
|
||||
{
|
||||
new_request_key = se_memdup(prequest_key, sizeof(enip_request_key_t));
|
||||
new_request_key = (enip_request_key_t *)se_memdup(prequest_key, sizeof(enip_request_key_t));
|
||||
|
||||
request_val = se_alloc(sizeof(enip_request_val_t));
|
||||
request_val = se_new(enip_request_val_t);
|
||||
request_val->frames = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "enip_frames");
|
||||
|
||||
g_hash_table_insert(enip_request_hashtable, new_request_key, request_val );
|
||||
}
|
||||
|
||||
request_info = se_alloc(sizeof(enip_request_info_t));
|
||||
request_info = se_new(enip_request_info_t);
|
||||
request_info->req_num = pinfo->fd->num;
|
||||
request_info->rep_num = 0;
|
||||
request_info->req_time = pinfo->fd->abs_ts;
|
||||
|
@ -794,17 +794,17 @@ enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
|
|||
if (pinfo->fd->flags.visited)
|
||||
return;
|
||||
|
||||
conn_key = se_alloc(sizeof(enip_conn_key_t));
|
||||
conn_key = se_new(enip_conn_key_t);
|
||||
conn_key->ConnSerialNumber = connInfo->ConnSerialNumber;
|
||||
conn_key->VendorID = connInfo->VendorID;
|
||||
conn_key->DeviceSerialNumber = connInfo->DeviceSerialNumber;
|
||||
conn_key->O2TConnID = connInfo->O2T.connID;
|
||||
conn_key->T2OConnID = connInfo->T2O.connID;
|
||||
|
||||
conn_val = g_hash_table_lookup( enip_conn_hashtable, conn_key );
|
||||
conn_val = (enip_conn_val_t *)g_hash_table_lookup( enip_conn_hashtable, conn_key );
|
||||
if ( conn_val == NULL )
|
||||
{
|
||||
conn_val = se_alloc(sizeof(enip_conn_val_t));
|
||||
conn_val = se_new(enip_conn_val_t);
|
||||
|
||||
conn_val->ConnSerialNumber = connInfo->ConnSerialNumber;
|
||||
conn_val->VendorID = connInfo->VendorID;
|
||||
|
@ -865,10 +865,10 @@ enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
|
|||
PT_UDP, connInfo->O2T.port, 0, NO_PORT2);
|
||||
}
|
||||
|
||||
enip_info = conversation_get_proto_data(conversation, proto_enip);
|
||||
enip_info = (enip_conv_info_t *)conversation_get_proto_data(conversation, proto_enip);
|
||||
if (enip_info == NULL)
|
||||
{
|
||||
enip_info = se_alloc(sizeof(enip_conv_info_t));
|
||||
enip_info = se_new(enip_conv_info_t);
|
||||
enip_info->O2TConnIDs = se_tree_create_non_persistent(
|
||||
EMEM_TREE_TYPE_RED_BLACK, "enip_O2T");
|
||||
enip_info->T2OConnIDs = se_tree_create_non_persistent(
|
||||
|
@ -889,10 +889,10 @@ enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
|
|||
connInfo->T2O.port, 0, NO_PORT2);
|
||||
}
|
||||
|
||||
enip_info = conversation_get_proto_data(conversationTO, proto_enip);
|
||||
enip_info = (enip_conv_info_t *)conversation_get_proto_data(conversationTO, proto_enip);
|
||||
if (enip_info == NULL)
|
||||
{
|
||||
enip_info = se_alloc(sizeof(enip_conv_info_t));
|
||||
enip_info = se_new(enip_conv_info_t);
|
||||
enip_info->O2TConnIDs = se_tree_create_non_persistent(
|
||||
EMEM_TREE_TYPE_RED_BLACK, "enip_O2T");
|
||||
enip_info->T2OConnIDs = se_tree_create_non_persistent(
|
||||
|
@ -907,14 +907,14 @@ enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
|
|||
conversation = find_or_create_conversation(pinfo);
|
||||
|
||||
/* Do we already have a state structure for this conv */
|
||||
enip_info = conversation_get_proto_data(conversation, proto_enip);
|
||||
enip_info = (enip_conv_info_t *)conversation_get_proto_data(conversation, proto_enip);
|
||||
if (!enip_info)
|
||||
{
|
||||
/*
|
||||
* No. Attach that information to the conversation, and add
|
||||
* it to the list of information structures.
|
||||
*/
|
||||
enip_info = se_alloc(sizeof(enip_conv_info_t));
|
||||
enip_info = se_new(enip_conv_info_t);
|
||||
enip_info->O2TConnIDs = se_tree_create_non_persistent(
|
||||
EMEM_TREE_TYPE_RED_BLACK, "enip_O2T");
|
||||
enip_info->T2OConnIDs = se_tree_create_non_persistent(
|
||||
|
@ -944,7 +944,7 @@ enip_close_cip_connection(packet_info *pinfo, guint16 ConnSerialNumber,
|
|||
conn_key.O2TConnID = 0;
|
||||
conn_key.T2OConnID = 0;
|
||||
|
||||
conn_val = g_hash_table_lookup( enip_conn_hashtable, &conn_key );
|
||||
conn_val = (enip_conn_val_t *)g_hash_table_lookup( enip_conn_hashtable, &conn_key );
|
||||
if ( conn_val )
|
||||
{
|
||||
conn_val->closeframe = pinfo->fd->num;
|
||||
|
@ -976,7 +976,7 @@ enip_get_explicit_connid(packet_info *pinfo, enip_request_key_t *prequest_key, g
|
|||
/*
|
||||
* Do we already have a state structure for this conv
|
||||
*/
|
||||
enip_info = conversation_get_proto_data(conversation, proto_enip);
|
||||
enip_info = (enip_conv_info_t *)conversation_get_proto_data(conversation, proto_enip);
|
||||
if (!enip_info)
|
||||
return 0;
|
||||
|
||||
|
@ -984,15 +984,15 @@ enip_get_explicit_connid(packet_info *pinfo, enip_request_key_t *prequest_key, g
|
|||
switch ( prequest_key->requesttype )
|
||||
{
|
||||
case ENIP_REQUEST_PACKET:
|
||||
conn_val = se_tree_lookup32( enip_info->O2TConnIDs, connid );
|
||||
conn_val = (enip_conn_val_t *)se_tree_lookup32( enip_info->O2TConnIDs, connid );
|
||||
if ( conn_val == NULL )
|
||||
conn_val = se_tree_lookup32( enip_info->T2OConnIDs, connid );
|
||||
conn_val = (enip_conn_val_t *)se_tree_lookup32( enip_info->T2OConnIDs, connid );
|
||||
break;
|
||||
|
||||
case ENIP_RESPONSE_PACKET:
|
||||
conn_val = se_tree_lookup32( enip_info->T2OConnIDs, connid );
|
||||
conn_val = (enip_conn_val_t *)se_tree_lookup32( enip_info->T2OConnIDs, connid );
|
||||
if ( conn_val == NULL )
|
||||
conn_val = se_tree_lookup32( enip_info->O2TConnIDs, connid );
|
||||
conn_val = (enip_conn_val_t *)se_tree_lookup32( enip_info->O2TConnIDs, connid );
|
||||
break;
|
||||
case ENIP_CANNOT_CLASSIFY:
|
||||
/* ignore */
|
||||
|
@ -1028,17 +1028,17 @@ enip_get_io_connid(packet_info *pinfo, guint32 connid, enum enip_connid_type* pc
|
|||
/*
|
||||
* Do we already have a state structure for this conv
|
||||
*/
|
||||
if ((enip_info = conversation_get_proto_data(conversation, proto_enip)) == NULL)
|
||||
if ((enip_info = (enip_conv_info_t *)conversation_get_proto_data(conversation, proto_enip)) == NULL)
|
||||
return NULL;
|
||||
|
||||
if (enip_info->O2TConnIDs != NULL)
|
||||
conn_val = se_tree_lookup32( enip_info->O2TConnIDs, connid );
|
||||
conn_val = (enip_conn_val_t *)se_tree_lookup32( enip_info->O2TConnIDs, connid );
|
||||
|
||||
if ( conn_val == NULL )
|
||||
{
|
||||
if (enip_info->T2OConnIDs != NULL)
|
||||
{
|
||||
if ((conn_val = se_tree_lookup32( enip_info->T2OConnIDs, connid)) != NULL)
|
||||
if ((conn_val = (enip_conn_val_t *)se_tree_lookup32( enip_info->T2OConnIDs, connid)) != NULL)
|
||||
*pconnid_type = ECIDT_T2O;
|
||||
}
|
||||
}
|
||||
|
@ -1633,7 +1633,7 @@ dissect_cpf(enip_request_key_t *request_key, int command, tvbuff_t *tvb,
|
|||
if (conn_info->safety.safety_seg == TRUE)
|
||||
{
|
||||
/* Add any possible safety related data */
|
||||
cip_safety = se_alloc(sizeof(cip_safety_info_t));
|
||||
cip_safety = se_new(cip_safety_info_t);
|
||||
cip_safety->conn_type = connid_type;
|
||||
cip_safety->server_dir = (conn_info->TransportClass_trigger & CI_PRODUCTION_DIR_MASK) ? TRUE : FALSE;
|
||||
cip_safety->format = conn_info->safety.format;
|
||||
|
@ -1782,7 +1782,7 @@ dissect_cpf(enip_request_key_t *request_key, int command, tvbuff_t *tvb,
|
|||
|
||||
if ((FwdOpen == TRUE) || (FwdOpenReply == TRUE))
|
||||
{
|
||||
request_info = p_get_proto_data(pinfo->fd, proto_enip);
|
||||
request_info = (enip_request_info_t *)p_get_proto_data(pinfo->fd, proto_enip);
|
||||
if (request_info != NULL)
|
||||
{
|
||||
if (item == SOCK_ADR_INFO_OT)
|
||||
|
@ -1854,7 +1854,7 @@ dissect_cpf(enip_request_key_t *request_key, int command, tvbuff_t *tvb,
|
|||
/* See if there is a CIP connection to establish */
|
||||
if (FwdOpenReply == TRUE)
|
||||
{
|
||||
request_info = p_get_proto_data(pinfo->fd, proto_enip);
|
||||
request_info = (enip_request_info_t *)p_get_proto_data(pinfo->fd, proto_enip);
|
||||
if (request_info != NULL)
|
||||
{
|
||||
enip_open_cip_connection(pinfo, request_info->cip_info->connInfo);
|
||||
|
@ -1870,7 +1870,7 @@ dissect_cpf(enip_request_key_t *request_key, int command, tvbuff_t *tvb,
|
|||
|
||||
|
||||
|
||||
static int
|
||||
static enum enip_packet_type
|
||||
classify_packet(packet_info *pinfo)
|
||||
{
|
||||
/* see if nature of packets can be derived from src/dst ports */
|
||||
|
@ -1907,7 +1907,7 @@ get_enip_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
|
|||
static void
|
||||
dissect_enip_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
{
|
||||
int packet_type;
|
||||
enum enip_packet_type packet_type;
|
||||
guint16 encap_cmd, encap_data_length;
|
||||
const char *pkt_type_str = "";
|
||||
guint32 ifacehndl;
|
||||
|
|
|
@ -494,19 +494,19 @@ enum hf_lmp_filter_keys {
|
|||
static int hf_lmp_filter[LMPF_MAX];
|
||||
|
||||
static int
|
||||
lmp_valid_class(int class)
|
||||
lmp_valid_class(int lmp_class)
|
||||
{
|
||||
/* Contiguous classes */
|
||||
if (class > LMP_CLASS_NULL && class <= LMP_LAST_CONTIGUOUS_CLASS)
|
||||
if (lmp_class > LMP_CLASS_NULL && lmp_class <= LMP_LAST_CONTIGUOUS_CLASS)
|
||||
return 1;
|
||||
|
||||
/* Noncontiguous classes */
|
||||
if (class == LMP_CLASS_ERROR ||
|
||||
class == LMP_CLASS_TRACE ||
|
||||
class == LMP_CLASS_TRACE_REQ ||
|
||||
class == LMP_CLASS_SERVICE_CONFIG ||
|
||||
class == LMP_CLASS_DA_DCN_ADDRESS ||
|
||||
class == LMP_CLASS_LOCAL_LAD_INFO)
|
||||
if (lmp_class == LMP_CLASS_ERROR ||
|
||||
lmp_class == LMP_CLASS_TRACE ||
|
||||
lmp_class == LMP_CLASS_TRACE_REQ ||
|
||||
lmp_class == LMP_CLASS_SERVICE_CONFIG ||
|
||||
lmp_class == LMP_CLASS_DA_DCN_ADDRESS ||
|
||||
lmp_class == LMP_CLASS_LOCAL_LAD_INFO)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
@ -544,7 +544,7 @@ lmp_msg_to_filter_num(int msg_type)
|
|||
|
||||
|
||||
static int
|
||||
lmp_class_to_filter_num(int class)
|
||||
lmp_class_to_filter_num(int lmp_class)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -552,7 +552,7 @@ lmp_class_to_filter_num(int class)
|
|||
* Service Config objects, whose C-Type values are not contiguously assigned,
|
||||
* must be handled separately.
|
||||
*/
|
||||
switch (class) {
|
||||
switch (lmp_class) {
|
||||
|
||||
case LMP_CLASS_CCID:
|
||||
case LMP_CLASS_NODE_ID:
|
||||
|
@ -568,7 +568,7 @@ lmp_class_to_filter_num(int class)
|
|||
case LMP_CLASS_DATA_LINK:
|
||||
case LMP_CLASS_CHANNEL_STATUS:
|
||||
case LMP_CLASS_CHANNEL_STATUS_REQUEST:
|
||||
return LMPF_OBJECT + class;
|
||||
return LMPF_OBJECT + lmp_class;
|
||||
|
||||
case LMP_CLASS_ERROR:
|
||||
return LMPF_CLASS_ERROR;
|
||||
|
@ -627,20 +627,20 @@ enum {
|
|||
|
||||
static gint lmp_subtree[NUM_LMP_SUBTREES];
|
||||
|
||||
static int lmp_class_to_subtree(int class)
|
||||
static int lmp_class_to_subtree(int lmp_class)
|
||||
{
|
||||
if (lmp_valid_class(class)) {
|
||||
if (class == LMP_CLASS_SERVICE_CONFIG) {
|
||||
if (lmp_valid_class(lmp_class)) {
|
||||
if (lmp_class == LMP_CLASS_SERVICE_CONFIG) {
|
||||
return lmp_subtree[LMP_TREE_CLASS_START + LMP_CLASS_SERVICE_CONFIG];
|
||||
}
|
||||
if (class == LMP_CLASS_DA_DCN_ADDRESS) {
|
||||
if (lmp_class == LMP_CLASS_DA_DCN_ADDRESS) {
|
||||
return lmp_subtree[LMP_TREE_CLASS_START + LMP_CLASS_DA_DCN_ADDRESS];
|
||||
}
|
||||
if (class == LMP_CLASS_LOCAL_LAD_INFO) {
|
||||
if (lmp_class == LMP_CLASS_LOCAL_LAD_INFO) {
|
||||
return lmp_subtree[LMP_TREE_CLASS_START + LMP_CLASS_LOCAL_LAD_INFO];
|
||||
}
|
||||
|
||||
return lmp_subtree[LMP_TREE_CLASS_START + class];
|
||||
return lmp_subtree[LMP_TREE_CLASS_START + lmp_class];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -758,35 +758,35 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
|||
offset += 8;
|
||||
len = 8;
|
||||
while (len < msg_length) {
|
||||
guint8 class;
|
||||
guint8 lmp_class;
|
||||
guint8 type;
|
||||
guint8 negotiable;
|
||||
const char *object_type;
|
||||
|
||||
obj_length = tvb_get_ntohs(tvb, offset+2);
|
||||
class = tvb_get_guint8(tvb, offset+1);
|
||||
lmp_class = tvb_get_guint8(tvb, offset+1);
|
||||
type = tvb_get_guint8(tvb, offset);
|
||||
negotiable = (type >> 7); type &= 0x7f;
|
||||
object_type = val_to_str_const(class, lmp_class_vals, "Unknown");
|
||||
object_type = val_to_str_const(lmp_class, lmp_class_vals, "Unknown");
|
||||
hidden_item = proto_tree_add_uint(lmp_tree, hf_lmp_filter[LMPF_OBJECT], tvb,
|
||||
offset, 1, class);
|
||||
offset, 1, lmp_class);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
if (lmp_valid_class(class)) {
|
||||
if (lmp_valid_class(lmp_class)) {
|
||||
|
||||
ti = proto_tree_add_item(lmp_tree,
|
||||
hf_lmp_filter[lmp_class_to_filter_num(class)],
|
||||
hf_lmp_filter[lmp_class_to_filter_num(lmp_class)],
|
||||
tvb, offset, obj_length, ENC_NA); /* all possibilities are FT_NONE */
|
||||
} else {
|
||||
proto_tree_add_protocol_format(lmp_tree, proto_malformed, tvb,
|
||||
offset+1, 1,
|
||||
"Invalid class: %u", class);
|
||||
"Invalid class: %u", lmp_class);
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
lmp_object_tree = proto_item_add_subtree(ti, lmp_class_to_subtree(class));
|
||||
lmp_object_tree = proto_item_add_subtree(ti, lmp_class_to_subtree(lmp_class));
|
||||
|
||||
ti2 = proto_tree_add_text(lmp_object_tree, tvb, offset, 4,
|
||||
"Header. Class %d, C-Type %d, Length %d, %s",
|
||||
class, type, obj_length,
|
||||
lmp_class, type, obj_length,
|
||||
negotiable ? "Negotiable" : "Not Negotiable");
|
||||
|
||||
lmp_object_header_tree =
|
||||
|
@ -798,13 +798,13 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
|||
"Length: %u", obj_length);
|
||||
proto_tree_add_text(lmp_object_header_tree, tvb, offset+1, 1,
|
||||
"Object Class: %u - %s",
|
||||
class, object_type);
|
||||
lmp_class, object_type);
|
||||
proto_tree_add_uint(lmp_object_header_tree, hf_lmp_filter[LMPF_VAL_CTYPE],
|
||||
tvb, offset, 1, type);
|
||||
offset2 = offset+4;
|
||||
mylen = obj_length - 4;
|
||||
|
||||
switch (class) {
|
||||
switch (lmp_class) {
|
||||
|
||||
case LMP_CLASS_NULL:
|
||||
break;
|
||||
|
|
|
@ -525,7 +525,7 @@ radius_decrypt_avp(gchar *dest,int dest_len,tvbuff_t *tvb,int offset,int length)
|
|||
|
||||
padded_length = length + ((length % AUTHENTICATOR_LENGTH) ?
|
||||
(AUTHENTICATOR_LENGTH - (length % AUTHENTICATOR_LENGTH)) : 0);
|
||||
pd = ep_alloc0(padded_length);
|
||||
pd = (guint8 *)ep_alloc0(padded_length);
|
||||
tvb_memcpy(tvb, pd, offset, length);
|
||||
|
||||
for ( i = 0; i < padded_length; i += AUTHENTICATOR_LENGTH ) {
|
||||
|
@ -635,7 +635,7 @@ void radius_string(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _
|
|||
proto_tree_add_item(tree, a->hf_alt, tvb, offset, len, ENC_NA);
|
||||
} else {
|
||||
gchar *buffer;
|
||||
buffer=ep_alloc(1024); /* an AVP value can be at most 253 bytes */
|
||||
buffer=(gchar *)ep_alloc(1024); /* an AVP value can be at most 253 bytes */
|
||||
radius_decrypt_avp(buffer,1024,tvb,offset,len);
|
||||
proto_item_append_text(avp_item, "Decrypted: %s", buffer);
|
||||
proto_tree_add_string(tree, a->hf, tvb, offset, len, buffer);
|
||||
|
@ -844,7 +844,7 @@ void radius_tlv(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_,
|
|||
|
||||
len -= tlv_length;
|
||||
|
||||
dictionary_entry = g_hash_table_lookup(a->tlvs_by_id,GUINT_TO_POINTER(tlv_type));
|
||||
dictionary_entry = (radius_attr_info_t *)g_hash_table_lookup(a->tlvs_by_id,GUINT_TO_POINTER(tlv_type));
|
||||
|
||||
if (! dictionary_entry ) {
|
||||
dictionary_entry = &no_dictionary_entry;
|
||||
|
@ -992,7 +992,7 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_
|
|||
|
||||
length -= avp_length;
|
||||
|
||||
dictionary_entry = g_hash_table_lookup(dict->attrs_by_id, GUINT_TO_POINTER(avp_type));
|
||||
dictionary_entry = (radius_attr_info_t *)g_hash_table_lookup(dict->attrs_by_id, GUINT_TO_POINTER(avp_type));
|
||||
|
||||
if (! dictionary_entry ) {
|
||||
dictionary_entry = &no_dictionary_entry;
|
||||
|
@ -1023,7 +1023,7 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_
|
|||
avp_length -= 4;
|
||||
offset += 4;
|
||||
|
||||
vendor = g_hash_table_lookup(dict->vendors_by_id,GUINT_TO_POINTER(vendor_id));
|
||||
vendor = (radius_vendor_info_t *)g_hash_table_lookup(dict->vendors_by_id,GUINT_TO_POINTER(vendor_id));
|
||||
vendor_str = val_to_str_ext_const(vendor_id, &sminmpec_values_ext, "Unknown");
|
||||
if (!vendor) {
|
||||
vendor = &no_vendor;
|
||||
|
@ -1082,7 +1082,7 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_
|
|||
|
||||
avp_vsa_len -= avp_vsa_header_len;
|
||||
|
||||
dictionary_entry = g_hash_table_lookup(vendor->attrs_by_id,GUINT_TO_POINTER(avp_vsa_type));
|
||||
dictionary_entry = (radius_attr_info_t *)g_hash_table_lookup(vendor->attrs_by_id,GUINT_TO_POINTER(avp_vsa_type));
|
||||
|
||||
if ( !dictionary_entry ) {
|
||||
dictionary_entry = &no_dictionary_entry;
|
||||
|
@ -1117,9 +1117,9 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_
|
|||
vsa_buffer_table = g_hash_table_new(radius_vsa_hash, radius_vsa_equal);
|
||||
}
|
||||
|
||||
vsa_buffer = g_hash_table_lookup(vsa_buffer_table, &key);
|
||||
vsa_buffer = (radius_vsa_buffer *)g_hash_table_lookup(vsa_buffer_table, &key);
|
||||
if (vsa_buffer) {
|
||||
vsa_buffer->data = g_realloc(vsa_buffer->data, vsa_buffer->len + avp_vsa_len);
|
||||
vsa_buffer->data = (guint8 *)g_realloc(vsa_buffer->data, vsa_buffer->len + avp_vsa_len);
|
||||
tvb_memcpy(tvb, vsa_buffer->data + vsa_buffer->len, offset, avp_vsa_len);
|
||||
vsa_buffer->len += avp_vsa_len;
|
||||
vsa_buffer->seg_num++;
|
||||
|
@ -1127,12 +1127,12 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_
|
|||
|
||||
if (avp_vsa_flags & 0x80) {
|
||||
if (!vsa_buffer) {
|
||||
vsa_buffer = g_malloc(sizeof(radius_vsa_buffer));
|
||||
vsa_buffer = (radius_vsa_buffer *)g_malloc(sizeof(radius_vsa_buffer));
|
||||
vsa_buffer->key.vendor_id = vendor_id;
|
||||
vsa_buffer->key.vsa_type = avp_vsa_type;
|
||||
vsa_buffer->len = avp_vsa_len;
|
||||
vsa_buffer->seg_num = 1;
|
||||
vsa_buffer->data = g_malloc(avp_vsa_len);
|
||||
vsa_buffer->data = (guint8 *)g_malloc(avp_vsa_len);
|
||||
tvb_memcpy(tvb, vsa_buffer->data, offset, avp_vsa_len);
|
||||
g_hash_table_insert(vsa_buffer_table, &(vsa_buffer->key), vsa_buffer);
|
||||
}
|
||||
|
@ -1226,9 +1226,9 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_
|
|||
*/
|
||||
|
||||
if (eap_buffer == NULL)
|
||||
eap_buffer = g_malloc(eap_tot_len_captured + tvb_len);
|
||||
eap_buffer = (guint8 *)g_malloc(eap_tot_len_captured + tvb_len);
|
||||
else
|
||||
eap_buffer = g_realloc(eap_buffer,
|
||||
eap_buffer = (guint8 *)g_realloc(eap_buffer,
|
||||
eap_tot_len_captured + tvb_len);
|
||||
tvb_memcpy(tvb, eap_buffer + eap_tot_len_captured, offset,
|
||||
tvb_len);
|
||||
|
@ -1372,7 +1372,7 @@ dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
|
||||
|
||||
/* Initialise stat info for passing to tap */
|
||||
rad_info = ep_alloc(sizeof(radius_info_t));
|
||||
rad_info = ep_new(radius_info_t);
|
||||
rad_info->code = 0;
|
||||
rad_info->ident = 0;
|
||||
rad_info->req_time.secs = 0;
|
||||
|
@ -1483,7 +1483,7 @@ dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
radius_call_key.req_time = pinfo->fd->abs_ts;
|
||||
|
||||
/* Look up the request */
|
||||
radius_call = g_hash_table_lookup(radius_calls, &radius_call_key);
|
||||
radius_call = (radius_call_t *)g_hash_table_lookup(radius_calls, &radius_call_key);
|
||||
if (radius_call != NULL)
|
||||
{
|
||||
/* We've seen a request with this ID, with the same
|
||||
|
@ -1515,9 +1515,9 @@ dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
frame numbers are 1-origin, so we use 0
|
||||
to mean "we don't yet know in which frame
|
||||
the reply for this call appears". */
|
||||
new_radius_call_key = se_alloc(sizeof(radius_call_info_key));
|
||||
new_radius_call_key = se_new(radius_call_info_key);
|
||||
*new_radius_call_key = radius_call_key;
|
||||
radius_call = se_alloc(sizeof(radius_call_t));
|
||||
radius_call = se_new(radius_call_t);
|
||||
radius_call->req_num = pinfo->fd->num;
|
||||
radius_call->rsp_num = 0;
|
||||
radius_call->ident = rh.rh_ident;
|
||||
|
@ -1591,7 +1591,7 @@ dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
radius_call_key.conversation = conversation;
|
||||
radius_call_key.req_time = pinfo->fd->abs_ts;
|
||||
|
||||
radius_call = g_hash_table_lookup(radius_calls, &radius_call_key);
|
||||
radius_call = (radius_call_t *)g_hash_table_lookup(radius_calls, &radius_call_key);
|
||||
if (radius_call)
|
||||
{
|
||||
/* Indicate the frame to which this is a reply. */
|
||||
|
@ -1680,7 +1680,7 @@ dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
|
||||
|
||||
static void register_attrs(gpointer k _U_, gpointer v, gpointer p) {
|
||||
radius_attr_info_t* a = v;
|
||||
radius_attr_info_t* a = (radius_attr_info_t *)v;
|
||||
int i;
|
||||
gint* ett = &(a->ett);
|
||||
gchar* abbrev = g_strconcat("radius.",a->name,NULL);
|
||||
|
@ -1691,7 +1691,7 @@ static void register_attrs(gpointer k _U_, gpointer v, gpointer p) {
|
|||
{ NULL, { NULL,NULL, FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}
|
||||
};
|
||||
guint len_hf = 2;
|
||||
hfett_t* ri = p;
|
||||
hfett_t* ri = (hfett_t *)p;
|
||||
|
||||
for(i=0; abbrev[i]; i++) {
|
||||
if(abbrev[i] == '-') abbrev[i] = '_';
|
||||
|
@ -1817,8 +1817,8 @@ static void register_attrs(gpointer k _U_, gpointer v, gpointer p) {
|
|||
}
|
||||
|
||||
static void register_vendors(gpointer k _U_, gpointer v, gpointer p) {
|
||||
radius_vendor_info_t* vnd = v;
|
||||
hfett_t* ri = p;
|
||||
radius_vendor_info_t* vnd = (radius_vendor_info_t *)v;
|
||||
hfett_t* ri = (hfett_t *)p;
|
||||
value_string vnd_vs;
|
||||
gint* ett_p = &(vnd->ett);
|
||||
|
||||
|
@ -1840,10 +1840,10 @@ extern void radius_register_avp_dissector(guint32 vendor_id, guint32 attribute_i
|
|||
DISSECTOR_ASSERT(radius_avp_dissector != NULL);
|
||||
|
||||
if (vendor_id) {
|
||||
vendor = g_hash_table_lookup(dict->vendors_by_id,GUINT_TO_POINTER(vendor_id));
|
||||
vendor = (radius_vendor_info_t *)g_hash_table_lookup(dict->vendors_by_id,GUINT_TO_POINTER(vendor_id));
|
||||
|
||||
if ( ! vendor ) {
|
||||
vendor = g_malloc(sizeof(radius_vendor_info_t));
|
||||
vendor = (radius_vendor_info_t *)g_malloc(sizeof(radius_vendor_info_t));
|
||||
|
||||
vendor->name = g_strdup_printf("%s-%u",
|
||||
val_to_str_ext_const(vendor_id, &sminmpec_values_ext, "Unknown"),
|
||||
|
@ -1861,15 +1861,15 @@ extern void radius_register_avp_dissector(guint32 vendor_id, guint32 attribute_i
|
|||
g_hash_table_insert(dict->vendors_by_name,(gpointer)(vendor->name),vendor);
|
||||
}
|
||||
|
||||
dictionary_entry = g_hash_table_lookup(vendor->attrs_by_id,GUINT_TO_POINTER(attribute_id));
|
||||
dictionary_entry = (radius_attr_info_t *)g_hash_table_lookup(vendor->attrs_by_id,GUINT_TO_POINTER(attribute_id));
|
||||
by_id = vendor->attrs_by_id;
|
||||
} else {
|
||||
dictionary_entry = g_hash_table_lookup(dict->attrs_by_id,GUINT_TO_POINTER(attribute_id));
|
||||
dictionary_entry = (radius_attr_info_t *)g_hash_table_lookup(dict->attrs_by_id,GUINT_TO_POINTER(attribute_id));
|
||||
by_id = dict->attrs_by_id;
|
||||
}
|
||||
|
||||
if (!dictionary_entry) {
|
||||
dictionary_entry = g_malloc(sizeof(radius_attr_info_t));
|
||||
dictionary_entry = (radius_attr_info_t *)g_malloc(sizeof(radius_attr_info_t));
|
||||
|
||||
dictionary_entry->name = g_strdup_printf("Unknown-Attribute-%u",attribute_id);
|
||||
dictionary_entry->code = attribute_id;
|
||||
|
@ -2080,7 +2080,7 @@ proto_register_radius(void)
|
|||
radius_tap = register_tap("radius");
|
||||
proto_register_prefix("radius",register_radius_fields);
|
||||
|
||||
dict = g_malloc(sizeof(radius_dictionary_t));
|
||||
dict = (radius_dictionary_t *)g_malloc(sizeof(radius_dictionary_t));
|
||||
dict->attrs_by_id = g_hash_table_new(g_direct_hash,g_direct_equal);
|
||||
dict->attrs_by_name = g_hash_table_new(g_str_hash,g_str_equal);
|
||||
dict->vendors_by_id = g_hash_table_new(g_direct_hash,g_direct_equal);
|
||||
|
|
|
@ -551,7 +551,7 @@ dissect_rpcap_filterbpf_insn (tvbuff_t *tvb, packet_info *pinfo _U_,
|
|||
{
|
||||
proto_tree *tree, *code_tree;
|
||||
proto_item *ti, *code_ti;
|
||||
guint8 class;
|
||||
guint8 inst_class;
|
||||
|
||||
ti = proto_tree_add_item (parent_tree, hf_filterbpf_insn, tvb, offset, 8, ENC_NA);
|
||||
tree = proto_item_add_subtree (ti, ett_filterbpf_insn);
|
||||
|
@ -559,9 +559,9 @@ dissect_rpcap_filterbpf_insn (tvbuff_t *tvb, packet_info *pinfo _U_,
|
|||
code_ti = proto_tree_add_item (tree, hf_code, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
code_tree = proto_item_add_subtree (code_ti, ett_filterbpf_insn_code);
|
||||
proto_tree_add_item (code_tree, hf_code_class, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
class = tvb_get_guint8 (tvb, offset + 1) & 0x07;
|
||||
proto_item_append_text (ti, ": %s", val_to_str_const (class, bpf_class, ""));
|
||||
switch (class) {
|
||||
inst_class = tvb_get_guint8 (tvb, offset + 1) & 0x07;
|
||||
proto_item_append_text (ti, ": %s", val_to_str_const (inst_class, bpf_class, ""));
|
||||
switch (inst_class) {
|
||||
case 0x00: /* ld */
|
||||
case 0x01: /* ldx */
|
||||
proto_tree_add_item (code_tree, hf_code_ld_size, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
|
|
Loading…
Reference in New Issue