Skip to content

Commit

Permalink
Remove check_col() from ASN.1 dissectors
Browse files Browse the repository at this point in the history
svn path=/trunk/; revision=49927
  • Loading branch information
mmann78 committed Jun 14, 2013
1 parent 875040e commit 2dbf6c5
Show file tree
Hide file tree
Showing 41 changed files with 168 additions and 262 deletions.
6 changes: 2 additions & 4 deletions asn1/idmp/packet-idmp-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ static void dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_t

pinfo->fragmented = !idmp_final;

if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " [%sIDMP fragment, %u byte%s]",
col_append_fstr(pinfo->cinfo, COL_INFO, " [%sIDMP fragment, %u byte%s]",
idmp_final ? "Final " : "" ,
idmp_length, plurality(idmp_length, "", "s"));

Expand Down Expand Up @@ -218,8 +217,7 @@ static void dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_t
} else {
if(!idmp_final) {

if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " [IDMP fragment, %u byte%s, IDMP reassembly not enabled]",
col_append_fstr(pinfo->cinfo, COL_INFO, " [IDMP fragment, %u byte%s, IDMP reassembly not enabled]",
idmp_length, plurality(idmp_length, "", "s"));

proto_tree_add_text(tree, tvb, offset, (idmp_length) ? -1 : 0,
Expand Down
2 changes: 1 addition & 1 deletion asn1/kerberos/packet-kerberos-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@ dissect_krb5_PW_SALT(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
proto_tree_add_item(tree, hf_krb_smb_nt_status, tvb, offset, 4,
ENC_LITTLE_ENDIAN);
nt_status=tvb_get_letohl(tvb, offset);
if(nt_status && check_col(actx->pinfo->cinfo, COL_INFO)) {
if(nt_status) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO,
" NT Status: %s",
val_to_str(nt_status, NT_errors,
Expand Down
1 change: 0 additions & 1 deletion asn1/lcsap/lcsap.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ ProtocolIE-Field/value ie_field_value
#.FN_PARS ProcedureCode VAL_PTR = &ProcedureCode
#.FN_FTR ProcedureCode

if (check_col(actx->pinfo->cinfo, COL_INFO))
{
guint8 tmp = tvb_get_guint8(tvb, 0);

Expand Down
3 changes: 1 addition & 2 deletions asn1/lcsap/packet-lcsap-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ dissect_lcsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *lcsap_tree = NULL;

/* make entry in the Protocol column on summary display */
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "LCSAP");
col_set_str(pinfo->cinfo, COL_PROTOCOL, "LCSAP");

/* create the lcsap protocol tree */
lcsap_item = proto_tree_add_item(tree, proto_lcsap, tvb, 0, -1, ENC_NA);
Expand Down
3 changes: 1 addition & 2 deletions asn1/m3ap/packet-m3ap-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ dissect_m3ap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *m3ap_tree = NULL;

/* make entry in the Protocol column on summary display */
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, PNAME);
col_set_str(pinfo->cinfo, COL_PROTOCOL, PNAME);

/* create the m3ap protocol tree */
if (tree) {
Expand Down
12 changes: 4 additions & 8 deletions asn1/mpeg-audio/packet-mpeg-audio-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,12 @@ dissect_mpeg_audio_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
"Audio Layer %d", mpa_layer(&mpa) + 1);
if (MPA_BITRATE_VALID(&mpa) && MPA_FREQUENCY_VALID(&mpa)) {
data_size = (int)(MPA_DATA_BYTES(&mpa) - sizeof mpa);
if (check_col(pinfo->cinfo, COL_DEF_SRC)) {
SET_ADDRESS(&pinfo->src, AT_NONE, 0, NULL);
col_add_fstr(pinfo->cinfo, COL_DEF_SRC,
SET_ADDRESS(&pinfo->src, AT_NONE, 0, NULL);
col_add_fstr(pinfo->cinfo, COL_DEF_SRC,
"%d kb/s", mpa_bitrate(&mpa) / 1000);
}
if (check_col(pinfo->cinfo, COL_DEF_DST)) {
SET_ADDRESS(&pinfo->dst, AT_NONE, 0, NULL);
col_add_fstr(pinfo->cinfo, COL_DEF_DST,
SET_ADDRESS(&pinfo->dst, AT_NONE, 0, NULL);
col_add_fstr(pinfo->cinfo, COL_DEF_DST,
"%g kHz", mpa_frequency(&mpa) / (float)1000);
}
}

if (tree == NULL)
Expand Down
36 changes: 13 additions & 23 deletions asn1/mpeg-pes/packet-mpeg-pes-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,10 @@ dissect_mpeg_pes_header_data(tvbuff_t *tvb, packet_info *pinfo,
offset, 5, &nst);
offset += 5;

if (check_col(pinfo->cinfo, COL_DEF_DST)) {
SET_ADDRESS(&pinfo->dst, AT_NONE, 0, NULL);
col_add_fstr(pinfo->cinfo, COL_DEF_DST,
SET_ADDRESS(&pinfo->dst, AT_NONE, 0, NULL);
col_add_fstr(pinfo->cinfo, COL_DEF_DST,
"PTS %ld.%09u",
(long) nst.secs, nst.nsecs);
}
}
if (flags & DTS_FLAG) {
nstime_t nst;
Expand All @@ -221,12 +219,10 @@ dissect_mpeg_pes_header_data(tvbuff_t *tvb, packet_info *pinfo,
offset, 5, &nst);
offset += 5;

if (check_col(pinfo->cinfo, COL_DEF_SRC)) {
SET_ADDRESS(&pinfo->src, AT_NONE, 0, NULL);
col_add_fstr(pinfo->cinfo, COL_DEF_SRC,
SET_ADDRESS(&pinfo->src, AT_NONE, 0, NULL);
col_add_fstr(pinfo->cinfo, COL_DEF_SRC,
"DTS %ld.%09u",
(long) nst.secs, nst.nsecs);
}
}
if (flags & ESCR_FLAG) {
nstime_t nst;
Expand Down Expand Up @@ -364,10 +360,8 @@ dissect_mpeg_pes_pack_header(tvbuff_t *tvb, gint offset,
program_mux_rate);
offset += 3 * 8;

if (check_col(pinfo->cinfo, COL_DEF_SRC)) {
SET_ADDRESS(&pinfo->src, AT_NONE, 0, NULL);
col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "%u B/s", program_mux_rate);
}
SET_ADDRESS(&pinfo->src, AT_NONE, 0, NULL);
col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "%u B/s", program_mux_rate);

stuffing_length = tvb_get_guint8(tvb, offset / 8) & 0x07;
proto_tree_add_item(tree, hf_mpeg_pes_stuffing_length, tvb,
Expand All @@ -393,6 +387,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
int stream;
asn1_ctx_t asn1_ctx;
gint offset = 0;
const char *s;

if (!tvb_bytes_exist(tvb, 0, 3))
return FALSE; /* not enough bytes for a PES prefix */
Expand All @@ -404,11 +399,9 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
col_clear(pinfo->cinfo, COL_INFO);

stream = tvb_get_guint8(tvb, 3);
if (check_col(pinfo->cinfo, COL_INFO)) {
const char *s = try_val_to_str(stream, mpeg_pes_T_stream_vals);
if (s != NULL)
col_set_str(pinfo->cinfo, COL_INFO, s);
}
s = try_val_to_str(stream, mpeg_pes_T_stream_vals);
if (s != NULL)
col_set_str(pinfo->cinfo, COL_INFO, s);

#if 0
if (tree == NULL)
Expand All @@ -422,12 +415,9 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
int frame_type;

frame_type = tvb_get_guint8(tvb, 5) >> 3 & 0x07;
if (check_col(pinfo->cinfo, COL_INFO)) {
const char *s = try_val_to_str(frame_type,
mpeg_pes_T_frame_type_vals);
if (s != NULL)
col_set_str(pinfo->cinfo, COL_INFO, s);
}
s = try_val_to_str(frame_type, mpeg_pes_T_frame_type_vals);
if (s != NULL)
col_set_str(pinfo->cinfo, COL_INFO, s);

offset = dissect_mpeg_pes_Picture(tvb, offset, &asn1_ctx,
tree, hf_mpeg_video_picture);
Expand Down
16 changes: 6 additions & 10 deletions asn1/p1/p1.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"

} else {

if (check_col(actx->pinfo->cinfo, COL_INFO) && mtaname) {
if (mtaname) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", tvb_format_text(mtaname, 0, tvb_length(mtaname)));
}

Expand Down Expand Up @@ -1093,7 +1093,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
if(*oraddress) {
proto_item_append_text(address_item, " (%%s/", oraddress);

if(doing_subjectid && check_col(actx->pinfo->cinfo, COL_INFO)) {
if(doing_subjectid) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (%%s/", oraddress);
}
}
Expand All @@ -1111,7 +1111,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
if(doing_address)
proto_item_append_text(address_item, " $ %%s)", tvb_format_text(id, 0, tvb_length(id)));

if(doing_subjectid && check_col(actx->pinfo->cinfo, COL_INFO))
if(doing_subjectid)
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " $ %%s)", tvb_format_text(id, 0, tvb_length(id)));
}

Expand Down Expand Up @@ -1206,7 +1206,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
#.FN_BODY MTABindError
int error = -1;
%(DEFAULT_BODY)s
if((error != -1) && check_col(actx->pinfo->cinfo, COL_INFO))
if((error != -1))
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (%%s)", val_to_str(error, p1_MTABindError_vals, "error(%%d)"));

#.FN_PARS TokenTypeIdentifier
Expand All @@ -1226,9 +1226,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s

if( (credentials!=-1) && p1_Credentials_vals[credentials].strptr ){
if (check_col(actx->pinfo->cinfo, COL_INFO)) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", p1_Credentials_vals[credentials].strptr);
}
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", p1_Credentials_vals[credentials].strptr);
}

#.FN_PARS TokenDataType
Expand Down Expand Up @@ -1274,7 +1272,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s

if( (apdu!=-1) && p1_MTS_APDU_vals[apdu].strptr ){
if(check_col(actx->pinfo->cinfo, COL_INFO) && (apdu != 0)) { /* we don't show "message" - sub-dissectors have better idea */
if(apdu != 0) { /* we don't show "message" - sub-dissectors have better idea */
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", p1_MTS_APDU_vals[apdu].strptr);
}
}
Expand All @@ -1288,9 +1286,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s
if( (report!=-1) && p1_ReportType_vals[report].strptr ){
if(check_col(actx->pinfo->cinfo, COL_INFO)) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", p1_ReportType_vals[report].strptr);
}
}
#.FN_BODY MessageSubmissionArgument
Expand Down
3 changes: 1 addition & 2 deletions asn1/p1/packet-p1-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
return;
}

if (check_col(pinfo->cinfo, COL_INFO))
col_set_str(pinfo->cinfo, COL_INFO, p1_op_name);
col_set_str(pinfo->cinfo, COL_INFO, p1_op_name);

while (tvb_reported_length_remaining(tvb, offset) > 0){
old_offset=offset;
Expand Down
2 changes: 1 addition & 1 deletion asn1/p22/p22.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ IpnSecurityResponse B "2.6.1.18.1" "id-sec-security-common-fields"

%(DEFAULT_BODY)s

if(subject && check_col(actx->pinfo->cinfo, COL_INFO))
if(subject)
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (%%s)", tvb_format_text(subject, 0, tvb_length(subject)));

#.FN_PARS CharacterSetRegistration
Expand Down
14 changes: 4 additions & 10 deletions asn1/p7/p7.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ RTSE-apdus B "2.6.0.2.10""id-as-ms-rtse"

%(DEFAULT_BODY)s

if (check_col(actx->pinfo->cinfo, COL_INFO) && (ora = p1_get_last_oraddress())) {
if (ora = p1_get_last_oraddress()) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (initiator=%%s)", ora);
}

Expand All @@ -382,14 +382,10 @@ RTSE-apdus B "2.6.0.2.10""id-as-ms-rtse"
col_append_str(actx->pinfo->cinfo, COL_INFO, ")");

#.FN_FTR NumberRange/from
if (check_col(actx->pinfo->cinfo, COL_INFO)) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " from %d", seqno);
}
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " from %d", seqno);

#.FN_FTR NumberRange/to
if (check_col(actx->pinfo->cinfo, COL_INFO)) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " to %d", seqno);
}
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " to %d", seqno);

#.FN_PARS SummarizeResult/count VAL_PTR = &count

Expand All @@ -398,9 +394,7 @@ RTSE-apdus B "2.6.0.2.10""id-as-ms-rtse"

%(DEFAULT_BODY)s

if (check_col(actx->pinfo->cinfo, COL_INFO)) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (count=%%d)", count);
}
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (count=%%d)", count);

#.FN_BODY MSMessageSubmissionArgument
p1_initialize_content_globals (tree, TRUE);
Expand Down
4 changes: 2 additions & 2 deletions asn1/p772/p772.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ InformationObject B "2.6.1.4.17.1.3.26.0.4406.0.4.1" "id-et-content-p772"
#.FN_BODY PrimaryPrecedence
int precedence = -1;
%(DEFAULT_BODY)s
if((precedence != -1) && check_col(actx->pinfo->cinfo, COL_INFO))
if(precedence != -1)
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (primary=%%s)", val_to_str(precedence, p772_PrimaryPrecedence_vals, "precedence(%%d)"));

#.FN_PARS CopyPrecedence
VAL_PTR=&precedence
#.FN_BODY CopyPrecedence
int precedence = -1;
%(DEFAULT_BODY)s
if((precedence != -1) && check_col(actx->pinfo->cinfo, COL_INFO))
if(precedence != -1)
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (copy=%%s)", val_to_str(precedence, p772_CopyPrecedence_vals, "precedence(%%d)"));
8 changes: 3 additions & 5 deletions asn1/ros/packet-ros-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,9 @@ static gboolean ros_try_string(const char *oid, tvbuff_t *tvb, packet_info *pinf

opname = val_to_str(opcode_lcl, lookup, "Unknown opcode (%d)");

if (check_col(pinfo->cinfo, COL_INFO)) {
col_set_str(pinfo->cinfo, COL_INFO, opname);
if(suffix)
col_append_str(pinfo->cinfo, COL_INFO, suffix);
}
col_set_str(pinfo->cinfo, COL_INFO, opname);
if(suffix)
col_append_str(pinfo->cinfo, COL_INFO, suffix);

(*opdissector)(tvb, pinfo, ros_tree, NULL);

Expand Down
2 changes: 1 addition & 1 deletion asn1/ros/ros-err.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

if (actx->rose_ctx->apdu_depth >= 0)
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %s", descr);
if (actx->rose_ctx->fillin_info && check_col(actx->pinfo->cinfo, COL_INFO))
if (actx->rose_ctx->fillin_info)
col_append_str(actx->pinfo->cinfo, COL_INFO, descr);
if (actx->rose_ctx->fillin_ptr)
g_strlcat(actx->rose_ctx->fillin_ptr, descr, actx->rose_ctx->fillin_buf_size);
Expand Down
2 changes: 1 addition & 1 deletion asn1/ros/ros-inv.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

if (actx->rose_ctx->apdu_depth >= 0)
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %s", descr);
if (actx->rose_ctx->fillin_info && check_col(actx->pinfo->cinfo, COL_INFO))
if (actx->rose_ctx->fillin_info)
col_append_str(actx->pinfo->cinfo, COL_INFO, descr);
if (actx->rose_ctx->fillin_ptr)
g_strlcat(actx->rose_ctx->fillin_ptr, descr, actx->rose_ctx->fillin_buf_size);
Expand Down
2 changes: 1 addition & 1 deletion asn1/ros/ros-rej.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

if (actx->rose_ctx->apdu_depth >= 0)
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %s", descr);
if (actx->rose_ctx->fillin_info && check_col(actx->pinfo->cinfo, COL_INFO))
if (actx->rose_ctx->fillin_info)
col_append_str(actx->pinfo->cinfo, COL_INFO, descr);
if (actx->rose_ctx->fillin_ptr)
g_strlcat(actx->rose_ctx->fillin_ptr, descr, actx->rose_ctx->fillin_buf_size);
Expand Down
2 changes: 1 addition & 1 deletion asn1/ros/ros-res.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

if (actx->rose_ctx->apdu_depth >= 0)
proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), actx->rose_ctx->apdu_depth), " %s", descr);
if (actx->rose_ctx->fillin_info && check_col(actx->pinfo->cinfo, COL_INFO))
if (actx->rose_ctx->fillin_info)
col_append_str(actx->pinfo->cinfo, COL_INFO, descr);
if (actx->rose_ctx->fillin_ptr)
g_strlcat(actx->rose_ctx->fillin_ptr, descr, actx->rose_ctx->fillin_buf_size);
Expand Down
Loading

0 comments on commit 2dbf6c5

Please sign in to comment.