Use PROTO_ITEM_SET_HIDDEN().

Fix ID marking
Add checkapi to makefiles

svn path=/trunk/; revision=25260
This commit is contained in:
Anders Broman 2008-05-09 07:07:50 +00:00
parent db6d0b9a4c
commit 8db8e90221
11 changed files with 73 additions and 38 deletions

View File

@ -74,6 +74,7 @@
#include <string.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#include <epan/prefs.h>
@ -447,13 +448,13 @@ static char *showtaglist(guint level)
case BER_CLASS_PRI: *p++ = 'P'; break;
default: *p++ = 'x'; break;
}
p += sprintf(p, "%d.", taglist[i].tag);
p += g_sprintf(p, "%d.", taglist[i].tag);
}
#else /* only context tags */
*p++ = 'C';
for(i=0; i<= level; i++) {
if (taglist[i].cls == BER_CLASS_CON) {
p += sprintf(p, "%d.", taglist[i].tag);
p += g_sprintf(p, "%d.", taglist[i].tag);
}
}
#endif
@ -515,7 +516,7 @@ showbitnames(guchar *val, guint count, PDUprops *props, guint offset)
if (val != NULL) {
for(i=0; i<count; i++) {
if (val[i>>3] & (0x80 >> (i & 7))) { /* bit i is set */
p += sprintf(p,"%s,", getPDUenum(props, offset, 0, 0, i));
p += g_sprintf(p,"%s,", getPDUenum(props, offset, 0, 0, i));
}
}
if (p > str)
@ -539,7 +540,7 @@ static char *showoid(subid_t *oid, guint len)
if (oid != NULL) {
for(i=0; i<len; i++) {
if (i) *p++ = '.';
p += sprintf(p, "%lu", (unsigned long)oid[i]);
p += g_sprintf(p, "%lu", (unsigned long)oid[i]);
}
}
*p = 0;
@ -570,14 +571,14 @@ showoctets(guchar *octets, guint len, guint hexlen) /* if len <= hexlen, always
if (dohex) {
str = p = g_malloc(len*2 + 5);
for (i=0; i<len; i++) {
p += sprintf(p, "%2.2X", octets[i]);
p += g_sprintf(p, "%2.2X", octets[i]);
}
strncpy(p, endstr, len*2 + 5);
} else {
if (len <= hexlen) { /* show both hex and ascii, assume hexlen < MAX_OTSLEN */
str = p = g_malloc(len*3+2);
for (i=0; i<len; i++) {
p += sprintf(p, "%2.2X", octets[i]);
p += g_sprintf(p, "%2.2X", octets[i]);
}
*p++ = ' '; /* insert space */
strncpy(p, octets, len);
@ -976,7 +977,7 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in
if (asn1_full)
name = &props.fullname[pabbrev_pdu_len]; /* no abbrev.pduname */
if (asn1_debug) { /* show both names */
sprintf(fieldname, "%s[%s]", props.name, props.fullname);
g_sprintf(fieldname, "%s[%s]", props.name, props.fullname);
name = fieldname;
}
@ -1014,7 +1015,7 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in
cls = BER_CLASS_UNI;
tag = BER_UNI_TAG_GeneralString;
oname = g_malloc(strlen(name) + 32);
sprintf(oname, "%s ** nesting cut off **", name);
g_sprintf(oname, "%s ** nesting cut off **", name);
name = oname;
}
switch(cls) {
@ -3277,31 +3278,31 @@ PDUtext(char *txt, PDUinfo *info) /* say everything we know about this entry */
tn = info->typename;
fn = info->fullname;
if (info->flags & PDU_NAMEDNUM)
txt += sprintf(txt, "name: %2d %s", info->tag, nn);
txt += g_sprintf(txt, "name: %2d %s", info->tag, nn);
else {
if (info->flags & PDU_TYPEDEF)
txt += sprintf(txt, "def %d: ", info->typenum);
txt += g_sprintf(txt, "def %d: ", info->typenum);
else
txt += sprintf(txt, " ");
txt += g_sprintf(txt, " ");
ty = (info->flags & PDU_TYPETREE) ? "typ" : "val";
txt += sprintf(txt, "%s %s (%s)%s [%s] tag %c%d hf=%d tf=%d",ty,tt, tn, nn, fn,
txt += g_sprintf(txt, "%s %s (%s)%s [%s] tag %c%d hf=%d tf=%d",ty,tt, tn, nn, fn,
tag_class[info->tclass], info->tag, info->value_id, info->type_id);
txt += sprintf(txt, ", mt=%d, bt=%d", info->mytype, info->basetype);
txt += g_sprintf(txt, ", mt=%d, bt=%d", info->mytype, info->basetype);
oo = (info->flags & PDU_OPTIONAL) ? ", optional" : empty;
ii = (info->flags & PDU_IMPLICIT) ? ", implicit" : empty;
nn = (info->flags & PDU_NAMEDNUM) ? ", namednum" : empty;
an = (info->flags & PDU_ANONYMOUS) ? ", anonymous" : empty;
txt += sprintf(txt, "%s%s%s%s", oo, ii, nn, an);
txt += g_sprintf(txt, "%s%s%s%s", oo, ii, nn, an);
if (info->flags & PDU_REFERENCE) {
rinfo = (PDUinfo *)((GNode *)(info->reference))->data;
tt = TBLTYPE(rinfo->type);
nn = rinfo->name;
tn = rinfo->typename;
fn = rinfo->fullname;
txt += sprintf(txt, ", reference to %s (%s)%s [%s]", tt, tn, nn, fn);
txt += g_sprintf(txt, ", reference to %s (%s)%s [%s]", tt, tn, nn, fn);
if (rinfo->flags & PDU_TYPEDEF)
txt += sprintf(txt, " T%d", rinfo->typenum);
txt += sprintf(txt, " tag %c%d", tag_class[rinfo->tclass], rinfo->tag);
txt += g_sprintf(txt, " T%d", rinfo->typenum);
txt += g_sprintf(txt, " tag %c%d", tag_class[rinfo->tclass], rinfo->tag);
oo = (rinfo->flags & PDU_OPTIONAL) ? ", optional" : empty;
ii = (rinfo->flags & PDU_IMPLICIT) ? ", implicit" : empty;
nn = (rinfo->flags & PDU_NAMEDNUM) ? ", namednum" : empty;
@ -3309,7 +3310,7 @@ PDUtext(char *txt, PDUinfo *info) /* say everything we know about this entry */
tt = (rinfo->flags & PDU_TYPEDEF) ? ", typedef" : empty;
an = (rinfo->flags & PDU_ANONYMOUS) ? ", anonymous" : empty;
tr = (rinfo->flags & PDU_TYPETREE) ? ", typetree" : empty;
txt += sprintf(txt, "%s%s%s%s%s%s%s", oo, ii, nn, tn, tt, an, tr);
txt += g_sprintf(txt, "%s%s%s%s%s%s%s", oo, ii, nn, tn, tt, an, tr);
}
}
} else {
@ -3401,7 +3402,7 @@ build_pdu_tree(const char *pduname)
anonCount = 0; /* anonymous types counter */
PDUtree = g_node_new(info);
pabbrev_pdu_len = sprintf(fieldname, "%s.%s.", pabbrev, pduname);
pabbrev_pdu_len = g_sprintf(fieldname, "%s.%s.", pabbrev, pduname);
sav_len = pabbrev_pdu_len;
/* Now build the tree for this top level PDU */
@ -3447,7 +3448,7 @@ build_pdu_tree(const char *pduname)
info->value_hf.hfinfo.blurb = info->fullname;
tr->typetree = g_node_new(info);
pabbrev_pdu_len = sprintf(fieldname, "%s.--.%s.", pabbrev, tr->name);
pabbrev_pdu_len = g_sprintf(fieldname, "%s.--.%s.", pabbrev, tr->name);
tbl_typeref(0, tr->typetree, tr->type, pabbrev_pdu_len-1);
}
}
@ -4070,7 +4071,7 @@ showstack(statestack *pos, char *txt, int n)
if (typef & TBL_SEQUENCE_choice)sch = "[seq-chs]";
if (typef & TBL_CONSTRUCTED) con = "[constr]";
i = sprintf(buf, "%s sp=%d,pos=%p,%s%s%s%s%s%s%s%s%s%s:%s,%d", txt, PDUstatec,
i = g_sprintf(buf, "%s sp=%d,pos=%p,%s%s%s%s%s%s%s%s%s%s:%s,%d", txt, PDUstatec,
pos->node, stype, rep, chs, done, ref, pop, chr, rch, sch, con,
pos->name, pos->offset);
@ -4088,7 +4089,7 @@ showstack(statestack *pos, char *txt, int n)
sch = (typef & TBL_SEQUENCE_choice)? "[seq-chs]" : empty;
con = (typef & TBL_CONSTRUCTED) ? "[constr]" : empty;
i += sprintf(&buf[i], "| sp=%d,st=%p,%s%s%s%s%s%s%s%s%s%s:%s,%d", PDUstatec-j,
i += g_sprintf(&buf[i], "| sp=%d,st=%p,%s%s%s%s%s%s%s%s%s%s:%s,%d", PDUstatec-j,
p->node, stype, rep, chs, done, ref, pop, chr, rch, sch, con,
p->name, p->offset);
}
@ -4244,7 +4245,7 @@ getPDUprops(PDUprops *out, guint offset, guint class, guint tag, guint cons)
/* a very simple, too simple??, way to handle constructed entities */
if ((PDUstatec > 0) && (pos.type & TBL_CONSTRUCTED)) {
/* unexpectedly constructed, return same info as last time */
sprintf(posstr, "==off=%d %c%d%c", offset, tag_class[class], tag, cons?'c':'p');
g_sprintf(posstr, "==off=%d %c%d%c", offset, tag_class[class], tag, cons?'c':'p');
showstack(&pos, posstr, 3);
pos.offset = offset;
pos.type &= ~TBL_CONSTRUCTED; /* remove the flag */
@ -4282,7 +4283,7 @@ getPDUprops(PDUprops *out, guint offset, guint class, guint tag, guint cons)
PDUerrcount++;
return out;
}
sprintf(posstr, "==off=%d %c%d%c", offset, tag_class[class], tag, cons?'c':'p');
g_sprintf(posstr, "==off=%d %c%d%c", offset, tag_class[class], tag, cons?'c':'p');
showstack(&pos, posstr, 3);
@ -4611,7 +4612,7 @@ getPDUprops(PDUprops *out, guint offset, guint class, guint tag, guint cons)
out->type = (pos.type & TBL_TYPEmask);
out->flags |= OUT_FLAG_type;
sprintf(namestr, "%s!%s", ret, getname(pos.node));
g_sprintf(namestr, "%s!%s", ret, getname(pos.node));
ret = namestr;
if (asn1_verbose)
g_message(" %s:%s will be used", TBLTYPE(pos.type), ret);

View File

@ -100,4 +100,4 @@ distclean: clean
maintainer-clean: distclean
checkapi:
# $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -51,4 +51,9 @@ distclean: clean
maintainer-clean: distclean
checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
$(PERL) ../../tools/checkAPIs.pl \
packet-cosnaming.c \
packet-coseventcomm.c \
packet-tango.c \
packet-parlay.c

View File

@ -1,4 +1,7 @@
/* packet-coseventcomm.c
*
* $Id$
*
* Routines for IDL dissection
*
* Autogenerated from idl2wrs

View File

@ -1,4 +1,7 @@
/* packet-cosnaming.c
*
* $Id$
*
* Routines for IDL dissection
*
* Autogenerated from idl2wrs

View File

@ -1,4 +1,7 @@
/* packet-parlay.c
*
* $Id$
*
* Routines for IDL dissection
*
* Autogenerated from idl2wrs

View File

@ -1,4 +1,7 @@
/* packet-tango.c
*
* $Id$
*
* Routines for IDL dissection
*
* Autogenerated from idl2wrs

View File

@ -100,4 +100,4 @@ distclean: clean
maintainer-clean: distclean
checkapi:
# $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -204,7 +204,7 @@ dissect_gryphon_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree *gryphon_tree;
proto_item *ti;
proto_tree *header_tree, *body_tree, *localTree;
proto_item *header_item, *body_item, *localItem;
proto_item *header_item, *body_item, *localItem, *hiddenItem;
int start_offset, msgend;
int msglen, msgpad;
unsigned int src, dest, i, frmtyp;
@ -264,25 +264,34 @@ dissect_gryphon_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
"Source: %s, channel %u",
val_to_str(src, src_dest, "Unknown (0x%02x)"),
tvb_get_guint8(tvb, offset + 1));
proto_tree_add_uint_hidden(header_tree, hf_gryphon_src, tvb,
hiddenItem = proto_tree_add_uint(header_tree, hf_gryphon_src, tvb,
offset, 1, src);
proto_tree_add_uint_hidden(header_tree, hf_gryphon_srcchan, tvb,
PROTO_ITEM_SET_HIDDEN(hiddenItem);
hiddenItem = proto_tree_add_uint(header_tree, hf_gryphon_srcchan, tvb,
offset+1, 1, tvb_get_guint8(tvb, offset + 1));
PROTO_ITEM_SET_HIDDEN(hiddenItem);
proto_tree_add_text(header_tree, tvb, offset+2, 2,
"Destination: %s, channel %u",
val_to_str(dest, src_dest, "Unknown (0x%02x)"),
tvb_get_guint8(tvb, offset + 3));
proto_tree_add_uint_hidden(header_tree, hf_gryphon_dest, tvb,
hiddenItem = proto_tree_add_uint(header_tree, hf_gryphon_dest, tvb,
offset+2, 1, dest);
proto_tree_add_uint_hidden(header_tree, hf_gryphon_destchan, tvb,
PROTO_ITEM_SET_HIDDEN(hiddenItem);
hiddenItem = proto_tree_add_uint(header_tree, hf_gryphon_destchan, tvb,
offset+3, 1, tvb_get_guint8(tvb, offset + 3));
PROTO_ITEM_SET_HIDDEN(hiddenItem);
proto_tree_add_text(header_tree, tvb, offset+4, 2,
"Data length: %u byte%s", msglen, msglen == 1 ? "" : "s");
proto_tree_add_text(header_tree, tvb, offset+6, 1,
"Frame type: %s", frame_type[frmtyp]);
if (is_msgresp_add) {
if (is_msgresp_add) {
localItem = proto_tree_add_text(header_tree, tvb, offset+6, 1, "Flags");
localTree = proto_item_add_subtree (localItem, ett_gryphon_flags);
proto_tree_add_text(localTree, tvb, offset+6, 1, "%s",
@ -296,8 +305,10 @@ dissect_gryphon_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
proto_tree_add_text(header_tree, tvb, offset+7, 1, "reserved");
proto_tree_add_uint_hidden(header_tree, hf_gryphon_type, tvb,
hiddenItem = proto_tree_add_uint(header_tree, hf_gryphon_type, tvb,
offset+6, 1, frmtyp);
PROTO_ITEM_SET_HIDDEN(hiddenItem);
msgpad = 3 - (msglen + 3) % 4;
msgend = offset + msglen + msgpad + MSG_HDR_SZ;
@ -635,10 +646,12 @@ decode_command(tvbuff_t *tvb, int offset, int dst, proto_tree *pt)
unsigned int i;
proto_tree *ft;
proto_item *ti;
proto_item *hi;
msglen = tvb_reported_length_remaining(tvb, offset);
cmd = tvb_get_guint8(tvb, offset);
proto_tree_add_uint_hidden(pt, hf_gryphon_cmd, tvb, offset, 1, cmd);
hi = proto_tree_add_uint(pt, hf_gryphon_cmd, tvb, offset, 1, cmd);
PROTO_ITEM_SET_HIDDEN(hi);
if (cmd > 0x3F)
cmd += dst * 256;

View File

@ -553,7 +553,7 @@ dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti, *et, *dt;
proto_item *ti, *et, *dt, *hi;
proto_tree *sbus_tree, *ethsbus_tree, *sbusdata_tree;
gint i; /*for CRC calculation*/
@ -1310,8 +1310,9 @@ dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_uint_format(sbus_tree,
hf_sbus_crc, tvb, offset, 2, sbus_helper,
"Checksum: 0x%04x (NOT correct)", sbus_helper);
proto_tree_add_boolean_hidden(sbus_tree,
hi = proto_tree_add_boolean(sbus_tree,
hf_sbus_crc_bad, tvb, offset + 2, 2, TRUE);
PROTO_ITEM_SET_HIDDEN(hi);
}
offset += 2; /*now at the end of the telegram*/
}

View File

@ -2047,6 +2047,9 @@ for (i_@aname@=0; i_@aname@ < @aval@; i_@aname@++) {
template_Header = """\
/* packet-@dissector_name@.c
*
* $Id$
*
* Routines for IDL dissection
*
* Autogenerated from idl2wrs