#define AFP_MAX_ACL_ENTRIES 500 /* Arbitrary. */
static gint
-decode_kauth_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
+decode_kauth_acl(tvbuff_t *tvb, proto_tree *tree, gint offset)
{
int entries;
int i;
sub_tree = proto_item_add_subtree(item, ett_afp_ace_entries);
offset += 4;
- item = proto_tree_add_item(tree, hf_afp_acl_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_afp_acl_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
if (entries > AFP_MAX_ACL_ENTRIES) {
- expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, "Too many ACL entries (%u). Stopping dissection.", entries);
+ expert_add_info_format(NULL, item, PI_UNDECODED, PI_WARN, "Too many ACL entries (%u). Stopping dissection.", entries);
THROW(ReportedBoundsError);
}
}
static gint
-decode_uuid_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, guint16 bitmap)
+decode_uuid_acl(tvbuff_t *tvb, proto_tree *tree, gint offset, guint16 bitmap)
{
if ((offset & 1))
PAD(1);
}
if ((bitmap & kFileSec_ACL)) {
- offset = decode_kauth_acl(tvb, pinfo, tree, offset);
+ offset = decode_kauth_acl(tvb, tree, offset);
}
return offset;
offset = decode_name(tree, pinfo, tvb, offset);
- offset = decode_uuid_acl(tvb, pinfo, tree, offset, bitmap);
+ offset = decode_uuid_acl(tvb, tree, offset, bitmap);
return offset;
}
bitmap = decode_acl_list_bitmap(tvb, tree, offset);
offset += 2;
- offset = decode_uuid_acl(tvb, pinfo, tree, offset, bitmap);
+ offset = decode_uuid_acl(tvb, tree, offset, bitmap);
return offset;
}
{ &hf_afp_acl_entrycount,
{ "ACEs count", "afp.acl_entrycount",
- FT_UINT32, BASE_DEC, NULL, 0,
+ FT_UINT32, BASE_HEX, NULL, 0,
"Number of ACL entries", HFILL }},
{ &hf_afp_acl_flags,
if ((run_info_str || run_req_cond) && !ncp_tree) {
proto_item *ti;
- temp_tree = proto_tree_create_root();
+ temp_tree = proto_tree_create_root(pinfo);
proto_tree_set_visible(temp_tree, FALSE);
ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
ncp_tree = proto_item_add_subtree(ti, ett_ncp);
if ((run_info_str || run_req_cond) && !ncp_tree) {
proto_item *ti;
- temp_tree = proto_tree_create_root();
+ temp_tree = proto_tree_create_root(pinfo);
proto_tree_set_visible(temp_tree, FALSE);
ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
ncp_tree = proto_item_add_subtree(ti, ett_ncp);
if (ncp_rec && !ncp_tree) {
proto_item *ti;
- temp_tree = proto_tree_create_root();
+ temp_tree = proto_tree_create_root(pinfo);
proto_tree_set_visible(temp_tree, FALSE);
ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
ncp_tree = proto_item_add_subtree(ti, ett_ncp);
CLEANUP_CALL_AND_POP;
}
}
-
g_assert(edt);
if (create_proto_tree) {
- edt->tree = proto_tree_create_root();
+ edt->tree = proto_tree_create_root(&edt->pi);
proto_tree_set_visible(edt->tree, proto_tree_visible);
}
else {
proto_tree *tree;
proto_item *ti;
+ if (pinfo == NULL && pi->tree_data) {
+ pinfo = PTREE_DATA(pi)->pinfo;
+ }
+
/* if this packet isn't loaded because of a read filter, don't output anything */
if (pinfo == NULL || PINFO_FD_NUM(pinfo) == 0) {
return;
expert_add_undecoded_item(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length, const int severity)
{
- proto_item *expert_item;
+ proto_item *expert_item;
expert_item = proto_tree_add_text(tree, tvb, offset, length, "Not dissected yet");
PROTO_ITEM_SET_GENERATED(expert_item); \
}
-
/** Add an expert info.
Add an expert info tree to a protocol item, with classification and message.
- @param pinfo packet info of the currently processed packet
- @param pi current protocol item (or NULL)
- @param group the expert group (like PI_CHECKSUM - see: proto.h)
- @param severity the expert severity (like PI_WARN - see: proto.h)
- @param format printf like format string with further infos
+ @param pinfo Packet info of the currently processed packet. May be NULL if
+ pi is supplied
+ @param pi Current protocol item (or NULL)
+ @param group The expert group (like PI_CHECKSUM - see: proto.h)
+ @param severity The expert severity (like PI_WARN - see: proto.h)
+ @param format Printf-style format string for additional arguments
*/
extern void
expert_add_info_format(packet_info *pinfo, proto_item *pi, int group,
/** Add an expert info about not dissected "item"
Add an expert info tree to a not dissected protocol item.
- @patam tvb the tvb with the item.
- @param pinfo packet info of the currently processed packet
- @param tree tree to add the item to
- @param offset in tvb
- @param length the length of the item.
- @param severity the expert severity (like PI_WARN - see: proto.h)
+ @patam tvb The tvb associated with the item.
+ @param pinfo Packet info of the currently processed packet. May be NULL.
+ @param tree Tree to add the item to
+ @param offset Offset in tvb
+ @param length The length of the item.
+ @param severity The expert severity (like PI_WARN - see: proto.h)
*/
extern void
}
proto_tree *
-proto_tree_create_root(void)
+proto_tree_create_root(packet_info *pinfo)
{
proto_node *pnode;
PNODE_FINFO(pnode) = NULL;
pnode->tree_data = g_new(tree_data_t, 1);
+ /* Make sure we can access pinfo everywhere */
+ pnode->tree_data->pinfo = pinfo;
+
/* Don't initialize the tree_data_t. Wait until we know we need it */
pnode->tree_data->interesting_hfids = NULL;
* in the protocol tree points to the same copy. */
typedef struct {
GHashTable *interesting_hfids;
- gboolean visible;
- gboolean fake_protocols;
- gint count;
+ gboolean visible;
+ gboolean fake_protocols;
+ gint count;
+ struct _packet_info *pinfo;
} tree_data_t;
/** Each proto_tree, proto_item is one of these. */
/** Creates a new proto_tree root.
@return the new tree root */
-extern proto_tree* proto_tree_create_root(void);
+extern proto_tree* proto_tree_create_root(struct _packet_info *pinfo);
/** Clear memory for entry proto_tree. Clears proto_tree struct also.
@param tree the tree to free */