70#define EXPECTATION_TIMEOUT 30
71#define EXPECTATION_MAX_LEVEL 10
96static void ExpectationDataFree(
void *e)
110static void AppLayerFreeExpectation(
Expectation *exp)
114 if (expdata->DFree) {
115 expdata->DFree(exp->
data);
123static void ExpectationListFree(
void *el)
126 if (exp_list == NULL)
129 if (exp_list->length > 0) {
134 AppLayerFreeExpectation(exp);
148 g_ippair_expectation_id =
150 g_flow_expectation_id =
157 memset(ip_src, 0,
sizeof(*ip_src));
158 memset(ip_dst, 0,
sizeof(*ip_dst));
174 if (GetFlowAddresses(f, &ip_src, &ip_dst) == -1)
190 AppLayerFreeExpectation(exp);
193 if (exp_list->length == 0) {
195 ExpectationListFree(exp_list);
238 if (GetFlowAddresses(f, &ip_src, &ip_dst) == -1)
252 AppLayerFreeExpectation(last_exp);
260 exp_list =
SCCalloc(1,
sizeof(*exp_list));
261 if (exp_list == NULL)
263 exp_list->length = 0;
269 exp_list->length += 1;
290 return g_flow_expectation_id;
317 if (exp_list == NULL)
322 ((exp->
dp == 0) || (exp->
dp == f->
dp))) {
333 ExpectationDataFree(exp->
data);
341 exp_list = AppLayerExpectationRemove(ipp, exp_list, exp);
342 if (exp_list == NULL)
348 exp_list = AppLayerExpectationRemove(ipp, exp_list, exp);
349 if (exp_list == NULL)
374 if (exp_list == NULL)
379 if (exp->
orig_f == (
void *)f) {
380 exp_list = AppLayerExpectationRemove(ipp, exp_list, exp);
381 if (exp_list == NULL)
void * FlowGetStorageById(const Flow *f, FlowStorageId id)
int FlowSetStorageById(Flow *f, FlowStorageId id, void *ptr)
FlowStorageId FlowStorageRegister(const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *))
#define FLOW_COPY_IPV4_ADDR_TO_PACKET(fa, pa)
#define FLOW_HAS_EXPECTATION
#define FLOW_COPY_IPV6_ADDR_TO_PACKET(fa, pa)
void AppLayerExpectationClean(Flow *f)
AppProto AppLayerExpectationHandle(Flow *f, uint8_t flags)
struct Expectation_ Expectation
uint64_t ExpectationGetCounter(void)
FlowStorageId AppLayerExpectationGetFlowId(void)
void AppLayerExpectationSetup(void)
int AppLayerExpectationCreate(Flow *f, int direction, Port src, Port dst, AppProto alproto, void *data)
struct ExpectationData_ ExpectationData
#define EXPECTATION_MAX_LEVEL
struct ExpectationList_ ExpectationList
#define EXPECTATION_TIMEOUT
void * IPPairGetStorageById(IPPair *h, IPPairStorageId id)
IPPairStorageId IPPairStorageRegister(const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *))
int IPPairSetStorageById(IPPair *h, IPPairStorageId id, void *ptr)
void IPPairUnlock(IPPair *h)
void IPPairRelease(IPPair *h)
IPPair * IPPairGetIPPairFromHash(Address *a, Address *b)
IPPair * IPPairLookupIPPairFromHash(Address *a, Address *b)
look up a ippair in the hash
#define CIRCLEQ_INSERT_HEAD(head, elm, field)
#define CIRCLEQ_INIT(head)
#define CIRCLEQ_LAST(head)
#define CIRCLEQ_ENTRY(type)
#define CIRCLEQ_HEAD(name, type)
#define CIRCLEQ_REMOVE(head, elm, field)
#define CIRCLEQ_FOREACH_SAFE(var, head, field, tvar)
#define SC_ATOMIC_ADD(name, val)
add a value to our atomic variable
#define SC_ATOMIC_INIT(name)
wrapper for initializing an atomic variable.
#define SC_ATOMIC_DECLARE(type, name)
wrapper for declaring atomic variables.
#define SC_ATOMIC_SUB(name, val)
sub a value from our atomic variable
#define SC_ATOMIC_GET(name)
Get the value from the atomic variable.