Mercurial > hg > freeDiameter
annotate tests/testsctp.c @ 1240:0420ccc4671a
Add a counter for the sent requests for which we did not wait for an answer. It might be relevant this value contributes to the load estimate of the remote peer, but it is not very reliable
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Thu, 10 Oct 2013 16:30:55 +0200 |
parents | f937feb72734 |
children | 407e0a889c7e |
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 * * |
1235
f937feb72734
Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1186
diff
changeset
|
5 * Copyright (c) 2013, 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; |
1186
56c36d1007b4
Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
740
diff
changeset
|
63 struct iovec iov; |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
64 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
|
65 uint16_t str; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
66 int ev; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
67 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
68 /* Initialize the server addresses */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
69 { |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
70 struct addrinfo hints, *ai, *aip; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
71 memset(&hints, 0, sizeof(hints)); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
72 hints.ai_flags = AI_NUMERICSERV; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
73 hints.ai_family = AF_INET; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
74 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
|
75 aip = ai; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
76 while (aip) { |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
77 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
|
78 aip = aip->ai_next; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
79 }; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
80 freeaddrinfo(ai); |
729
5d8ac5da7092
Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
706
diff
changeset
|
81 |
5d8ac5da7092
Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
706
diff
changeset
|
82 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
|
83 } |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
84 |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
85 memset(&cli, 0, sizeof(cli)); |
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
86 memset(&srv, 0, sizeof(srv)); |
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
87 |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
88 /* First, initialize the daemon modules */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
89 INIT_FD(); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
90 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
91 /* Restrain the # of streams */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
92 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
|
93 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
94 /* Create the server socket */ |
478
b65f32c20e6d
Fix for FreeBSD which is less tolerant
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
477
diff
changeset
|
95 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
|
96 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
97 /* Accept incoming clients */ |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
98 CHECK( 0, fd_sctp_listen( sock )); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
99 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
100 /* Now, create the client socket */ |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
101 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
|
102 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
103 /* Accept this connection */ |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
104 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
|
105 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
106 /* Send a first message */ |
1186
56c36d1007b4
Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
740
diff
changeset
|
107 iov.iov_base = buf1; |
56c36d1007b4
Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
740
diff
changeset
|
108 iov.iov_len = sizeof(buf1); |
56c36d1007b4
Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
740
diff
changeset
|
109 CHECK( sizeof(buf1), fd_sctp_sendstrv(&srv, 1, &iov, 1 ) ); |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
110 CHECK( 0, srv.cc_state); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
111 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
112 /* 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
|
113 redo1: |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
114 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
|
115 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
|
116 goto redo1; |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
117 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
|
118 CHECK( 0, cli.cc_state); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
119 CHECK( 1, str); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
120 CHECK( sizeof(buf1), sz ); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
121 CHECK( 0, memcmp(buf1, buf2, sz) ); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
122 free(buf2); buf2 = NULL; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
123 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
124 /* Send in the other direction */ |
1186
56c36d1007b4
Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents:
740
diff
changeset
|
125 CHECK( sizeof(buf1), fd_sctp_sendstrv(&cli, 2, &iov, 1) ); |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
126 CHECK( 0, cli.cc_state); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
127 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
128 /* 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
|
129 redo2: |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
130 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
|
131 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
|
132 goto redo2; |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
133 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
|
134 CHECK( 0, srv.cc_state); |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
135 CHECK( 2, str); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
136 CHECK( sizeof(buf1), sz ); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
137 CHECK( 0, memcmp(buf1, buf2, sz) ); |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
138 free(buf2); buf2 = NULL; |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
139 |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
140 /* 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
|
141 PASSTEST(); |
482
3b7d579e9507
Remove compilation warnings if DISABLE_SCTP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
479
diff
changeset
|
142 #endif /* DISABLE_SCTP */ |
477
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
143 } |
4e4ed23028ca
Add a simple test to verify ticket #12
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
144 |