eb7edf557d238b816d2b318f83cc9fa34fabbc51
[tpg/acess2.git] / Tools / NetTest_Runner / include / tcp.h
1 /*
2  * tcp.h
3  * - TCP Test Wrapper
4  */
5 #ifndef _TCP_H_
6 #define _TCP_H_
7
8 #include <stdbool.h>
9 #include <stdint.h>
10 #include <stddef.h>
11
12 typedef struct {
13          int    IFNum;
14          int    AF;
15         const void      *LAddr;
16         const void      *RAddr;
17         uint16_t        LPort;
18         uint16_t        RPort;
19         uint16_t        Window;
20         uint32_t        LSeq;
21         uint32_t        RSeq;
22 } tTCPConn;
23
24 #define TCP_FIN 0x01
25 #define TCP_SYN 0x02
26 #define TCP_RST 0x04
27 #define TCP_PSH 0x08
28 #define TCP_ACK 0x10
29 #define TCP_URG 0x20
30
31
32 extern void     TCP_SendC(const tTCPConn *Conn, uint8_t flags, size_t data_len, const void *data);
33 extern void     TCP_Send(int IF, int AF, const void *IP, short sport, short dport, uint32_t seq, uint32_t ack, uint8_t flags, uint16_t window, size_t data_len, const void *data);
34
35 // The following skip the next check of each field
36 extern void     TCP_SkipCheck_Seq(bool Skip);
37
38 extern bool     TCP_Pkt_CheckC(size_t len, const void *data, size_t *ofs, size_t *out_len, const tTCPConn *Conn, uint8_t flags);
39 extern bool     TCP_Pkt_Check(size_t len, const void *data, size_t *ofs, size_t *out_len, int AF, const void *IP, short sport, short dport, uint32_t seq, uint32_t ack, uint8_t flags);
40
41 // - Get a field from a previously validated packet
42 extern uint32_t TCP_Pkt_GetSeq(size_t len, const void *data, int AF);
43
44 #endif
45

UCC git Repository :: git.ucc.asn.au