| 1 | /* SCTP kernel Implementation |
| 2 | * (C) Copyright IBM Corp. 2002, 2003 |
| 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
| 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
| 5 | * Copyright (c) 2001 Intel Corp. |
| 6 | * Copyright (c) 2001 Nokia, Inc. |
| 7 | * |
| 8 | * The SCTP implementation is free software; |
| 9 | * you can redistribute it and/or modify it under the terms of |
| 10 | * the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2, or (at your option) |
| 12 | * any later version. |
| 13 | * |
| 14 | * The SCTP implementation is distributed in the hope that it |
| 15 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
| 16 | * ************************ |
| 17 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 18 | * See the GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with GNU CC; see the file COPYING. If not, write to |
| 22 | * the Free Software Foundation, 59 Temple Place - Suite 330, |
| 23 | * Boston, MA 02111-1307, USA. |
| 24 | * |
| 25 | * Please send any bug reports or fixes you make to the |
| 26 | * email address(es): |
| 27 | * lksctp developers <[email protected]> |
| 28 | * |
| 29 | * Or submit a bug report through the following website: |
| 30 | * https://github.com/sctp/lksctp-tools/ |
| 31 | * |
| 32 | * Any bugs reported to us we will try to fix... any fixes shared will |
| 33 | * be incorporated into the next SCTP release. |
| 34 | * |
| 35 | * Written or modified by: |
| 36 | * Ardelle Fan <[email protected]> |
| 37 | * Sridhar Samudrala <[email protected]> |
| 38 | */ |
| 39 | |
| 40 | /* This is a receiver for the performance test to verify Nagle's algorithm. |
| 41 | * It creates a socket, binds to a address specified as a parameter and |
| 42 | * sends 1,000,000 packets to a specified target. |
| 43 | */ |
| 44 | |
| 45 | #include <stdio.h> |
| 46 | #include <unistd.h> |
| 47 | #include <stdlib.h> |
| 48 | #include <string.h> |
| 49 | #include <sys/types.h> |
| 50 | #include <sys/socket.h> |
| 51 | #include <sys/uio.h> |
| 52 | #include <netinet/in.h> |
| 53 | #include <errno.h> |
| 54 | #include <netinet/sctp.h>cxx . . $ `<file>/src/include/netinet/sctp.h`/ |
| 55 | #include <sctputil.h>cxx . . $ `<file>/src/testlib/sctputil.h`/ |
| 56 | #include <getopt.h> |
| 57 | #include <netdb.h> |
| 58 | |
| 59 | char *TCIDcxx . . $ TCID. = __FILE__; |
| 60 | int TST_TOTALcxx . . $ TST_TOTAL. = 1; |
| 61 | int TST_CNTcxx . . $ TST_CNT. = 0; |
| 62 | |
| 63 | void |
| 64 | usagecxx . . $ usage(fda57c8427c60377).(char *argv0) |
| 65 | { |
| 66 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Usage: %s -H localhost [-P localport] " |
| 67 | "-h remotehost [-p remoteport]\n" |
| 68 | "\t\t[-S msgsize] [-I interval] -N\n" |
| 69 | " -H, --local\t\tspecify one of the local addresses,\n" |
| 70 | " -P, --local-port\tspecify the port number for local addresses,\n" |
| 71 | " -h, --remote\t\tspecify one of the remote addresses,\n" |
| 72 | " -p, --remote-port\tspecify the port number for remote addresses,\n" |
| 73 | " -S, --size\t\tspecify the size(byte) of the sending message,\n" |
| 74 | " -I, --interval\t\tspecify the interval(second) that sending messages at,\n" |
| 75 | " -N, --nodelay\t\tspecify whether the SCTP allows Nagle's algorithm\n", |
| 76 | argv0); |
| 77 | } |
| 78 | |
| 79 | int |
| 80 | maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[]) |
| 81 | { |
| 82 | int sk, i; |
| 83 | struct addrinfocxx . . $ addrinfo# *hst_res, *tgt_res; |
| 84 | sockaddr_storage_tcxx . . $ sockaddr_storage_t# host, target; |
| 85 | sockaddr_storage_tcxx . . $ sockaddr_storage_t# msgname; |
| 86 | struct ioveccxx . . $ iovec# iov; |
| 87 | struct msghdrcxx . . $ msghdr# inmessage; |
| 88 | struct msghdrcxx . . $ msghdr# outmessage; |
| 89 | char incmsg[CMSG_SPACEcxx . . $ `<external>/8962547315054503424/socket.h:309:9`!(sizeof(sctp_cmsg_data_t))]; |
| 90 | char outcmsg[CMSG_SPACEcxx . . $ `<external>/8962547315054503424/socket.h:309:9`!(sizeof(struct sctp_sndrcvinfo))]; |
| 91 | struct cmsghdrcxx . . $ cmsghdr# *cmsg; |
| 92 | struct sctp_sndrcvinfocxx . . $ sctp_sndrcvinfo# *sinfo; |
| 93 | struct ioveccxx . . $ iovec# out_iov; |
| 94 | char *message; |
| 95 | int error, pf_class; |
| 96 | sctp_assoc_tcxx . . $ sctp_assoc_t# associd; |
| 97 | uint32_tcxx . . $ uint32_t# ppid; |
| 98 | uint32_tcxx . . $ uint32_t# stream; |
| 99 | char *remote_host = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 100 | int remote_port = SCTP_TESTPORT_1cxx . . $ `src/testlib/sctputil.h:71:9`!; |
| 101 | char *local_host = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 102 | int local_port = SCTP_TESTPORT_2cxx . . $ `src/testlib/sctputil.h:73:9`!; |
| 103 | int size = 1; |
| 104 | int interval = 0; |
| 105 | int nodelay = 0; |
| 106 | int option_index = 0; |
| 107 | char *big_buffer; |
| 108 | char port_buffer[10]; |
| 109 | int c; |
| 110 | static struct optioncxx . . $ option# long_options[] = { |
| 111 | {"local", 1, 0, 1}, |
| 112 | {"local-port", 1, 0, 2}, |
| 113 | {"remote", 1, 0, 3}, |
| 114 | {"remote-port", 1, 0, 4}, |
| 115 | {"size", 1, 0, 5}, |
| 116 | {"interval", 1, 0, 6}, |
| 117 | {"nodelay", 0, 0, 10}, |
| 118 | {0, 0, 0, 0} |
| 119 | }; |
| 120 | |
| 121 | /* Rather than fflush() throughout the code, set stdout to |
| 122 | * be unbuffered. |
| 123 | */ |
| 124 | setvbufcxx . . $ setvbuf(4da3ba8c983f31bc).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, _IONBFcxx . . $ `<external>/232824719582829767/stdio.h:100:9`!, 0); |
| 125 | |
| 126 | /* Parse the arguments. */ |
| 127 | while (1) { |
| 128 | c = getopt_longcxx . . $ getopt_long(41f665c090816971). (argc, argv, "H:P:h:p:S:I:N", |
| 129 | long_options, &option_index); |
| 130 | if (c == -1) |
| 131 | break; |
| 132 | |
| 133 | switch (c) { |
| 134 | case 0: |
| 135 | printfcxx . . $ printf(581fddd72a8db8fc).("option %s", long_options[option_index].namecxx . . $ option#name.); |
| 136 | if (optargcxx . . $ optarg.) { |
| 137 | printfcxx . . $ printf(581fddd72a8db8fc).(" with arg %s", optargcxx . . $ optarg.); |
| 138 | } |
| 139 | printfcxx . . $ printf(581fddd72a8db8fc).("\n"); |
| 140 | break; |
| 141 | case 1: /* local host */ |
| 142 | case 'H': |
| 143 | local_host = optargcxx . . $ optarg.; |
| 144 | break; |
| 145 | case 2: /* local port */ |
| 146 | case 'P': |
| 147 | local_port = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.); |
| 148 | break; |
| 149 | case 3: /* remote host */ |
| 150 | case 'h': |
| 151 | remote_host = optargcxx . . $ optarg.; |
| 152 | break; |
| 153 | case 4: /* remote port */ |
| 154 | case 'p': |
| 155 | remote_port = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.); |
| 156 | break; |
| 157 | case 5: /* size */ |
| 158 | case 'S': |
| 159 | size = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.); |
| 160 | break; |
| 161 | case 6: /* interval */ |
| 162 | case 'I': |
| 163 | interval = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.); |
| 164 | break; |
| 165 | case 10: /* nodelay */ |
| 166 | case 'N': |
| 167 | nodelay = 1; |
| 168 | break; |
| 169 | case '?': |
| 170 | usagecxx . . $ usage(fda57c8427c60377).(argv[0]); |
| 171 | exitcxx . . $ exit(3ca292c338df9bb3).(0); |
| 172 | |
| 173 | default: |
| 174 | printfcxx . . $ printf(581fddd72a8db8fc). ("%s: unrecognized option 0%c\n", |
| 175 | argv[0], c); |
| 176 | usagecxx . . $ usage(fda57c8427c60377).(argv[0]); |
| 177 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | if (optindcxx . . $ optind. < argc) |
| 182 | { |
| 183 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: non-option arguments are illegal: ", |
| 184 | argv[0]); |
| 185 | while (optindcxx . . $ optind. < argc) |
| 186 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s ", argv[optindcxx . . $ optind.++]); |
| 187 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac). (stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "\n"); |
| 188 | usagecxx . . $ usage(fda57c8427c60377).(argv[0]); |
| 189 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 190 | } |
| 191 | |
| 192 | if (!local_host || !remote_host) { |
| 193 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: : option --local and --remote are required\n", |
| 194 | argv[0]); |
| 195 | usagecxx . . $ usage(fda57c8427c60377).(argv[0]); |
| 196 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 197 | } |
| 198 | |
| 199 | /* Set some basic values which depend on the address family. */ |
| 200 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(local_host, "0")) |
| 201 | local_host = "0.0.0.0"; |
| 202 | |
| 203 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(port_buffer, 10, "%d", local_port); |
| 204 | error = getaddrinfocxx . . $ getaddrinfo(f68af21b9849b03e).(local_host, port_buffer, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, &hst_res); |
| 205 | if (error) { |
| 206 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: getaddrinfo failed: %s\n", argv[0], local_host); |
| 207 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 208 | } |
| 209 | |
| 210 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(port_buffer, 10, "%d", remote_port); |
| 211 | error = getaddrinfocxx . . $ getaddrinfo(f68af21b9849b03e).(remote_host, port_buffer, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, &tgt_res); |
| 212 | if (error) { |
| 213 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: getaddrinfo failed: %s\n", argv[0], remote_host); |
| 214 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 215 | } |
| 216 | |
| 217 | if ( hst_res->ai_familycxx . . $ addrinfo#ai_family. != tgt_res->ai_familycxx . . $ addrinfo#ai_family.) { |
| 218 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "local and reomte hosts should be the " |
| 219 | "same address family\n"); |
| 220 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 221 | } |
| 222 | |
| 223 | pf_class = hst_res->ai_familycxx . . $ addrinfo#ai_family.; |
| 224 | switch (pf_class) { |
| 225 | case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!: |
| 226 | case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!: |
| 227 | memcpycxx . . $ memcpy(cc817cb175f282d).(&host.sacxx . . $ $anonymous_type_f8e963888af85862_0#sa., hst_res->ai_addrcxx . . $ addrinfo#ai_addr., hst_res->ai_addrlencxx . . $ addrinfo#ai_addrlen.); |
| 228 | memcpycxx . . $ memcpy(cc817cb175f282d).(&target.sacxx . . $ $anonymous_type_f8e963888af85862_0#sa., tgt_res->ai_addrcxx . . $ addrinfo#ai_addr., tgt_res->ai_addrlencxx . . $ addrinfo#ai_addrlen.); |
| 229 | break; |
| 230 | default: |
| 231 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Invalid address type.\n"); |
| 232 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 233 | break; |
| 234 | } |
| 235 | |
| 236 | freeaddrinfocxx . . $ freeaddrinfo(aadc8f19092a28e8).(hst_res); |
| 237 | freeaddrinfocxx . . $ freeaddrinfo(aadc8f19092a28e8).(tgt_res); |
| 238 | |
| 239 | sk = test_socketcxx . . $ test_socket(2326284602b0bb2d).(pf_class, SOCK_SEQPACKETcxx . . $ `<external>/5956532346368192945/socket_type.h:38:9`!, IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!); |
| 240 | |
| 241 | /* Enable ASSOC_CHANGE and SNDRCVINFO notifications. */ |
| 242 | test_enable_assoc_changecxx . . $ test_enable_assoc_change(d4f767463ce0a6b3).(sk); |
| 243 | |
| 244 | test_setsockoptcxx . . $ test_setsockopt(57908ac6eaa2fecc).(sk, SCTP_NODELAYcxx . . $ `<external>/17169092326581286071/sctp.h:72:9`!, &nodelay, sizeof(int)); |
| 245 | |
| 246 | /* Bind the sockets to the test port. */ |
| 247 | test_bindcxx . . $ test_bind(18e507052d945257).(sk, &host.sacxx . . $ $anonymous_type_f8e963888af85862_0#sa., sizeof(host)); |
| 248 | |
| 249 | /* Mark sk as being able to accept new associations. */ |
| 250 | test_listencxx . . $ test_listen(9b79fb6aee4c0440).(sk, 1); |
| 251 | |
| 252 | /* Build up a msghdr structure we can use for all sending. */ |
| 253 | outmessage.msg_namecxx . . $ msghdr#msg_name. = ⌖ |
| 254 | outmessage.msg_namelencxx . . $ msghdr#msg_namelen. = sizeof(target); |
| 255 | outmessage.msg_iovcxx . . $ msghdr#msg_iov. = &out_iov; |
| 256 | outmessage.msg_iovlencxx . . $ msghdr#msg_iovlen. = 1; |
| 257 | outmessage.msg_controlcxx . . $ msghdr#msg_control. = outcmsg; |
| 258 | outmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(outcmsg); |
| 259 | outmessage.msg_flagscxx . . $ msghdr#msg_flags. = 0; |
| 260 | cmsg = CMSG_FIRSTHDRcxx . . $ `<external>/8962547315054503424/socket.h:304:9`!(&outmessage); |
| 261 | cmsg->cmsg_levelcxx . . $ cmsghdr#cmsg_level. = IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!; |
| 262 | cmsg->cmsg_typecxx . . $ cmsghdr#cmsg_type. = SCTP_SNDRCVcxx . . $ `<external>/17169092326581286071/sctp.h:333:9`!; |
| 263 | cmsg->cmsg_lencxx . . $ cmsghdr#cmsg_len. = CMSG_LENcxx . . $ `<external>/8962547315054503424/socket.h:311:9`!(sizeof(struct sctp_sndrcvinfo)); |
| 264 | outmessage.msg_controllencxx . . $ msghdr#msg_controllen. = cmsg->cmsg_lencxx . . $ cmsghdr#cmsg_len.; |
| 265 | sinfo = (struct sctp_sndrcvinfocxx . . $ sctp_sndrcvinfo# *)CMSG_DATAcxx . . $ `<external>/8962547315054503424/socket.h:299:10`!(cmsg); |
| 266 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(sinfo, 0x00, sizeof(struct sctp_sndrcvinfocxx . . $ sctp_sndrcvinfo#)); |
| 267 | ppid = randcxx . . $ rand(b126dc7c1de90089).(); /* Choose an arbitrary value. */ |
| 268 | stream = 1; |
| 269 | sinfo->sinfo_ppidcxx . . $ sctp_sndrcvinfo#sinfo_ppid. = ppid; |
| 270 | sinfo->sinfo_streamcxx . . $ sctp_sndrcvinfo#sinfo_stream. = stream; |
| 271 | |
| 272 | message = test_malloccxx . . $ test_malloc(bfcfa4d6b7f7ef64).((size + 1) * sizeof(u_int8_tcxx . . $ u_int8_t#)); |
| 273 | |
| 274 | for(i=0; i + 10 < size; i+= 10) |
| 275 | memcpycxx . . $ memcpy(cc817cb175f282d).(message+i, "1234567890", 10); |
| 276 | strncpycxx . . $ strncpy(255158a415b673b0).(message+i, "1234567890", size-i); |
| 277 | *(message+size) = 0; |
| 278 | |
| 279 | outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_basecxx . . $ iovec#iov_base. = message; |
| 280 | outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_lencxx . . $ iovec#iov_len. = size + 1; |
| 281 | |
| 282 | printfcxx . . $ printf(581fddd72a8db8fc).("Initiating connection with %s:%d...\n", remote_host, |
| 283 | remote_port); |
| 284 | |
| 285 | /* Send the first message. This will create the association. */ |
| 286 | test_sendmsgcxx . . $ test_sendmsg(c45a39c477f473e).(sk, &outmessage, 0, size+1); |
| 287 | |
| 288 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&inmessage, 0, sizeof(inmessage)); |
| 289 | big_buffer = test_malloccxx . . $ test_malloc(bfcfa4d6b7f7ef64).(REALLY_BIGcxx . . $ `src/testlib/sctputil.h:65:9`!); |
| 290 | iov.iov_basecxx . . $ iovec#iov_base. = big_buffer; |
| 291 | iov.iov_lencxx . . $ iovec#iov_len. = REALLY_BIGcxx . . $ `src/testlib/sctputil.h:65:9`!; |
| 292 | inmessage.msg_iovcxx . . $ msghdr#msg_iov. = &iov; |
| 293 | inmessage.msg_iovlencxx . . $ msghdr#msg_iovlen. = 1; |
| 294 | inmessage.msg_controlcxx . . $ msghdr#msg_control. = incmsg; |
| 295 | inmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(incmsg); |
| 296 | inmessage.msg_namecxx . . $ msghdr#msg_name. = &msgname; |
| 297 | inmessage.msg_namelencxx . . $ msghdr#msg_namelen. = sizeof(msgname); |
| 298 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&msgname, 0, sizeof(msgname)); |
| 299 | |
| 300 | /* Get the communication up message on sk. */ |
| 301 | error = test_recvmsgcxx . . $ test_recvmsg(2284ea468be03a33).(sk, &inmessage, MSG_WAITALLcxx . . $ `<external>/8962547315054503424/socket.h:230:9`!); |
| 302 | test_check_msg_notificationcxx . . $ test_check_msg_notification(bda0d4705bf9b0d0).(&inmessage, error, |
| 303 | sizeof(struct sctp_assoc_changecxx . . $ sctp_assoc_change#), |
| 304 | SCTP_ASSOC_CHANGEcxx . . $ `<external>/17169092326581286071/sctp.h:666:9`!, SCTP_COMM_UPcxx . . $ SCTP_COMM_UP.); |
| 305 | associd = ((struct sctp_assoc_changecxx . . $ sctp_assoc_change# *)iov.iov_basecxx . . $ iovec#iov_base.)->sac_assoc_idcxx . . $ sctp_assoc_change#sac_assoc_id.; |
| 306 | |
| 307 | printfcxx . . $ printf(581fddd72a8db8fc).("Established connection with "); |
| 308 | if (AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`! == msgname.sacxx . . $ $anonymous_type_f8e963888af85862_0#sa..sa_familycxx . . $ sockaddr#sa_family.) |
| 309 | printfcxx . . $ printf(581fddd72a8db8fc).("%d.%d.%d.%d(%d)\n", NIPQUADcxx . . $ `src/testlib/sctputil.h:83:9`!(msgname.v4.sin_addr), |
| 310 | ntohscxx . . $ `<external>/9581057695539925927/in.h:429:12`!(msgname.v4.sin_port)); |
| 311 | if (AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`! == msgname.sacxx . . $ $anonymous_type_f8e963888af85862_0#sa..sa_familycxx . . $ sockaddr#sa_family.) |
| 312 | printfcxx . . $ printf(581fddd72a8db8fc).("%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x(%d)\n", |
| 313 | NIP6cxx . . $ `src/testlib/sctputil.h:90:9`!(msgname.v6.sin6_addr), ntohscxx . . $ `<external>/9581057695539925927/in.h:429:12`!(msgname.v6.sin6_port)); |
| 314 | |
| 315 | printfcxx . . $ printf(581fddd72a8db8fc).("Sending data to receiver...\n"); |
| 316 | |
| 317 | for (i=1; i<1000000; i++) { |
| 318 | |
| 319 | if (interval) |
| 320 | sleepcxx . . $ sleep(2141b656ce2cc063).(interval); |
| 321 | |
| 322 | outmessage.msg_namecxx . . $ msghdr#msg_name. = ⌖ |
| 323 | outmessage.msg_namelencxx . . $ msghdr#msg_namelen. = sizeof(target); |
| 324 | outmessage.msg_iovcxx . . $ msghdr#msg_iov. = &out_iov; |
| 325 | outmessage.msg_iovlencxx . . $ msghdr#msg_iovlen. = 1; |
| 326 | outmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(outcmsg); |
| 327 | outmessage.msg_flagscxx . . $ msghdr#msg_flags. = 0; |
| 328 | |
| 329 | cmsg = CMSG_FIRSTHDRcxx . . $ `<external>/8962547315054503424/socket.h:304:9`!(&outmessage); |
| 330 | cmsg->cmsg_levelcxx . . $ cmsghdr#cmsg_level. = IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!; |
| 331 | cmsg->cmsg_typecxx . . $ cmsghdr#cmsg_type. = SCTP_SNDRCVcxx . . $ `<external>/17169092326581286071/sctp.h:333:9`!; |
| 332 | cmsg->cmsg_lencxx . . $ cmsghdr#cmsg_len. = CMSG_LENcxx . . $ `<external>/8962547315054503424/socket.h:311:9`!(sizeof(struct sctp_sndrcvinfo)); |
| 333 | outmessage.msg_controllencxx . . $ msghdr#msg_controllen. = cmsg->cmsg_lencxx . . $ cmsghdr#cmsg_len.; |
| 334 | sinfo = (struct sctp_sndrcvinfocxx . . $ sctp_sndrcvinfo# *)CMSG_DATAcxx . . $ `<external>/8962547315054503424/socket.h:299:10`!(cmsg); |
| 335 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(sinfo, 0x00, sizeof(struct sctp_sndrcvinfocxx . . $ sctp_sndrcvinfo#)); |
| 336 | |
| 337 | ppid++; |
| 338 | |
| 339 | sinfo->sinfo_ppidcxx . . $ sctp_sndrcvinfo#sinfo_ppid. = ppid; |
| 340 | sinfo->sinfo_streamcxx . . $ sctp_sndrcvinfo#sinfo_stream. = stream; |
| 341 | sinfo->sinfo_assoc_idcxx . . $ sctp_sndrcvinfo#sinfo_assoc_id. = associd; |
| 342 | |
| 343 | outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_basecxx . . $ iovec#iov_base. = message; |
| 344 | outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_lencxx . . $ iovec#iov_len. = size + 1; |
| 345 | |
| 346 | test_sendmsgcxx . . $ test_sendmsg(c45a39c477f473e).(sk, &outmessage, 0, size+1); |
| 347 | } |
| 348 | |
| 349 | printfcxx . . $ printf(581fddd72a8db8fc).("\n\n\t\tComplete all the data sendings to receiver...\n\n\n"); |
| 350 | |
| 351 | error = 0; |
| 352 | closecxx . . $ close(7864480464b09eea).(sk); |
| 353 | |
| 354 | freecxx . . $ free(5d22bdacc48458e8).(message); |
| 355 | |
| 356 | /* Indicate successful completion. */ |
| 357 | return 0; |
| 358 | |
| 359 | } |