struct pkt_info { // pkt recving time uint32_t cur_ts; // ETH uint16_t eth_len; // IP uint16_t ip_len; //TCP uint64_t offset; // TCP recv buffer offset uint16_t payloadlen; uint32_t seq; uint32_t ack_seq; uint16_t window; struct ethhdr *ethh; struct iphdr *iph; struct tcphdr *tcph; uint8_t *payload; }
A successful call to
mtcp_getlastpkt() creates a copy of the last recorded Ethernet frame and appends
its meta-data (in host byte order). The last four fields of
"pinfo" (ethh, iph, tcph and payload) point to the copied frame at
the appropriate offsets. Please note that the packet buffer
that contains the copied frame is reused for future invocations
of
mtcp_getlastpkt().
An
mtcp_getlastpkt () call takes an additional argument named
"mctx" that represents the per-core mTCP context in an application
(see
mtcp_create_context() for details).
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
15 "EACCES" "mctx" is invalid.
15 "EPERM" Permission denied.
15 "ENODATA" The last captured Ethernet frame for this flow does not exist. This can occur if "mtcp_getlastpkt()" is called during e.g. connection initiation.
15
"EBADF" "sockid" is not a valid socket descriptor for creating a connection.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""".SH CONFORMING TO
""""POSIX.1-2001.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""