static hf_register_info hf[] = {
{ &hf_cms_ci_contentType,
{ "contentType", "cms.contentInfo.contentType",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_OID, BASE_NONE, NULL, 0,
"ContentType", HFILL }},
#include "packet-cms-hfarr.c"
};
"OCTETSTRING", "ber.unknown.OCTETSTRING", FT_BYTES, BASE_HEX,
NULL, 0, "This is an unknown OCTETSTRING", HFILL }},
{ &hf_ber_unknown_OID, {
- "OID", "ber.unknown.OID", FT_STRING, BASE_NONE,
+ "OID", "ber.unknown.OID", FT_OID, BASE_NONE,
NULL, 0, "This is an unknown Object Identifier", HFILL }},
{ &hf_ber_unknown_GraphicString, {
"GRAPHICSTRING", "ber.unknown.GRAPHICSTRING", FT_STRING, BASE_HEX,
static hf_register_info hf[] = {
{ &hf_cms_ci_contentType,
{ "contentType", "cms.contentInfo.contentType",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_OID, BASE_NONE, NULL, 0,
"ContentType", HFILL }},
/*--- Included file: packet-cms-hfarr.c ---*/
num_tap_filters DATA
num_tree_types DATA
offset_from_real_beginning
+oid_get_url
other_decode_bitfield_value
plugin_list DATA
postseq_cleanup_all_protocols
static GHashTable *oid_table = NULL;
+/* this should be configurable - but where ? */
+static const gchar *oid_url_template = "http://www.alvestrand.no/objectid/%s.html";
+
void oid_resolv_init(void) {
oid_table = g_hash_table_new(g_str_hash, g_str_equal);
}
extern void add_oid_str_name(const gchar *oid_str, const gchar *name) {
g_hash_table_insert(oid_table, (gpointer)g_strdup(oid_str), (gpointer)name);
}
+
+gboolean get_oid_url(field_info *finfo, gchar **ret_url)
+{
+ const char *oid;
+
+ if(finfo && (finfo->hfinfo->type == FT_OID) &&
+ (oid_url_template != NULL) && (*oid_url_template != NULL)) {
+ if(ret_url) {
+ /* return the URL */
+ oid = oid_to_str(tvb_get_ptr(finfo->ds_tvb, finfo->start, finfo->length),
+ finfo->length);
+
+ /* the URL will be freed */
+ *ret_url = g_strdup_printf(oid_url_template, oid);
+ return TRUE;
+ } else {
+ /* return TRUE if we are configured to return URLs */
+
+ if((oid_url_template != NULL) && (*oid_url_template != NULL))
+ return TRUE;
+
+ }
+ }
+
+ return FALSE;
+}
#ifndef __OID_RESOLV_H__
#define __OID_RESOLV_H__
+#include <epan/proto.h>
+
/* init and clenup funcions called from epan.h */
extern void oid_resolv_init(void);
extern void oid_resolv_cleanup(void);
extern void add_oid_name(const guint8 *oid, gint oid_len, const gchar *name);
extern void add_oid_str_name(const gchar *oid_str, const gchar *name);
+/* get a URL for an OID in the given field */
+/* if ret_url is NULL, just return TRUE if we are configured to provide one */
+extern gboolean get_oid_url(field_info *finfo, gchar **ret_url);
#endif /* __OID_RESOLV_H__ */
#include "cmdarg_err.h"
#include "version_info.h"
#include "merge.h"
+#include <epan/oid_resolv.h>
#ifdef HAVE_LIBPCAP
#include "capture-pcap-util.h"
}
}
+void
+selected_ptree_field_url_cb(GtkWidget *widget _U_, gpointer data _U_)
+{
+ gchar *selected_info_url;
+
+ /* only OIDs for now */
+ if(cfile.finfo_selected->hfinfo->type == FT_OID) {
+ if(get_oid_url(cfile.finfo_selected, &selected_info_url)) {
+ browser_open_url(selected_info_url);
+ g_free(selected_info_url);
+ }
+ }
+}
+
+gboolean selected_ptree_has_field_url()
+{
+ /* only OIDs for now */
+ if(cfile.finfo_selected->hfinfo->type == FT_OID)
+ return get_oid_url(cfile.finfo_selected, NULL);
+
+ return FALSE;
+}
static gchar *
get_text_from_packet_list(gpointer data)
*/
extern void selected_ptree_ref_cb(GtkWidget *widget, gpointer data);
+/** User requested "Field Information" by ptree context menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void selected_ptree_field_url_cb(GtkWidget *widget, gpointer data);
+
+/** Determine if "Field Information" should be enabled in ptree context menu.
+ *
+ */
+extern gboolean selected_ptree_has_field_url();
/** "Apply as Filter" / "Prepare a Filter" action type. */
typedef enum {
0, ETHEREAL_STOCK_WIKI),
ITEM_FACTORY_STOCK_ENTRY("/Filter Field Reference", NULL, selected_ptree_ref_cb,
0, ETHEREAL_STOCK_INTERNET),
+ ITEM_FACTORY_STOCK_ENTRY("/Field Information", NULL, selected_ptree_field_url_cb,
+ 0, ETHEREAL_STOCK_INTERNET),
ITEM_FACTORY_ENTRY("/Protocol Preferences...", NULL, properties_cb,
0, NULL, NULL),
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
TRUE);
set_menu_sensitivity(tree_view_menu_factory, "/Filter Field Reference",
TRUE);
+ set_menu_sensitivity(tree_view_menu_factory, "/Field Information",
+ selected_ptree_has_field_url());
} else {
set_menu_sensitivity(main_menu_factory,
"/Go/Go to Corresponding Packet", FALSE);
FALSE);
set_menu_sensitivity(tree_view_menu_factory, "/Filter Field Reference",
FALSE);
+ set_menu_sensitivity(tree_view_menu_factory, "/Field Information",
+ FALSE);
}
walk_menu_tree_for_selected_tree_row(tap_menu_tree_root, cf->finfo_selected);