Go to the documentation of this file.
65 #define KEYWORD_NAME "http.start"
66 #define KEYWORD_NAME_LEGACY "http_start"
67 #define KEYWORD_DOC "http-keywords.html#http-start"
68 #define BUFFER_NAME "http_start"
69 #define BUFFER_DESC "http start: request/response line + headers"
70 static int g_buffer_id = 0;
71 static int g_keyword_thread_id = 0;
73 #define BUFFER_SIZE_STEP 2048
76 static uint8_t *GetBufferForTX(
90 if (
flags & STREAM_TOSERVER) {
94 line = tx->request_line;
95 headers = tx->request_headers;
100 headers = tx->response_headers;
101 line = tx->response_line;
103 if (line == NULL || headers == NULL)
106 size_t line_size = bstr_len(line) + 2;
107 if (line_size + buf->
len > buf->
size) {
112 memcpy(buf->
buffer + buf->
len, bstr_ptr(line), bstr_size(line));
113 buf->
len += bstr_size(line);
118 size_t no_of_headers = htp_table_size(headers);
119 for (; i < no_of_headers; i++) {
120 htp_header_t *h = htp_table_get_index(headers, i, NULL);
121 size_t size1 = bstr_size(h->name);
122 size_t size2 = bstr_size(h->value);
123 size_t size = size1 + size2 + 4;
124 if (i + 1 == no_of_headers)
126 if (size + buf->
len > buf->
size) {
132 memcpy(buf->
buffer + buf->
len, bstr_ptr(h->name), bstr_size(h->name));
133 buf->
len += bstr_size(h->name);
136 memcpy(buf->
buffer + buf->
len, bstr_ptr(h->value), bstr_size(h->value));
137 buf->
len += bstr_size(h->value);
140 if (i + 1 == no_of_headers) {
146 *buffer_len = buf->
len;
156 uint32_t rawdata_len = 0;
157 uint8_t *rawdata = GetBufferForTX(txv, det_ctx, f, flow_flags, &rawdata_len);
158 if (rawdata_len == 0)
209 SCLogDebug(
"keyword %s registered. Thread id %d. "
210 "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.
#define KEYWORD_NAME_LEGACY
void DetectHttpStartRegister(void)
Registers the keyword handlers for the "http_start" keyword.
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
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)