From: Victor Julien Date: Thu, 9 Jan 2014 10:32:40 +0000 (+0100) Subject: app layer: uint16_t alproto -> AppProto alproto X-Git-Tag: suricata-2.0rc1~249 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f5f148805c1b47231bd1e921eebee883a520a214;p=thirdparty%2Fsuricata.git app layer: uint16_t alproto -> AppProto alproto This conversion was missing in a couple of places. --- diff --git a/src/app-layer-detect-proto.c b/src/app-layer-detect-proto.c index 8359e46fba..d98e1b9fd9 100644 --- a/src/app-layer-detect-proto.c +++ b/src/app-layer-detect-proto.c @@ -65,7 +65,7 @@ #include "runmodes.h" typedef struct AppLayerProtoDetectProbingParserElement_ { - uint16_t alproto; + AppProto alproto; /* \todo don't really need it. See if you can get rid of it */ uint16_t port; /* \todo calculate at runtime and get rid of this var */ @@ -388,7 +388,7 @@ static void AppLayerProtoDetectPPGetIpprotos(AppProto alproto, SCReturn; } -static uint32_t AppLayerProtoDetectProbingParserGetMask(uint16_t alproto) +static uint32_t AppLayerProtoDetectProbingParserGetMask(AppProto alproto) { SCEnter(); @@ -490,7 +490,7 @@ static inline void DeAllocAppLayerProtoDetectProbingParser(AppLayerProtoDetectPr } static AppLayerProtoDetectProbingParserElement * -AppLayerProtoDetectCreateAppLayerProtoDetectProbingParserElement(uint16_t alproto, +AppLayerProtoDetectCreateAppLayerProtoDetectProbingParserElement(AppProto alproto, uint16_t port, uint16_t min_depth, uint16_t max_depth, @@ -752,7 +752,7 @@ static inline void AppendAppLayerProtoDetectProbingParserPort(AppLayerProtoDetec static inline void AppLayerProtoDetectInsertNewProbingParser(AppLayerProtoDetectProbingParser **pp, uint16_t ip_proto, uint16_t port, - uint16_t alproto, + AppProto alproto, uint16_t min_depth, uint16_t max_depth, uint8_t direction, ProbingParserFPtr ProbingParser) @@ -1153,7 +1153,7 @@ static int AppLayerProtoDetectPMAddSignature(AppLayerProtoDetectPMCtx *ctx, Dete SCReturnInt(ret); } -static int AppLayerProtoDetectPMRegisterPattern(uint8_t ipproto, uint16_t alproto, +static int AppLayerProtoDetectPMRegisterPattern(uint8_t ipproto, AppProto alproto, char *pattern, uint16_t depth, uint16_t offset, uint8_t direction, @@ -1286,7 +1286,7 @@ int AppLayerProtoDetectPrepareState(void) void AppLayerProtoDetectPPRegister(uint8_t ipproto, char *portstr, - uint16_t alproto, + AppProto alproto, uint16_t min_depth, uint16_t max_depth, uint8_t direction, ProbingParserFPtr ProbingParser) @@ -2676,7 +2676,7 @@ int AppLayerProtoDetectTest14(void) typedef struct AppLayerProtoDetectPPTestDataElement_ { char *alproto_name; - uint16_t alproto; + AppProto alproto; uint16_t port; uint32_t alproto_mask; uint32_t min_depth; diff --git a/src/app-layer-dns-common.c b/src/app-layer-dns-common.c index 28df0130e8..e07920d755 100644 --- a/src/app-layer-dns-common.c +++ b/src/app-layer-dns-common.c @@ -69,7 +69,7 @@ int DNSStateGetEventInfo(const char *event_name, return 0; } -void DNSAppLayerRegisterGetEventInfo(uint8_t ipproto, uint16_t alproto) +void DNSAppLayerRegisterGetEventInfo(uint8_t ipproto, AppProto alproto) { AppLayerParserRegisterGetEventInfo(ipproto, alproto, DNSStateGetEventInfo); diff --git a/src/app-layer-dns-common.h b/src/app-layer-dns-common.h index 6e42cf02f5..6fb13c8f2e 100644 --- a/src/app-layer-dns-common.h +++ b/src/app-layer-dns-common.h @@ -165,7 +165,7 @@ void DNSParserRegisterTests(void); void DNSAppLayerDecoderEventsRegister(int alproto); int DNSStateGetEventInfo(const char *event_name, int *event_id, AppLayerEventType *event_type); -void DNSAppLayerRegisterGetEventInfo(uint8_t ipproto, uint16_t alproto); +void DNSAppLayerRegisterGetEventInfo(uint8_t ipproto, AppProto alproto); void *DNSGetTx(void *alstate, uint64_t tx_id); uint64_t DNSGetTxCnt(void *alstate); diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index a791fa31ce..6cfe49e5e8 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -466,7 +466,7 @@ void AppLayerParserRegisterGetTx(uint8_t ipproto, AppProto alproto, } void AppLayerParserRegisterGetStateProgressCompletionStatus(uint8_t ipproto, - uint16_t alproto, + AppProto alproto, int (*StateGetProgressCompletionStatus)(uint8_t direction)) { SCEnter(); @@ -667,7 +667,7 @@ int AppLayerParserGetEventInfo(uint8_t ipproto, AppProto alproto, const char *ev SCReturnInt(r); } -uint8_t AppLayerParserGetFirstDataDir(uint8_t ipproto, uint16_t alproto) +uint8_t AppLayerParserGetFirstDataDir(uint8_t ipproto, AppProto alproto) { SCEnter(); SCReturnCT(alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto]. @@ -1179,7 +1179,7 @@ void AppLayerParserRegisterUnittests(void) SCEnter(); int ip; - uint16_t alproto; + AppProto alproto; AppLayerParserProtoCtx *ctx; for (ip = 0; ip < FLOW_PROTO_DEFAULT; ip++) { diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index 1b91329375..4527af3375 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -105,7 +105,7 @@ void AppLayerParserRegisterGetTxCnt(uint8_t ipproto, AppProto alproto, void AppLayerParserRegisterGetTx(uint8_t ipproto, AppProto alproto, void *(StateGetTx)(void *alstate, uint64_t tx_id)); void AppLayerParserRegisterGetStateProgressCompletionStatus(uint8_t ipproto, - uint16_t alproto, + AppProto alproto, int (*StateGetStateProgressCompletionStatus)(uint8_t direction)); void AppLayerParserRegisterGetEventInfo(uint8_t ipproto, AppProto alproto, int (*StateGetEventInfo)(const char *event_name, int *event_id, @@ -142,7 +142,7 @@ int AppLayerParserGetEventInfo(uint8_t ipproto, AppProto alproto, const char *ev uint64_t AppLayerParserGetTransactionActive(uint8_t ipproto, AppProto alproto, void *pstate, uint8_t direction); -uint8_t AppLayerParserGetFirstDataDir(uint8_t ipproto, uint16_t alproto); +uint8_t AppLayerParserGetFirstDataDir(uint8_t ipproto, AppProto alproto); /***** General *****/ diff --git a/src/app-layer-smb.c b/src/app-layer-smb.c index d22d4f44c5..039920597c 100644 --- a/src/app-layer-smb.c +++ b/src/app-layer-smb.c @@ -2187,7 +2187,7 @@ int SMBParserTest05(void) uint32_t smblen2 = sizeof(smbbuf2); int result = 0; - uint16_t alproto; + AppProto alproto; Flow f; void *alpd_tctx; memset(&f, 0, sizeof(f)); @@ -2270,7 +2270,7 @@ int SMBParserTest06(void) uint32_t smblen2 = sizeof(smbbuf2); int result = 0; - uint16_t alproto; + AppProto alproto; Flow f; void *alpd_tctx; memset(&f, 0, sizeof(f)); diff --git a/src/app-layer.c b/src/app-layer.c index bd36d14e91..f0f9a2071e 100644 --- a/src/app-layer.c +++ b/src/app-layer.c @@ -56,7 +56,7 @@ typedef struct AppLayerThreadCtx_ { uint64_t ticks_start; uint64_t ticks_end; uint64_t ticks_spent; - uint16_t alproto; + AppProto alproto; uint64_t proto_detect_ticks_start; uint64_t proto_detect_ticks_end; uint64_t proto_detect_ticks_spent; @@ -76,8 +76,8 @@ int AppLayerHandleTCPData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx, DEBUG_ASSERT_FLOW_LOCKED(f); AppLayerThreadCtx *app_tctx = ra_ctx->app_tctx; - uint16_t *alproto; - uint16_t *alproto_otherdir; + AppProto *alproto; + AppProto *alproto_otherdir; uint8_t dir; uint32_t data_al_so_far; int r = 0; diff --git a/src/detect-app-layer-event.c b/src/detect-app-layer-event.c index e21a206b87..55b8a70b80 100644 --- a/src/detect-app-layer-event.c +++ b/src/detect-app-layer-event.c @@ -169,7 +169,7 @@ static DetectAppLayerEventData *DetectAppLayerEventParseAppP1(const char *arg) { /* period index */ DetectAppLayerEventData *aled; - uint16_t alproto; + AppProto alproto; const char *p_idx; char alproto_name[50]; diff --git a/src/detect-app-layer-event.h b/src/detect-app-layer-event.h index 6a5ac42d97..a3ed608828 100644 --- a/src/detect-app-layer-event.h +++ b/src/detect-app-layer-event.h @@ -25,7 +25,7 @@ #define __DETECT_APP_LAYER_EVENT_H__ typedef struct DetectAppLayerEventData_ { - uint16_t alproto; + AppProto alproto; int event_id; char *arg; diff --git a/src/detect-app-layer-protocol.c b/src/detect-app-layer-protocol.c index cb07fbf0fa..4bc1a3e452 100644 --- a/src/detect-app-layer-protocol.c +++ b/src/detect-app-layer-protocol.c @@ -51,7 +51,7 @@ int DetectAppLayerProtocolMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx, static DetectAppLayerProtocolData *DetectAppLayerProtocolParse(const char *arg) { DetectAppLayerProtocolData *data; - uint16_t alproto = ALPROTO_UNKNOWN; + AppProto alproto = ALPROTO_UNKNOWN; uint8_t negated = 0; if (arg == NULL) { diff --git a/src/detect-app-layer-protocol.h b/src/detect-app-layer-protocol.h index 07a34e519d..616c4f2a56 100644 --- a/src/detect-app-layer-protocol.h +++ b/src/detect-app-layer-protocol.h @@ -25,7 +25,7 @@ #define __DETECT_APP_LAYER_PROTOCOL__H__ typedef struct DetectAppLayerProtocolData_ { - uint16_t alproto; + AppProto alproto; uint8_t negated; } DetectAppLayerProtocolData; diff --git a/src/detect-engine-apt-event.c b/src/detect-engine-apt-event.c index 9488491f21..5ca416892d 100644 --- a/src/detect-engine-apt-event.c +++ b/src/detect-engine-apt-event.c @@ -40,7 +40,7 @@ int DetectEngineAptEventInspect(ThreadVars *tv, { AppLayerDecoderEvents *decoder_events = NULL; int r = 0; - uint16_t alproto; + AppProto alproto; SigMatch *sm; DetectAppLayerEventData *aled = NULL; diff --git a/src/detect-engine-state.c b/src/detect-engine-state.c index 7e310359b4..da8e0bdcf9 100644 --- a/src/detect-engine-state.c +++ b/src/detect-engine-state.c @@ -156,7 +156,7 @@ static int DeStateStoreFilestoreSigsCantMatch(SigGroupHead *sgh, DetectEngineSta return 0; } -static void DeStateResetFileInspection(Flow *f, uint16_t alproto, void *alstate, uint8_t direction) +static void DeStateResetFileInspection(Flow *f, AppProto alproto, void *alstate, uint8_t direction) { if (f == NULL || alproto != ALPROTO_HTTP || alstate == NULL || f->de_state == NULL) return; @@ -212,7 +212,7 @@ void DetectEngineStateFree(DetectEngineState *state) return; } -int DeStateFlowHasInspectableState(Flow *f, uint16_t alproto, uint16_t alversion, uint8_t flags) +int DeStateFlowHasInspectableState(Flow *f, AppProto alproto, uint16_t alversion, uint8_t flags) { int r = 0; @@ -240,7 +240,7 @@ int DeStateFlowHasInspectableState(Flow *f, uint16_t alproto, uint16_t alversion int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Signature *s, Packet *p, Flow *f, uint8_t flags, - void *alstate, uint16_t alproto, uint16_t alversion) + void *alstate, AppProto alproto, uint16_t alversion) { DetectEngineAppInspectionEngine *engine = NULL; SigMatch *sm = NULL; @@ -452,7 +452,7 @@ int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx, void DeStateDetectContinueDetection(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p, Flow *f, uint8_t flags, void *alstate, - uint16_t alproto, uint16_t alversion) + AppProto alproto, uint16_t alversion) { SCMutexLock(&f->de_state_m); diff --git a/src/detect-engine-state.h b/src/detect-engine-state.h index 7606278f9d..1e47dd462d 100644 --- a/src/detect-engine-state.h +++ b/src/detect-engine-state.h @@ -150,7 +150,7 @@ void DetectEngineStateFree(DetectEngineState *state); * \retval 1 Has state. * \retval 0 Has no state. */ -int DeStateFlowHasInspectableState(Flow *f, uint16_t alproto, uint16_t alversion, uint8_t flags); +int DeStateFlowHasInspectableState(Flow *f, AppProto alproto, uint16_t alversion, uint8_t flags); /** * \brief Match app layer sig list against app state and store relevant match @@ -171,7 +171,7 @@ int DeStateFlowHasInspectableState(Flow *f, uint16_t alproto, uint16_t alversion int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Signature *s, Packet *p, Flow *f, uint8_t flags, - void *alstate, uint16_t alproto, + void *alstate, AppProto alproto, uint16_t alversion); /** @@ -189,7 +189,7 @@ int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx, void DeStateDetectContinueDetection(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p, Flow *f, uint8_t flags, void *alstate, - uint16_t alproto, uint16_t alversion); + AppProto alproto, uint16_t alversion); /** * \brief Update the inspect id. diff --git a/src/detect-engine.c b/src/detect-engine.c index d9de03a02a..5127a385c1 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -108,7 +108,7 @@ static void DetectEnginePrintAppInspectionEngines(DetectEngineAppInspectionEngin { printf("\n"); - uint16_t alproto = ALPROTO_UNKNOWN + 1; + AppProto alproto = ALPROTO_UNKNOWN + 1; for ( ; alproto < ALPROTO_MAX; alproto++) { printf("alproto - %d\n", alproto); int dir = 0; @@ -137,7 +137,7 @@ void DetectEngineRegisterAppInspectionEngines(void) { struct tmp_t { uint8_t ipproto; - uint16_t alproto; + AppProto alproto; int32_t sm_list; uint32_t inspect_flags; uint32_t match_flags; @@ -362,7 +362,7 @@ static void AppendAppInspectionEngine(DetectEngineAppInspectionEngine *engine, } void DetectEngineRegisterAppInspectionEngine(uint8_t ipproto, - uint16_t alproto, + AppProto alproto, uint16_t dir, int32_t sm_list, uint32_t inspect_flags, diff --git a/src/detect-engine.h b/src/detect-engine.h index 14008ea860..73b3554f20 100644 --- a/src/detect-engine.h +++ b/src/detect-engine.h @@ -30,7 +30,7 @@ typedef struct DetectEngineAppInspectionEngine_ { uint8_t ipproto; - uint16_t alproto; + AppProto alproto; uint16_t dir; int32_t sm_list; @@ -82,7 +82,7 @@ const char *DetectSigmatchListEnumToString(enum DetectSigmatchListEnum type); * \param Callback The engine callback. */ void DetectEngineRegisterAppInspectionEngine(uint8_t ipproto, - uint16_t alproto, + AppProto alproto, uint16_t direction, int32_t sm_list, uint32_t inspect_flags, diff --git a/src/detect-parse.c b/src/detect-parse.c index e12bedbaa6..c898b49b3d 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -141,7 +141,7 @@ typedef struct SignatureParser_ { int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg, uint8_t sm_type, uint8_t sm_list, - uint16_t alproto, void (*CustomCallback)(Signature *s)) + AppProto alproto, void (*CustomCallback)(Signature *s)) { SigMatch *sm = NULL; int ret = -1; diff --git a/src/detect-parse.h b/src/detect-parse.h index e3f29383e3..c90560a916 100644 --- a/src/detect-parse.h +++ b/src/detect-parse.h @@ -62,7 +62,7 @@ void DetectParseDupSigHashFree(DetectEngineCtx *); int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg, uint8_t sm_type, uint8_t sm_list, - uint16_t alproto, void (*CustomCallback)(Signature *s)); + AppProto alproto, void (*CustomCallback)(Signature *s)); #endif /* __DETECT_PARSE_H__ */ diff --git a/src/detect-simd.c b/src/detect-simd.c index 0323ba8a02..0773bc964c 100644 --- a/src/detect-simd.c +++ b/src/detect-simd.c @@ -45,7 +45,7 @@ * The size of a register is leading here. */ void SigMatchSignaturesBuildMatchArray(DetectEngineThreadCtx *det_ctx, - Packet *p, SignatureMask mask, uint16_t alproto) + Packet *p, SignatureMask mask, AppProto alproto) { uint32_t u; SigIntId x; @@ -190,7 +190,7 @@ void SigMatchSignaturesBuildMatchArray(DetectEngineThreadCtx *det_ctx, * futher inspection. */ void SigMatchSignaturesBuildMatchArray(DetectEngineThreadCtx *det_ctx, - Packet *p, SignatureMask mask, uint16_t alproto) + Packet *p, SignatureMask mask, AppProto alproto) { uint32_t u; register uint64_t bm; /* bit mask, 64 bits used */ diff --git a/src/detect.c b/src/detect.c index f16209b346..e8b9d28476 100644 --- a/src/detect.c +++ b/src/detect.c @@ -496,7 +496,7 @@ int SigLoadSignatures(DetectEngineCtx *de_ctx, char *sig_file, int sig_file_excl */ int SigMatchSignaturesBuildMatchArrayAddSignature(DetectEngineThreadCtx *det_ctx, Packet *p, SignatureHeader *s, - uint16_t alproto) + AppProto alproto) { /* if the sig has alproto and the session as well they should match */ if (likely(s->flags & SIG_FLAG_APPLAYER)) { @@ -577,7 +577,7 @@ int SigMatchSignaturesBuildMatchArrayAddSignature(DetectEngineThreadCtx *det_ctx */ void SigMatchSignaturesBuildMatchArray(DetectEngineThreadCtx *det_ctx, Packet *p, SignatureMask mask, - uint16_t alproto) + AppProto alproto) { uint32_t u; @@ -790,7 +790,7 @@ end: */ static inline void DetectMpmPrefilter(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, StreamMsg *smsg, Packet *p, - uint8_t flags, uint16_t alproto, void *alstate, uint8_t *sms_runflags) + uint8_t flags, AppProto alproto, void *alstate, uint8_t *sms_runflags) { /* have a look at the reassembled stream (if any) */ if (p->flowflags & FLOW_PKT_ESTABLISHED) { @@ -1086,7 +1086,7 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh { uint8_t sms_runflags = 0; /* function flags */ uint8_t alert_flags = 0; - uint16_t alproto = ALPROTO_UNKNOWN; + AppProto alproto = ALPROTO_UNKNOWN; #ifdef PROFILING int smatch = 0; /* signature match: 1, no match: 0 */ #endif @@ -2043,7 +2043,7 @@ deonly: * SIG_MASK_REQUIRE_HTTP_STATE, SIG_MASK_REQUIRE_DCE_STATE */ static void -PacketCreateMask(Packet *p, SignatureMask *mask, uint16_t alproto, void *alstate, StreamMsg *smsg, +PacketCreateMask(Packet *p, SignatureMask *mask, AppProto alproto, void *alstate, StreamMsg *smsg, int app_decoder_events) { /* no payload inspect flag doesn't apply to smsg */ diff --git a/src/detect.h b/src/detect.h index 439edd1e00..86469995c4 100644 --- a/src/detect.h +++ b/src/detect.h @@ -340,7 +340,7 @@ typedef struct SignatureHeader_ { struct { /* coccinelle: SignatureHeader:flags:SIG_FLAG */ uint32_t flags; - uint16_t alproto; + AppProto alproto; uint16_t dsize_low; }; uint64_t hdr_copy1; @@ -379,7 +379,7 @@ typedef struct Signature_ { struct { /* coccinelle: Signature:flags:SIG_FLAG */ uint32_t flags; - uint16_t alproto; + AppProto alproto; uint16_t dsize_low; }; uint64_t hdr_copy1; @@ -888,7 +888,7 @@ typedef struct SigTableElmt_ { uint8_t flags, File *, Signature *, SigMatch *); /** app layer proto from app-layer-protos.h this match applies to */ - uint16_t alproto; + AppProto alproto; /** keyword setup function pointer */ int (*Setup)(DetectEngineCtx *, Signature *, char *); diff --git a/src/flow.h b/src/flow.h index b4ec666689..f9155b4c58 100644 --- a/src/flow.h +++ b/src/flow.h @@ -332,9 +332,9 @@ typedef struct Flow_ uint8_t protomap; uint8_t pad0; - uint16_t alproto; /**< \brief application level protocol */ - uint16_t alproto_ts; - uint16_t alproto_tc; + AppProto alproto; /**< \brief application level protocol */ + AppProto alproto_ts; + AppProto alproto_tc; uint32_t data_al_so_far[2];