|
|
|
@ -139,14 +139,16 @@ typedef struct AppLayerProbingParserElement_ {
|
|
|
|
const char *al_proto_name;
|
|
|
|
const char *al_proto_name;
|
|
|
|
uint16_t al_proto;
|
|
|
|
uint16_t al_proto;
|
|
|
|
uint16_t port;
|
|
|
|
uint16_t port;
|
|
|
|
|
|
|
|
uint16_t ip_proto;
|
|
|
|
uint8_t priority;
|
|
|
|
uint8_t priority;
|
|
|
|
uint8_t top;
|
|
|
|
uint8_t top;
|
|
|
|
|
|
|
|
uint16_t al_proto_mask;
|
|
|
|
/* the min length of data that has to be supplied to invoke the parser */
|
|
|
|
/* the min length of data that has to be supplied to invoke the parser */
|
|
|
|
uint32_t min_depth;
|
|
|
|
uint32_t min_depth;
|
|
|
|
/* the max length of data after which this parser won't be invoked */
|
|
|
|
/* the max length of data after which this parser won't be invoked */
|
|
|
|
uint32_t max_depth;
|
|
|
|
uint32_t max_depth;
|
|
|
|
/* the probing parser function */
|
|
|
|
/* the probing parser function */
|
|
|
|
uint16_t (*ProbingParser)(uint8_t *input, uint32_t input_len);
|
|
|
|
int16_t (*ProbingParser)(uint8_t *input, int32_t input_len);
|
|
|
|
|
|
|
|
|
|
|
|
struct AppLayerProbingParserElement_ *next;
|
|
|
|
struct AppLayerProbingParserElement_ *next;
|
|
|
|
} AppLayerProbingParserElement;
|
|
|
|
} AppLayerProbingParserElement;
|
|
|
|
@ -154,6 +156,8 @@ typedef struct AppLayerProbingParserElement_ {
|
|
|
|
typedef struct AppLayerProbingParser_ {
|
|
|
|
typedef struct AppLayerProbingParser_ {
|
|
|
|
/* the port no for which probing parser(s) are invoked */
|
|
|
|
/* the port no for which probing parser(s) are invoked */
|
|
|
|
uint16_t port;
|
|
|
|
uint16_t port;
|
|
|
|
|
|
|
|
uint16_t toserver_al_proto_mask;
|
|
|
|
|
|
|
|
uint16_t toclient_al_proto_mask;
|
|
|
|
/* the max depth for all the probing parsers registered for this port */
|
|
|
|
/* the max depth for all the probing parsers registered for this port */
|
|
|
|
uint16_t toserver_max_depth;
|
|
|
|
uint16_t toserver_max_depth;
|
|
|
|
uint16_t toclient_max_depth;
|
|
|
|
uint16_t toclient_max_depth;
|
|
|
|
@ -164,6 +168,14 @@ typedef struct AppLayerProbingParser_ {
|
|
|
|
struct AppLayerProbingParser_ *next;
|
|
|
|
struct AppLayerProbingParser_ *next;
|
|
|
|
} AppLayerProbingParser;
|
|
|
|
} AppLayerProbingParser;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct AppLayerProbingParserInfo_ {
|
|
|
|
|
|
|
|
const char *al_proto_name;
|
|
|
|
|
|
|
|
uint16_t ip_proto;
|
|
|
|
|
|
|
|
uint16_t al_proto;
|
|
|
|
|
|
|
|
int16_t (*ProbingParser)(uint8_t *input, int32_t input_len);
|
|
|
|
|
|
|
|
struct AppLayerProbingParserInfo_ *next;
|
|
|
|
|
|
|
|
} AppLayerProbingParserInfo;
|
|
|
|
|
|
|
|
|
|
|
|
#define APP_LAYER_PROBING_PARSER_PRIORITY_HIGH 1
|
|
|
|
#define APP_LAYER_PROBING_PARSER_PRIORITY_HIGH 1
|
|
|
|
#define APP_LAYER_PROBING_PARSER_PRIORITY_MEDIUM 2
|
|
|
|
#define APP_LAYER_PROBING_PARSER_PRIORITY_MEDIUM 2
|
|
|
|
#define APP_LAYER_PROBING_PARSER_PRIORITY_LOW 3
|
|
|
|
#define APP_LAYER_PROBING_PARSER_PRIORITY_LOW 3
|
|
|
|
@ -178,7 +190,7 @@ AppLayerProbingParser *AppLayerGetProbingParsers(AppLayerProbingParser *probing_
|
|
|
|
|
|
|
|
|
|
|
|
AppLayerProbingParser *pp = probing_parsers;
|
|
|
|
AppLayerProbingParser *pp = probing_parsers;
|
|
|
|
while (pp != NULL) {
|
|
|
|
while (pp != NULL) {
|
|
|
|
if (pp->port == port) {
|
|
|
|
if (pp->port == port || pp->port == 0) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pp = pp->next;
|
|
|
|
pp = pp->next;
|
|
|
|
@ -187,6 +199,19 @@ AppLayerProbingParser *AppLayerGetProbingParsers(AppLayerProbingParser *probing_
|
|
|
|
return pp;
|
|
|
|
return pp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline
|
|
|
|
|
|
|
|
AppLayerProbingParserInfo *AppLayerGetProbingParserInfo(AppLayerProbingParserInfo *ppi,
|
|
|
|
|
|
|
|
const char *al_proto_name)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
while (ppi != NULL) {
|
|
|
|
|
|
|
|
if (strcmp(ppi->al_proto_name, al_proto_name) == 0)
|
|
|
|
|
|
|
|
return ppi;
|
|
|
|
|
|
|
|
ppi = ppi->next;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct AlpProtoDetectCtx_;
|
|
|
|
struct AlpProtoDetectCtx_;
|
|
|
|
|
|
|
|
|
|
|
|
/* prototypes */
|
|
|
|
/* prototypes */
|
|
|
|
@ -205,8 +230,8 @@ int AppLayerRegisterParser(char *name, uint16_t proto, uint16_t parser_id,
|
|
|
|
void AppLayerRegisterProbingParser(struct AlpProtoDetectCtx_ *, uint16_t, uint16_t,
|
|
|
|
void AppLayerRegisterProbingParser(struct AlpProtoDetectCtx_ *, uint16_t, uint16_t,
|
|
|
|
const char *, uint16_t,
|
|
|
|
const char *, uint16_t,
|
|
|
|
uint16_t, uint16_t, uint8_t, uint8_t,
|
|
|
|
uint16_t, uint16_t, uint8_t, uint8_t,
|
|
|
|
uint8_t, uint16_t (*ProbingParser)
|
|
|
|
uint8_t,
|
|
|
|
(uint8_t *, uint32_t));
|
|
|
|
int16_t (*ProbingParser)(uint8_t *, int32_t));
|
|
|
|
void AppLayerRegisterStateFuncs(uint16_t proto, void *(*StateAlloc)(void),
|
|
|
|
void AppLayerRegisterStateFuncs(uint16_t proto, void *(*StateAlloc)(void),
|
|
|
|
void (*StateFree)(void *));
|
|
|
|
void (*StateFree)(void *));
|
|
|
|
void AppLayerRegisterTransactionIdFuncs(uint16_t proto,
|
|
|
|
void AppLayerRegisterTransactionIdFuncs(uint16_t proto,
|
|
|
|
@ -243,8 +268,9 @@ void AppLayerParserCleanupState(Flow *);
|
|
|
|
uint8_t AppLayerRegisterModule(void);
|
|
|
|
uint8_t AppLayerRegisterModule(void);
|
|
|
|
uint8_t AppLayerGetStorageSize(void);
|
|
|
|
uint8_t AppLayerGetStorageSize(void);
|
|
|
|
void AppLayerFreeProbingParsers(AppLayerProbingParser *);
|
|
|
|
void AppLayerFreeProbingParsers(AppLayerProbingParser *);
|
|
|
|
|
|
|
|
void AppLayerFreeProbingParsersInfo(AppLayerProbingParserInfo *);
|
|
|
|
|
|
|
|
void AppLayerPrintProbingParsers(AppLayerProbingParser *);
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t AppLayerGetStateVersion(Flow *f);
|
|
|
|
uint16_t AppLayerGetStateVersion(Flow *f);
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __APP_LAYER_PARSER_H__ */
|
|
|
|
#endif /* __APP_LAYER_PARSER_H__ */
|
|
|
|
|
|
|
|
|
|
|
|
|