65 static int g_expectation_id = -1;
66 static int g_expectation_data_id = -1;
70 #define EXPECTATION_TIMEOUT 30 85 void (*DFree)(
void *);
88 static void ExpectationDataFree(
void *e)
99 static void ExpectationListFree(
void *e)
107 if (expdata->
DFree) {
127 g_expectation_data_id =
FlowStorageRegister(
"expectation",
sizeof(
void *), NULL, ExpectationDataFree);
133 memset(ip_src, 0,
sizeof(*ip_src));
134 memset(ip_dst, 0,
sizeof(*ip_dst));
150 if (GetFlowAddresses(f, &ip_src, &ip_dst) == -1)
194 if (GetFlowAddresses(f, &ip_src, &ip_dst) == -1)
223 return g_expectation_data_id;
252 if (expdata->
DFree) {
285 Expectation *exp = AppLayerExpectationLookup(f, direction, &ipp);
289 time_t ctime = f->
lastts.tv_sec;
295 ((exp->
sp == 0) || (exp->
sp == f->
sp)) &&
296 ((exp->
dp == 0) || (exp->
dp == f->
dp))) {
303 ExpectationDataFree(exp->
data);
311 exp = RemoveExpectationAndGetNext(ipp, pexp, exp, lexp);
316 exp = RemoveExpectationAndGetNext(ipp, pexp, exp, lexp);
int IPPairStorageRegister(const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *))
struct Expectation_ Expectation
struct ExpectationData_ ExpectationData
int AppLayerExpectationGetDataId(void)
#define FLOW_COPY_IPV6_ADDR_TO_PACKET(fa, pa)
#define FLOW_COPY_IPV4_ADDR_TO_PACKET(fa, pa)
#define SC_ATOMIC_ADD(name, val)
add a value to our atomic variable
IPPair * IPPairGetIPPairFromHash(Address *a, Address *b)
#define SC_ATOMIC_SUB(name, val)
sub a value from our atomic variable
#define EXPECTATION_TIMEOUT
IPPair * IPPairLookupIPPairFromHash(Address *a, Address *b)
look up a ippair in the hash
uint64_t ExpectationGetCounter(void)
#define SC_ATOMIC_INIT(name)
Initialize the previously declared atomic variable and it's lock.
#define IPPairDecrUsecnt(h)
SC_ATOMIC_DECLARE(uint32_t, expectation_count)
struct Expectation_ * next
AppProto AppLayerExpectationHandle(Flow *f, int direction)
int FlowSetStorageById(Flow *f, int id, void *ptr)
void * IPPairGetStorageById(IPPair *h, int id)
int IPPairSetStorageById(IPPair *h, int id, void *ptr)
int FlowStorageRegister(const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *))
void AppLayerExpectationSetup(void)
int AppLayerExpectationCreate(Flow *f, int direction, Port src, Port dst, AppProto alproto, void *data)
#define SC_ATOMIC_GET(name)
Get the value from the atomic variable.
void * FlowGetStorageById(Flow *f, int id)
void IPPairUnlock(IPPair *h)
void IPPairRelease(IPPair *h)