From be4c6b85de69d24e733ce47f48e5cea91f8197c2 Mon Sep 17 00:00:00 2001 From: Jeff Lucovsky Date: Tue, 29 Oct 2019 11:24:53 +0100 Subject: [PATCH] general: Convert _Bool to bool This commit addresses task 3167 and changes usages of '_Bool` to `bool`. The latter is included from `suricata-common.h` --- src/decode-ipv6.h | 6 +++--- src/decode-tcp.h | 2 +- src/detect-app-layer-protocol.c | 6 +++--- src/detect-content.c | 2 +- src/detect-content.h | 2 +- src/detect-dsize.c | 6 +++--- src/detect-engine-prefilter-common.c | 16 ++++++++-------- src/detect-engine-prefilter-common.h | 6 +++--- src/detect-engine.c | 2 +- src/detect-engine.h | 2 +- src/detect-flow.c | 6 +++--- src/detect-fragbits.c | 6 +++--- src/detect-fragoffset.c | 6 +++--- src/detect-http-host.c | 4 ++-- src/detect-http-method.c | 4 ++-- src/detect-http-raw-header.c | 4 ++-- src/detect-icmp-id.c | 8 ++++---- src/detect-icmp-seq.c | 8 ++++---- src/detect-icode.c | 6 +++--- src/detect-id.c | 6 +++--- src/detect-itype.c | 6 +++--- src/detect-lua-extensions.c | 4 ++-- src/detect-tcp-ack.c | 6 +++--- src/detect-tcp-flags.c | 6 +++--- src/detect-tcp-seq.c | 6 +++--- src/detect-tcpmss.c | 6 +++--- src/detect-template2.c | 6 +++--- src/detect-tls-cert-fingerprint.c | 8 ++++---- src/detect-tls-cert-serial.c | 6 +++--- src/detect-tls-ja3-hash.c | 6 +++--- src/detect-tls-ja3s-hash.c | 6 +++--- src/detect-ttl.c | 6 +++--- src/detect.h | 6 +++--- src/util-thash.c | 2 +- src/util-thash.h | 4 ++-- 35 files changed, 96 insertions(+), 96 deletions(-) diff --git a/src/decode-ipv6.h b/src/decode-ipv6.h index 0598f0743d..654a151e20 100644 --- a/src/decode-ipv6.h +++ b/src/decode-ipv6.h @@ -213,11 +213,11 @@ typedef struct IPV6GenOptHdr_ typedef struct IPV6ExtHdrs_ { - _Bool rh_set; + bool rh_set; uint8_t rh_type; - _Bool fh_set; - _Bool fh_more_frags_set; + bool fh_set; + bool fh_more_frags_set; uint8_t fh_nh; uint8_t fh_prev_nh; diff --git a/src/decode-tcp.h b/src/decode-tcp.h index 1908042311..025e872860 100644 --- a/src/decode-tcp.h +++ b/src/decode-tcp.h @@ -153,7 +153,7 @@ typedef struct TCPHdr_ typedef struct TCPVars_ { /* commonly used and needed opts */ - _Bool ts_set; + bool ts_set; uint32_t ts_val; /* host-order */ uint32_t ts_ecr; /* host-order */ TCPOpt sack; diff --git a/src/detect-app-layer-protocol.c b/src/detect-app-layer-protocol.c index e3abe1d0ac..6466b2d05b 100644 --- a/src/detect-app-layer-protocol.c +++ b/src/detect-app-layer-protocol.c @@ -111,7 +111,7 @@ static DetectAppLayerProtocolData *DetectAppLayerProtocolParse(const char *arg, return data; } -static _Bool HasConflicts(const DetectAppLayerProtocolData *us, +static bool HasConflicts(const DetectAppLayerProtocolData *us, const DetectAppLayerProtocolData *them) { /* mixing negated and non negated is illegal */ @@ -228,7 +228,7 @@ PrefilterPacketAppProtoSet(PrefilterPacketHeaderValue *v, void *smctx) v->u8[2] = (uint8_t)a->negated; } -static _Bool +static bool PrefilterPacketAppProtoCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectAppLayerProtocolData *a = smctx; @@ -246,7 +246,7 @@ static int PrefilterSetupAppProto(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketAppProtoMatch); } -static _Bool PrefilterAppProtoIsPrefilterable(const Signature *s) +static bool PrefilterAppProtoIsPrefilterable(const Signature *s) { if (s->flags & SIG_FLAG_PDONLY) { SCLogDebug("prefilter on PD %u", s->id); diff --git a/src/detect-content.c b/src/detect-content.c index aea8776b63..8fb6f10d81 100644 --- a/src/detect-content.c +++ b/src/detect-content.c @@ -374,7 +374,7 @@ void DetectContentFree(void *ptr) * \retval 1 valid * \retval 0 invalid */ -_Bool DetectContentPMATCHValidateCallback(const Signature *s) +bool DetectContentPMATCHValidateCallback(const Signature *s) { if (!(s->flags & SIG_FLAG_DSIZE)) { return TRUE; diff --git a/src/detect-content.h b/src/detect-content.h index 484e8993a2..ce06c11bbc 100644 --- a/src/detect-content.h +++ b/src/detect-content.h @@ -120,7 +120,7 @@ int DetectContentSetup(DetectEngineCtx *de_ctx, Signature *s, const char *conten void DetectContentPrint(DetectContentData *); void DetectContentFree(void *); -_Bool DetectContentPMATCHValidateCallback(const Signature *s); +bool DetectContentPMATCHValidateCallback(const Signature *s); void DetectContentPropagateLimits(Signature *s); #endif /* __DETECT_CONTENT_H__ */ diff --git a/src/detect-dsize.c b/src/detect-dsize.c index 7f6deb2166..e0bf943f9d 100644 --- a/src/detect-dsize.c +++ b/src/detect-dsize.c @@ -57,7 +57,7 @@ static void DsizeRegisterTests(void); static void DetectDsizeFree(void *); static int PrefilterSetupDsize(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterDsizeIsPrefilterable(const Signature *s); +static bool PrefilterDsizeIsPrefilterable(const Signature *s); /** * \brief Registration function for dsize: keyword @@ -343,7 +343,7 @@ PrefilterPacketDsizeSet(PrefilterPacketHeaderValue *v, void *smctx) v->u16[2] = a->dsize2; } -static _Bool +static bool PrefilterPacketDsizeCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectDsizeData *a = smctx; @@ -362,7 +362,7 @@ static int PrefilterSetupDsize(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketDsizeMatch); } -static _Bool PrefilterDsizeIsPrefilterable(const Signature *s) +static bool PrefilterDsizeIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-engine-prefilter-common.c b/src/detect-engine-prefilter-common.c index b9495fa063..4c9e4f5e03 100644 --- a/src/detect-engine-prefilter-common.c +++ b/src/detect-engine-prefilter-common.c @@ -95,7 +95,7 @@ static void GetExtraMatch(const Signature *s, uint16_t *type, uint16_t *value) static int SetupEngineForPacketHeader(DetectEngineCtx *de_ctx, SigGroupHead *sgh, int sm_type, PrefilterPacketHeaderHashCtx *hctx, - _Bool (*Compare)(PrefilterPacketHeaderValue v, void *), + bool (*Compare)(PrefilterPacketHeaderValue v, void *), void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)) { Signature *s = NULL; @@ -200,7 +200,7 @@ static int SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(DetectEngineCtx *de_ctx, SigGroupHead *sgh, int sm_type, uint32_t *counts, void (*Set)(PrefilterPacketHeaderValue *v, void *), - _Bool (*Compare)(PrefilterPacketHeaderValue v, void *), + bool (*Compare)(PrefilterPacketHeaderValue v, void *), void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)) { Signature *s = NULL; @@ -254,7 +254,7 @@ SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(DetectEngineCtx *de_ctx, */ static void SetupSingle(DetectEngineCtx *de_ctx, HashListTable *hash_table, SigGroupHead *sgh, int sm_type, - _Bool (*Compare)(PrefilterPacketHeaderValue v, void *), + bool (*Compare)(PrefilterPacketHeaderValue v, void *), void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)) { @@ -273,7 +273,7 @@ static void SetupSingle(DetectEngineCtx *de_ctx, HashListTable *hash_table, static void SetupU8Hash(DetectEngineCtx *de_ctx, HashListTable *hash_table, SigGroupHead *sgh, int sm_type, void (*Set)(PrefilterPacketHeaderValue *v, void *), - _Bool (*Compare)(PrefilterPacketHeaderValue v, void *), + bool (*Compare)(PrefilterPacketHeaderValue v, void *), void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)) { @@ -325,10 +325,10 @@ static void SetupU8Hash(DetectEngineCtx *de_ctx, HashListTable *hash_table, static int PrefilterSetupPacketHeaderCommon(DetectEngineCtx *de_ctx, SigGroupHead *sgh, int sm_type, void (*Set)(PrefilterPacketHeaderValue *v, void *), - _Bool (*Compare)(PrefilterPacketHeaderValue v, void *), + bool (*Compare)(PrefilterPacketHeaderValue v, void *), void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx), - _Bool u8hash) + bool u8hash) { Signature *s = NULL; uint32_t sig = 0; @@ -395,7 +395,7 @@ error: int PrefilterSetupPacketHeaderU8Hash(DetectEngineCtx *de_ctx, SigGroupHead *sgh, int sm_type, void (*Set)(PrefilterPacketHeaderValue *v, void *), - _Bool (*Compare)(PrefilterPacketHeaderValue v, void *), + bool (*Compare)(PrefilterPacketHeaderValue v, void *), void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)) { @@ -406,7 +406,7 @@ int PrefilterSetupPacketHeaderU8Hash(DetectEngineCtx *de_ctx, int PrefilterSetupPacketHeader(DetectEngineCtx *de_ctx, SigGroupHead *sgh, int sm_type, void (*Set)(PrefilterPacketHeaderValue *v, void *), - _Bool (*Compare)(PrefilterPacketHeaderValue v, void *), + bool (*Compare)(PrefilterPacketHeaderValue v, void *), void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)) { diff --git a/src/detect-engine-prefilter-common.h b/src/detect-engine-prefilter-common.h index 6137f8b19b..b8f317f148 100644 --- a/src/detect-engine-prefilter-common.h +++ b/src/detect-engine-prefilter-common.h @@ -59,18 +59,18 @@ typedef struct PrefilterPacketU8HashCtx_ { int PrefilterSetupPacketHeader(DetectEngineCtx *de_ctx, SigGroupHead *sgh, int sm_type, void (*Set)(PrefilterPacketHeaderValue *v, void *), - _Bool (*Compare)(PrefilterPacketHeaderValue v, void *), + bool (*Compare)(PrefilterPacketHeaderValue v, void *), void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)); int PrefilterSetupPacketHeaderU8Hash(DetectEngineCtx *de_ctx, SigGroupHead *sgh, int sm_type, void (*Set)(PrefilterPacketHeaderValue *v, void *), - _Bool (*Compare)(PrefilterPacketHeaderValue v, void *), + bool (*Compare)(PrefilterPacketHeaderValue v, void *), void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)); -static inline _Bool +static inline bool PrefilterPacketHeaderExtraMatch(const PrefilterPacketHeaderCtx *ctx, const Packet *p) { diff --git a/src/detect-engine.c b/src/detect-engine.c index 8eb16dffd9..6b9eb775b9 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -950,7 +950,7 @@ void DetectBufferRunSetupCallback(const DetectEngineCtx *de_ctx, } void DetectBufferTypeRegisterValidateCallback(const char *name, - _Bool (*ValidateCallback)(const Signature *, const char **sigerror)) + bool (*ValidateCallback)(const Signature *, const char **sigerror)) { BUG_ON(g_buffer_type_reg_closed); DetectBufferTypeRegister(name); diff --git a/src/detect-engine.h b/src/detect-engine.h index 1e877a06c3..2df8655de8 100644 --- a/src/detect-engine.h +++ b/src/detect-engine.h @@ -52,7 +52,7 @@ const char *DetectBufferTypeGetDescriptionByName(const char *name); void DetectBufferTypeRegisterSetupCallback(const char *name, void (*Callback)(const DetectEngineCtx *, Signature *)); void DetectBufferTypeRegisterValidateCallback(const char *name, - _Bool (*ValidateCallback)(const Signature *, const char **sigerror)); + bool (*ValidateCallback)(const Signature *, const char **sigerror)); int DetectBufferTypeGetByIdTransforms(DetectEngineCtx *de_ctx, const int id, int *transforms, int transform_cnt); diff --git a/src/detect-flow.c b/src/detect-flow.c index 236025b4d3..67c58cedcf 100644 --- a/src/detect-flow.c +++ b/src/detect-flow.c @@ -56,7 +56,7 @@ void DetectFlowRegisterTests(void); void DetectFlowFree(void *); static int PrefilterSetupFlow(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterFlowIsPrefilterable(const Signature *s); +static bool PrefilterFlowIsPrefilterable(const Signature *s); /** * \brief Registration function for flow: keyword @@ -446,7 +446,7 @@ PrefilterPacketFlowSet(PrefilterPacketHeaderValue *v, void *smctx) v->u8[1] = fb->match_cnt; } -static _Bool +static bool PrefilterPacketFlowCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectFlowData *fb = smctx; @@ -466,7 +466,7 @@ static int PrefilterSetupFlow(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketFlowMatch); } -static _Bool PrefilterFlowIsPrefilterable(const Signature *s) +static bool PrefilterFlowIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-fragbits.c b/src/detect-fragbits.c index 6b600d412b..86bfed2493 100644 --- a/src/detect-fragbits.c +++ b/src/detect-fragbits.c @@ -74,7 +74,7 @@ static int DetectFragBitsSetup (DetectEngineCtx *, Signature *, const char *); static void DetectFragBitsFree(void *); static int PrefilterSetupFragBits(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterFragBitsIsPrefilterable(const Signature *s); +static bool PrefilterFragBitsIsPrefilterable(const Signature *s); /** * \brief Registration function for fragbits: keyword @@ -346,7 +346,7 @@ PrefilterPacketFragBitsSet(PrefilterPacketHeaderValue *v, void *smctx) v->u8[1] = fb->fragbits; } -static _Bool +static bool PrefilterPacketFragBitsCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectFragBitsData *fb = smctx; @@ -366,7 +366,7 @@ static int PrefilterSetupFragBits(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketFragBitsMatch); } -static _Bool PrefilterFragBitsIsPrefilterable(const Signature *s) +static bool PrefilterFragBitsIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-fragoffset.c b/src/detect-fragoffset.c index 7599703b4a..671250bb0b 100644 --- a/src/detect-fragoffset.c +++ b/src/detect-fragoffset.c @@ -51,7 +51,7 @@ void DetectFragOffsetRegisterTests(void); void DetectFragOffsetFree(void *); static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterFragOffsetIsPrefilterable(const Signature *s); +static bool PrefilterFragOffsetIsPrefilterable(const Signature *s); /** * \brief Registration function for fragoffset @@ -290,7 +290,7 @@ PrefilterPacketFragOffsetSet(PrefilterPacketHeaderValue *v, void *smctx) v->u16[1] = fb->frag_off; } -static _Bool +static bool PrefilterPacketFragOffsetCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectFragOffsetData *fb = smctx; @@ -310,7 +310,7 @@ static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketFragOffsetMatch); } -static _Bool PrefilterFragOffsetIsPrefilterable(const Signature *s) +static bool PrefilterFragOffsetIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-http-host.c b/src/detect-http-host.c index e471b4be32..3b74206066 100644 --- a/src/detect-http-host.c +++ b/src/detect-http-host.c @@ -62,7 +62,7 @@ static int DetectHttpHHSetup(DetectEngineCtx *, Signature *, const char *); #ifdef UNITTESTS static void DetectHttpHHRegisterTests(void); #endif -static _Bool DetectHttpHostValidateCallback(const Signature *s, const char **sigerror); +static bool DetectHttpHostValidateCallback(const Signature *s, const char **sigerror); static int DetectHttpHostSetup(DetectEngineCtx *, Signature *, const char *); static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx, const DetectEngineTransforms *transforms, @@ -165,7 +165,7 @@ static int DetectHttpHHSetup(DetectEngineCtx *de_ctx, Signature *s, const char * ALPROTO_HTTP); } -static _Bool DetectHttpHostValidateCallback(const Signature *s, const char **sigerror) +static bool DetectHttpHostValidateCallback(const Signature *s, const char **sigerror) { const SigMatch *sm = s->init_data->smlists[g_http_host_buffer_id]; for ( ; sm != NULL; sm = sm->next) { diff --git a/src/detect-http-method.c b/src/detect-http-method.c index 4095f8e6d9..d787dc50ce 100644 --- a/src/detect-http-method.c +++ b/src/detect-http-method.c @@ -66,7 +66,7 @@ static int DetectHttpMethodSetupSticky(DetectEngineCtx *de_ctx, Signature *s, co void DetectHttpMethodRegisterTests(void); #endif void DetectHttpMethodFree(void *); -static _Bool DetectHttpMethodValidateCallback(const Signature *s, const char **sigerror); +static bool DetectHttpMethodValidateCallback(const Signature *s, const char **sigerror); static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx, const DetectEngineTransforms *transforms, Flow *_f, const uint8_t _flow_flags, void *txv, const int list_id); @@ -157,7 +157,7 @@ static int DetectHttpMethodSetupSticky(DetectEngineCtx *de_ctx, Signature *s, co * \retval 1 valid * \retval 0 invalid */ -static _Bool DetectHttpMethodValidateCallback(const Signature *s, const char **sigerror) +static bool DetectHttpMethodValidateCallback(const Signature *s, const char **sigerror) { const SigMatch *sm = s->init_data->smlists[g_http_method_buffer_id]; for ( ; sm != NULL; sm = sm->next) { diff --git a/src/detect-http-raw-header.c b/src/detect-http-raw-header.c index 10250ba879..9e2e20cdc0 100644 --- a/src/detect-http-raw-header.c +++ b/src/detect-http-raw-header.c @@ -57,7 +57,7 @@ static int DetectHttpRawHeaderSetupSticky(DetectEngineCtx *de_ctx, Signature *s, #ifdef UNITTESTS static void DetectHttpRawHeaderRegisterTests(void); #endif -static _Bool DetectHttpRawHeaderValidateCallback(const Signature *s, const char **sigerror); +static bool DetectHttpRawHeaderValidateCallback(const Signature *s, const char **sigerror); static int g_http_raw_header_buffer_id = 0; static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx, const DetectEngineTransforms *transforms, Flow *_f, @@ -155,7 +155,7 @@ static int DetectHttpRawHeaderSetupSticky(DetectEngineCtx *de_ctx, Signature *s, return 0; } -static _Bool DetectHttpRawHeaderValidateCallback(const Signature *s, const char **sigerror) +static bool DetectHttpRawHeaderValidateCallback(const Signature *s, const char **sigerror) { if ((s->flags & (SIG_FLAG_TOCLIENT|SIG_FLAG_TOSERVER)) == (SIG_FLAG_TOCLIENT|SIG_FLAG_TOSERVER)) { *sigerror = "http_raw_header signature " diff --git a/src/detect-icmp-id.c b/src/detect-icmp-id.c index da9cb3016a..cb0058e399 100644 --- a/src/detect-icmp-id.c +++ b/src/detect-icmp-id.c @@ -49,7 +49,7 @@ static int DetectIcmpIdSetup(DetectEngineCtx *, Signature *, const char *); void DetectIcmpIdRegisterTests(void); void DetectIcmpIdFree(void *); static int PrefilterSetupIcmpId(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterIcmpIdIsPrefilterable(const Signature *s); +static bool PrefilterIcmpIdIsPrefilterable(const Signature *s); /** * \brief Registration function for icode: icmp_id @@ -70,7 +70,7 @@ void DetectIcmpIdRegister (void) DetectSetupParseRegexes(PARSE_REGEX, &parse_regex, &parse_regex_study); } -static inline _Bool GetIcmpId(Packet *p, uint16_t *id) +static inline bool GetIcmpId(Packet *p, uint16_t *id) { if (PKT_IS_PSEUDOPKT(p)) return FALSE; @@ -290,7 +290,7 @@ PrefilterPacketIcmpIdSet(PrefilterPacketHeaderValue *v, void *smctx) v->u16[0] = a->id; } -static _Bool +static bool PrefilterPacketIcmpIdCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectIcmpIdData *a = smctx; @@ -307,7 +307,7 @@ static int PrefilterSetupIcmpId(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketIcmpIdMatch); } -static _Bool PrefilterIcmpIdIsPrefilterable(const Signature *s) +static bool PrefilterIcmpIdIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-icmp-seq.c b/src/detect-icmp-seq.c index e9875b5cb4..3874112140 100644 --- a/src/detect-icmp-seq.c +++ b/src/detect-icmp-seq.c @@ -49,7 +49,7 @@ static int DetectIcmpSeqSetup(DetectEngineCtx *, Signature *, const char *); void DetectIcmpSeqRegisterTests(void); void DetectIcmpSeqFree(void *); static int PrefilterSetupIcmpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterIcmpSeqIsPrefilterable(const Signature *s); +static bool PrefilterIcmpSeqIsPrefilterable(const Signature *s); /** * \brief Registration function for icmp_seq @@ -70,7 +70,7 @@ void DetectIcmpSeqRegister (void) DetectSetupParseRegexes(PARSE_REGEX, &parse_regex, &parse_regex_study); } -static inline _Bool GetIcmpSeq(Packet *p, uint16_t *seq) +static inline bool GetIcmpSeq(Packet *p, uint16_t *seq) { uint16_t seqn; @@ -293,7 +293,7 @@ PrefilterPacketIcmpSeqSet(PrefilterPacketHeaderValue *v, void *smctx) v->u16[0] = a->seq; } -static _Bool +static bool PrefilterPacketIcmpSeqCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectIcmpSeqData *a = smctx; @@ -310,7 +310,7 @@ static int PrefilterSetupIcmpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketIcmpSeqMatch); } -static _Bool PrefilterIcmpSeqIsPrefilterable(const Signature *s) +static bool PrefilterIcmpSeqIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-icode.c b/src/detect-icode.c index 40f5c70ba5..4bab717542 100644 --- a/src/detect-icode.c +++ b/src/detect-icode.c @@ -53,7 +53,7 @@ void DetectICodeRegisterTests(void); void DetectICodeFree(void *); static int PrefilterSetupICode(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterICodeIsPrefilterable(const Signature *s); +static bool PrefilterICodeIsPrefilterable(const Signature *s); /** * \brief Registration function for icode: keyword @@ -320,7 +320,7 @@ PrefilterPacketICodeSet(PrefilterPacketHeaderValue *v, void *smctx) v->u8[2] = a->code2; } -static _Bool +static bool PrefilterPacketICodeCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectICodeData *a = smctx; @@ -339,7 +339,7 @@ static int PrefilterSetupICode(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketICodeMatch); } -static _Bool PrefilterICodeIsPrefilterable(const Signature *s) +static bool PrefilterICodeIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-id.c b/src/detect-id.c index 235a09c61d..bd1026929d 100644 --- a/src/detect-id.c +++ b/src/detect-id.c @@ -56,7 +56,7 @@ void DetectIdRegisterTests(void); void DetectIdFree(void *); static int PrefilterSetupId(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterIdIsPrefilterable(const Signature *s); +static bool PrefilterIdIsPrefilterable(const Signature *s); /** * \brief Registration function for keyword: id @@ -248,7 +248,7 @@ PrefilterPacketIdSet(PrefilterPacketHeaderValue *v, void *smctx) v->u16[0] = a->id; } -static _Bool +static bool PrefilterPacketIdCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectIdData *a = smctx; @@ -265,7 +265,7 @@ static int PrefilterSetupId(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketIdMatch); } -static _Bool PrefilterIdIsPrefilterable(const Signature *s) +static bool PrefilterIdIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-itype.c b/src/detect-itype.c index 522b637766..39286dccbf 100644 --- a/src/detect-itype.c +++ b/src/detect-itype.c @@ -53,7 +53,7 @@ void DetectITypeRegisterTests(void); void DetectITypeFree(void *); static int PrefilterSetupIType(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterITypeIsPrefilterable(const Signature *s); +static bool PrefilterITypeIsPrefilterable(const Signature *s); /** * \brief Registration function for itype: keyword @@ -324,7 +324,7 @@ PrefilterPacketITypeSet(PrefilterPacketHeaderValue *v, void *smctx) v->u8[2] = a->type2; } -static _Bool +static bool PrefilterPacketITypeCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectITypeData *a = smctx; @@ -343,7 +343,7 @@ static int PrefilterSetupIType(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketITypeMatch); } -static _Bool PrefilterITypeIsPrefilterable(const Signature *s) +static bool PrefilterITypeIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-lua-extensions.c b/src/detect-lua-extensions.c index 3edea09760..b9b38a74e6 100644 --- a/src/detect-lua-extensions.c +++ b/src/detect-lua-extensions.c @@ -108,7 +108,7 @@ static int GetFlow(lua_State *luastate, Flow **ret_f) } static int GetFlowVarById(lua_State *luastate, Flow *f, - FlowVar **ret_fv, _Bool fv_may_be_null, uint32_t *ret_idx) + FlowVar **ret_fv, bool fv_may_be_null, uint32_t *ret_idx) { DetectLuaData *ld = NULL; if (ret_idx) @@ -169,7 +169,7 @@ static int GetFlowVarByKey(lua_State *luastate, Flow *f, FlowVar **ret_fv) } static int GetFlowIntById(lua_State *luastate, Flow *f, - FlowVar **ret_fv, _Bool fv_may_be_null, uint32_t *ret_idx) + FlowVar **ret_fv, bool fv_may_be_null, uint32_t *ret_idx) { DetectLuaData *ld = NULL; if (ret_idx) diff --git a/src/detect-tcp-ack.c b/src/detect-tcp-ack.c index 313b79acfb..b9f01090b1 100644 --- a/src/detect-tcp-ack.c +++ b/src/detect-tcp-ack.c @@ -49,7 +49,7 @@ static int DetectAckMatch(DetectEngineThreadCtx *, static void DetectAckRegisterTests(void); static void DetectAckFree(void *); static int PrefilterSetupTcpAck(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterTcpAckIsPrefilterable(const Signature *s); +static bool PrefilterTcpAckIsPrefilterable(const Signature *s); void DetectAckRegister(void) { @@ -175,7 +175,7 @@ PrefilterPacketAckSet(PrefilterPacketHeaderValue *v, void *smctx) v->u32[0] = a->ack; } -static _Bool +static bool PrefilterPacketAckCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectAckData *a = smctx; @@ -192,7 +192,7 @@ static int PrefilterSetupTcpAck(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketAckMatch); } -static _Bool PrefilterTcpAckIsPrefilterable(const Signature *s) +static bool PrefilterTcpAckIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-tcp-flags.c b/src/detect-tcp-flags.c index cfade1c868..6e4bb7e411 100644 --- a/src/detect-tcp-flags.c +++ b/src/detect-tcp-flags.c @@ -63,7 +63,7 @@ static int DetectFlagsMatch (DetectEngineThreadCtx *, Packet *, static int DetectFlagsSetup (DetectEngineCtx *, Signature *, const char *); static void DetectFlagsFree(void *); -static _Bool PrefilterTcpFlagsIsPrefilterable(const Signature *s); +static bool PrefilterTcpFlagsIsPrefilterable(const Signature *s); static int PrefilterSetupTcpFlags(DetectEngineCtx *de_ctx, SigGroupHead *sgh); /** @@ -574,7 +574,7 @@ PrefilterPacketFlagsSet(PrefilterPacketHeaderValue *v, void *smctx) SCLogDebug("v->u8[0] = %02x", v->u8[0]); } -static _Bool +static bool PrefilterPacketFlagsCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectFlagsData *a = smctx; @@ -594,7 +594,7 @@ static int PrefilterSetupTcpFlags(DetectEngineCtx *de_ctx, SigGroupHead *sgh) } -static _Bool PrefilterTcpFlagsIsPrefilterable(const Signature *s) +static bool PrefilterTcpFlagsIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-tcp-seq.c b/src/detect-tcp-seq.c index c5790b9087..7ffe3720af 100644 --- a/src/detect-tcp-seq.c +++ b/src/detect-tcp-seq.c @@ -46,7 +46,7 @@ static int DetectSeqMatch(DetectEngineThreadCtx *, static void DetectSeqRegisterTests(void); static void DetectSeqFree(void *); static int PrefilterSetupTcpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterTcpSeqIsPrefilterable(const Signature *s); +static bool PrefilterTcpSeqIsPrefilterable(const Signature *s); void DetectSeqRegister(void) { @@ -170,7 +170,7 @@ PrefilterPacketSeqSet(PrefilterPacketHeaderValue *v, void *smctx) v->u32[0] = a->seq; } -static _Bool +static bool PrefilterPacketSeqCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectSeqData *a = smctx; @@ -187,7 +187,7 @@ static int PrefilterSetupTcpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketSeqMatch); } -static _Bool PrefilterTcpSeqIsPrefilterable(const Signature *s) +static bool PrefilterTcpSeqIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-tcpmss.c b/src/detect-tcpmss.c index 71337d9e20..7a8d03c35a 100644 --- a/src/detect-tcpmss.c +++ b/src/detect-tcpmss.c @@ -47,7 +47,7 @@ void DetectTcpmssFree (void *); void DetectTcpmssRegisterTests (void); #endif static int PrefilterSetupTcpmss(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterTcpmssIsPrefilterable(const Signature *s); +static bool PrefilterTcpmssIsPrefilterable(const Signature *s); /** * \brief Registration function for tcpmss: keyword @@ -333,7 +333,7 @@ PrefilterPacketTcpmssSet(PrefilterPacketHeaderValue *v, void *smctx) v->u16[2] = a->arg2; } -static _Bool +static bool PrefilterPacketTcpmssCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectTcpmssData *a = smctx; @@ -352,7 +352,7 @@ static int PrefilterSetupTcpmss(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketTcpmssMatch); } -static _Bool PrefilterTcpmssIsPrefilterable(const Signature *s) +static bool PrefilterTcpmssIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-template2.c b/src/detect-template2.c index e9b8d83965..d612631104 100644 --- a/src/detect-template2.c +++ b/src/detect-template2.c @@ -47,7 +47,7 @@ void DetectTemplate2Free (void *); void DetectTemplate2RegisterTests (void); #endif static int PrefilterSetupTemplate2(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterTemplate2IsPrefilterable(const Signature *s); +static bool PrefilterTemplate2IsPrefilterable(const Signature *s); /** * \brief Registration function for template2: keyword @@ -346,7 +346,7 @@ PrefilterPacketTemplate2Set(PrefilterPacketHeaderValue *v, void *smctx) v->u8[2] = a->arg2; } -static _Bool +static bool PrefilterPacketTemplate2Compare(PrefilterPacketHeaderValue v, void *smctx) { const DetectTemplate2Data *a = smctx; @@ -365,7 +365,7 @@ static int PrefilterSetupTemplate2(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketTemplate2Match); } -static _Bool PrefilterTemplate2IsPrefilterable(const Signature *s) +static bool PrefilterTemplate2IsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect-tls-cert-fingerprint.c b/src/detect-tls-cert-fingerprint.c index 111a2cfe7b..e923b5a75c 100644 --- a/src/detect-tls-cert-fingerprint.c +++ b/src/detect-tls-cert-fingerprint.c @@ -64,7 +64,7 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx, void *txv, const int list_id); static void DetectTlsFingerprintSetupCallback(const DetectEngineCtx *de_ctx, Signature *s); -static _Bool DetectTlsFingerprintValidateCallback(const Signature *s, +static bool DetectTlsFingerprintValidateCallback(const Signature *s, const char **sigerror); static int g_tls_cert_fingerprint_buffer_id = 0; @@ -148,7 +148,7 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx, return buffer; } -static _Bool DetectTlsFingerprintValidateCallback(const Signature *s, +static bool DetectTlsFingerprintValidateCallback(const Signature *s, const char **sigerror) { const SigMatch *sm = s->init_data->smlists[g_tls_cert_fingerprint_buffer_id]; @@ -166,7 +166,7 @@ static _Bool DetectTlsFingerprintValidateCallback(const Signature *s, return FALSE; } - _Bool have_delimiters = FALSE; + bool have_delimiters = FALSE; uint32_t u; for (u = 0; u < cd->content_len; u++) { @@ -206,7 +206,7 @@ static void DetectTlsFingerprintSetupCallback(const DetectEngineCtx *de_ctx, DetectContentData *cd = (DetectContentData *)sm->ctx; - _Bool changed = FALSE; + bool changed = FALSE; uint32_t u; for (u = 0; u < cd->content_len; u++) { diff --git a/src/detect-tls-cert-serial.c b/src/detect-tls-cert-serial.c index cdf96ab047..4c9cccfee1 100644 --- a/src/detect-tls-cert-serial.c +++ b/src/detect-tls-cert-serial.c @@ -64,7 +64,7 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx, void *txv, const int list_id); static void DetectTlsSerialSetupCallback(const DetectEngineCtx *de_ctx, Signature *s); -static _Bool DetectTlsSerialValidateCallback(const Signature *s, +static bool DetectTlsSerialValidateCallback(const Signature *s, const char **sigerror); static int g_tls_cert_serial_buffer_id = 0; @@ -147,7 +147,7 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx, return buffer; } -static _Bool DetectTlsSerialValidateCallback(const Signature *s, +static bool DetectTlsSerialValidateCallback(const Signature *s, const char **sigerror) { const SigMatch *sm = s->init_data->smlists[g_tls_cert_serial_buffer_id]; @@ -196,7 +196,7 @@ static void DetectTlsSerialSetupCallback(const DetectEngineCtx *de_ctx, DetectContentData *cd = (DetectContentData *)sm->ctx; - _Bool changed = FALSE; + bool changed = FALSE; uint32_t u; for (u = 0; u < cd->content_len; u++) { diff --git a/src/detect-tls-ja3-hash.c b/src/detect-tls-ja3-hash.c index f83a568c6f..57a79ef6e5 100644 --- a/src/detect-tls-ja3-hash.c +++ b/src/detect-tls-ja3-hash.c @@ -68,7 +68,7 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx, void *txv, const int list_id); static void DetectTlsJa3HashSetupCallback(const DetectEngineCtx *de_ctx, Signature *s); -static _Bool DetectTlsJa3HashValidateCallback(const Signature *s, +static bool DetectTlsJa3HashValidateCallback(const Signature *s, const char **sigerror); static int g_tls_ja3_hash_buffer_id = 0; @@ -160,7 +160,7 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx, return buffer; } -static _Bool DetectTlsJa3HashValidateCallback(const Signature *s, +static bool DetectTlsJa3HashValidateCallback(const Signature *s, const char **sigerror) { const SigMatch *sm = s->init_data->smlists[g_tls_ja3_hash_buffer_id]; @@ -202,7 +202,7 @@ static void DetectTlsJa3HashSetupCallback(const DetectEngineCtx *de_ctx, DetectContentData *cd = (DetectContentData *)sm->ctx; - _Bool changed = FALSE; + bool changed = FALSE; uint32_t u; for (u = 0; u < cd->content_len; u++) { diff --git a/src/detect-tls-ja3s-hash.c b/src/detect-tls-ja3s-hash.c index daddc1bef6..d7f97a2329 100644 --- a/src/detect-tls-ja3s-hash.c +++ b/src/detect-tls-ja3s-hash.c @@ -68,7 +68,7 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx, void *txv, const int list_id); static void DetectTlsJa3SHashSetupCallback(const DetectEngineCtx *de_ctx, Signature *s); -static _Bool DetectTlsJa3SHashValidateCallback(const Signature *s, +static bool DetectTlsJa3SHashValidateCallback(const Signature *s, const char **sigerror); static int g_tls_ja3s_hash_buffer_id = 0; @@ -158,7 +158,7 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx, return buffer; } -static _Bool DetectTlsJa3SHashValidateCallback(const Signature *s, +static bool DetectTlsJa3SHashValidateCallback(const Signature *s, const char **sigerror) { const SigMatch *sm = s->init_data->smlists[g_tls_ja3s_hash_buffer_id]; @@ -200,7 +200,7 @@ static void DetectTlsJa3SHashSetupCallback(const DetectEngineCtx *de_ctx, DetectContentData *cd = (DetectContentData *)sm->ctx; - _Bool changed = FALSE; + bool changed = FALSE; uint32_t u; for (u = 0; u < cd->content_len; u++) { diff --git a/src/detect-ttl.c b/src/detect-ttl.c index 00c57359f2..cabc158b22 100644 --- a/src/detect-ttl.c +++ b/src/detect-ttl.c @@ -51,7 +51,7 @@ void DetectTtlFree (void *); void DetectTtlRegisterTests (void); #endif static int PrefilterSetupTtl(DetectEngineCtx *de_ctx, SigGroupHead *sgh); -static _Bool PrefilterTtlIsPrefilterable(const Signature *s); +static bool PrefilterTtlIsPrefilterable(const Signature *s); /** * \brief Registration function for ttl: keyword @@ -331,7 +331,7 @@ PrefilterPacketTtlSet(PrefilterPacketHeaderValue *v, void *smctx) v->u8[2] = a->ttl2; } -static _Bool +static bool PrefilterPacketTtlCompare(PrefilterPacketHeaderValue v, void *smctx) { const DetectTtlData *a = smctx; @@ -350,7 +350,7 @@ static int PrefilterSetupTtl(DetectEngineCtx *de_ctx, SigGroupHead *sgh) PrefilterPacketTtlMatch); } -static _Bool PrefilterTtlIsPrefilterable(const Signature *s) +static bool PrefilterTtlIsPrefilterable(const Signature *s) { const SigMatch *sm; for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) { diff --git a/src/detect.h b/src/detect.h index 45dbc6e254..ca63c1ca70 100644 --- a/src/detect.h +++ b/src/detect.h @@ -426,8 +426,8 @@ typedef struct DetectBufferType_ { const char *description; int id; int parent_id; - _Bool mpm; - _Bool packet; /**< compat to packet matches */ + bool mpm; + bool packet; /**< compat to packet matches */ bool supports_transforms; void (*SetupCallback)(const struct DetectEngineCtx_ *, struct Signature_ *); bool (*ValidateCallback)(const struct Signature_ *, const char **sigerror); @@ -1185,7 +1185,7 @@ typedef struct SigTableElmt_ { /** keyword setup function pointer */ int (*Setup)(DetectEngineCtx *, Signature *, const char *); - _Bool (*SupportsPrefilter)(const Signature *s); + bool (*SupportsPrefilter)(const Signature *s); int (*SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh); void (*Free)(void *); diff --git a/src/util-thash.c b/src/util-thash.c index 5b4f688c44..76a8d70f50 100644 --- a/src/util-thash.c +++ b/src/util-thash.c @@ -296,7 +296,7 @@ THashTableContext* THashInit(const char *cnf_prefix, size_t data_size, int (*DataSet)(void *, void *), void (*DataFree)(void *), uint32_t (*DataHash)(void *), - _Bool (*DataCompare)(void *, void *)) + bool (*DataCompare)(void *, void *)) { THashTableContext *ctx = SCCalloc(1, sizeof(*ctx)); BUG_ON(!ctx); diff --git a/src/util-thash.h b/src/util-thash.h index 0418663e32..8ebd210fed 100644 --- a/src/util-thash.h +++ b/src/util-thash.h @@ -135,7 +135,7 @@ typedef struct THashDataConfig_ { int (*DataSet)(void *dst, void *src); void (*DataFree)(void *); uint32_t (*DataHash)(void *); - _Bool (*DataCompare)(void *, void *); + bool (*DataCompare)(void *, void *); } THashConfig; #define THASH_DATA_SIZE(ctx) (sizeof(THashData) + (ctx)->config.data_size) @@ -187,7 +187,7 @@ THashTableContext* THashInit(const char *cnf_prefix, size_t data_size, int (*DataSet)(void *dst, void *src), void (*DataFree)(void *), uint32_t (*DataHash)(void *), - _Bool (*DataCompare)(void *, void *)); + bool (*DataCompare)(void *, void *)); void THashShutdown(THashTableContext *ctx); -- 2.47.2