Mercurial > hg > freeDiameter
annotate tests/testsctp.c @ 740:4a9f08d6b6ba
Updated my mail address
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Thu, 24 Mar 2011 15:00:18 +0900 |
parents | 5d8ac5da7092 |
children | 56c36d1007b4 |
rev | line source |
---|---|
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1 /********************************************************************************************************* |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
2 * Software License Agreement (BSD License) * |
740
4a9f08d6b6ba
Updated my mail address
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
729
diff
changeset
|
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> * |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 * * |
662
2e94ef0515d7
Updated copyright information
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
658
diff
changeset
|
5 * Copyright (c) 2011, WIDE Project and NICT * |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
6 * All rights reserved. * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
7 * * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
8 * Redistribution and use of this software in source and binary forms, with or without modification, are * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
9 * permitted provided that the following conditions are met: * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
10 * * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
11 * * Redistributions of source code must retain the above * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
12 * copyright notice, this list of conditions and the * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
13 * following disclaimer. * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
14 * * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
15 * * Redistributions in binary form must reproduce the above * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
16 * copyright notice, this list of conditions and the * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
17 * following disclaimer in the documentation and/or other * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
18 * materials provided with the distribution. * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
19 * * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
20 * * Neither the name of the WIDE Project or NICT nor the * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
21 * names of its contributors may be used to endorse or * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
22 * promote products derived from this software without * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
23 * specific prior written permission of WIDE Project and * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
24 * NICT. * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
25 * * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
34 *********************************************************************************************************/ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
35 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
36 #include "tests.h" |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
37 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
38 #include <cnxctx.h> |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
39 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
40 #ifndef TEST_PORT |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
41 #define TEST_PORT 3868 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
42 #endif /* TEST_PORT */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
43 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
44 #ifndef NB_STREAMS |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
45 #define NB_STREAMS 10 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
46 #endif /* NB_STREAMS */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
47 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
48 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
49 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
50 /* Main test routine */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
51 int main(int argc, char *argv[]) |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
52 { |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
53 #ifdef DISABLE_SCTP |
485
2b0578a5c589
Fix compilation warning
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
482
diff
changeset
|
54 INIT_FD(); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
55 /* In this case, we don't perform this simple test */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
56 PASSTEST(); |
482
3b7d579e9507
Remove compilation warnings if DISABLE_SCTP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
479
diff
changeset
|
57 #else /* DISABLE_SCTP */ |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
58 struct cnxctx cli, srv; /* we use only their cc_socket & cc_state */ |
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
59 int sock; |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
60 char buf1[]="abcdef"; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
61 char *buf2; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
62 size_t sz; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
63 struct fd_list eps = FD_LIST_INITIALIZER(eps); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
64 uint16_t str; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
65 int ev; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
66 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
67 /* Initialize the server addresses */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
68 { |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
69 struct addrinfo hints, *ai, *aip; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
70 memset(&hints, 0, sizeof(hints)); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
71 hints.ai_flags = AI_NUMERICSERV; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
72 hints.ai_family = AF_INET; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
73 CHECK( 0, getaddrinfo("localhost", _stringize(TEST_PORT), &hints, &ai) ); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
74 aip = ai; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
75 while (aip) { |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
76 CHECK( 0, fd_ep_add_merge( &eps, aip->ai_addr, aip->ai_addrlen, EP_FL_DISC | EP_ACCEPTALL )); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
77 aip = aip->ai_next; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
78 }; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
79 freeaddrinfo(ai); |
729
5d8ac5da7092
Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
706
diff
changeset
|
80 |
5d8ac5da7092
Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
706
diff
changeset
|
81 CHECK( 0, FD_IS_LIST_EMPTY(&eps) ? 1 : 0 ); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
82 } |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
83 |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
84 memset(&cli, 0, sizeof(cli)); |
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
85 memset(&srv, 0, sizeof(srv)); |
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
86 |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
87 /* First, initialize the daemon modules */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
88 INIT_FD(); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
89 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
90 /* Restrain the # of streams */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
91 fd_g_config->cnf_sctp_str = NB_STREAMS; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
92 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
93 /* Create the server socket */ |
478
b65f32c20e6d
Fix for FreeBSD which is less tolerant
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
477
diff
changeset
|
94 CHECK( 0, fd_sctp_create_bind_server( &sock, AF_INET6, &eps, TEST_PORT )); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
95 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
96 /* Accept incoming clients */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
97 CHECK( 0, fd_sctp_listen( sock )); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
98 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
99 /* Now, create the client socket */ |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
100 CHECK( 0, fd_sctp_client( &cli.cc_socket, 0, TEST_PORT, &eps )); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
101 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
102 /* Accept this connection */ |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
103 srv.cc_socket = accept(sock, NULL, NULL); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
104 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
105 /* Send a first message */ |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
106 CHECK( 0, fd_sctp_sendstr(&srv, 1, (uint8_t *)buf1, sizeof(buf1) ) ); |
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
107 CHECK( 0, srv.cc_state); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
108 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
109 /* Receive this message */ |
479
a186743b89a3
Allow FDEVP_CNX_EP_CHANGE to occur in the test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
478
diff
changeset
|
110 redo1: |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
111 CHECK( 0, fd_sctp_recvmeta(&cli, &str, (uint8_t **)&buf2, &sz, &ev) ); |
479
a186743b89a3
Allow FDEVP_CNX_EP_CHANGE to occur in the test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
478
diff
changeset
|
112 if (ev == FDEVP_CNX_EP_CHANGE) |
a186743b89a3
Allow FDEVP_CNX_EP_CHANGE to occur in the test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
478
diff
changeset
|
113 goto redo1; |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
114 CHECK( FDEVP_CNX_MSG_RECV, ev); |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
115 CHECK( 0, cli.cc_state); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
116 CHECK( 1, str); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
117 CHECK( sizeof(buf1), sz ); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
118 CHECK( 0, memcmp(buf1, buf2, sz) ); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
119 free(buf2); buf2 = NULL; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
120 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
121 /* Send in the other direction */ |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
122 CHECK( 0, fd_sctp_sendstr(&cli, 2, (uint8_t *)buf1, sizeof(buf1)) ); |
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
123 CHECK( 0, cli.cc_state); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
124 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
125 /* Receive this message */ |
479
a186743b89a3
Allow FDEVP_CNX_EP_CHANGE to occur in the test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
478
diff
changeset
|
126 redo2: |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
127 CHECK( 0, fd_sctp_recvmeta(&srv, &str, (uint8_t **)&buf2, &sz, &ev) ); |
479
a186743b89a3
Allow FDEVP_CNX_EP_CHANGE to occur in the test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
478
diff
changeset
|
128 if (ev == FDEVP_CNX_EP_CHANGE) |
a186743b89a3
Allow FDEVP_CNX_EP_CHANGE to occur in the test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
478
diff
changeset
|
129 goto redo2; |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
130 CHECK( FDEVP_CNX_MSG_RECV, ev); |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
131 CHECK( 0, srv.cc_state); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
132 CHECK( 2, str); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
133 CHECK( sizeof(buf1), sz ); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
134 CHECK( 0, memcmp(buf1, buf2, sz) ); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
135 free(buf2); buf2 = NULL; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
136 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
137 /* That's all for the tests yet */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
138 PASSTEST(); |
482
3b7d579e9507
Remove compilation warnings if DISABLE_SCTP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
479
diff
changeset
|
139 #endif /* DISABLE_SCTP */ |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
140 } |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
141 |