flow: introduce function to generate flow id

The flow id itself is not stored in the flow, but generated based on
properties that do not change during the lifetime of the flow.

As it's meant for use with the json output, it is limited to a signed
64 bit integer (int64_t) because that is the time json_integer_t uses.
pull/2211/head
Victor Julien 9 years ago
parent 666bba8121
commit 78b4db8a95

@ -536,6 +536,18 @@ static inline void FlowDeReference(Flow **d)
}
}
/** \brief create a flow id that is as unique as possible
* \retval flow_id signed 64bit id
* \note signed because of the signedness of json_integer_t in
* the json output
*/
static inline int64_t FlowGetId(const Flow *f)
{
return (int64_t)f->flow_hash << 31 |
(int64_t)(f->startts.tv_sec & 0x0000FFFF) << 16 |
(int64_t)(f->startts.tv_usec & 0x0000FFFF);
}
int FlowClearMemory(Flow *,uint8_t );
AppProto FlowGetAppProtocol(const Flow *f);

Loading…
Cancel
Save