a19c85b28f95fa8cb8b4caffaf147d13adf3d1ee
[tpg/acess2.git] / Tools / NetTest_Runner / test_tcp.c
1 /*
2  */
3 #include "test.h"
4 #include "tests.h"
5 #include "net.h"
6 #include "stack.h"
7 #include "arp.h"
8 #include "tcp.h"
9
10 bool Test_TCP_Basic(void)
11 {
12         TEST_SETNAME(__func__);
13         size_t  rxlen, ofs;
14         char rxbuf[MTU];
15         
16         // 1. Test connection to closed port
17         uint32_t        seq_tx = 0x1000;
18         uint32_t        seq_exp = 0;
19         TCP_Send(0, 4, BLOB(TEST_IP), 1234, 80, seq_tx, seq_exp, TCP_SYN, 0x1000, 0, NULL);
20         
21         TEST_ASSERT( rxlen = Net_Receive(0, sizeof(rxbuf), rxbuf, 1000) );
22         TEST_ASSERT( TCP_Pkt_Check(rxlen, rxbuf, &ofs, 4, BLOB(TEST_IP), 80, 1234, TCP_RST) );
23         TEST_ASSERT_REL(ofs, ==, rxlen);
24         
25         return true;
26 }

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