forked from osmocom/wireshark
dfilter: Add ftypes pseudofields
This adds a _ws.ftypes namespace with protocol fields with all the existing field types. Currently this is only useful to debug the display filter compiler, without having to find a real protocol field with the desired type. Later it may find other uses.
This commit is contained in:
parent
f54bad026f
commit
b9b45a4a8f
|
@ -827,6 +827,64 @@ ftype_register_bytes(void)
|
|||
ftype_register(FT_FCWWN, &fcwwn_type);
|
||||
}
|
||||
|
||||
void
|
||||
ftype_register_pseudofields_bytes(int proto)
|
||||
{
|
||||
static int hf_ft_bytes;
|
||||
static int hf_ft_uint_bytes;
|
||||
static int hf_ft_ax25;
|
||||
static int hf_ft_vines;
|
||||
static int hf_ft_ether;
|
||||
static int hf_ft_oid;
|
||||
static int hf_ft_rel_oid;
|
||||
static int hf_ft_system_id;
|
||||
|
||||
static hf_register_info hf_ftypes[] = {
|
||||
{ &hf_ft_bytes,
|
||||
{ "FT_BYTES", "_ws.ftypes.bytes",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_uint_bytes,
|
||||
{ "FT_UINT_BYTES", "_ws.ftypes.uint_bytes",
|
||||
FT_UINT_BYTES, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_ax25,
|
||||
{ "FT_AX25", "_ws.ftypes.ax25",
|
||||
FT_AX25, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_vines,
|
||||
{ "FT_VINES", "_ws.ftypes.vines",
|
||||
FT_VINES, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_ether,
|
||||
{ "FT_ETHER", "_ws.ftypes.ether",
|
||||
FT_ETHER, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_oid,
|
||||
{ "FT_OID", "_ws.ftypes.oid",
|
||||
FT_OID, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_rel_oid,
|
||||
{ "FT_REL_OID", "_ws.ftypes.rel_oid",
|
||||
FT_REL_OID, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_system_id,
|
||||
{ "FT_SYSTEM_ID", "_ws.ftypes.system_id",
|
||||
FT_SYSTEM_ID, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
proto_register_field_array(proto, hf_ftypes, array_length(hf_ftypes));
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -162,6 +162,28 @@ ftype_register_double(void)
|
|||
ftype_register(FT_DOUBLE, &double_type);
|
||||
}
|
||||
|
||||
void
|
||||
ftype_register_pseudofields_double(int proto)
|
||||
{
|
||||
static int hf_ft_float;
|
||||
static int hf_ft_double;
|
||||
|
||||
static hf_register_info hf_ftypes[] = {
|
||||
{ &hf_ft_float,
|
||||
{ "FT_FLOAT", "_ws.ftypes.float",
|
||||
FT_FLOAT, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_double,
|
||||
{ "FT_DOUBLE", "_ws.ftypes.double",
|
||||
FT_DOUBLE, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
proto_register_field_array(proto, hf_ftypes, array_length(hf_ftypes));
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -126,6 +126,22 @@ ftype_register_guid(void)
|
|||
ftype_register(FT_GUID, &guid_type);
|
||||
}
|
||||
|
||||
void
|
||||
ftype_register_pseudofields_guid(int proto)
|
||||
{
|
||||
static int hf_ft_guid;
|
||||
|
||||
static hf_register_info hf_ftypes[] = {
|
||||
{ &hf_ft_guid,
|
||||
{ "FT_GUID", "_ws.ftypes.guid",
|
||||
FT_GUID, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
proto_register_field_array(proto, hf_ftypes, array_length(hf_ftypes));
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -981,6 +981,28 @@ Example: 36.4 is 0xFF00016C
|
|||
ftype_register(FT_IEEE_11073_FLOAT, &float_type);
|
||||
}
|
||||
|
||||
void
|
||||
ftype_register_pseudofields_ieee_11073_float(int proto)
|
||||
{
|
||||
static int hf_ft_ieee_11073_sfloat;
|
||||
static int hf_ft_ieee_11073_float;
|
||||
|
||||
static hf_register_info hf_ftypes[] = {
|
||||
{ &hf_ft_ieee_11073_sfloat,
|
||||
{ "FT_IEEE_11073_SFLOAT", "_ws.ftypes.ieee_11073_sfloat",
|
||||
FT_IEEE_11073_SFLOAT, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_ieee_11073_float,
|
||||
{ "FT_IEEE_11073_FLOAT", "_ws.ftypes.ieee_11073_float",
|
||||
FT_IEEE_11073_FLOAT, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
proto_register_field_array(proto, hf_ftypes, array_length(hf_ftypes));
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -1414,6 +1414,142 @@ ftype_register_integers(void)
|
|||
ftype_register(FT_EUI64, &eui64_type);
|
||||
}
|
||||
|
||||
void
|
||||
ftype_register_pseudofields_integer(int proto)
|
||||
{
|
||||
static int hf_ft_char;
|
||||
static int hf_ft_uint8;
|
||||
static int hf_ft_uint16;
|
||||
static int hf_ft_uint24;
|
||||
static int hf_ft_uint32;
|
||||
static int hf_ft_uint40;
|
||||
static int hf_ft_uint48;
|
||||
static int hf_ft_uint56;
|
||||
static int hf_ft_uint64;
|
||||
static int hf_ft_int8;
|
||||
static int hf_ft_int16;
|
||||
static int hf_ft_int24;
|
||||
static int hf_ft_int32;
|
||||
static int hf_ft_int40;
|
||||
static int hf_ft_int48;
|
||||
static int hf_ft_int56;
|
||||
static int hf_ft_int64;
|
||||
static int hf_ft_boolean;
|
||||
static int hf_ft_ipxnet;
|
||||
static int hf_ft_framenum;
|
||||
static int hf_ft_eui64;
|
||||
|
||||
static hf_register_info hf_ftypes[] = {
|
||||
{ &hf_ft_char,
|
||||
{ "FT_CHAR", "_ws.ftypes.char",
|
||||
FT_CHAR, BASE_HEX, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_uint8,
|
||||
{ "FT_UINT8", "_ws.ftypes.uint8",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_uint16,
|
||||
{ "FT_UINT16", "_ws.ftypes.uint16",
|
||||
FT_UINT16, BASE_HEX, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_uint24,
|
||||
{ "FT_UINT24", "_ws.ftypes.uint24",
|
||||
FT_UINT24, BASE_HEX, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_uint32,
|
||||
{ "FT_UINT32", "_ws.ftypes.uint32",
|
||||
FT_UINT32, BASE_HEX, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_uint40,
|
||||
{ "FT_UINT40", "_ws.ftypes.uint40",
|
||||
FT_UINT40, BASE_HEX, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_uint48,
|
||||
{ "FT_UINT48", "_ws.ftypes.uint48",
|
||||
FT_UINT48, BASE_HEX, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_uint56,
|
||||
{ "FT_UINT56", "_ws.ftypes.uint56",
|
||||
FT_UINT56, BASE_HEX, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_uint64,
|
||||
{ "FT_UINT64", "_ws.ftypes.uint64",
|
||||
FT_UINT64, BASE_HEX, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_int8,
|
||||
{ "FT_INT8", "_ws.ftypes.int8",
|
||||
FT_INT8, BASE_DEC, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_int16,
|
||||
{ "FT_INT16", "_ws.ftypes.int16",
|
||||
FT_INT16, BASE_DEC, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_int24,
|
||||
{ "FT_INT24", "_ws.ftypes.int24",
|
||||
FT_INT24, BASE_DEC, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_int32,
|
||||
{ "FT_INT32", "_ws.ftypes.int32",
|
||||
FT_INT32, BASE_DEC, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_int40,
|
||||
{ "FT_INT40", "_ws.ftypes.int40",
|
||||
FT_INT40, BASE_DEC, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_int48,
|
||||
{ "FT_INT48", "_ws.ftypes.int48",
|
||||
FT_INT48, BASE_DEC, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_int56,
|
||||
{ "FT_INT56", "_ws.ftypes.int56",
|
||||
FT_INT56, BASE_DEC, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_int64,
|
||||
{ "FT_INT64", "_ws.ftypes.int64",
|
||||
FT_INT64, BASE_DEC, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_boolean,
|
||||
{ "FT_BOOLEAN", "_ws.ftypes.boolean",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_ipxnet,
|
||||
{ "FT_IPXNET", "_ws.ftypes.ipxnet",
|
||||
FT_IPXNET, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_framenum,
|
||||
{ "FT_FRAMENUM", "_ws.ftypes.framenum",
|
||||
FT_FRAMENUM, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_eui64,
|
||||
{ "FT_EUI64", "_ws.ftypes.eui64",
|
||||
FT_EUI64, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
proto_register_field_array(proto, hf_ftypes, array_length(hf_ftypes));
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -178,6 +178,22 @@ ftype_register_ipv4(void)
|
|||
ftype_register(FT_IPv4, &ipv4_type);
|
||||
}
|
||||
|
||||
void
|
||||
ftype_register_pseudofields_ipv4(int proto)
|
||||
{
|
||||
static int hf_ft_ipv4;
|
||||
|
||||
static hf_register_info hf_ftypes[] = {
|
||||
{ &hf_ft_ipv4,
|
||||
{ "FT_IPv4", "_ws.ftypes.ipv4",
|
||||
FT_IPv4, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
proto_register_field_array(proto, hf_ftypes, array_length(hf_ftypes));
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -201,6 +201,22 @@ ftype_register_ipv6(void)
|
|||
ftype_register(FT_IPv6, &ipv6_type);
|
||||
}
|
||||
|
||||
void
|
||||
ftype_register_pseudofields_ipv6(int proto)
|
||||
{
|
||||
static int hf_ft_ipv6;
|
||||
|
||||
static hf_register_info hf_ftypes[] = {
|
||||
{ &hf_ft_ipv6,
|
||||
{ "FT_IPv6", "_ws.ftypes.ipv6",
|
||||
FT_IPv6, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
proto_register_field_array(proto, hf_ftypes, array_length(hf_ftypes));
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -340,6 +340,22 @@ ftype_register_tvbuff(void)
|
|||
ftype_register(FT_PROTOCOL, &protocol_type);
|
||||
}
|
||||
|
||||
void
|
||||
ftype_register_pseudofields_tvbuff(int proto)
|
||||
{
|
||||
static int hf_ft_protocol;
|
||||
|
||||
static hf_register_info hf_ftypes[] = {
|
||||
{ &hf_ft_protocol,
|
||||
{ "FT_PROTOCOL", "_ws.ftypes.protocol",
|
||||
FT_PROTOCOL, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
proto_register_field_array(proto, hf_ftypes, array_length(hf_ftypes));
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -296,6 +296,46 @@ ftype_register_string(void)
|
|||
ftype_register(FT_STRINGZTRUNC, &stringztrunc_type);
|
||||
}
|
||||
|
||||
void
|
||||
ftype_register_pseudofields_string(int proto)
|
||||
{
|
||||
static int hf_ft_string;
|
||||
static int hf_ft_stringz;
|
||||
static int hf_ft_uint_string;
|
||||
static int hf_ft_stringzpad;
|
||||
static int hf_ft_stringztrunc;
|
||||
|
||||
static hf_register_info hf_ftypes[] = {
|
||||
{ &hf_ft_string,
|
||||
{ "FT_STRING", "_ws.ftypes.string",
|
||||
FT_STRING, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_stringz,
|
||||
{ "FT_STRINGZ", "_ws.ftypes.stringz",
|
||||
FT_STRINGZ, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_uint_string,
|
||||
{ "FT_UINT_STRING", "_ws.ftypes.uint_string",
|
||||
FT_UINT_STRING, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_stringzpad,
|
||||
{ "FT_STRINGZPAD", "_ws.ftypes.stringzpad",
|
||||
FT_STRINGZPAD, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_stringztrunc,
|
||||
{ "FT_STRINGZTRUNC", "_ws.ftypes.stringztrunc",
|
||||
FT_STRINGZTRUNC, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
proto_register_field_array(proto, hf_ftypes, array_length(hf_ftypes));
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -478,6 +478,28 @@ ftype_register_time(void)
|
|||
ftype_register(FT_RELATIVE_TIME, &reltime_type);
|
||||
}
|
||||
|
||||
void
|
||||
ftype_register_pseudofields_time(int proto)
|
||||
{
|
||||
static int hf_ft_rel_time;
|
||||
static int hf_ft_abs_time;
|
||||
|
||||
static hf_register_info hf_ftypes[] = {
|
||||
{ &hf_ft_abs_time,
|
||||
{ "FT_ABSOLUTE_TIME", "_ws.ftypes.abs_time",
|
||||
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_ft_rel_time,
|
||||
{ "FT_RELATIVE_TIME", "_ws.ftypes.rel_time",
|
||||
FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
proto_register_field_array(proto, hf_ftypes, array_length(hf_ftypes));
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "ftypes.h"
|
||||
#include <epan/proto.h>
|
||||
#include <epan/packet.h>
|
||||
|
||||
extern ftype_t* type_list[FT_NUM_TYPES];
|
||||
|
||||
|
@ -123,6 +124,17 @@ void ftype_register_string(void);
|
|||
void ftype_register_time(void);
|
||||
void ftype_register_tvbuff(void);
|
||||
|
||||
void ftype_register_pseudofields_bytes(int proto);
|
||||
void ftype_register_pseudofields_double(int proto);
|
||||
void ftype_register_pseudofields_ieee_11073_float(int proto);
|
||||
void ftype_register_pseudofields_integer(int proto);
|
||||
void ftype_register_pseudofields_ipv4(int proto);
|
||||
void ftype_register_pseudofields_ipv6(int proto);
|
||||
void ftype_register_pseudofields_guid(int proto);
|
||||
void ftype_register_pseudofields_string(int proto);
|
||||
void ftype_register_pseudofields_time(int proto);
|
||||
void ftype_register_pseudofields_tvbuff(int proto);
|
||||
|
||||
GByteArray *
|
||||
byte_array_from_literal(const char *s, gchar **err_msg);
|
||||
|
||||
|
|
|
@ -32,6 +32,30 @@ ftypes_initialize(void)
|
|||
ftype_register_tvbuff();
|
||||
}
|
||||
|
||||
void
|
||||
ftypes_register_pseudofields(void)
|
||||
{
|
||||
static int proto_ftypes;
|
||||
|
||||
proto_ftypes = proto_register_protocol(
|
||||
"Wireshark Field/Fundamental Types",
|
||||
"Wireshark FTypes",
|
||||
"_ws.ftypes");
|
||||
|
||||
ftype_register_pseudofields_bytes(proto_ftypes);
|
||||
ftype_register_pseudofields_double(proto_ftypes);
|
||||
ftype_register_pseudofields_ieee_11073_float(proto_ftypes);
|
||||
ftype_register_pseudofields_integer(proto_ftypes);
|
||||
ftype_register_pseudofields_ipv4(proto_ftypes);
|
||||
ftype_register_pseudofields_ipv6(proto_ftypes);
|
||||
ftype_register_pseudofields_guid(proto_ftypes);
|
||||
ftype_register_pseudofields_string(proto_ftypes);
|
||||
ftype_register_pseudofields_time(proto_ftypes);
|
||||
ftype_register_pseudofields_tvbuff(proto_ftypes);
|
||||
|
||||
proto_set_cant_toggle(proto_ftypes);
|
||||
}
|
||||
|
||||
/* Each ftype_t is registered via this function */
|
||||
void
|
||||
ftype_register(enum ftenum ftype, ftype_t *ft)
|
||||
|
|
|
@ -144,6 +144,9 @@ typedef enum ftrepr ftrepr_t;
|
|||
void
|
||||
ftypes_initialize(void);
|
||||
|
||||
void
|
||||
ftypes_register_pseudofields(void);
|
||||
|
||||
/* ---------------- FTYPE ----------------- */
|
||||
|
||||
/* given two types, are they similar - for example can two
|
||||
|
|
|
@ -573,6 +573,10 @@ proto_init(GSList *register_all_plugin_protocols_list,
|
|||
register_number_string_decodinws_error();
|
||||
register_string_errors();
|
||||
|
||||
#ifndef WS_DISABLE_DEBUG
|
||||
ftypes_register_pseudofields();
|
||||
#endif
|
||||
|
||||
/* Have each built-in dissector register its protocols, fields,
|
||||
dissector tables, and dissectors to be called through a
|
||||
handle, and do whatever one-time initialization it needs to
|
||||
|
|
Loading…
Reference in New Issue