Go to the documentation of this file.
14 #undef PACKAGE_BUGREPORT
16 #undef PACKAGE_TARNAME
25 #ifdef HAVE_ARPA_INET_H
26 #include <arpa/inet.h>
39 #ifndef CARES_SYMBOL_HIDING
45 <<
" for input " <<
input;
54 #ifndef CARES_SYMBOL_HIDING
135 expected = htonl(0x01020304);
138 expected = htonl(0x0a0b0c0d);
141 expected = htonl(0x0a0b0c0d);
145 expected = htonl(0x11223340);
170 void*
p = &(
data->data);
188 #ifndef CARES_SYMBOL_HIDING
191 for (
int ii = 0; ii < 100000; ii++) {
200 TEST(LibraryInit, StrdupFailures) {
216 SetAllocSizeFail(
sizeof(
struct ares_data));
221 byte a[4] = {0x80, 0x01, 0x02, 0x03};
222 byte b[4] = {0x80, 0x01, 0x02, 0x04};
223 byte c[4] = {0x01, 0xFF, 0x80, 0x02};
228 for (
int ii = 1; ii < (3*8+5); ii++) {
245 unsigned int u = 100;
259 TempFile temp(
"abcde\n0123456789\nXYZ\n012345678901234567890\n\n");
260 FILE *fp = fopen(
temp.filename(),
"r");
279 TempFile temp(
"abcde\n0123456789\nXYZ\n012345678901234567890");
280 FILE *fp = fopen(
temp.filename(),
"r");
301 TempFile hostsfile(
"1.2.3.4 example.com \n"
302 " 2.3.4.5\tgoogle.com www.google.com\twww2.google.com\n"
307 struct hostent *host =
nullptr;
315 std::stringstream ss1;
317 EXPECT_EQ(
"{'example.com' aliases=[] addrs=[1.2.3.4]}", ss1.str());
323 std::stringstream ss2;
325 EXPECT_EQ(
"{'google.com' aliases=[www.google.com, www2.google.com] addrs=[2.3.4.5]}", ss2.str());
334 std::stringstream ss3;
336 EXPECT_EQ(
"{'ipv6.com' aliases=[] addrs=[0000:0000:0000:0000:0000:0000:0000:0001]}", ss3.str());
344 TempFile hostsfile(
"1.2.3.4 example.com alias1 alias2\n");
345 struct hostent *host =
nullptr;
349 for (
int ii = 1; ii <= 8; ii++) {
360 TempFile hostsfile(
"1.2.3.4 example.com \n"
361 " 2.3.4.5\tgoogle.com www.google.com\twww2.google.com\n"
374 std::stringstream ss;
376 EXPECT_EQ(
"{example.com addr=[1.2.3.4]}", ss.str());
380 TempFile hostsfile(
"1.2.3.4 example.com \n"
381 " 2.3.4.5\tgoogle.com www.google.com\twww2.google.com\n"
394 std::stringstream ss;
396 EXPECT_EQ(
"{www.google.com->google.com, www2.google.com->google.com addr=[2.3.4.5]}", ss.str());
400 TempFile hostsfile(
"1.2.3.4 example.com \n"
401 " 2.3.4.5\tgoogle.com www.google.com\twww2.google.com\n"
414 std::stringstream ss;
416 EXPECT_EQ(
"{www.google.com->google.com, www2.google.com->google.com addr=[2.3.4.5]}", ss.str());
420 TempFile hostsfile(
"1.2.3.4 example.com \n"
421 " 2.3.4.5\tgoogle.com www.google.com\twww2.google.com\n"
434 std::stringstream ss;
436 EXPECT_EQ(
"{ipv6.com addr=[[0000:0000:0000:0000:0000:0000:0000:0001]]}", ss.str());
440 TempFile hostsfile(
"1.2.3.4 example.com alias1 alias2\n");
442 unsigned short port = 80;
444 memset(&hints, 0,
sizeof(hints));
450 for (
int ii = 1; ii <= 3; ii++) {
472 #ifdef CARES_EXPOSE_STATICS
477 TEST_F(LibraryTest, Striendstr) {
484 const char *
str =
"plugh";
488 TEST_F(DefaultChannelTest, SingleDomain) {
489 TempFile aliases(
"www www.google.com\n");
490 EnvValue with_env(
"HOSTALIASES", aliases.filename());
492 SetAllocSizeFail(128);
521 #if defined(USE_BLOCKING_SOCKETS)
523 #elif defined(HAVE_FCNTL_O_NONBLOCK)
526 flags = fcntl(s, F_GETFL, 0);
527 return fcntl(s, F_SETFL,
flags | O_NONBLOCK);
528 #elif defined(HAVE_IOCTL_FIONBIO)
531 return ioctl(s, FIONBIO, &
flags);
532 #elif defined(HAVE_IOCTLSOCKET_FIONBIO)
537 unsigned long flags = 1UL;
539 return ioctlsocket(s, FIONBIO, &
flags);
540 #elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)
543 return IoctlSocket(s, FIONBIO,
flags);
544 #elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK)
547 return setsockopt(s, SOL_SOCKET, SO_NONBLOCK, &
b,
sizeof(
b));
549 # error "no non-blocking method was found/used/set"
571 return ::connect(s,
addr,
len);
577 return sread(s,
dst,
len);
#define ASSERT_NE(val1, val2)
CARES_EXTERN int ares_inet_pton(int af, const char *src, void *dst)
CARES_EXTERN int ares_library_init(int flags)
return memset(p, 0, total)
ares_socket_t const struct iovec * vec
int ares__bitncmp(const void *l, const void *r, int n)
char * ares_strdup(const char *s1)
static int copy(grpc_slice_buffer *input, grpc_slice_buffer *output)
#define EXPECT_GT(val1, val2)
ares_socket_t const struct sockaddr socklen_t void ares_socket_t void size_t len
const char * filename() const
void CheckPtoN4(int size, unsigned int value, const char *input)
OPENSSL_EXPORT pem_password_cb void * u
#define ARES_LIB_INIT_ALL
ares_ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt)
struct ares_addr_node * next
int ares__is_onion_domain(const char *name)
STATIC_TESTABLE char * ares_striendstr(const char *s1, const char *s2)
int ares__read_line(FILE *fp, char **buf, size_t *bufsize)
#define ARES_AI_CANONNAME
int aresx_sltosi(long slnum)
CARES_EXTERN void ares_free_hostent(struct hostent *host)
bool ReadLine(StringPiece *input, StringPiece *line)
void *(* ares_malloc)(size_t size)=default_malloc
#define EXPECT_NE(val1, val2)
RefCountedPtr< Channel > channel_
#define writev(s, ptr, cnt)
#define ARES_DATATYPE_MARK
CARES_EXTERN int ares_save_options(ares_channel channel, struct ares_options *options, int *optmask)
int ares_inet_net_pton(int af, const char *src, void *dst, size_t size)
CARES_EXTERN void ares_free_data(void *dataptr)
void * ares_malloc_data(ares_datatype type)
CARES_EXTERN void ares_library_cleanup(void)
int aresx_sztosi(ares_ssize_t sznum)
int ares__get_hostent(FILE *fp, int family, struct hostent **host)
#define EXPECT_LT(val1, val2)
void(* ares_free)(void *ptr)=default_free
@ ARES_DATATYPE_ADDR_NODE
#define EXPECT_TRUE(condition)
#define ARES_FLAG_NOALIASES
static int configure_socket(ares_socket_t s)
CARES_EXTERN void ares_getaddrinfo(ares_channel channel, const char *node, const char *service, const struct ares_addrinfo_hints *hints, ares_addrinfo_callback callback, void *arg)
int ares__single_domain(ares_channel channel, const char *name, char **s)
TEST_F(LibraryTest, OptionsChannelInit)
#define ARES_FLAG_NOSEARCH
CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t
void AddrInfoCallback(void *data, int status, int timeouts, struct ares_addrinfo *ai)
int ares__readaddrinfo(FILE *fp, const char *name, unsigned short port, const struct ares_addrinfo_hints *hints, struct ares_addrinfo *ai)
unsigned int aresx_sztoui(ares_ssize_t sznum)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:42