Go to the documentation of this file.
37 static const char * IpProtoToString(
int ip_proto);
43 const char *ip_proto_str = NULL;
46 FatalError(
"Call to %s with NULL pointer.", __FUNCTION__);
50 FatalError(
"Unknown or invalid AppProto '%s'.",
p->name);
54 ip_proto_str = IpProtoToString(
p->ip_proto);
55 if (ip_proto_str == NULL)
56 FatalError(
"Unknown or unsupported ip_proto field in parser '%s'",
p->name);
58 SCLogDebug(
"%s %s protocol detection enabled.", ip_proto_str,
p->name);
62 if (
p->ProbeTS == NULL &&
p->ProbeTC == NULL) {
63 BUG_ON(
p->default_port != NULL);
69 SCLogDebug(
"Unittest mode, registering default configuration.");
71 p->max_depth, STREAM_TOSERVER,
p->ProbeTS,
p->ProbeTC);
77 p->min_depth,
p->max_depth,
p->ProbeTS,
p->ProbeTC)) {
78 if (enable_default != 0) {
79 SCLogDebug(
"No %s app-layer configuration, enabling %s"
80 " detection %s detection on port %s.",
81 p->name,
p->name, ip_proto_str,
p->default_port);
83 p->max_depth, STREAM_TOSERVER,
p->ProbeTS,
p->ProbeTC);
85 SCLogDebug(
"No %s app-layer configuration for detection port (%s).",
86 p->name, ip_proto_str);
96 const char *ip_proto_str = NULL;
99 FatalError(
"Call to %s with NULL pointer.", __FUNCTION__);
101 if (!AppProtoIsValid(alproto))
102 FatalError(
"Unknown or invalid AppProto '%s'.",
p->name);
106 ip_proto_str = IpProtoToString(
p->ip_proto);
107 if (ip_proto_str == NULL)
108 FatalError(
"Unknown or unsupported ip_proto field in parser '%s'",
p->name);
110 SCLogDebug(
"Registering %s protocol parser.",
p->name);
115 p->StateAlloc,
p->StateFree);
119 STREAM_TOSERVER,
p->ParseTS);
123 STREAM_TOCLIENT,
p->ParseTC);
128 p->StateTransactionFree);
138 p->StateGetProgress);
142 if (
p->StateGetEventInfo) {
144 p->StateGetEventInfo);
146 if (
p->StateGetEventInfoById) {
148 p->StateGetEventInfoById);
150 if (
p->LocalStorageAlloc &&
p->LocalStorageFree) {
152 p->LocalStorageAlloc,
p->LocalStorageFree);
158 if (
p->GetTxIterator) {
168 if (
p->GetStateData) {
172 if (
p->ApplyTxConfig) {
183 if (
p->GetFrameIdByName &&
p->GetFrameNameById) {
185 p->ip_proto, alproto,
p->GetFrameIdByName,
p->GetFrameNameById);
188 if (
p->GetStateIdByName &&
p->GetStateNameById) {
190 p->ip_proto, alproto,
p->GetStateIdByName,
p->GetStateNameById);
203 static const char * IpProtoToString(
int ip_proto)
void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto, int(*StateGetProgress)(void *alstate, uint8_t direction))
void AppLayerParserRegisterLocalStorageFunc(uint8_t ipproto, AppProto alproto, void *(*LocalStorageAlloc)(void), void(*LocalStorageFree)(void *))
void AppLayerParserRegisterOptionFlags(uint8_t ipproto, AppProto alproto, uint32_t flags)
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
void AppLayerParserRegisterStateProgressCompletionStatus(AppProto alproto, const int ts, const int tc)
void AppLayerParserRegisterTxFreeFunc(uint8_t ipproto, AppProto alproto, void(*StateTransactionFree)(void *, uint64_t))
void AppLayerParserRegisterGetStateFuncs(uint8_t ipproto, AppProto alproto, AppLayerParserGetStateIdByNameFn GetIdByNameFunc, AppLayerParserGetStateNameByIdFn GetNameByIdFunc)
void AppLayerParserRegisterApplyTxConfigFunc(uint8_t ipproto, AppProto alproto, void(*ApplyTxConfig)(void *state, void *tx, int mode, AppLayerTxConfig))
AppProto SCAppLayerRegisterProtocolDetection(const struct AppLayerProtocolDetect *p, int enable_default)
App layer protocol detection function.
int SCAppLayerRegisterParser(const struct AppLayerParser *p, AppProto alproto)
App layer protocol registration function.
AppProto StringToAppProto(const char *proto_name)
Maps a string to its ALPROTO_* equivalent.
void AppLayerParserRegisterGetFrameFuncs(uint8_t ipproto, AppProto alproto, AppLayerParserGetFrameIdByNameFn GetIdByNameFunc, AppLayerParserGetFrameNameByIdFn GetNameByIdFunc)
void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto, void *(*StateAlloc)(void *, AppProto), void(*StateFree)(void *))
void AppLayerParserRegisterGetEventInfo(uint8_t ipproto, AppProto alproto, int(*StateGetEventInfo)(const char *event_name, uint8_t *event_id, AppLayerEventType *event_type))
void AppLayerParserRegisterGetTxFilesFunc(uint8_t ipproto, AppProto alproto, AppLayerGetFileState(*GetTxFiles)(void *, uint8_t))
void AppLayerProtoDetectRegisterProtocol(AppProto alproto, const char *alproto_name)
Registers a protocol for protocol detection phase.
int RunmodeIsUnittests(void)
int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto, uint8_t direction, AppLayerParserFPtr Parser)
Register app layer parser for the protocol.
void SCAppLayerProtoDetectPPRegister(uint8_t ipproto, const char *portstr, AppProto alproto, uint16_t min_depth, uint16_t max_depth, uint8_t direction, ProbingParserFPtr ProbingParser1, ProbingParserFPtr ProbingParser2)
register parser at a port
void AppLayerParserRegisterGetTx(uint8_t ipproto, AppProto alproto, void *(StateGetTx)(void *alstate, uint64_t tx_id))
void AppLayerParserRegisterStateDataFunc(uint8_t ipproto, AppProto alproto, AppLayerStateData *(*GetStateData)(void *state))
int SCAppLayerRegisterParserAlias(const char *proto_name, const char *proto_alias)
void AppLayerParserRegisterTxDataFunc(uint8_t ipproto, AppProto alproto, AppLayerTxData *(*GetTxData)(void *tx))
First part of AppLayerParser, needed only for protocol detection.
void AppLayerParserRegisterGetTxIterator(uint8_t ipproto, AppProto alproto, AppLayerGetTxIteratorFunc Func)
int SCAppLayerProtoDetectPPParseConfPorts(const char *ipproto_name, uint8_t ipproto, const char *alproto_name, AppProto alproto, uint16_t min_depth, uint16_t max_depth, ProbingParserFPtr ProbingParserTs, ProbingParserFPtr ProbingParserTc)
void AppLayerProtoDetectRegisterAlias(const char *proto_name, const char *proto_alias)
void AppLayerParserRegisterGetTxCnt(uint8_t ipproto, AppProto alproto, uint64_t(*StateGetTxCnt)(void *alstate))
void AppLayerParserRegisterGetEventInfoById(uint8_t ipproto, AppProto alproto, int(*StateGetEventInfoById)(uint8_t event_id, const char **event_name, AppLayerEventType *event_type))