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
This commit is contained in:
Gerald Combs 2005-03-29 14:56:09 +00:00
parent e4f2f32fe6
commit 9ead15a6eb
7 changed files with 68 additions and 54 deletions

View File

@ -37,7 +37,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;

View File

@ -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 ---*/

View File

@ -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));

View File

@ -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));
}

View File

@ -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));

View File

@ -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));

View File

@ -2364,7 +2364,8 @@ proto_register_protocol(char *name, char *short_name, char *filter_name)
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
@ -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,16 +2397,29 @@ 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);