aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2005-03-29 14:56:09 +0000
committerGerald Combs <gerald@wireshark.org>2005-03-29 14:56:09 +0000
commit9ead15a6eb16be93559d71b4083948338ab9d26e (patch)
tree1b4d41f5bbb525f1f29ffee89c660d9734a1a947 /epan
parente4f2f32fe6d10d252374cd3a6a42fe958a445708 (diff)
README.developer says:
"PROTOABBREV A name for the protocol for use in filter expressions; it should contain only lower-case letters, digits, and hyphens." In proto_register_protocol(), generate a warning if PROTOABBREV contains invalid characters. Along with the list above, allow underscores and periods. Fix up whitespace. Lower-case PROTOABBREV in several dissectors. svn path=/trunk/; revision=13967
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-MAP_DialoguePDU.c28
-rw-r--r--epan/dissectors/packet-ccsds.c2
-rw-r--r--epan/dissectors/packet-dcom-sysact.c4
-rw-r--r--epan/dissectors/packet-fcdns.c2
-rw-r--r--epan/dissectors/packet-fcfzs.c2
-rw-r--r--epan/proto.c84
6 files changed, 68 insertions, 54 deletions
diff --git a/epan/dissectors/packet-MAP_DialoguePDU.c b/epan/dissectors/packet-MAP_DialoguePDU.c
index 05bcdd119b..1b45e96b13 100644
--- a/epan/dissectors/packet-MAP_DialoguePDU.c
+++ b/epan/dissectors/packet-MAP_DialoguePDU.c
@@ -44,7 +44,7 @@
#define PNAME "MAP_DialoguePDU"
#define PSNAME "MAP_DialoguePDU"
-#define PFNAME "MAP_DialoguePDU"
+#define PFNAME "map_dialoguepdu"
/* Initialize the protocol and registered fields */
int proto_MAP_DialoguePDU = -1;
@@ -170,7 +170,7 @@ static int dissect_map_close_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t
}
-static const value_string Reason_vals[] = {
+static const value_string MAP_DialoguePDU_Reason_vals[] = {
{ 0, "noReasonGiven" },
{ 1, "invalidDestinationReference" },
{ 2, "invalidOriginatingReference" },
@@ -222,7 +222,7 @@ static int dissect_userResourceLimitation_impl(packet_info *pinfo, proto_tree *t
}
-static const value_string ResourceUnavailable_vals[] = {
+static const value_string MAP_DialoguePDU_ResourceUnavailable_vals[] = {
{ 0, "shortTermResourceLimitation" },
{ 1, "longTermResourceLimitation" },
{ 0, NULL }
@@ -240,7 +240,7 @@ static int dissect_resourceUnavailable_impl(packet_info *pinfo, proto_tree *tree
}
-static const value_string ApplicationProcedureCancellation_vals[] = {
+static const value_string MAP_DialoguePDU_ApplicationProcedureCancellation_vals[] = {
{ 0, "handoverCancellation" },
{ 1, "radioChannelRelease" },
{ 2, "networkPathRelease" },
@@ -263,7 +263,7 @@ static int dissect_applicationProcedureCancellation_impl(packet_info *pinfo, pro
}
-static const value_string MAP_UserAbortChoice_vals[] = {
+static const value_string MAP_DialoguePDU_MAP_UserAbortChoice_vals[] = {
{ 0, "userSpecificReason" },
{ 1, "userResourceLimitation" },
{ 2, "resourceUnavailable" },
@@ -307,7 +307,7 @@ static int dissect_map_userAbort_impl(packet_info *pinfo, proto_tree *tree, tvbu
}
-static const value_string MAP_ProviderAbortReason_vals[] = {
+static const value_string MAP_DialoguePDU_MAP_ProviderAbortReason_vals[] = {
{ 0, "abnormalDialogue" },
{ 1, "invalidPDU" },
{ 0, NULL }
@@ -341,7 +341,7 @@ static int dissect_map_providerAbort_impl(packet_info *pinfo, proto_tree *tree,
}
-static const value_string MAP_DialoguePDU_vals[] = {
+static const value_string MAP_DialoguePDU_MAP_DialoguePDU_vals[] = {
{ 0, "map-open" },
{ 1, "map-accept" },
{ 2, "map-close" },
@@ -434,7 +434,7 @@ dissect_MAP_DialoguePDU_MAP_UserAbortInfo(gboolean implicit_tag _U_, tvbuff_t *t
}
-static const value_string ResourceUnavailableReason_vals[] = {
+static const value_string MAP_DialoguePDU_ResourceUnavailableReason_vals[] = {
{ 0, "shortTermResourceLimitation" },
{ 1, "longTermResourceLimitation" },
{ 0, NULL }
@@ -449,7 +449,7 @@ dissect_MAP_DialoguePDU_ResourceUnavailableReason(gboolean implicit_tag _U_, tvb
}
-static const value_string ProcedureCancellationReason_vals[] = {
+static const value_string MAP_DialoguePDU_ProcedureCancellationReason_vals[] = {
{ 0, "handoverCancellation" },
{ 1, "radioChannelRelease" },
{ 2, "networkPathRelease" },
@@ -525,7 +525,7 @@ void proto_register_MAP_DialoguePDU(void) {
"MAP-DialoguePDU/map-refuse", HFILL }},
{ &hf_MAP_DialoguePDU_reason,
{ "reason", "MAP_DialoguePDU.reason",
- FT_UINT32, BASE_DEC, VALS(Reason_vals), 0,
+ FT_UINT32, BASE_DEC, VALS(MAP_DialoguePDU_Reason_vals), 0,
"", HFILL }},
{ &hf_MAP_DialoguePDU_map_userAbort,
{ "map-userAbort", "MAP_DialoguePDU.map_userAbort",
@@ -533,7 +533,7 @@ void proto_register_MAP_DialoguePDU(void) {
"MAP-DialoguePDU/map-userAbort", HFILL }},
{ &hf_MAP_DialoguePDU_map_UserAbortChoice,
{ "map-UserAbortChoice", "MAP_DialoguePDU.map_UserAbortChoice",
- FT_UINT32, BASE_DEC, VALS(MAP_UserAbortChoice_vals), 0,
+ FT_UINT32, BASE_DEC, VALS(MAP_DialoguePDU_MAP_UserAbortChoice_vals), 0,
"", HFILL }},
{ &hf_MAP_DialoguePDU_map_providerAbort,
{ "map-providerAbort", "MAP_DialoguePDU.map_providerAbort",
@@ -541,7 +541,7 @@ void proto_register_MAP_DialoguePDU(void) {
"MAP-DialoguePDU/map-providerAbort", HFILL }},
{ &hf_MAP_DialoguePDU_map_ProviderAbortReason,
{ "map-ProviderAbortReason", "MAP_DialoguePDU.map_ProviderAbortReason",
- FT_UINT32, BASE_DEC, VALS(MAP_ProviderAbortReason_vals), 0,
+ FT_UINT32, BASE_DEC, VALS(MAP_DialoguePDU_MAP_ProviderAbortReason_vals), 0,
"", HFILL }},
{ &hf_MAP_DialoguePDU_userSpecificReason,
{ "userSpecificReason", "MAP_DialoguePDU.userSpecificReason",
@@ -553,11 +553,11 @@ void proto_register_MAP_DialoguePDU(void) {
"MAP-UserAbortChoice/userResourceLimitation", HFILL }},
{ &hf_MAP_DialoguePDU_resourceUnavailable,
{ "resourceUnavailable", "MAP_DialoguePDU.resourceUnavailable",
- FT_UINT32, BASE_DEC, VALS(ResourceUnavailable_vals), 0,
+ FT_UINT32, BASE_DEC, VALS(MAP_DialoguePDU_ResourceUnavailable_vals), 0,
"MAP-UserAbortChoice/resourceUnavailable", HFILL }},
{ &hf_MAP_DialoguePDU_applicationProcedureCancellation,
{ "applicationProcedureCancellation", "MAP_DialoguePDU.applicationProcedureCancellation",
- FT_UINT32, BASE_DEC, VALS(ApplicationProcedureCancellation_vals), 0,
+ FT_UINT32, BASE_DEC, VALS(MAP_DialoguePDU_ApplicationProcedureCancellation_vals), 0,
"MAP-UserAbortChoice/applicationProcedureCancellation", HFILL }},
/*--- End of included file: packet-MAP_DialoguePDU-hfarr.c ---*/
diff --git a/epan/dissectors/packet-ccsds.c b/epan/dissectors/packet-ccsds.c
index b3292a672c..ac1f6ca281 100644
--- a/epan/dissectors/packet-ccsds.c
+++ b/epan/dissectors/packet-ccsds.c
@@ -235,7 +235,7 @@ proto_register_ccsds(void)
};
/* Register the protocol name and description */
- proto_ccsds = proto_register_protocol("CCSDS", "CCSDS", "CCSDS");
+ proto_ccsds = proto_register_protocol("CCSDS", "CCSDS", "ccsds");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_ccsds, hf, array_length(hf));
diff --git a/epan/dissectors/packet-dcom-sysact.c b/epan/dissectors/packet-dcom-sysact.c
index 19101f9c1e..05525eaf0d 100644
--- a/epan/dissectors/packet-dcom-sysact.c
+++ b/epan/dissectors/packet-dcom-sysact.c
@@ -58,13 +58,13 @@ proto_register_ISystemActivator (void)
{
static hf_register_info hf[] = {
{ &hf_opnum,
- { "Operation", "ISystemActivator.opnum", FT_UINT16, BASE_DEC,
+ { "Operation", "isystemactivator.opnum", FT_UINT16, BASE_DEC,
NULL, 0x0, "", HFILL }},
};
static gint *ett[] = {
&ett_ISystemActivator
};
- proto_ISystemActivator = proto_register_protocol ("ISystemActivator ISystemActivator Resolver", "ISystemActivator", "ISystemActivator");
+ proto_ISystemActivator = proto_register_protocol ("ISystemActivator ISystemActivator Resolver", "ISystemActivator", "isystemactivator");
proto_register_field_array (proto_ISystemActivator, hf, array_length (hf));
proto_register_subtree_array (ett, array_length (ett));
}
diff --git a/epan/dissectors/packet-fcdns.c b/epan/dissectors/packet-fcdns.c
index 7261410b1f..98ba7e7f62 100644
--- a/epan/dissectors/packet-fcdns.c
+++ b/epan/dissectors/packet-fcdns.c
@@ -1917,7 +1917,7 @@ proto_register_fcdns (void)
/* Register the protocol name and description */
proto_fcdns = proto_register_protocol("Fibre Channel Name Server",
- "FC-dNS", "FC-dNS");
+ "FC-dNS", "fcdns");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_fcdns, hf, array_length(hf));
diff --git a/epan/dissectors/packet-fcfzs.c b/epan/dissectors/packet-fcfzs.c
index d38761a18a..90afbfc6ac 100644
--- a/epan/dissectors/packet-fcfzs.c
+++ b/epan/dissectors/packet-fcfzs.c
@@ -897,7 +897,7 @@ proto_register_fcfzs(void)
};
/* Register the protocol name and description */
- proto_fcfzs = proto_register_protocol("Fibre Channel Fabric Zone Server", "FC FZS", "FZS");
+ proto_fcfzs = proto_register_protocol("Fibre Channel Fabric Zone Server", "FC FZS", "fcfzs");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_fcfzs, hf, array_length(hf));
diff --git a/epan/proto.c b/epan/proto.c
index 927d46b540..b9535573ed 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -2360,19 +2360,20 @@ proto_tree_get_parent(proto_tree *tree) {
int
proto_register_protocol(char *name, char *short_name, char *filter_name)
{
- protocol_t *protocol;
- header_field_info *hfinfo;
- int proto_id;
+ protocol_t *protocol;
+ header_field_info *hfinfo;
+ int proto_id;
char *existing_name;
- gint *key;
+ gint *key, i;
+ gboolean found_invalid;
- /*
- * Make sure there's not already a protocol with any of those
- * names. Crash if there is, as that's an error in the code
+ /*
+ * Make sure there's not already a protocol with any of those
+ * names. Crash if there is, as that's an error in the code
* or an inappropriate plugin.
* This situation has to be fixed to not register more than one
- * protocol with the same name.
- *
+ * protocol with the same name.
+ *
* This is done by reducing the number of strcmp (and alike) calls as much as possible,
* as this significally slows down startup time.
*
@@ -2387,7 +2388,7 @@ proto_register_protocol(char *name, char *short_name, char *filter_name)
existing_name = g_hash_table_lookup(proto_names, key);
if (existing_name != NULL) {
/* g_error will terminate the program */
- g_error("The protocol name \"%s\" is existing more than one time!"
+ g_error("Duplicate protocol name \"%s\"!"
" This might be caused by an inappropriate plugin or a development error.", name);
}
g_hash_table_insert(proto_names, key, name);
@@ -2396,46 +2397,59 @@ proto_register_protocol(char *name, char *short_name, char *filter_name)
*key = g_str_hash(short_name);
existing_name = g_hash_table_lookup(proto_short_names, key);
if (existing_name != NULL) {
- g_error("The protocol short_name \"%s\" is existing more than one time!"
+ g_error("Duplicate protocol short_name \"%s\"!"
" This might be caused by an inappropriate plugin or a development error.", short_name);
}
g_hash_table_insert(proto_short_names, key, short_name);
+ found_invalid = FALSE;
+ for (i = 0; i < strlen(filter_name); i++) {
+ if (! (islower(filter_name[i]) ||
+ isdigit(filter_name[i]) ||
+ filter_name[i] == '-' ||
+ filter_name[i] == '_' ||
+ filter_name[i] == '.' )) {
+ found_invalid = TRUE;
+ }
+ }
+ if (found_invalid) {
+ g_warning("Protocol filter name \"%s\" has one or more invalid characters.", filter_name);
+ }
key = g_malloc (sizeof(gint));
*key = g_str_hash(filter_name);
existing_name = g_hash_table_lookup(proto_filter_names, key);
if (existing_name != NULL) {
- g_error("The protocol filter_name \"%s\" is existing more than one time!"
+ g_error("Duplicate protocol filter_name \"%s\"!"
" This might be caused by an inappropriate plugin or a development error.", filter_name);
}
g_hash_table_insert(proto_filter_names, key, filter_name);
- /* Add this protocol to the list of known protocols; the list
- is sorted by protocol short name. */
- protocol = g_malloc(sizeof (protocol_t));
- protocol->name = name;
- protocol->short_name = short_name;
- protocol->filter_name = filter_name;
- protocol->fields = NULL;
- protocol->is_enabled = TRUE; /* protocol is enabled by default */
- protocol->can_toggle = TRUE;
+ /* Add this protocol to the list of known protocols; the list
+ is sorted by protocol short name. */
+ protocol = g_malloc(sizeof (protocol_t));
+ protocol->name = name;
+ protocol->short_name = short_name;
+ protocol->filter_name = filter_name;
+ protocol->fields = NULL;
+ protocol->is_enabled = TRUE; /* protocol is enabled by default */
+ protocol->can_toggle = TRUE;
/* list will be sorted later by name, when all protocols completed registering */
protocols = g_list_append(protocols, protocol);
- /* Here we do allocate a new header_field_info struct */
- hfinfo = g_mem_chunk_alloc(gmc_hfinfo);
- hfinfo->name = name;
- hfinfo->abbrev = filter_name;
- hfinfo->type = FT_PROTOCOL;
- hfinfo->strings = NULL;
- hfinfo->bitmask = 0;
- hfinfo->bitshift = 0;
- hfinfo->blurb = "";
- hfinfo->parent = -1; /* this field differentiates protos and fields */
-
- proto_id = proto_register_field_init(hfinfo, hfinfo->parent);
- protocol->proto_id = proto_id;
- return proto_id;
+ /* Here we do allocate a new header_field_info struct */
+ hfinfo = g_mem_chunk_alloc(gmc_hfinfo);
+ hfinfo->name = name;
+ hfinfo->abbrev = filter_name;
+ hfinfo->type = FT_PROTOCOL;
+ hfinfo->strings = NULL;
+ hfinfo->bitmask = 0;
+ hfinfo->bitshift = 0;
+ hfinfo->blurb = "";
+ hfinfo->parent = -1; /* this field differentiates protos and fields */
+
+ proto_id = proto_register_field_init(hfinfo, hfinfo->parent);
+ protocol->proto_id = proto_id;
+ return proto_id;
}
/*