aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgal <gal@f5534014-38df-0310-8fa8-9805f1628bb7>2006-09-30 14:37:09 +0000
committergal <gal@f5534014-38df-0310-8fa8-9805f1628bb7>2006-09-30 14:37:09 +0000
commit9e6ac7679e6943456f72a9bc36b5516f5f5170bd (patch)
tree3ad573d612af222181b20d12c872834b8d10d3a1
parent0302c1941fbc7e3aef1e9884a47a2a883bccb8d5 (diff)
A new field information flag, FI_URL, to indicate a field contains a URL.
This is used to display the field underlined and to allow the user to double-click on it (like FT_FRAMENUM) to open the URL in the configured browser. Example usage in the x509ce and logotype certificate extensions. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19383 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--asn1/logotype-cert-extn/logotype-cert-extn.cnf5
-rw-r--r--asn1/x509ce/x509ce-exp.cnf2
-rw-r--r--asn1/x509ce/x509ce.cnf4
-rw-r--r--epan/dissectors/packet-logotypecertextn.c8
-rw-r--r--epan/dissectors/packet-x509ce.c7
-rw-r--r--epan/proto.h8
-rw-r--r--gtk/proto_draw.c10
7 files changed, 40 insertions, 4 deletions
diff --git a/asn1/logotype-cert-extn/logotype-cert-extn.cnf b/asn1/logotype-cert-extn/logotype-cert-extn.cnf
index e30bf6845d..95040d06a0 100644
--- a/asn1/logotype-cert-extn/logotype-cert-extn.cnf
+++ b/asn1/logotype-cert-extn/logotype-cert-extn.cnf
@@ -14,6 +14,11 @@ LogotypeExtn B "1.3.6.1.5.5.7.1.12" "id-pe-logotype"
LogotypeExtn B "1.3.6.1.5.5.7.20.1" "id-pe-logo-loyalty"
LogotypeExtn B "1.3.6.1.5.5.7.20.2" "id-pe-logo-background"
+#.FN_FTR IA5String
+ if((hf_index == hf_logotypecertextn_logotypeURI_item) ||
+ (hf_index == hf_logotypecertextn_refStructURI_item))
+ PROTO_ITEM_SET_URL(get_ber_last_created_item());
+
#.NO_EMIT
#.TYPE_RENAME
diff --git a/asn1/x509ce/x509ce-exp.cnf b/asn1/x509ce/x509ce-exp.cnf
index c278497151..147a278d18 100644
--- a/asn1/x509ce/x509ce-exp.cnf
+++ b/asn1/x509ce/x509ce-exp.cnf
@@ -1,6 +1,6 @@
# Do not modify this file.
# It is created automatically by the ASN.1 to Wireshark dissector compiler
-# .\x509ce-exp.cnf
+# ./x509ce-exp.cnf
# ../../tools/asn2wrs.py -b -e -p x509ce -c x509ce.cnf -s packet-x509ce-template CertificateExtensions.asn
#.MODULE
diff --git a/asn1/x509ce/x509ce.cnf b/asn1/x509ce/x509ce.cnf
index 50fe50b073..09ef2ecbf6 100644
--- a/asn1/x509ce/x509ce.cnf
+++ b/asn1/x509ce/x509ce.cnf
@@ -119,6 +119,10 @@ CertificatePairExactAssertion/issuedByThisCAAssertion cpea_issuedByThisCAAsserti
#.FN_BODY OtherNameValue
offset=call_ber_oid_callback(object_identifier_id, tvb, offset, pinfo, tree);
+#.FN_FTR IA5String
+ if(hf_index == hf_x509ce_uniformResourceIdentifier)
+ PROTO_ITEM_SET_URL(get_ber_last_created_item());
+
#.END
diff --git a/epan/dissectors/packet-logotypecertextn.c b/epan/dissectors/packet-logotypecertextn.c
index 4e9b2d1664..66c7ea84e3 100644
--- a/epan/dissectors/packet-logotypecertextn.c
+++ b/epan/dissectors/packet-logotypecertextn.c
@@ -1,6 +1,6 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
-/* .\packet-logotypecertextn.c */
+/* ./packet-logotypecertextn.c */
/* ../../tools/asn2wrs.py -b -e -p logotypecertextn -c logotype-cert-extn.cnf -s packet-logotype-cert-extn-template LogotypeCertExtn.asn */
/* Input file: packet-logotype-cert-extn-template.c */
@@ -144,6 +144,12 @@ dissect_logotypecertextn_IA5String(gboolean implicit_tag _U_, tvbuff_t *tvb, int
pinfo, tree, tvb, offset, hf_index,
NULL);
+#line 18 "logotype-cert-extn.cnf"
+ if((hf_index == hf_logotypecertextn_logotypeURI_item) ||
+ (hf_index == hf_logotypecertextn_refStructURI_item))
+ PROTO_ITEM_SET_URL(get_ber_last_created_item());
+
+
return offset;
}
static int dissect_mediaType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
diff --git a/epan/dissectors/packet-x509ce.c b/epan/dissectors/packet-x509ce.c
index 5fe3523782..75d9b4c9b5 100644
--- a/epan/dissectors/packet-x509ce.c
+++ b/epan/dissectors/packet-x509ce.c
@@ -1,6 +1,6 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
-/* .\packet-x509ce.c */
+/* ./packet-x509ce.c */
/* ../../tools/asn2wrs.py -b -e -p x509ce -c x509ce.cnf -s packet-x509ce-template CertificateExtensions.asn */
/* Input file: packet-x509ce-template.c */
@@ -386,6 +386,11 @@ dissect_x509ce_IA5String(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, p
pinfo, tree, tvb, offset, hf_index,
NULL);
+#line 123 "x509ce.cnf"
+ if(hf_index == hf_x509ce_uniformResourceIdentifier)
+ PROTO_ITEM_SET_URL(get_ber_last_created_item());
+
+
return offset;
}
static int dissect_rfc822Name_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
diff --git a/epan/proto.h b/epan/proto.h
index 65133a7df4..1f8af93e2d 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -211,6 +211,8 @@ typedef struct field_info {
/** The protocol field should be displayed as "generated by Wireshark",
* used in field_info.flags. */
#define FI_GENERATED 0x0002
+/* The protocol field is actually a URL */
+#define FI_URL 0x0004
/** convenience macro to get field_info.flags */
@@ -290,6 +292,12 @@ typedef proto_node proto_item;
/** mark this protocol field as generated by Wireshark (and not read from the packet data) */
#define PROTO_ITEM_SET_GENERATED(proto_item) \
((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_GENERATED) : 0)
+/* is this protocol field actually a URL */
+#define PROTO_ITEM_IS_URL(proto_item) \
+ ((proto_item) ? FI_GET_FLAG((proto_item)->finfo, FI_URL) : 0)
+/* mark this protocol field as a URL */
+#define PROTO_ITEM_SET_URL(proto_item) \
+ ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_URL) : 0)
typedef void (*proto_tree_foreach_func)(proto_node *, gpointer);
diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c
index 636bf957a6..89034d7574 100644
--- a/gtk/proto_draw.c
+++ b/gtk/proto_draw.c
@@ -1721,7 +1721,8 @@ static void tree_cell_renderer(GtkTreeViewColumn *tree_column _U_,
g_object_set (cell, "weight-set", TRUE, NULL);*/
}
- if(fi->hfinfo->type == FT_FRAMENUM) {
+ if((fi->hfinfo->type == FT_FRAMENUM) ||
+ (FI_GET_FLAG(fi, FI_URL) && IS_FT_STRING(fi->hfinfo->type))) {
g_object_set (cell, "foreground", "blue", NULL);
g_object_set (cell, "foreground-set", TRUE, NULL);
@@ -1939,9 +1940,16 @@ main_proto_tree_draw(proto_tree *protocol_tree)
static void
tree_view_follow_link(field_info *fi)
{
+ gchar *url;
+
if(fi->hfinfo->type == FT_FRAMENUM) {
cf_goto_frame(&cfile, fi->value.value.integer);
}
+ if(FI_GET_FLAG(fi, FI_URL) && IS_FT_STRING(fi->hfinfo->type)) {
+ url = g_strndup(tvb_get_ptr(fi->ds_tvb, fi->start, fi->length), fi->length);
+ browser_open_url(url);
+ g_free(url);
+ }
}