Go to the documentation of this file.
66 #define KEYWORD_NAME "http.header_names"
67 #define KEYWORD_NAME_LEGACY "http_header_names"
68 #define KEYWORD_DOC "http-keywords.html#http-header-names"
69 #define BUFFER_NAME "http_header_names"
70 #define BUFFER_DESC "http header names"
71 static int g_buffer_id = 0;
72 static int g_keyword_thread_id = 0;
74 #define BUFFER_SIZE_STEP 256
77 static uint8_t *GetBufferForTX(
90 if (
flags & STREAM_TOSERVER) {
94 headers = tx->request_headers;
99 headers = tx->response_headers;
106 size_t no_of_headers = htp_table_size(headers);
107 for (; i < no_of_headers; i++) {
108 htp_header_t *h = htp_table_get_index(headers, i, NULL);
109 size_t size = bstr_size(h->name) + 2;
112 if (i + 1 == no_of_headers)
115 SCLogDebug(
"size %"PRIuMAX
" + buf->len %u vs buf->size %u",
116 (uintmax_t)size, buf->
len, buf->
size);
117 if (size + buf->
len > buf->
size) {
129 memcpy(buf->
buffer + buf->
len, bstr_ptr(h->name), bstr_size(h->name));
130 buf->
len += bstr_size(h->name);
135 if (i + 1 == no_of_headers) {
141 *buffer_len = buf->
len;
151 uint32_t rawdata_len = 0;
152 uint8_t *rawdata = GetBufferForTX(txv, det_ctx, f, flow_flags, &rawdata_len);
153 if (rawdata_len == 0)
170 const uint8_t *b = NULL;
172 if (rs_http2_tx_get_header_names(txv, flow_flags, &b, &b_len) != 1)
174 if (b == NULL || b_len == 0)
251 SCLogDebug(
"keyword %s registered. Thread id %d. "
252 "Buffer %s registered. Buffer id %d",
int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
#define SIGMATCH_INFO_STICKY_BUFFER
SigTableElmt * sigmatch_table
uint8_t DetectEngineInspectBufferGeneric(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const DetectEngineAppInspectionEngine *engine, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Do the content inspection & validation for a signature.
int DetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto, void *alstate, uint8_t flags)
get the progress value for a tx/protocol
main detection engine ctx
#define SIG_FLAG_TOCLIENT
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
InspectionBuffer * InspectionBufferGet(DetectEngineThreadCtx *det_ctx, const int list_id)
int DetectBufferTypeGetByName(const char *name)
#define SIG_FLAG_TOSERVER
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistry *mpm_reg, int list_id)
void DetectAppLayerMpmRegister(const char *name, int direction, int priority, PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, AppProto alproto, int tx_min_progress)
register an app layer keyword for mpm
Data structures and function prototypes for keeping state for the detection engine.
void * HttpHeaderThreadDataInit(void *data)
void InspectionBufferApplyTransforms(InspectionBuffer *buffer, const DetectEngineTransforms *transforms)
void InspectionBufferSetup(DetectEngineThreadCtx *det_ctx, const int list_id, InspectionBuffer *buffer, const uint8_t *data, const uint32_t data_len)
setup the buffer with our initial data
@ DETECT_AL_HTTP_HEADER_NAMES
HttpHeaderBuffer * HttpHeaderGetBufferSpace(DetectEngineThreadCtx *det_ctx, Flow *f, uint8_t flags, const int keyword_id, HttpHeaderThreadData **ret_hdr_td)
int HttpHeaderExpandBuffer(HttpHeaderThreadData *td, HttpHeaderBuffer *buf, uint32_t size)
void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
Registers an app inspection engine.
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
void HttpHeaderThreadDataFree(void *data)
int DetectRegisterThreadCtxGlobalFuncs(const char *name, void *(*InitFunc)(void *), void *data, void(*FreeFunc)(void *))
Register Thread keyword context Funcs (Global)