Go to the documentation of this file.
52 #define MAX_ALPROTO_NAME 50
65 uint8_t
flags,
void *alstate,
void *tx, uint64_t tx_id);
66 static int g_applayer_events_list_id = 0;
77 DetectAppLayerEventPktMatch;
82 DetectEngineAptEventInspect, NULL);
84 DetectEngineAptEventInspect, NULL);
91 uint8_t
flags,
void *alstate,
void *tx, uint64_t tx_id)
97 if (decoder_events == NULL) {
105 if (AppLayerDecoderEventsIsEventSet(decoder_events, aled->
event_id)) {
145 AppLayerEventType *event_type)
147 uint8_t event_id = 0;
150 "supplied with packet based event - \"%s\" that isn't "
160 *event_type = APP_LAYER_EVENT_TYPE_PACKET;
165 static bool OutdatedEvent(
const char *raw)
167 if (strcmp(raw,
"tls.certificate_missing_element") == 0 ||
168 strcmp(raw,
"tls.certificate_unknown_element") == 0 ||
169 strcmp(raw,
"tls.certificate_invalid_string") == 0) {
175 static AppProto AppLayerEventGetProtoByName(
char *alproto_name)
188 SCLogError(
"app-layer-event keyword supplied "
189 "with no arguments. This keyword needs an argument.");
193 while (*arg !=
'\0' && isspace((
unsigned char)*arg))
196 AppLayerEventType event_type;
199 if (strchr(arg,
'.') == NULL) {
200 data = DetectAppLayerEventParsePkt(arg, &event_type);
206 bool needs_detctx =
false;
208 const char *p_idx = strchr(arg,
'.');
210 SCLogError(
"app-layer-event keyword is too long or malformed");
213 const char *event_name = p_idx + 1;
215 strlcpy(alproto_name, arg, p_idx - arg + 1);
217 const AppProto alproto = AppLayerEventGetProtoByName(alproto_name);
219 if (!strcmp(alproto_name,
"file")) {
223 "supplied with unknown protocol \"%s\"",
228 if (OutdatedEvent(arg)) {
230 SCLogError(
"app-layer-event keyword no longer supports event \"%s\"", arg);
233 SCLogWarning(
"app-layer-event keyword no longer supports event \"%s\"", arg);
239 if (s->
proto.
proto[IPPROTO_TCP / 8] & 1 << (IPPROTO_TCP % 8)) {
240 ipproto = IPPROTO_TCP;
241 }
else if (s->
proto.
proto[IPPROTO_UDP / 8] & 1 << (IPPROTO_UDP % 8)) {
242 ipproto = IPPROTO_UDP;
244 SCLogError(
"protocol %s is disabled", alproto_name);
249 uint8_t event_id = 0;
258 "protocol \"%s\" doesn't have event \"%s\" registered",
259 alproto_name, event_name);
263 "protocol \"%s\" doesn't have event \"%s\" registered",
264 alproto_name, event_name);
276 if (event_type == APP_LAYER_EVENT_TYPE_PACKET) {
286 g_applayer_events_list_id) == NULL) {
296 DetectAppLayerEventFree(
de_ctx, data);
void DetectAppLayerEventRegister(void)
Registers the keyword handlers for the "app-layer-event" keyword.
int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
SigTableElmt * sigmatch_table
void(* Free)(DetectEngineCtx *, void *)
AppLayerDecoderEvents * AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *tx)
int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto, void *alstate, uint8_t flags)
get the progress value for a tx/protocol
struct DetectAppLayerEventData_ DetectAppLayerEventData
@ DETECT_AL_APP_LAYER_EVENT
main detection engine ctx
int AppLayerParserGetStateProgressCompletionStatus(AppProto alproto, uint8_t direction)
int DetectEngineGetEventInfo(const char *event_name, uint8_t *event_id, AppLayerEventType *event_type)
#define SIG_FLAG_TOCLIENT
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
#define KEYWORD_PROFILING_START
Data structure to store app layer decoder events.
AppLayerDecoderEvents * app_layer_events
AppProto AppLayerGetProtoByName(char *alproto_name)
Given a protocol string, returns the corresponding internal protocol id.
#define SIG_FLAG_APPLAYER
int DetectBufferTypeGetByName(const char *name)
#define KEYWORD_PROFILING_END(ctx, type, m)
size_t strlcpy(char *dst, const char *src, size_t siz)
#define SIG_FLAG_TOSERVER
int AppLayerGetPktEventInfo(const char *event_name, uint8_t *event_id)
#define DETECT_ENGINE_INSPECT_SIG_MATCH
bool SigMatchStrictEnabled(const enum DetectKeywordId id)
#define SCLogWarning(...)
Macro used to log WARNING messages.
Data structures and function prototypes for keeping state for the detection engine.
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
#define DETECT_ENGINE_INSPECT_SIG_CANT_MATCH
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
#define DETECT_ENGINE_INSPECT_SIG_NO_MATCH
#define SCLogError(...)
Macro used to log ERROR messages.
void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
Registers an app inspection engine.
SigMatch * SigMatchAppendSMToList(DetectEngineCtx *de_ctx, Signature *s, uint16_t type, SigMatchCtx *ctx, const int list)
Append a SigMatch to the list type.
AppProto alproto
application level protocol
int AppLayerParserGetEventInfo(uint8_t ipproto, AppProto alproto, const char *event_name, uint8_t *event_id, AppLayerEventType *event_type)