From: Victor Julien Date: Sat, 20 Dec 2014 11:28:01 +0000 (+0100) Subject: hostbits: prepare for xbits integration X-Git-Tag: suricata-2.1beta4~71 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=57d93cbcfec50ade29350cbfd423dbb4bbf832ec;p=thirdparty%2Fsuricata.git hostbits: prepare for xbits integration --- diff --git a/src/detect-hostbits.c b/src/detect-hostbits.c index 11897bda41..ff280e2a88 100644 --- a/src/detect-hostbits.c +++ b/src/detect-hostbits.c @@ -256,37 +256,42 @@ static int DetectHostbitMatchIsnotset (Packet *p, const DetectXbitsData *fd) return 0; } -/* - * returns 0: no match - * 1: match - * -1: error - */ - -int DetectHostbitMatch (ThreadVars *t, DetectEngineThreadCtx *det_ctx, Packet *p, Signature *s, const SigMatchCtx *ctx) +int DetectXbitMatchHost(Packet *p, const DetectXbitsData *xd) { - const DetectXbitsData *fd = (const DetectXbitsData *)ctx; - if (fd == NULL) - return 0; - - switch (fd->cmd) { + switch (xd->cmd) { case DETECT_XBITS_CMD_ISSET: - return DetectHostbitMatchIsset(p,fd); + return DetectHostbitMatchIsset(p,xd); case DETECT_XBITS_CMD_ISNOTSET: - return DetectHostbitMatchIsnotset(p,fd); + return DetectHostbitMatchIsnotset(p,xd); case DETECT_XBITS_CMD_SET: - return DetectHostbitMatchSet(p,fd); + return DetectHostbitMatchSet(p,xd); case DETECT_XBITS_CMD_UNSET: - return DetectHostbitMatchUnset(p,fd); + return DetectHostbitMatchUnset(p,xd); case DETECT_XBITS_CMD_TOGGLE: - return DetectHostbitMatchToggle(p,fd); + return DetectHostbitMatchToggle(p,xd); default: - SCLogError(SC_ERR_UNKNOWN_VALUE, "unknown cmd %" PRIu32 "", fd->cmd); + SCLogError(SC_ERR_UNKNOWN_VALUE, "unknown cmd %" PRIu32 "", xd->cmd); return 0; } return 0; } +/* + * returns 0: no match + * 1: match + * -1: error + */ + +int DetectHostbitMatch (ThreadVars *t, DetectEngineThreadCtx *det_ctx, Packet *p, Signature *s, const SigMatchCtx *ctx) +{ + const DetectXbitsData *xd = (const DetectXbitsData *)ctx; + if (xd == NULL) + return 0; + + return DetectXbitMatchHost(p, xd); +} + int DetectHostbitSetup (DetectEngineCtx *de_ctx, Signature *s, char *rawstr) { DetectXbitsData *cd = NULL;