/libuv/test/ |
H A D | test-tcp-bind-error.c | 46 struct sockaddr_in addr; in TEST_IMPL() local 66 addrlen = sizeof(addr); in TEST_IMPL() 81 struct sockaddr_in addr; in TEST_IMPL() local 114 struct sockaddr_in addr; in TEST_IMPL() local 139 struct sockaddr_in addr; in TEST_IMPL() local 215 struct sockaddr_in addr; in TEST_IMPL() local 232 struct sockaddr_in addr; in TEST_IMPL() local 263 struct sockaddr_in addr; in TEST_IMPL() local 303 struct sockaddr_in addr; in TEST_IMPL() local 305 memset(&addr, 0, sizeof(addr)); in TEST_IMPL() [all …]
|
H A D | test-udp-ipv6.c | 94 if (addr != NULL) { in is_from_client() 95 ASSERT_EQ(addr->sa_family, AF_INET6); in is_from_client() 96 addr6 = (struct sockaddr_in6*) addr; in is_from_client() 115 if (!is_from_client(addr) || (nread == 0 && addr == NULL)) in ipv6_recv_fail() 129 if (!is_from_client(addr) || (nread == 0 && addr == NULL)) in ipv6_recv_ok() 147 struct sockaddr_in addr; in do_test() local 179 ASSERT_OK(uv_inet_ntop(addr.sin_family, &addr.sin_addr, dst, sizeof(dst))); in do_test() 194 (const struct sockaddr*) &addr, in do_test() 198 addr_len = sizeof(addr); in do_test() 200 ASSERT_OK(uv_inet_ntop(addr.sin_family, &addr.sin_addr, dst, sizeof(dst))); in do_test() [all …]
|
H A D | test-ip4-addr.c | 30 struct sockaddr_in addr; in TEST_IMPL() local 38 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 39 ASSERT_OK(uv_ip4_addr("255.255.255.255", TEST_PORT, &addr)); in TEST_IMPL() 40 ASSERT_EQ(UV_EINVAL, uv_ip4_addr("255.255.255*000", TEST_PORT, &addr)); in TEST_IMPL() 41 ASSERT_EQ(UV_EINVAL, uv_ip4_addr("255.255.255.256", TEST_PORT, &addr)); in TEST_IMPL() 42 ASSERT_EQ(UV_EINVAL, uv_ip4_addr("2555.0.0.0", TEST_PORT, &addr)); in TEST_IMPL() 43 ASSERT_EQ(UV_EINVAL, uv_ip4_addr("255", TEST_PORT, &addr)); in TEST_IMPL() 46 ASSERT_EQ(addr.sin_len, sizeof(addr)); in TEST_IMPL() 51 &addr.sin_addr.s_addr)); in TEST_IMPL()
|
H A D | test-udp-open.c | 112 ASSERT_NULL(addr); in recv_cb() 118 ASSERT_NOT_NULL(addr); in recv_cb() 139 struct sockaddr_in addr; in TEST_IMPL() local 223 struct sockaddr_in addr; in TEST_IMPL() local 233 r = bind(sock, (struct sockaddr*) &addr, sizeof(addr)); in TEST_IMPL() 253 struct sockaddr_in addr; in TEST_IMPL() local 268 r = connect(sock, (const struct sockaddr*) &addr, sizeof(addr)); in TEST_IMPL() 306 struct sockaddr_un addr; in TEST_IMPL() local 316 memset(&addr, 0, sizeof addr); in TEST_IMPL() 317 addr.sun_family = AF_UNIX; in TEST_IMPL() [all …]
|
H A D | test-udp-multicast-join6.c | 87 struct sockaddr_in6 addr; in do_send() local 98 (const struct sockaddr*) &addr, in do_send() 106 const struct sockaddr* addr, in cl_recv_cb() argument 117 ASSERT_NULL(addr); in cl_recv_cb() 121 ASSERT_NOT_NULL(addr); in cl_recv_cb() 150 uv_interface_address_t* addr; in can_ipv6_external() local 155 if (uv_interface_addresses(&addr, &count)) in can_ipv6_external() 161 !addr[i].is_internal); in can_ipv6_external() 163 uv_free_interface_addresses(addr, count); in can_ipv6_external() 170 struct sockaddr_in6 addr; in TEST_IMPL() local [all …]
|
H A D | test-ip6-addr.c | 42 struct sockaddr_in6 addr; in TEST_IMPL() local 107 ASSERT_OK(uv_ip6_addr(scoped_addr, TEST_PORT, &addr)); in TEST_IMPL() 108 fprintf(stderr, "Got scope_id 0x%2x\n", (unsigned)addr.sin6_scope_id); in TEST_IMPL() 110 ASSERT_EQ(iface_index, addr.sin6_scope_id); in TEST_IMPL() 144 ASSERT_OK(uv_inet_pton(AF_INET6, ADDR, &addr)); \ 145 ASSERT_OK(uv_inet_pton(AF_INET6, ADDR "%en1", &addr)); \ 146 ASSERT_OK(uv_inet_pton(AF_INET6, ADDR "%%%%", &addr)); \ 147 ASSERT_OK(uv_inet_pton(AF_INET6, ADDR "%en1:1.2.3.4", &addr)); \ 150 ASSERT_NE(0, uv_inet_pton(AF_INET6, ADDR, &addr)); \ 151 ASSERT_NE(0, uv_inet_pton(AF_INET6, ADDR "%en1", &addr)); \ [all …]
|
H A D | test-udp-send-and-recv.c | 65 const struct sockaddr* addr, in cl_recv_cb() argument 76 ASSERT_NULL(addr); in cl_recv_cb() 80 ASSERT_NOT_NULL(addr); in cl_recv_cb() 119 const struct sockaddr* addr, in sv_recv_cb() argument 131 ASSERT_NULL(addr); in sv_recv_cb() 138 ASSERT_NOT_NULL(addr); in sv_recv_cb() 153 r = uv_udp_send(req, handle, &sndbuf, 1, addr, sv_send_cb); in sv_recv_cb() 161 struct sockaddr_in addr; in TEST_IMPL() local 166 ASSERT_OK(uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); in TEST_IMPL() 177 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() [all …]
|
H A D | test-ip-name.c | 29 struct sockaddr addr; member 38 struct sockaddr* addr = &test_addr.addr; in TEST_IMPL() local 47 ASSERT_OK(uv_ip_name(addr, dst, INET_ADDRSTRLEN)); in TEST_IMPL() 55 ASSERT_OK(uv_ip_name(addr, dst, INET6_ADDRSTRLEN)); in TEST_IMPL() 59 addr->sa_family = AF_UNIX; in TEST_IMPL() 61 ASSERT_EQ(UV_EAFNOSUPPORT, uv_ip_name(addr, dst, INET6_ADDRSTRLEN)); in TEST_IMPL()
|
H A D | test-udp-bind.c | 31 struct sockaddr_in addr; in TEST_IMPL() local 36 ASSERT_OK(uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); in TEST_IMPL() 46 r = uv_udp_bind(&h1, (const struct sockaddr*) &addr, 0); in TEST_IMPL() 49 r = uv_udp_bind(&h2, (const struct sockaddr*) &addr, 0); in TEST_IMPL() 64 struct sockaddr_in addr; in TEST_IMPL() local 69 ASSERT_OK(uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); in TEST_IMPL() 79 r = uv_udp_bind(&h1, (const struct sockaddr*) &addr, UV_UDP_REUSEADDR); in TEST_IMPL() 82 r = uv_udp_bind(&h2, (const struct sockaddr*) &addr, UV_UDP_REUSEADDR); in TEST_IMPL()
|
H A D | test-udp-try-send.c | 61 const struct sockaddr* addr, in sv_recv_cb() argument 66 ASSERT_NULL(addr); in sv_recv_cb() 71 ASSERT_NOT_NULL(addr); in sv_recv_cb() 82 struct sockaddr_in addr; in TEST_IMPL() local 87 ASSERT_OK(uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); in TEST_IMPL() 92 r = uv_udp_bind(&server, (const struct sockaddr*) &addr, 0); in TEST_IMPL() 98 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 104 r = uv_udp_try_send(&client, &buf, 1, (const struct sockaddr*) &addr); in TEST_IMPL() 108 r = uv_udp_try_send(&client, &buf, 1, (const struct sockaddr*) &addr); in TEST_IMPL()
|
H A D | test-udp-send-immediate.c | 70 const struct sockaddr* addr, in sv_recv_cb() argument 78 ASSERT_NULL(addr); in sv_recv_cb() 85 ASSERT_NOT_NULL(addr); in sv_recv_cb() 98 struct sockaddr_in addr; in TEST_IMPL() local 103 ASSERT_OK(uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); in TEST_IMPL() 108 r = uv_udp_bind(&server, (const struct sockaddr*) &addr, 0); in TEST_IMPL() 114 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 126 (const struct sockaddr*) &addr, in TEST_IMPL() 136 (const struct sockaddr*) &addr, in TEST_IMPL()
|
H A D | test-udp-mmsg.c | 74 const struct sockaddr* addr, in recv_cb() argument 81 ASSERT_NULL(addr); in recv_cb() 88 ASSERT_NULL(addr); in recv_cb() 91 ASSERT_NOT_NULL(addr); in recv_cb() 109 struct sockaddr_in addr; in TEST_IMPL() local 113 ASSERT_OK(uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); in TEST_IMPL() 118 ASSERT_OK(uv_udp_bind(&recver, (const struct sockaddr*) &addr, 0)); in TEST_IMPL() 122 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 128 ASSERT_EQ(4, uv_udp_try_send(&sender, &buf, 1, (const struct sockaddr*) &addr)); in TEST_IMPL()
|
H A D | test-udp-alloc-cb-fail.c | 71 const struct sockaddr* addr, in cl_recv_cb() argument 112 const struct sockaddr* addr, in sv_recv_cb() argument 124 ASSERT_NULL(addr); in sv_recv_cb() 131 ASSERT_NOT_NULL(addr); in sv_recv_cb() 142 r = uv_udp_send(req, handle, &sndbuf, 1, addr, sv_send_cb); in sv_recv_cb() 150 struct sockaddr_in addr; in TEST_IMPL() local 155 ASSERT_OK(uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); in TEST_IMPL() 160 r = uv_udp_bind(&server, (const struct sockaddr*) &addr, 0); in TEST_IMPL() 166 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 176 (const struct sockaddr*) &addr, in TEST_IMPL()
|
H A D | test-tcp-bind6-error.c | 38 struct sockaddr_in6 addr; in TEST_IMPL() local 45 ASSERT_OK(uv_ip6_addr("::", TEST_PORT, &addr)); in TEST_IMPL() 49 r = uv_tcp_bind(&server1, (const struct sockaddr*) &addr, 0); in TEST_IMPL() 54 r = uv_tcp_bind(&server2, (const struct sockaddr*) &addr, 0); in TEST_IMPL() 75 struct sockaddr_in6 addr; in TEST_IMPL() local 82 ASSERT_OK(uv_ip6_addr("4:4:4:4:4:4:4:4", TEST_PORT, &addr)); in TEST_IMPL() 86 r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); in TEST_IMPL() 160 struct sockaddr_in6 addr; in TEST_IMPL() local 167 ASSERT_OK(uv_ip6_addr("::1", TEST_PORT, &addr)); in TEST_IMPL() 171 r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); in TEST_IMPL()
|
H A D | test-udp-multicast-join.c | 75 struct sockaddr_in addr; in do_send() local 79 ASSERT_OK(uv_ip4_addr(MULTICAST_ADDR, TEST_PORT, &addr)); in do_send() 86 (const struct sockaddr*) &addr, in do_send() 94 const struct sockaddr* addr, in cl_recv_cb() argument 105 ASSERT_NULL(addr); in cl_recv_cb() 109 ASSERT_NOT_NULL(addr); in cl_recv_cb() 122 r = uv_ip4_name((const struct sockaddr_in*)addr, source_addr, sizeof(source_addr)); in cl_recv_cb() 151 struct sockaddr_in addr; in TEST_IMPL() local 153 ASSERT_OK(uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); in TEST_IMPL() 162 r = uv_udp_bind(&server, (const struct sockaddr*) &addr, 0); in TEST_IMPL()
|
H A D | test-udp-options.c | 30 static int udp_options_test(const struct sockaddr* addr) { in udp_options_test() argument 43 r = uv_udp_bind(&h, addr, 0); in udp_options_test() 56 if (addr->sa_family == AF_INET6) in udp_options_test() 96 struct sockaddr_in addr; in TEST_IMPL() local 98 ASSERT_OK(uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); in TEST_IMPL() 99 return udp_options_test((const struct sockaddr*) &addr); in TEST_IMPL() 104 struct sockaddr_in6 addr; in TEST_IMPL() local 109 ASSERT_OK(uv_ip6_addr("::", TEST_PORT, &addr)); in TEST_IMPL() 110 return udp_options_test((const struct sockaddr*) &addr); in TEST_IMPL()
|
H A D | test-tcp-create-socket-early.c | 61 struct sockaddr_in addr; in tcp_listener() local 64 ASSERT_OK(uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); in tcp_listener() 69 r = uv_tcp_bind(server, (const struct sockaddr*) &addr, 0); in tcp_listener() 95 struct sockaddr_in addr; in TEST_IMPL() local 101 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 120 r = uv_tcp_bind(&client, (const struct sockaddr*) &addr, 0); in TEST_IMPL() 126 ASSERT_OK(memcmp(&addr.sin_addr, in TEST_IMPL() 128 sizeof(addr.sin_addr))); in TEST_IMPL() 139 struct sockaddr_in addr; in TEST_IMPL() local 147 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() [all …]
|
H A D | test-udp-create-socket-early.c | 35 struct sockaddr_in addr; in TEST_IMPL() local 41 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 60 r = uv_udp_bind(&client, (const struct sockaddr*) &addr, 0); in TEST_IMPL() 66 ASSERT_OK(memcmp(&addr.sin_addr, in TEST_IMPL() 68 sizeof(addr.sin_addr))); in TEST_IMPL() 79 struct sockaddr_in addr; in TEST_IMPL() local 87 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 110 r = uv_udp_bind(&client, (const struct sockaddr*) &addr, 0); in TEST_IMPL()
|
H A D | test-tcp-connect-timeout.c | 64 struct sockaddr_in addr; in TEST_IMPL() local 67 ASSERT_OK(uv_ip4_addr("8.8.8.8", 9999, &addr)); in TEST_IMPL() 80 (const struct sockaddr*) &addr, in TEST_IMPL() 127 struct sockaddr_in addr; in TEST_IMPL() local 133 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 147 (const struct sockaddr*) &addr, in TEST_IMPL() 161 struct sockaddr_in6 addr; in TEST_IMPL() local 171 ASSERT_OK(uv_ip6_addr("::1", 9999, &addr)); in TEST_IMPL() 185 (const struct sockaddr*) &addr, in TEST_IMPL()
|
H A D | test-multiple-listen.c | 48 struct sockaddr_in addr; in start_server() local 51 ASSERT_OK(uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); in start_server() 56 r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); in start_server() 77 struct sockaddr_in addr; in client_connect() local 81 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in client_connect() 89 (const struct sockaddr*) &addr, in client_connect()
|
H A D | benchmark-udp-pummel.c | 36 struct sockaddr_in addr; member 42 struct sockaddr_in addr; member 103 (const struct sockaddr*) &s->addr, in send_cb() 112 const struct sockaddr* addr, in recv_cb() argument 122 ASSERT_EQ(addr->sa_family, AF_INET); in recv_cb() 174 struct sockaddr_in addr; in pummel() local 175 ASSERT_OK(uv_ip4_addr("0.0.0.0", BASE_PORT + i, &addr)); in pummel() 177 ASSERT_OK(uv_udp_bind(&s->udp_handle, (const struct sockaddr*) &addr, 0)); in pummel() 192 &s->addr)); in pummel() 198 (const struct sockaddr*) &s->addr, in pummel()
|
H A D | test-udp-send-unreachable.c | 80 const struct sockaddr* addr, in recv_cb() argument 89 ASSERT_NULL(addr); in recv_cb() 91 ASSERT_NOT_NULL(addr); in recv_cb() 107 struct sockaddr_in addr; in TEST_IMPL() local 118 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 144 (const struct sockaddr*) &addr, in TEST_IMPL() 154 (const struct sockaddr*) &addr, in TEST_IMPL() 177 (const struct sockaddr*) &addr, in TEST_IMPL() 187 (const struct sockaddr*) &addr, in TEST_IMPL()
|
H A D | test-tcp-open.c | 237 struct sockaddr_in addr; in TEST_IMPL() local 242 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 255 (const struct sockaddr*) &addr, in TEST_IMPL() 313 struct sockaddr_in addr; in TEST_IMPL() local 320 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 324 ASSERT_OK(bind(sock, (struct sockaddr*) &addr, sizeof(addr))); in TEST_IMPL() 336 struct sockaddr_in addr; in TEST_IMPL() local 341 ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); in TEST_IMPL() 346 ASSERT_OK(connect(sock, (struct sockaddr*) &addr, sizeof(addr))); in TEST_IMPL() 376 struct sockaddr_in addr; in TEST_IMPL() local [all …]
|
/libuv/src/ |
H A D | uv-common.c | 255 memset(addr, 0, sizeof(*addr)); in uv_ip4_addr() 256 addr->sin_family = AF_INET; in uv_ip4_addr() 257 addr->sin_port = htons(port); in uv_ip4_addr() 259 addr->sin_len = sizeof(*addr); in uv_ip4_addr() 270 memset(addr, 0, sizeof(*addr)); in uv_ip6_addr() 271 addr->sin6_family = AF_INET6; in uv_ip6_addr() 274 addr->sin6_len = sizeof(*addr); in uv_ip6_addr() 421 if (addr == NULL) { in uv_udp_connect() 443 struct sockaddr_storage addr; in uv__udp_is_connected() local 448 addrlen = sizeof(addr); in uv__udp_is_connected() [all …]
|
/libuv/src/unix/ |
H A D | udp.c | 601 memset(addr, 0, sizeof *addr); in uv__udp_maybe_deferred_bind() 604 addrlen = sizeof *addr; in uv__udp_maybe_deferred_bind() 610 memset(addr, 0, sizeof *addr); in uv__udp_maybe_deferred_bind() 613 addrlen = sizeof *addr; in uv__udp_maybe_deferred_bind() 683 struct sockaddr addr; in uv__udp_disconnect() local 686 memset(&addr, 0, sizeof(addr)); in uv__udp_disconnect() 704 r = connect(handle->io_watcher.fd, (struct sockaddr*) &addr, sizeof(addr)); in uv__udp_disconnect() 733 if (addr) { in uv__udp_send() 747 if (addr == NULL) in uv__udp_send() 750 memcpy(&req->addr, addr, addrlen); in uv__udp_send() [all …]
|