Fix some warnings reported by gcc -Wshadow ...

svn path=/trunk/; revision=25616
This commit is contained in:
Bill Meier 2008-06-27 04:52:56 +00:00
parent 6012eaeafb
commit 7aaadd9bec
7 changed files with 197 additions and 200 deletions

View File

@ -1338,14 +1338,14 @@ static void alcap_leg_tree(proto_tree* tree, tvbuff_t* tvb, const alcap_leg_info
if(leg->msgs) {
alcap_msg_data_t* msg = leg->msgs;
proto_item* pi = proto_tree_add_text(tree,tvb,0,0,"[Messages in this leg]");
proto_tree* tree = proto_item_add_subtree(pi,ett_leg);
proto_item* pi_local = proto_tree_add_text(tree,tvb,0,0,"[Messages in this leg]");
proto_tree* tree_local = proto_item_add_subtree(pi_local,ett_leg);
do {
pi = proto_tree_add_uint(tree,hf_alcap_leg_frame,tvb,0,0,msg->framenum);
proto_item_set_text(pi,"%s in frame %u", val_to_str(msg->msg_type,msg_type_strings,"Unknown message"),msg->framenum);
PROTO_ITEM_SET_GENERATED(pi);
pi_local = proto_tree_add_uint(tree_local,hf_alcap_leg_frame,tvb,0,0,msg->framenum);
proto_item_set_text(pi_local,"%s in frame %u", val_to_str(msg->msg_type,msg_type_strings,"Unknown message"),msg->framenum);
PROTO_ITEM_SET_GENERATED(pi_local);
} while (( msg = msg->next));
}

View File

@ -397,13 +397,13 @@ static int header_len(tvbuff_t *tvb, int offset)
static int
dissect_beep_mime_header(tvbuff_t *tvb, int offset,
struct beep_proto_data *frame_data,
struct beep_proto_data *beep_frame_data,
proto_tree *tree)
{
proto_tree *ti = NULL, *mime_tree = NULL;
int mime_length = header_len(tvb, offset), cc = 0;
if (frame_data && !frame_data->mime_hdr) return 0;
if (beep_frame_data && !beep_frame_data->mime_hdr) return 0;
if (tree) {
@ -482,7 +482,7 @@ dissect_beep_int(tvbuff_t *tvb, int offset,
static void
set_mime_hdr_flags(int more, struct beep_request_val *request_val,
struct beep_proto_data *frame_data, packet_info *pinfo)
struct beep_proto_data *beep_frame_data, packet_info *pinfo)
{
if (!request_val) return; /* Nothing to do ??? */
@ -491,14 +491,14 @@ set_mime_hdr_flags(int more, struct beep_request_val *request_val,
if (request_val->c_mime_hdr) {
frame_data->mime_hdr = 0;
beep_frame_data->mime_hdr = 0;
if (!more) request_val->c_mime_hdr = 0;
}
else {
frame_data->mime_hdr = 1;
beep_frame_data->mime_hdr = 1;
if (more) request_val->c_mime_hdr = 1;
@ -509,14 +509,14 @@ set_mime_hdr_flags(int more, struct beep_request_val *request_val,
if (request_val->s_mime_hdr) {
frame_data->mime_hdr = 0;
beep_frame_data->mime_hdr = 0;
if (!more) request_val->s_mime_hdr = 0;
}
else {
frame_data->mime_hdr = 1;
beep_frame_data->mime_hdr = 1;
if (more) request_val->s_mime_hdr = 1;
@ -537,7 +537,7 @@ set_mime_hdr_flags(int more, struct beep_request_val *request_val,
static int
dissect_beep_tree(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, struct beep_request_val *request_val,
struct beep_proto_data *frame_data)
struct beep_proto_data *beep_frame_data)
{
proto_tree *ti = NULL, *hdr = NULL;
proto_item *hidden_item;
@ -585,10 +585,10 @@ dissect_beep_tree(tvbuff_t *tvb, int offset, packet_info *pinfo,
/* Insert the more elements ... */
if ((more = dissect_beep_more(tvb, offset, hdr)) >= 0) {
/* Figure out which direction this is in and what mime_hdr flag to
* add to the frame_data. If there are missing segments, this code
* add to the beep_frame_data. If there are missing segments, this code
* will get it wrong!
*/
set_mime_hdr_flags(more, request_val, frame_data, pinfo);
set_mime_hdr_flags(more, request_val, beep_frame_data, pinfo);
}
else { /* Protocol violation, so dissect rest as undisectable */
if (tree) {
@ -614,8 +614,8 @@ dissect_beep_tree(tvbuff_t *tvb, int offset, packet_info *pinfo,
if (request_val) /* FIXME, is this the right order ... */
request_val -> size = size; /* Stash this away */
else {
frame_data->pl_size = size;
if (frame_data->pl_size < 0) frame_data->pl_size = 0; /* FIXME: OK? */
beep_frame_data->pl_size = size;
if (beep_frame_data->pl_size < 0) beep_frame_data->pl_size = 0; /* FIXME: OK? */
}
/* offset += 1; skip the space */
@ -647,8 +647,8 @@ dissect_beep_tree(tvbuff_t *tvb, int offset, packet_info *pinfo,
/* Insert MIME header ... */
if (frame_data && frame_data->mime_hdr)
offset += dissect_beep_mime_header(tvb, offset, frame_data, hdr);
if (beep_frame_data && beep_frame_data->mime_hdr)
offset += dissect_beep_mime_header(tvb, offset, beep_frame_data, hdr);
/* Now for the payload, if any */
@ -675,15 +675,15 @@ dissect_beep_tree(tvbuff_t *tvb, int offset, packet_info *pinfo,
if (request_val->size < 0) request_val->size = 0;
}
else {
frame_data->pl_size -= pl_size;
if (frame_data->pl_size < 0) frame_data->pl_size = 0;
beep_frame_data->pl_size -= pl_size;
if (beep_frame_data->pl_size < 0) beep_frame_data->pl_size = 0;
}
}
/* If anything else left, dissect it ... */
if (tvb_length_remaining(tvb, offset) > 0)
offset += dissect_beep_tree(tvb, offset, pinfo, tree, request_val, frame_data);
offset += dissect_beep_tree(tvb, offset, pinfo, tree, request_val, beep_frame_data);
} else if (tvb_strneql(tvb, offset, "SEQ ", 4) == 0) {
@ -783,8 +783,8 @@ dissect_beep_tree(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
} else if (frame_data) {
pl_size = MIN(frame_data->pl_size, tvb_length_remaining(tvb, offset));
} else if (beep_frame_data) {
pl_size = MIN(beep_frame_data->pl_size, tvb_length_remaining(tvb, offset));
} else { /* Just in case */
pl_size = tvb_length_remaining(tvb, offset);
}
@ -815,13 +815,13 @@ dissect_beep_tree(tvbuff_t *tvb, int offset, packet_info *pinfo,
if (request_val->size < 0) request_val->size = 0;
}
else {
frame_data->pl_size -= pl_size;
if (frame_data->pl_size < 0) frame_data->pl_size = 0;
beep_frame_data->pl_size -= pl_size;
if (beep_frame_data->pl_size < 0) beep_frame_data->pl_size = 0;
}
}
if (tvb_length_remaining(tvb, offset) > 0) {
offset += dissect_beep_tree(tvb, offset, pinfo, tree, request_val, frame_data);
offset += dissect_beep_tree(tvb, offset, pinfo, tree, request_val, beep_frame_data);
}
}
@ -833,7 +833,7 @@ static void
dissect_beep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
int offset;
struct beep_proto_data *frame_data = NULL;
struct beep_proto_data *beep_frame_data = NULL;
proto_tree *beep_tree = NULL, *ti = NULL;
conversation_t *conversation = NULL;
struct beep_request_key request_key, *new_request_key;
@ -863,9 +863,9 @@ dissect_beep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* info first.
*/
frame_data = p_get_proto_data(pinfo->fd, proto_beep);
beep_frame_data = p_get_proto_data(pinfo->fd, proto_beep);
if (!frame_data) {
if (!beep_frame_data) {
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype,
pinfo->srcport, pinfo->destport, 0);
@ -937,9 +937,9 @@ dissect_beep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* We also depend on the first frame in a group having a pl_size of 0.
*/
if (frame_data && frame_data->pl_left > 0) {
if (beep_frame_data && beep_frame_data->pl_left > 0) {
int pl_left = frame_data->pl_left;
int pl_left = beep_frame_data->pl_left;
pl_left = MIN(pl_left, tvb_length_remaining(tvb, offset));
@ -960,13 +960,13 @@ dissect_beep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* elsewhere for other frames
*/
frame_data = se_alloc(sizeof(struct beep_proto_data));
beep_frame_data = se_alloc(sizeof(struct beep_proto_data));
frame_data->pl_left = pl_left;
frame_data->pl_size = 0;
frame_data->mime_hdr = 0;
beep_frame_data->pl_left = pl_left;
beep_frame_data->pl_size = 0;
beep_frame_data->mime_hdr = 0;
p_add_proto_data(pinfo->fd, proto_beep, frame_data);
p_add_proto_data(pinfo->fd, proto_beep, beep_frame_data);
}
@ -974,21 +974,21 @@ dissect_beep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* This _must_ come after the checks above ...
*/
if (frame_data == NULL) {
if (beep_frame_data == NULL) {
frame_data = se_alloc(sizeof(struct beep_proto_data));
beep_frame_data = se_alloc(sizeof(struct beep_proto_data));
frame_data->pl_left = 0;
frame_data->pl_size = 0;
frame_data->mime_hdr = 0;
beep_frame_data->pl_left = 0;
beep_frame_data->pl_size = 0;
beep_frame_data->mime_hdr = 0;
p_add_proto_data(pinfo->fd, proto_beep, frame_data);
p_add_proto_data(pinfo->fd, proto_beep, beep_frame_data);
}
if (tvb_length_remaining(tvb, offset) > 0) {
offset += dissect_beep_tree(tvb, offset, pinfo, beep_tree, request_val, frame_data);
offset += dissect_beep_tree(tvb, offset, pinfo, beep_tree, request_val, beep_frame_data);
}

View File

@ -1316,10 +1316,10 @@ dissect_ber_real(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbu
/* this function dissects a BER sequence
*/
int dissect_ber_sequence(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const ber_sequence_t *seq, gint hf_id, gint ett_id) {
gint8 class;
gboolean pc, ind = 0, ind_field, imp_tag=FALSE;
gint32 tag;
guint32 len;
gint8 classx;
gboolean pcx, ind = 0, ind_field, imp_tag=FALSE;
gint32 tagx;
guint32 lenx;
proto_tree *tree = parent_tree;
proto_item *item = NULL;
proto_item *cause;
@ -1350,16 +1350,16 @@ printf("SEQUENCE dissect_ber_sequence(%s) entered\n",name);
hoffset = offset;
if(!implicit_tag) {
offset = get_ber_identifier(tvb, offset, NULL, NULL, NULL);
offset = get_ber_length(tvb, offset, &len, NULL);
offset = get_ber_length(tvb, offset, &lenx, NULL);
} else {
/* was implicit tag so just use the length of the tvb */
len=tvb_length_remaining(tvb,offset);
end_offset=offset+len;
lenx=tvb_length_remaining(tvb,offset);
end_offset=offset+lenx;
}
/* create subtree */
if(hf_id >= 0) {
if(parent_tree){
item = proto_tree_add_item(parent_tree, hf_id, tvb, hoffset, len + offset - hoffset, FALSE);
item = proto_tree_add_item(parent_tree, hf_id, tvb, hoffset, lenx + offset - hoffset, FALSE);
tree = proto_item_add_subtree(item, ett_id);
}
}
@ -1367,23 +1367,23 @@ printf("SEQUENCE dissect_ber_sequence(%s) entered\n",name);
if(!implicit_tag){
/* first we must read the sequence header */
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind);
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &classx, &pcx, &tagx);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &lenx, &ind);
if(ind){
/* Fixed the length is correctly returned from dissect ber_length
end_offset = tvb_length(tvb);*/
end_offset = offset + len -2;
end_offset = offset + lenx -2;
} else {
end_offset = offset + len;
end_offset = offset + lenx;
}
/* sanity check: we only handle Constructed Universal Sequences */
if((class!=BER_CLASS_APP)&&(class!=BER_CLASS_PRI))
if((!pc)
||(!implicit_tag&&((class!=BER_CLASS_UNI)
||(tag!=BER_UNI_TAG_SEQUENCE)))) {
if((classx!=BER_CLASS_APP)&&(classx!=BER_CLASS_PRI))
if((!pcx)
||(!implicit_tag&&((classx!=BER_CLASS_UNI)
||(tagx!=BER_UNI_TAG_SEQUENCE)))) {
tvb_ensure_bytes_exist(tvb, hoffset, 2);
cause = proto_tree_add_text(tree, tvb, offset, len, "BER Error: Sequence expected but class:%s(%d) %s tag:%d was unexpected", val_to_str(class,ber_class_codes,"Unknown"), class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tag);
cause = proto_tree_add_text(tree, tvb, offset, lenx, "BER Error: Sequence expected but class:%s(%d) %s tag:%d was unexpected", val_to_str(classx,ber_class_codes,"Unknown"), classx, pcx ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tagx);
proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: Sequence expected");
if (decode_unexpected) {
@ -1646,10 +1646,10 @@ printf("SEQUENCE dissect_ber_sequence(%s) subdissector ate %d bytes\n",name,coun
}
int dissect_ber_old_sequence(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const ber_old_sequence_t *seq, gint hf_id, gint ett_id) {
gint8 class;
gboolean pc, ind = 0, ind_field;
gint32 tag;
guint32 len;
gint8 classx;
gboolean pcx, ind = 0, ind_field;
gint32 tagx;
guint32 lenx;
proto_tree *tree = parent_tree;
proto_item *item = NULL;
proto_item *cause;
@ -1680,16 +1680,16 @@ printf("SEQUENCE dissect_ber_old_sequence(%s) entered\n",name);
hoffset = offset;
if(!implicit_tag) {
offset = get_ber_identifier(tvb, offset, NULL, NULL, NULL);
offset = get_ber_length(tvb, offset, &len, NULL);
offset = get_ber_length(tvb, offset, &lenx, NULL);
} else {
/* was implicit tag so just use the length of the tvb */
len=tvb_length_remaining(tvb,offset);
end_offset=offset+len;
lenx=tvb_length_remaining(tvb,offset);
end_offset=offset+lenx;
}
/* create subtree */
if(hf_id >= 0) {
if(parent_tree){
item = proto_tree_add_item(parent_tree, hf_id, tvb, hoffset, len + offset - hoffset, FALSE);
item = proto_tree_add_item(parent_tree, hf_id, tvb, hoffset, lenx + offset - hoffset, FALSE);
tree = proto_item_add_subtree(item, ett_id);
}
}
@ -1697,23 +1697,23 @@ printf("SEQUENCE dissect_ber_old_sequence(%s) entered\n",name);
if(!implicit_tag){
/* first we must read the sequence header */
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind);
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &classx, &pcx, &tagx);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &lenx, &ind);
if(ind){
/* Fixed the length is correctly returned from dissect ber_length
end_offset = tvb_length(tvb);*/
end_offset = offset + len -2;
end_offset = offset + lenx -2;
} else {
end_offset = offset + len;
end_offset = offset + lenx;
}
/* sanity check: we only handle Constructed Universal Sequences */
if((class!=BER_CLASS_APP)&&(class!=BER_CLASS_PRI))
if((!pc)
||(!implicit_tag&&((class!=BER_CLASS_UNI)
||(tag!=BER_UNI_TAG_SEQUENCE)))) {
if((classx!=BER_CLASS_APP)&&(classx!=BER_CLASS_PRI))
if((!pcx)
||(!implicit_tag&&((classx!=BER_CLASS_UNI)
||(tagx!=BER_UNI_TAG_SEQUENCE)))) {
tvb_ensure_bytes_exist(tvb, hoffset, 2);
cause = proto_tree_add_text(tree, tvb, offset, len, "BER Error: Sequence expected but class:%s(%d) %s tag:%d was unexpected", val_to_str(class,ber_class_codes,"Unknown"), class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tag);
cause = proto_tree_add_text(tree, tvb, offset, lenx, "BER Error: Sequence expected but class:%s(%d) %s tag:%d was unexpected", val_to_str(classx,ber_class_codes,"Unknown"), classx, pcx ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tagx);
proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: Sequence expected");
if (decode_unexpected) {
@ -1973,10 +1973,10 @@ printf("SEQUENCE dissect_ber_old_sequence(%s) subdissector ate %d bytes\n",name,
/* This function dissects a BER set
*/
int dissect_ber_set(gboolean implicit_tag,asn1_ctx_t *actx, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const ber_sequence_t *set, gint hf_id, gint ett_id) {
gint8 class;
gboolean pc, ind = 0, ind_field, imp_tag = FALSE;
gint32 tag;
guint32 len;
gint8 classx;
gboolean pcx, ind = 0, ind_field, imp_tag = FALSE;
gint32 tagx;
guint32 lenx;
proto_tree *tree = parent_tree;
proto_item *item = NULL;
proto_item *cause;
@ -2011,23 +2011,23 @@ printf("SET dissect_ber_set(%s) entered\n",name);
if(!implicit_tag){
hoffset = offset;
/* first we must read the sequence header */
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind);
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &classx, &pcx, &tagx);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &lenx, &ind);
if(ind){
/* Fixed the length is correctly returned from dissect ber_length
end_offset = tvb_length(tvb);*/
end_offset = offset + len -2;
end_offset = offset + lenx -2;
} else {
end_offset = offset + len;
end_offset = offset + lenx;
}
/* sanity check: we only handle Constructed Universal Sets */
if ((class!=BER_CLASS_APP)&&(class!=BER_CLASS_PRI))
if ((!pc)
||(!implicit_tag&&((class!=BER_CLASS_UNI)
||(tag!=BER_UNI_TAG_SET)))) {
if ((classx!=BER_CLASS_APP)&&(classx!=BER_CLASS_PRI))
if ((!pcx)
||(!implicit_tag&&((classx!=BER_CLASS_UNI)
||(tagx!=BER_UNI_TAG_SET)))) {
tvb_ensure_bytes_exist(tvb, hoffset, 2);
cause = proto_tree_add_text(tree, tvb, offset, len, "BER Error: SET expected but class:%s(%d) %s tag:%d was found", val_to_str(class,ber_class_codes,"Unknown"), class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tag);
cause = proto_tree_add_text(tree, tvb, offset, lenx, "BER Error: SET expected but class:%s(%d) %s tag:%d was found", val_to_str(classx,ber_class_codes,"Unknown"), classx, pcx ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tagx);
proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: SET expected");
if (decode_unexpected) {
@ -2038,14 +2038,14 @@ printf("SET dissect_ber_set(%s) entered\n",name);
}
} else {
/* was implicit tag so just use the length of the tvb */
len=tvb_length_remaining(tvb,offset);
end_offset=offset+len;
lenx=tvb_length_remaining(tvb,offset);
end_offset=offset+lenx;
}
/* create subtree */
if (hf_id >= 0) {
if(parent_tree){
item = proto_tree_add_item(parent_tree, hf_id, tvb, offset, len, FALSE);
item = proto_tree_add_item(parent_tree, hf_id, tvb, offset, lenx, FALSE);
tree = proto_item_add_subtree(item, ett_id);
}
}
@ -2203,7 +2203,7 @@ printf("SET dissect_ber_set(%s) calling subdissector\n",name);
if(mandatory_fields & (1 << set_idx)) {
/* here is something we should have seen - but didn't! */
cause = proto_tree_add_text(tree, tvb, offset, len,
cause = proto_tree_add_text(tree, tvb, offset, lenx,
"BER Error: Missing field in SET class:%s(%d) tag:%d expected",
val_to_str(cset->class,ber_class_codes,"Unknown"),cset->class,
cset->tag);
@ -2237,10 +2237,10 @@ printf("SET dissect_ber_set(%s) calling subdissector\n",name);
}
int dissect_ber_old_set(gboolean implicit_tag,asn1_ctx_t *actx, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const ber_old_sequence_t *set, gint hf_id, gint ett_id) {
gint8 class;
gboolean pc, ind = 0, ind_field;
gint32 tag;
guint32 len;
gint8 classx;
gboolean pcx, ind = 0, ind_field;
gint32 tagx;
guint32 lenx;
proto_tree *tree = parent_tree;
proto_item *item = NULL;
proto_item *cause;
@ -2275,23 +2275,23 @@ printf("SET dissect_old_ber_set(%s) entered\n",name);
if(!implicit_tag){
hoffset = offset;
/* first we must read the sequence header */
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind);
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &classx, &pcx, &tagx);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &lenx, &ind);
if(ind){
/* Fixed the length is correctly returned from dissect ber_length
end_offset = tvb_length(tvb);*/
end_offset = offset + len -2;
end_offset = offset + lenx -2;
} else {
end_offset = offset + len;
end_offset = offset + lenx;
}
/* sanity check: we only handle Constructed Universal Sets */
if ((class!=BER_CLASS_APP)&&(class!=BER_CLASS_PRI))
if ((!pc)
||(!implicit_tag&&((class!=BER_CLASS_UNI)
||(tag!=BER_UNI_TAG_SET)))) {
if ((classx!=BER_CLASS_APP)&&(classx!=BER_CLASS_PRI))
if ((!pcx)
||(!implicit_tag&&((classx!=BER_CLASS_UNI)
||(tagx!=BER_UNI_TAG_SET)))) {
tvb_ensure_bytes_exist(tvb, hoffset, 2);
cause = proto_tree_add_text(tree, tvb, offset, len, "BER Error: SET expected but class:%s(%d) %s tag:%d was found", val_to_str(class,ber_class_codes,"Unknown"), class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tag);
cause = proto_tree_add_text(tree, tvb, offset, lenx, "BER Error: SET expected but class:%s(%d) %s tag:%d was found", val_to_str(classx,ber_class_codes,"Unknown"), classx, pcx ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tagx);
proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: SET expected");
if (decode_unexpected) {
@ -2302,14 +2302,14 @@ printf("SET dissect_old_ber_set(%s) entered\n",name);
}
} else {
/* was implicit tag so just use the length of the tvb */
len=tvb_length_remaining(tvb,offset);
end_offset=offset+len;
lenx=tvb_length_remaining(tvb,offset);
end_offset=offset+lenx;
}
/* create subtree */
if (hf_id >= 0) {
if(parent_tree){
item = proto_tree_add_item(parent_tree, hf_id, tvb, offset, len, FALSE);
item = proto_tree_add_item(parent_tree, hf_id, tvb, offset, lenx, FALSE);
tree = proto_item_add_subtree(item, ett_id);
}
}
@ -2464,7 +2464,7 @@ printf("SET dissect_old_ber_set(%s) calling subdissector\n",name);
if(mandatory_fields & (1 << set_idx)) {
/* here is something we should have seen - but didn't! */
cause = proto_tree_add_text(tree, tvb, offset, len,
cause = proto_tree_add_text(tree, tvb, offset, lenx,
"BER Error: Missing field in SET class:%s(%d) tag:%d expected",
val_to_str(cset->class,ber_class_codes,"Unknown"),cset->class,
cset->tag);
@ -3176,18 +3176,18 @@ printf("OBJECT IDENTIFIER dissect_ber_object_identifier(%s) entered\n",name);
return eoffset;
}
int dissect_ber_object_identifier_str(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, const char **value_string)
int dissect_ber_object_identifier_str(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, const char **value_stringx)
{
tvbuff_t *value_tvb = NULL;
guint length;
offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_id, (value_string) ? &value_tvb : NULL);
offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_id, (value_stringx) ? &value_tvb : NULL);
if (value_string) {
if (value_stringx) {
if (value_tvb && (length = tvb_length(value_tvb))) {
*value_string = oid_encoded2string(tvb_get_ptr(value_tvb, 0, length), length);
*value_stringx = oid_encoded2string(tvb_get_ptr(value_tvb, 0, length), length);
} else {
*value_string = "";
*value_stringx = "";
}
}
@ -3199,15 +3199,15 @@ int dissect_ber_object_identifier_str(gboolean implicit_tag, asn1_ctx_t *actx, p
#endif
static int dissect_ber_sq_of(gboolean implicit_tag, gint32 type, asn1_ctx_t *actx, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const ber_sequence_t *seq, gint hf_id, gint ett_id) {
gint8 class;
gboolean pc, ind = FALSE, ind_field;
gint32 tag;
guint32 len;
gint8 classx;
gboolean pcx, ind = FALSE, ind_field;
gint32 tagx;
guint32 lenx;
proto_tree *tree = parent_tree;
proto_item *item = NULL;
proto_item *cause;
int cnt, hoffset, end_offset;
proto_item *causex;
int cnt, hoffsetx, end_offset;
header_field_info *hfi;
#ifdef DEBUG_BER_SQ_OF
@ -3229,45 +3229,45 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n",name);
#endif
if(!implicit_tag){
hoffset = offset;
hoffsetx = offset;
/* first we must read the sequence header */
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind);
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &classx, &pcx, &tagx);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &lenx, &ind);
if(ind){
/* if the length is indefinite we dont really know (yet) where the
* object ends so assume it spans the rest of the tvb for now.
*/
end_offset = offset + len;
end_offset = offset + lenx;
} else {
end_offset = offset + len;
end_offset = offset + lenx;
}
/* sanity check: we only handle Constructed Universal Sequences */
if((class!=BER_CLASS_APP)&&(class!=BER_CLASS_PRI))
if(!pc
||(!implicit_tag&&((class!=BER_CLASS_UNI)
||(tag!=type)))) {
tvb_ensure_bytes_exist(tvb, hoffset, 2);
cause = proto_tree_add_text(tree, tvb, offset, len, "BER Error: %s Of expected but class:%s(%d) %s tag:%d was unexpected",
(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence", val_to_str(class,ber_class_codes,"Unknown"), class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tag);
proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: %s Of expected",(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence");
if((classx!=BER_CLASS_APP)&&(classx!=BER_CLASS_PRI))
if(!pcx
||(!implicit_tag&&((classx!=BER_CLASS_UNI)
||(tagx!=type)))) {
tvb_ensure_bytes_exist(tvb, hoffsetx, 2);
causex = proto_tree_add_text(tree, tvb, offset, lenx, "BER Error: %s Of expected but class:%s(%d) %s tag:%d was unexpected",
(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence", val_to_str(classx,ber_class_codes,"Unknown"), classx, pcx ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tagx);
proto_item_set_expert_flags(causex, PI_MALFORMED, PI_WARN);
expert_add_info_format(actx->pinfo, causex, PI_MALFORMED, PI_WARN, "BER Error: %s Of expected",(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence");
if (decode_unexpected) {
proto_tree *unknown_tree = proto_item_add_subtree(cause, ett_ber_unknown);
dissect_unknown_ber(actx->pinfo, tvb, hoffset, unknown_tree);
proto_tree *unknown_tree = proto_item_add_subtree(causex, ett_ber_unknown);
dissect_unknown_ber(actx->pinfo, tvb, hoffsetx, unknown_tree);
}
return end_offset;
}
} else {
/* the tvb length should be correct now nope we could be comming from an implicit choice or sequence, thus we
read the items we match and return the length*/
len=tvb_length_remaining(tvb,offset);
end_offset = offset + len;
lenx=tvb_length_remaining(tvb,offset);
end_offset = offset + lenx;
}
/* count number of items */
cnt = 0;
hoffset = offset;
hoffsetx = offset;
/* only count the number of items IFF we have the full blob,
* else this will just generate a [short frame] before we even start
* dissecting a single item.
@ -3297,17 +3297,17 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n",name);
THROW(ReportedBoundsError);
}
}
offset = hoffset;
offset = hoffsetx;
/* create subtree */
if(hf_id >= 0) {
hfi = proto_registrar_get_nth(hf_id);
if(parent_tree){
if(hfi->type == FT_NONE) {
item = proto_tree_add_item(parent_tree, hf_id, tvb, offset, len, FALSE);
item = proto_tree_add_item(parent_tree, hf_id, tvb, offset, lenx, FALSE);
proto_item_append_text(item, ":");
} else {
item = proto_tree_add_uint(parent_tree, hf_id, tvb, offset, len, cnt);
item = proto_tree_add_uint(parent_tree, hf_id, tvb, offset, lenx, cnt);
proto_item_append_text(item, (cnt==1)?" item":" items");
}
tree = proto_item_add_subtree(item, ett_id);
@ -3396,25 +3396,25 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n",name);
/* if we didnt end up at exactly offset, then we ate too many bytes */
if(offset != end_offset) {
tvb_ensure_bytes_exist(tvb, offset-2, 2);
cause =proto_tree_add_text(tree, tvb, offset-2, 2, "BER Error: %s Of ate %d too many bytes",
causex =proto_tree_add_text(tree, tvb, offset-2, 2, "BER Error: %s Of ate %d too many bytes",
(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence", offset-end_offset);
proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error:too many byte in %s",(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence");
proto_item_set_expert_flags(causex, PI_MALFORMED, PI_WARN);
expert_add_info_format(actx->pinfo, causex, PI_MALFORMED, PI_WARN, "BER Error:too many byte in %s",(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence");
}
return end_offset;
}
static int dissect_ber_old_sq_of(gboolean implicit_tag, gint32 type, asn1_ctx_t *actx, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const ber_old_sequence_t *seq, gint hf_id, gint ett_id) {
gint8 class;
gboolean pc, ind = FALSE, ind_field;
gint32 tag;
guint32 len;
gint8 classx;
gboolean pcx, ind = FALSE, ind_field;
gint32 tagx;
guint32 lenx;
proto_tree *tree = parent_tree;
proto_item *item = NULL;
proto_item *cause;
int cnt, hoffset, end_offset;
proto_item *causex;
int cnt, hoffsetx, end_offset;
header_field_info *hfi;
#ifdef DEBUG_BER_SQ_OF
@ -3436,45 +3436,45 @@ printf("SQ OF dissect_ber_old_sq_of(%s) entered\n",name);
#endif
if(!implicit_tag){
hoffset = offset;
hoffsetx = offset;
/* first we must read the sequence header */
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind);
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &classx, &pcx, &tagx);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &lenx, &ind);
if(ind){
/* if the length is indefinite we dont really know (yet) where the
* object ends so assume it spans the rest of the tvb for now.
*/
end_offset = offset + len;
end_offset = offset + lenx;
} else {
end_offset = offset + len;
end_offset = offset + lenx;
}
/* sanity check: we only handle Constructed Universal Sequences */
if((class!=BER_CLASS_APP)&&(class!=BER_CLASS_PRI))
if(!pc
||(!implicit_tag&&((class!=BER_CLASS_UNI)
||(tag!=type)))) {
tvb_ensure_bytes_exist(tvb, hoffset, 2);
cause = proto_tree_add_text(tree, tvb, offset, len, "BER Error: %s Of expected but class:%s(%d) %s tag:%d was unexpected",
(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence", val_to_str(class,ber_class_codes,"Unknown"), class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tag);
proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: %s Of expected",(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence");
if((classx!=BER_CLASS_APP)&&(classx!=BER_CLASS_PRI))
if(!pcx
||(!implicit_tag&&((classx!=BER_CLASS_UNI)
||(tagx!=type)))) {
tvb_ensure_bytes_exist(tvb, hoffsetx, 2);
causex = proto_tree_add_text(tree, tvb, offset, lenx, "BER Error: %s Of expected but class:%s(%d) %s tag:%d was unexpected",
(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence", val_to_str(classx,ber_class_codes,"Unknown"), classx, pcx ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tagx);
proto_item_set_expert_flags(causex, PI_MALFORMED, PI_WARN);
expert_add_info_format(actx->pinfo, causex, PI_MALFORMED, PI_WARN, "BER Error: %s Of expected",(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence");
if (decode_unexpected) {
proto_tree *unknown_tree = proto_item_add_subtree(cause, ett_ber_unknown);
dissect_unknown_ber(actx->pinfo, tvb, hoffset, unknown_tree);
proto_tree *unknown_tree = proto_item_add_subtree(causex, ett_ber_unknown);
dissect_unknown_ber(actx->pinfo, tvb, hoffsetx, unknown_tree);
}
return end_offset;
}
} else {
/* the tvb length should be correct now nope we could be comming from an implicit choice or sequence, thus we
read the items we match and return the length*/
len=tvb_length_remaining(tvb,offset);
end_offset = offset + len;
lenx=tvb_length_remaining(tvb,offset);
end_offset = offset + lenx;
}
/* count number of items */
cnt = 0;
hoffset = offset;
hoffsetx = offset;
/* only count the number of items IFF we have the full blob,
* else this will just generate a [short frame] before we even start
* dissecting a single item.
@ -3504,17 +3504,17 @@ printf("SQ OF dissect_ber_old_sq_of(%s) entered\n",name);
THROW(ReportedBoundsError);
}
}
offset = hoffset;
offset = hoffsetx;
/* create subtree */
if(hf_id >= 0) {
hfi = proto_registrar_get_nth(hf_id);
if(parent_tree){
if(hfi->type == FT_NONE) {
item = proto_tree_add_item(parent_tree, hf_id, tvb, offset, len, FALSE);
item = proto_tree_add_item(parent_tree, hf_id, tvb, offset, lenx, FALSE);
proto_item_append_text(item, ":");
} else {
item = proto_tree_add_uint(parent_tree, hf_id, tvb, offset, len, cnt);
item = proto_tree_add_uint(parent_tree, hf_id, tvb, offset, lenx, cnt);
proto_item_append_text(item, (cnt==1)?" item":" items");
}
tree = proto_item_add_subtree(item, ett_id);
@ -3598,10 +3598,10 @@ printf("SQ OF dissect_ber_old_sq_of(%s) entered\n",name);
/* if we didnt end up at exactly offset, then we ate too many bytes */
if(offset != end_offset) {
tvb_ensure_bytes_exist(tvb, offset-2, 2);
cause =proto_tree_add_text(tree, tvb, offset-2, 2, "BER Error: %s Of ate %d too many bytes",
causex =proto_tree_add_text(tree, tvb, offset-2, 2, "BER Error: %s Of ate %d too many bytes",
(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence", offset-end_offset);
proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error:too many byte in %s",(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence");
proto_item_set_expert_flags(causex, PI_MALFORMED, PI_WARN);
expert_add_info_format(actx->pinfo, causex, PI_MALFORMED, PI_WARN, "BER Error:too many byte in %s",(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence");
}
return end_offset;

View File

@ -469,10 +469,10 @@ static guint
decode_MPLS_stack(tvbuff_t *tvb, gint offset, char *buf, size_t buflen)
{
guint32 label_entry; /* an MPLS label enrty (label + COS field + stack bit */
gint index; /* index for the label stack */
gint indx; /* index for the label stack */
char *bufptr;
index = offset ;
indx = offset ;
label_entry = 0x000000 ;
buf[0] = '\0' ;
@ -480,10 +480,10 @@ decode_MPLS_stack(tvbuff_t *tvb, gint offset, char *buf, size_t buflen)
while ((label_entry & 0x000001) == 0) {
label_entry = tvb_get_ntoh24(tvb, index) ;
label_entry = tvb_get_ntoh24(tvb, indx) ;
/* withdrawn routes may contain 0 or 0x800000 in the first label */
if((index-offset)==0&&(label_entry==0||label_entry==0x800000)) {
if((indx-offset)==0&&(label_entry==0||label_entry==0x800000)) {
g_snprintf(bufptr, buflen-(bufptr-buf), "0 (withdrawn)");
return (1);
}
@ -493,7 +493,7 @@ decode_MPLS_stack(tvbuff_t *tvb, gint offset, char *buf, size_t buflen)
(label_entry >> 4),
((label_entry & 0x000001) == 0) ? "," : " (bottom)"));
index += 3 ;
indx += 3 ;
if ((label_entry & 0x000001) == 0) {
/* real MPLS multi-label stack in BGP? - maybe later; for now, it must be a bogus packet */
@ -502,7 +502,7 @@ decode_MPLS_stack(tvbuff_t *tvb, gint offset, char *buf, size_t buflen)
}
}
return((index - offset) / 3);
return((indx - offset) / 3);
}
/*
@ -1504,13 +1504,13 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree)
subtree = proto_item_add_subtree(ti, ett_bgp_attrs);
i = 2;
while (i < len) {
proto_item *hidden_item;
proto_item *hidden_item;
const char *msg;
int off;
gint k;
guint16 alen, tlen, aoff, aoff_save;
guint16 af;
guint8 saf, snpa;
guint8 saf, snpa;
guint8 nexthop_len;
guint8 asn_len = 0;
@ -2328,8 +2328,6 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree)
end = o + i + aoff + tlen ;
while(q < end) {
proto_item *hidden_item;
ssa_type = tvb_get_ntohs(tvb, q) & BGP_SSA_TYPE;
ssa_len = tvb_get_ntohs(tvb, q + 2);
@ -2342,7 +2340,7 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree)
q, 1, FALSE);
hidden_item = proto_tree_add_item(subtree3, hf_bgp_ssa_type, tvb,
q, 2, FALSE);
PROTO_ITEM_SET_HIDDEN(hidden_item);
PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_tree_add_text(subtree3, tvb, q, 2,
"Type: %s", val_to_str(ssa_type, bgp_ssa_type, "Unknown"));
if ((ssa_len == 0) || (q + ssa_len > end)) {

View File

@ -321,7 +321,6 @@ dissect_sdp_type(proto_tree *t, tvbuff_t *tvb, int offset, char **attr_val)
guint8 byte0;
guint8 type;
guint8 size_index;
char *ptr;
str=ep_alloc(MAX_SDP_LEN+1);
*attr_val=str;
@ -386,7 +385,7 @@ dissect_sdp_type(proto_tree *t, tvbuff_t *tvb, int offset, char **attr_val)
}
case 8: /* fall through */
case 4: {
ptr = (gchar*)tvb_get_ephemeral_string(tvb, offset, size);
char *ptr = (gchar*)tvb_get_ephemeral_string(tvb, offset, size);
proto_tree_add_text(t, tvb, start_offset, type_size, "%s \"%s\"",
type == 8 ? "URL" : "String", ptr);

View File

@ -1377,12 +1377,12 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
&dest_port_offset)))
{
proto_tree *sctpprim_tree;
proto_item *ti;
proto_item *ti_local;
/* Will use this dissector then. */
protocol_handle = heur_protocol_handle;
ti = proto_tree_add_string_format(dct2000_tree, hf_catapult_dct2000_sctpprim_addresses,
ti_local = proto_tree_add_string_format(dct2000_tree, hf_catapult_dct2000_sctpprim_addresses,
tvb, offset_before_sctpprim_header, 0,
"", "SCTPPrim transport: -> %s:%u",
(dest_addr_offset) ?
@ -1396,7 +1396,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
0);
/* Add these SCTPPRIM fields inside an SCTPPRIM subtree */
sctpprim_tree = proto_item_add_subtree(ti, ett_catapult_dct2000_sctpprim);
sctpprim_tree = proto_item_add_subtree(ti_local, ett_catapult_dct2000_sctpprim);
pinfo->ipproto = IP_PROTO_SCTP;
@ -1488,10 +1488,10 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
/* Show number of dissected bytes */
if (dct2000_tree) {
proto_item *ti = proto_tree_add_uint(dct2000_tree,
proto_item *ti_local = proto_tree_add_uint(dct2000_tree,
hf_catapult_dct2000_dissected_length,
tvb, 0, 0, tvb_reported_length(tvb)-offset);
PROTO_ITEM_SET_GENERATED(ti);
PROTO_ITEM_SET_GENERATED(ti_local);
}
}
}

View File

@ -277,7 +277,7 @@ dissect_slarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item *ti;
proto_tree *slarp_tree = NULL;
guint32 code;
guint32 address;
guint32 addr;
guint32 mysequence;
guint32 yoursequence;
@ -298,10 +298,10 @@ dissect_slarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case SLARP_REQUEST:
case SLARP_REPLY:
if (check_col(pinfo->cinfo, COL_INFO)) {
address = tvb_get_ipv4(tvb, 4);
addr = tvb_get_ipv4(tvb, 4);
col_add_fstr(pinfo->cinfo, COL_INFO, "%s, from %s, mask %s",
val_to_str(code, slarp_ptype_vals, "Unknown (%d)"),
get_hostname(address),
get_hostname(addr),
ip_to_str(tvb_get_ptr(tvb, 8, 4)));
}
if (tree) {