Go to the documentation of this file.
80 static inline Packet *FlowPseudoPacketSetup(
83 const int orig_dir = direction;
86 p->
proto = IPPROTO_TCP;
87 FlowReference(&p->
flow, f);
97 DecodeSetNoPacketInspectionFlag(p);
100 DecodeSetNoPayloadInspectionFlag(p);
115 if (direction == 0) {
146 if (direction == 0) {
147 ip4h->s_ip_src.s_addr = f->
src.addr_data32[0];
148 ip4h->s_ip_dst.s_addr = f->
dst.addr_data32[0];
150 ip4h->s_ip_src.s_addr = f->
dst.addr_data32[0];
151 ip4h->s_ip_dst.s_addr = f->
src.addr_data32[0];
160 if (direction == 0) {
183 ip6h->s_ip6_vfc = 0x60;
184 ip6h->s_ip6_flow = 0;
185 ip6h->s_ip6_nxt = IPPROTO_TCP;
186 ip6h->s_ip6_plen = htons(20);
187 ip6h->s_ip6_hlim = 64;
188 if (direction == 0) {
189 ip6h->s_ip6_src[0] = f->
src.addr_data32[0];
190 ip6h->s_ip6_src[1] = f->
src.addr_data32[1];
191 ip6h->s_ip6_src[2] = f->
src.addr_data32[2];
192 ip6h->s_ip6_src[3] = f->
src.addr_data32[3];
193 ip6h->s_ip6_dst[0] = f->
dst.addr_data32[0];
194 ip6h->s_ip6_dst[1] = f->
dst.addr_data32[1];
195 ip6h->s_ip6_dst[2] = f->
dst.addr_data32[2];
196 ip6h->s_ip6_dst[3] = f->
dst.addr_data32[3];
198 ip6h->s_ip6_src[0] = f->
dst.addr_data32[0];
199 ip6h->s_ip6_src[1] = f->
dst.addr_data32[1];
200 ip6h->s_ip6_src[2] = f->
dst.addr_data32[2];
201 ip6h->s_ip6_src[3] = f->
dst.addr_data32[3];
202 ip6h->s_ip6_dst[0] = f->
src.addr_data32[0];
203 ip6h->s_ip6_dst[1] = f->
src.addr_data32[1];
204 ip6h->s_ip6_dst[2] = f->
src.addr_data32[2];
205 ip6h->s_ip6_dst[3] = f->
src.addr_data32[3];
243 const IPV6Hdr *ip6h = PacketGetIPv6(p);
245 TCPChecksum(ip6h->s_ip6_addrs, (uint16_t *)p->
l4.
hdrs.
tcph, 20, 0);
250 if (direction == 0) {
263 FlowDeReference(&p->
flow);
277 return FlowPseudoPacketSetup(p, direction, f, ssn);
291 if (f == NULL || f->
protoctx == NULL) {
366 static inline void FlowRemoveHash(
void)
394 RemoveFromHash(f, prev_f);
@ STREAM_HAS_UNPROCESSED_SEGMENTS_NEED_ONLY_DETECTION
void FlowSendToLocalThread(Flow *f)
#define FLOW_NOPAYLOAD_INSPECTION
union PacketL3::Hdrs hdrs
#define FLOW_PKT_TOSERVER
Packet * FlowPseudoPacketGet(int direction, Flow *f, const TcpSession *ssn)
int DatalinkGetGlobalType(void)
#define APP_LAYER_PARSER_EOF_TS
#define GET_PKT_DIRECT_MAX_SIZE(p)
#define FLOWLOCK_UNLOCK(fb)
@ STREAM_HAS_UNPROCESSED_SEGMENTS_NONE
void TmThreadsInjectFlowById(Flow *f, const int id)
inject a flow into a threads flow queue
#define FLOW_COPY_IPV6_ADDR_TO_PACKET(fa, pa)
AppLayerParserState * alparser
#define SET_PKT_LEN(p, len)
uint64_t AppLayerParserGetTransactionActive(const Flow *f, AppLayerParserState *pstate, uint8_t direction)
#define STREAM_HAS_SEEN_DATA(stream)
#define PKT_PSEUDO_STREAM_END
#define FLOWLOCK_WRLOCK(fb)
#define IPV4_GET_RAW_HLEN(ip4h)
uint8_t StreamNeedsReassembly(const TcpSession *ssn, uint8_t direction)
see what if any work the TCP session still needs
int PacketCallocExtPkt(Packet *p, int datalen)
void PacketPoolWait(void)
#define APP_LAYER_PARSER_EOF_TC
#define FBLOCK_UNLOCK(fb)
struct LiveDevice_ * livedev
Data structures and function prototypes for keeping state for the detection engine.
#define FLOW_PKT_TOCLIENT
void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint16_t flag)
struct LiveDevice_ * livedev
#define PACKET_PROFILING_START(p)
union PacketL4::L4Hdrs hdrs
Packet * PacketPoolGetPacket(void)
Get a new packet from the packet pool.
#define FLOW_PKT_ESTABLISHED
#define FLOW_END_FLAG_SHUTDOWN
uint16_t vlan_id[VLAN_MAX_LAYERS]
uint16_t vlan_id[VLAN_MAX_LAYERS]
bool FlowNeedsReassembly(Flow *f)
Check if a flow needs forced reassembly, or any other processing.
#define FLOW_NOPACKET_INSPECTION
AppProto alproto
application level protocol
#define FLOW_DIR_REVERSED
uint64_t AppLayerParserGetTxCnt(const Flow *f, void *alstate)
FlowThreadId thread_id[2]
#define FLOW_COPY_IPV4_ADDR_TO_PACKET(fa, pa)
void FlowWorkToDoCleanup(void)
Clean up all the flows that have unprocessed segments and have some work to do in the detection engin...