Skip to content

Commit

Permalink
Remove check_col() and the occasional tree.
Browse files Browse the repository at this point in the history
This leaves just the Pidl dissectors remaining for removal of check_col() in the dissectors directory.  A small handful of check_col() calls remain outside of the dissectors.

svn path=/trunk/; revision=49941
  • Loading branch information
mmann78 committed Jun 14, 2013
1 parent c5d092e commit f42e5bc
Show file tree
Hide file tree
Showing 29 changed files with 299 additions and 487 deletions.
7 changes: 3 additions & 4 deletions asn1/pcap/pcap.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ ProtocolIE-Field/value ie_field_value

#.FN_PARS ProcedureCode VAL_PTR = &ProcedureCode
#.FN_FTR ProcedureCode
if (check_col(actx->pinfo->cinfo, COL_INFO))
col_add_fstr(actx->pinfo->cinfo, COL_INFO, "%s ",
val_to_str(ProcedureCode, pcap_ProcedureCode_vals,
"unknown message"));
col_add_fstr(actx->pinfo->cinfo, COL_INFO, "%s ",
val_to_str(ProcedureCode, pcap_ProcedureCode_vals,
"unknown message"));
#.END

#.FN_PARS InitiatingMessage/value FN_VARIANT=_pdu_new TYPE_REF_FN=dissect_InitiatingMessageValue
Expand Down
120 changes: 55 additions & 65 deletions epan/dissectors/packet-arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,28 +1252,26 @@ dissect_ax25arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
was padding. */
tvb_set_reported_length(tvb, tot_len);

if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
switch (ar_op) {
switch (ar_op) {

case ARPOP_REQUEST:
if (global_arp_detect_request_storm)
request_seen(pinfo);
case ARPOP_REQUEST:
if (global_arp_detect_request_storm)
request_seen(pinfo);
/* fall-through */
case ARPOP_REPLY:
default:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ARP");
break;
case ARPOP_REPLY:
default:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ARP");
break;

case ARPOP_RREQUEST:
case ARPOP_RREPLY:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RARP");
break;
case ARPOP_RREQUEST:
case ARPOP_RREPLY:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RARP");
break;

case ARPOP_IREQUEST:
case ARPOP_IREPLY:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Inverse ARP");
break;
}
case ARPOP_IREQUEST:
case ARPOP_IREPLY:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Inverse ARP");
break;
}

/* Get the offsets of the addresses. */
Expand All @@ -1286,12 +1284,6 @@ dissect_ax25arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Target Protocol Address */
tpa_offset = tha_offset + ar_hln;

if (!tree && !check_col(pinfo->cinfo, COL_INFO)) {
/* We're not building a protocol tree and we're not setting the Info
column, so we don't have any more work to do. */
return;
}

/* sha_val = tvb_get_ptr(tvb, sha_offset, ar_hln); */
spa_val = tvb_get_ptr(tvb, spa_offset, ar_pln);
/* tha_val = tvb_get_ptr(tvb, tha_offset, ar_hln); */
Expand All @@ -1309,51 +1301,49 @@ dissect_ax25arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
else
is_gratuitous = FALSE;

if (check_col(pinfo->cinfo, COL_INFO)) {
switch (ar_op) {
case ARPOP_REQUEST:
if (is_gratuitous)
switch (ar_op) {
case ARPOP_REQUEST:
if (is_gratuitous)
col_add_fstr(pinfo->cinfo, COL_INFO, "Gratuitous ARP for %s (Request)",
arpproaddr_to_str(tpa_val, ar_pln, ar_pro));
else
col_add_fstr(pinfo->cinfo, COL_INFO, "Who has %s? Tell %s",
arpproaddr_to_str(tpa_val, ar_pln, ar_pro),
arpproaddr_to_str(spa_val, ar_pln, ar_pro));
break;
case ARPOP_REPLY:
if (is_gratuitous)
col_add_fstr(pinfo->cinfo, COL_INFO, "Gratuitous ARP for %s (Reply)",
arpproaddr_to_str(spa_val, ar_pln, ar_pro));
else
col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s",
arpproaddr_to_str(spa_val, ar_pln, ar_pro),
/* arphrdaddr_to_str(sha_val, ar_hln, ar_hrd)); */
tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd));
break;
case ARPOP_RREQUEST:
case ARPOP_IREQUEST:
col_add_fstr(pinfo->cinfo, COL_INFO, "Who is %s? Tell %s",
/* arphrdaddr_to_str(tha_val, ar_hln, ar_hrd), */
tvb_arphrdaddr_to_str(tvb, tha_offset, ar_hln, ar_hrd),
else
col_add_fstr(pinfo->cinfo, COL_INFO, "Who has %s? Tell %s",
arpproaddr_to_str(tpa_val, ar_pln, ar_pro),
arpproaddr_to_str(spa_val, ar_pln, ar_pro));
break;
case ARPOP_REPLY:
if (is_gratuitous)
col_add_fstr(pinfo->cinfo, COL_INFO, "Gratuitous ARP for %s (Reply)",
arpproaddr_to_str(spa_val, ar_pln, ar_pro));
else
col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s",
arpproaddr_to_str(spa_val, ar_pln, ar_pro),
/* arphrdaddr_to_str(sha_val, ar_hln, ar_hrd)); */
tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd));
break;
case ARPOP_RREPLY:
col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s",
/* arphrdaddr_to_str(tha_val, ar_hln, ar_hrd), */
tvb_arphrdaddr_to_str(tvb, tha_offset, ar_hln, ar_hrd),
arpproaddr_to_str(tpa_val, ar_pln, ar_pro));
break;
case ARPOP_IREPLY:
col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s",
/* arphrdaddr_to_str(sha_val, ar_hln, ar_hrd), */
tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd),
arpproaddr_to_str(spa_val, ar_pln, ar_pro));
break;
default:
col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown ARP opcode 0x%04x", ar_op);
break;
}
break;
case ARPOP_RREQUEST:
case ARPOP_IREQUEST:
col_add_fstr(pinfo->cinfo, COL_INFO, "Who is %s? Tell %s",
/* arphrdaddr_to_str(tha_val, ar_hln, ar_hrd), */
tvb_arphrdaddr_to_str(tvb, tha_offset, ar_hln, ar_hrd),
/* arphrdaddr_to_str(sha_val, ar_hln, ar_hrd)); */
tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd));
break;
case ARPOP_RREPLY:
col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s",
/* arphrdaddr_to_str(tha_val, ar_hln, ar_hrd), */
tvb_arphrdaddr_to_str(tvb, tha_offset, ar_hln, ar_hrd),
arpproaddr_to_str(tpa_val, ar_pln, ar_pro));
break;
case ARPOP_IREPLY:
col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s",
/* arphrdaddr_to_str(sha_val, ar_hln, ar_hrd), */
tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd),
arpproaddr_to_str(spa_val, ar_pln, ar_pro));
break;
default:
col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown ARP opcode 0x%04x", ar_op);
break;
}

if (tree) {
Expand Down
10 changes: 4 additions & 6 deletions epan/dissectors/packet-brp.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,10 @@ dissect_brp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
/* If there is a "tree" requested, we handle that request. */

col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_BRP);
if(check_col(pinfo->cinfo,COL_INFO)){
/* We add some snazzy bizness to the info field to quickly ascertain
what type of message was sent to/from the BRS/BRC. */
col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type - %s",
val_to_str(packet_type, brp_packettype_names, "Unknown (0x%02x)"));
}
/* We add some snazzy bizness to the info field to quickly ascertain
what type of message was sent to/from the BRS/BRC. */
col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type - %s",
val_to_str(packet_type, brp_packettype_names, "Unknown (0x%02x)"));

/* This call adds our tree to the main dissection tree. */

Expand Down
25 changes: 8 additions & 17 deletions epan/dissectors/packet-dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -3457,7 +3457,6 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
{
int offset = is_tcp ? 2 : 0;
int dns_data_offset;
column_info *cinfo;
proto_tree *dns_tree = NULL, *field_tree;
proto_item *ti, *tf;
guint16 id, flags, opcode, rcode, quest, ans, auth, add;
Expand All @@ -3478,25 +3477,17 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
opcode = (guint16) ((flags & F_OPCODE) >> OPCODE_SHIFT);
rcode = (guint16) (flags & F_RCODE);

if (check_col(pinfo->cinfo, COL_INFO)) {
col_add_fstr(pinfo->cinfo, COL_INFO, "%s%s 0x%04x ",
col_add_fstr(pinfo->cinfo, COL_INFO, "%s%s 0x%04x ",
val_to_str(opcode, opcode_vals, "Unknown operation (%u)"),
(flags&F_RESPONSE)?" response":"", id);

if (flags & F_RESPONSE) {
if (rcode != RCODE_NOERROR) {
col_append_str(pinfo-> cinfo,COL_INFO,
val_to_str(rcode, rcode_vals, "Unknown error (%u)"));
}
if (flags & F_RESPONSE) {
if (rcode != RCODE_NOERROR) {
col_append_str(pinfo-> cinfo,COL_INFO,
val_to_str(rcode, rcode_vals, "Unknown error (%u)"));
}
cinfo = pinfo->cinfo;
} else {
/* Set "cinfo" to NULL; we pass a NULL "cinfo" to the query and answer
dissectors, as a way of saying that they shouldn't add stuff
to the COL_INFO column (a call to "check_col(cinfo, COL_INFO)"
is more expensive than a check that a pointer isn't NULL). */
cinfo = NULL;
}

if (opcode == OPCODE_UPDATE) {
isupdate = TRUE;
} else {
Expand Down Expand Up @@ -3689,15 +3680,15 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* If this is a response, don't add information about the queries
to the summary, just add information about the answers. */
cur_off += dissect_query_records(tvb, cur_off, dns_data_offset, quest,
(!(flags & F_RESPONSE) ? cinfo : NULL),
(!(flags & F_RESPONSE) ? pinfo->cinfo : NULL),
dns_tree, isupdate, is_mdns);
}

if (ans > 0) {
/* If this is a request, don't add information about the answers
to the summary, just add information about the queries. */
cur_off += dissect_answer_records(tvb, cur_off, dns_data_offset, ans,
((flags & F_RESPONSE) ? cinfo : NULL),
((flags & F_RESPONSE) ? pinfo->cinfo : NULL),
dns_tree, (isupdate ?
"Prerequisites" : "Answers"),
pinfo, is_mdns);
Expand Down
Loading

0 comments on commit f42e5bc

Please sign in to comment.