app-layer: tell pp registrar if config was found

The probing parser registration function
AppLayerProtoDetectPPParseConfPorts was a void, meaning it would
give no feedback to the registering protocol implementation. If a
config was missing, it would just give up.

This patch changes it to return a bool. 0 if no config was found,
1 if a config was found.

This allows the caller to setup a default case.
pull/841/head
Victor Julien 12 years ago
parent ec4288f7c2
commit ab10c0a099

@ -1325,7 +1325,7 @@ void AppLayerProtoDetectPPRegister(uint8_t ipproto,
SCReturn;
}
void AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
int AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
uint8_t ipproto,
const char *alproto_name,
AppProto alproto,
@ -1338,6 +1338,7 @@ void AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
int r;
ConfNode *node;
ConfNode *port_node = NULL;
int config = 0;
r = snprintf(param, sizeof(param), "%s%s%s", "app-layer.protocols.",
alproto_name, ".detection-ports");
@ -1386,8 +1387,9 @@ void AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
}
config = 1;
end:
SCReturn;
SCReturnInt(config);
}
/***** PM registration *****/

@ -66,7 +66,10 @@ void AppLayerProtoDetectPPRegister(uint8_t ipproto,
uint16_t min_depth, uint16_t max_depth,
uint8_t direction,
ProbingParserFPtr ProbingParser);
void AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
/**
* \retval bool 0 if no config was found, 1 if config was found
*/
int AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
uint8_t ipproto,
const char *alproto_name,
AppProto alproto,

Loading…
Cancel
Save