Couldn't quite figure out how to make the expert items in proto.c and the LUA API filterable (suggestions welcome!), but I wanted to start forcing dissectors to use the filterable expert API (nothing like compile errors to force change!). I created expert_add_info_format_internal (original expert_add_info_format) and used it as a placeholder for proto.c/LUA API until a solution is created. The "new" expert_add_info_format will be the "old" expert_add_info_format_text, and I'll slowly do the search/replace.
For those with dissectors outside the source tree, please see tools/convert_expert_add_info_format.pl for help with the conversion. Please do not use expert_add_info_format_internal, as it's support time will be very short lived. svn path=/trunk/; revision=51844
This commit is contained in:
parent
fb75b6867e
commit
1b009df749
|
@ -357,7 +357,7 @@ expert_set_info_vformat(packet_info *pinfo, proto_item *pi, int group, int sever
|
|||
|
||||
|
||||
void
|
||||
expert_add_info_format(packet_info *pinfo, proto_item *pi, int group, int severity, const char *format, ...)
|
||||
expert_add_info_format_internal(packet_info *pinfo, proto_item *pi, int group, int severity, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
@ -378,7 +378,7 @@ expert_add_info(packet_info *pinfo, proto_item *pi, expert_field *expindex)
|
|||
}
|
||||
|
||||
void
|
||||
expert_add_info_format_text(packet_info *pinfo, proto_item *pi, expert_field *expindex, const char *format, ...)
|
||||
expert_add_info_format(packet_info *pinfo, proto_item *pi, expert_field *expindex, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
expert_field_info* eiinfo;
|
||||
|
|
|
@ -139,7 +139,7 @@ expert_update_comment_count(guint64 count);
|
|||
WS_DLL_PUBLIC void
|
||||
expert_add_info(packet_info *pinfo, proto_item *pi, expert_field* eiindex);
|
||||
|
||||
/** Add an expert info. TO BE DEPRECATED IN ITS CURRENT FORM!!!
|
||||
/** Add an expert info. FOR INTERNAL (NON-DISSECTOR) USE ONLY!!!
|
||||
Add an expert info tree to a protocol item, with classification and message.
|
||||
@param pinfo Packet info of the currently processed packet. May be NULL if
|
||||
pi is supplied
|
||||
|
@ -149,12 +149,12 @@ expert_add_info(packet_info *pinfo, proto_item *pi, expert_field* eiindex);
|
|||
@param format Printf-style format string for additional arguments
|
||||
*/
|
||||
WS_DLL_PUBLIC void
|
||||
expert_add_info_format(packet_info *pinfo, proto_item *pi, int group,
|
||||
expert_add_info_format_internal(packet_info *pinfo, proto_item *pi, int group,
|
||||
int severity, const char *format, ...)
|
||||
G_GNUC_PRINTF(5, 6);
|
||||
|
||||
/** Add an expert info.
|
||||
Add an expert info tree to a protocol item, using registered expert info item,
|
||||
Add an expert info tree to a protocol item, using registered expert info item,
|
||||
but with a formatted message.
|
||||
@param pinfo Packet info of the currently processed packet. May be NULL if
|
||||
pi is supplied
|
||||
|
@ -163,9 +163,12 @@ expert_add_info_format(packet_info *pinfo, proto_item *pi, int group,
|
|||
@param format Printf-style format string for additional arguments
|
||||
*/
|
||||
WS_DLL_PUBLIC void
|
||||
expert_add_info_format_text(packet_info *pinfo, proto_item *pi, expert_field *eiindex,
|
||||
expert_add_info_format(packet_info *pinfo, proto_item *pi, expert_field *eiindex,
|
||||
const char *format, ...) G_GNUC_PRINTF(4, 5);
|
||||
|
||||
/* XXX - TEMPORARY WHILE SEARCH/REPLACE OF expert_add_info_format_text IS DONE */
|
||||
#define expert_add_info_format_text expert_add_info_format
|
||||
|
||||
/** Add an expert info associated with some byte data
|
||||
Add an expert info tree to a protocol item using registered expert info item.
|
||||
This function is intended to replace places where
|
||||
|
|
|
@ -1052,7 +1052,7 @@ report_type_length_mismatch(proto_tree *tree, const gchar *descr, int length, gb
|
|||
/* Keep the current item from getting freed by proto_tree_new_item. */
|
||||
tree_data->fi_tmp = NULL;
|
||||
|
||||
expert_add_info_format(NULL, tree, PI_MALFORMED, is_error ? PI_ERROR : PI_WARN, "Trying to fetch %s with length %d", descr, length);
|
||||
expert_add_info_format_internal(NULL, tree, PI_MALFORMED, is_error ? PI_ERROR : PI_WARN, "Trying to fetch %s with length %d", descr, length);
|
||||
|
||||
tree_data->fi_tmp = fi_save;
|
||||
}
|
||||
|
@ -6917,7 +6917,7 @@ proto_tree_add_bitmask_len(proto_tree *parent_tree, tvbuff_t *tvb,
|
|||
|
||||
if (decodable_len < len) {
|
||||
/* Dissector likely requires updating for new protocol revision */
|
||||
expert_add_info_format(NULL, item, PI_UNDECODED, PI_WARN,
|
||||
expert_add_info_format_internal(NULL, item, PI_UNDECODED, PI_WARN,
|
||||
"Only least-significant %d of %d bytes decoded",
|
||||
decodable_len, len);
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ int dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data
|
|||
const gchar* error = lua_tostring(L,-1);
|
||||
|
||||
proto_item* pi = proto_tree_add_text(tree,tvb,0,0,"Lua Error: %s",error);
|
||||
expert_add_info_format(pinfo, pi, PI_UNDECODED, PI_ERROR ,"Lua Error");
|
||||
expert_add_info_format_internal(pinfo, pi, PI_UNDECODED, PI_ERROR ,"Lua Error");
|
||||
} else {
|
||||
|
||||
/* if the Lua dissector reported the consumed bytes, pass it to our caller */
|
||||
|
@ -114,7 +114,7 @@ int dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data
|
|||
proto_item* pi = proto_tree_add_text(tree,tvb,0,0,"Lua Error: did not find the %s dissector"
|
||||
" in the dissectors table",pinfo->current_proto);
|
||||
|
||||
expert_add_info_format(pinfo, pi, PI_UNDECODED, PI_ERROR ,"Lua Error");
|
||||
expert_add_info_format_internal(pinfo, pi, PI_UNDECODED, PI_ERROR ,"Lua Error");
|
||||
}
|
||||
|
||||
register_frame_end_routine(pinfo, lua_frame_end);
|
||||
|
|
|
@ -336,7 +336,7 @@ WSLUA_METHOD TreeItem_add_expert_info(lua_State *L) {
|
|||
luaL_error(L,"expired TreeItem");
|
||||
return 0;
|
||||
}
|
||||
expert_add_info_format(lua_pinfo, ti->item, group, severity, "%s", str);
|
||||
expert_add_info_format_internal(lua_pinfo, ti->item, group, severity, "%s", str);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue