Skip to content

Commit

Permalink
detect: reduce datatype scope for various keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjulien committed Jul 27, 2022
1 parent 77ffe4e commit 1eb901b
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 31 deletions.
11 changes: 11 additions & 0 deletions src/detect-app-layer-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@

#define MAX_ALPROTO_NAME 50

typedef struct DetectAppLayerEventData_ {
AppProto alproto;
uint8_t event_id;

/* it's used to check if there are event set into the detect engine */
bool needs_detctx;

char *arg;
} DetectAppLayerEventData;


static int DetectAppLayerEventPktMatch(DetectEngineThreadCtx *det_ctx,
Packet *p, const Signature *s, const SigMatchCtx *ctx);
static int DetectAppLayerEventSetupP1(DetectEngineCtx *, Signature *, const char *);
Expand Down
10 changes: 0 additions & 10 deletions src/detect-app-layer-event.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@
#ifndef __DETECT_APP_LAYER_EVENT_H__
#define __DETECT_APP_LAYER_EVENT_H__

typedef struct DetectAppLayerEventData_ {
AppProto alproto;
uint8_t event_id;

/* it's used to check if there are event set into the detect engine */
bool needs_detctx;

char *arg;
} DetectAppLayerEventData;

int DetectAppLayerEventPrepare(DetectEngineCtx *de_ctx, Signature *s);
void DetectAppLayerEventRegister(void);

Expand Down
5 changes: 5 additions & 0 deletions src/detect-app-layer-protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
static void DetectAppLayerProtocolRegisterTests(void);
#endif

typedef struct DetectAppLayerProtocolData_ {
AppProto alproto;
uint8_t negated;
} DetectAppLayerProtocolData;

static int DetectAppLayerProtocolPacketMatch(
DetectEngineThreadCtx *det_ctx,
Packet *p, const Signature *s, const SigMatchCtx *ctx)
Expand Down
5 changes: 0 additions & 5 deletions src/detect-app-layer-protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
#ifndef __DETECT_APP_LAYER_PROTOCOL__H__
#define __DETECT_APP_LAYER_PROTOCOL__H__

typedef struct DetectAppLayerProtocolData_ {
AppProto alproto;
uint8_t negated;
} DetectAppLayerProtocolData;

void DetectAppLayerProtocolRegister(void);

#endif /* __DETECT_APP_LAYER_PROTOCOL__H__ */
6 changes: 6 additions & 0 deletions src/detect-base64-decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
/* Arbitrary maximum buffer size for decoded base64 data. */
#define BASE64_DECODE_MAX 65535

typedef struct DetectBase64Decode_ {
uint32_t bytes;
uint32_t offset;
uint8_t relative;
} DetectBase64Decode;

static const char decode_pattern[] = "\\s*(bytes\\s+(\\d+),?)?"
"\\s*(offset\\s+(\\d+),?)?"
"\\s*(\\w+)?";
Expand Down
7 changes: 0 additions & 7 deletions src/detect-base64-decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@
#ifndef __DETECT_BASE64_DECODE_H__
#define __DETECT_BASE64_DECODE_H__


typedef struct DetectBase64Decode_ {
uint32_t bytes;
uint32_t offset;
uint8_t relative;
} DetectBase64Decode;

void DetectBase64DecodeRegister(void);
int DetectBase64DecodeDoMatch(DetectEngineThreadCtx *, const Signature *,
const SigMatchData *, const uint8_t *, uint32_t);
Expand Down
9 changes: 9 additions & 0 deletions src/detect-csum.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
#include "util-profiling.h"
#include "detect-engine-build.h"

#define DETECT_CSUM_VALID "valid"
#define DETECT_CSUM_INVALID "invalid"

typedef struct DetectCsumData_ {
/* Indicates if the csum-<protocol> keyword in a rule holds the
keyvalue "valid" or "invalid" */
int16_t valid;
} DetectCsumData;

/* prototypes for the "ipv4-csum" rule keyword */
static int DetectIPV4CsumMatch(DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
Expand Down
9 changes: 0 additions & 9 deletions src/detect-csum.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@
#ifndef __DETECT_CSUM_H__
#define __DETECT_CSUM_H__

#define DETECT_CSUM_VALID "valid"
#define DETECT_CSUM_INVALID "invalid"

typedef struct DetectCsumData_ {
/* Indicates if the csum-<protocol> keyword in a rule holds the
keyvalue "valid" or "invalid" */
int16_t valid;
} DetectCsumData;

void DetectCsumRegister(void);

#endif /* __DETECT_CSUM_H__ */
Expand Down

0 comments on commit 1eb901b

Please sign in to comment.