ares-test-init.cc
Go to the documentation of this file.
1 #include "ares-test.h"
2 
3 // library initialization is only needed for windows builds
4 #ifdef WIN32
5 #define EXPECTED_NONINIT ARES_ENOTINITIALIZED
6 #else
7 #define EXPECTED_NONINIT ARES_SUCCESS
8 #endif
9 
10 namespace ares {
11 namespace test {
12 
13 TEST(LibraryInit, Basic) {
19 }
20 
21 TEST(LibraryInit, UnexpectedCleanup) {
25 }
26 
27 TEST(LibraryInit, DISABLED_InvalidParam) {
28  // TODO: police flags argument to ares_library_init()
32 }
33 
34 TEST(LibraryInit, Nested) {
44 }
45 
46 TEST(LibraryInit, BasicChannelInit) {
48  ares_channel channel = nullptr;
50  EXPECT_NE(nullptr, channel);
53 }
54 
55 TEST_F(LibraryTest, OptionsChannelInit) {
56  struct ares_options opts = {0};
57  int optmask = 0;
59  optmask |= ARES_OPT_FLAGS;
60  opts.timeout = 2000;
61  optmask |= ARES_OPT_TIMEOUTMS;
62  opts.tries = 2;
63  optmask |= ARES_OPT_TRIES;
64  opts.ndots = 4;
65  optmask |= ARES_OPT_NDOTS;
66  opts.udp_port = 54;
67  optmask |= ARES_OPT_UDP_PORT;
68  opts.tcp_port = 54;
69  optmask |= ARES_OPT_TCP_PORT;
70  opts.socket_send_buffer_size = 514;
71  optmask |= ARES_OPT_SOCK_SNDBUF;
72  opts.socket_receive_buffer_size = 514;
73  optmask |= ARES_OPT_SOCK_RCVBUF;
74  opts.ednspsz = 1280;
75  optmask |= ARES_OPT_EDNSPSZ;
76  opts.nservers = 2;
77  opts.servers = (struct in_addr *)malloc(opts.nservers * sizeof(struct in_addr));
78  opts.servers[0].s_addr = htonl(0x01020304);
79  opts.servers[1].s_addr = htonl(0x02030405);
80  optmask |= ARES_OPT_SERVERS;
81  opts.ndomains = 2;
82  opts.domains = (char **)malloc(opts.ndomains * sizeof(char *));
83  opts.domains[0] = strdup("example.com");
84  opts.domains[1] = strdup("example2.com");
85  optmask |= ARES_OPT_DOMAINS;
86  opts.lookups = strdup("b");
87  optmask |= ARES_OPT_LOOKUPS;
88  optmask |= ARES_OPT_ROTATE;
89  opts.resolvconf_path = strdup("/etc/resolv.conf");
90  optmask |= ARES_OPT_RESOLVCONF;
91 
92  ares_channel channel = nullptr;
94  EXPECT_NE(nullptr, channel);
95 
96  ares_channel channel2 = nullptr;
97  EXPECT_EQ(ARES_SUCCESS, ares_dup(&channel2, channel));
98 
99  struct ares_options opts2 = {0};
100  int optmask2 = 0;
101  EXPECT_EQ(ARES_SUCCESS, ares_save_options(channel2, &opts2, &optmask2));
102 
103  // Note that not all opts-settable fields are saved (e.g.
104  // ednspsz, socket_{send,receive}_buffer_size).
105  EXPECT_EQ(opts.flags, opts2.flags);
106  EXPECT_EQ(opts.timeout, opts2.timeout);
107  EXPECT_EQ(opts.tries, opts2.tries);
108  EXPECT_EQ(opts.ndots, opts2.ndots);
109  EXPECT_EQ(opts.udp_port, opts2.udp_port);
110  EXPECT_EQ(opts.tcp_port, opts2.tcp_port);
111  EXPECT_EQ(1, opts2.nservers); // Truncated by ARES_FLAG_PRIMARY
112  EXPECT_EQ(opts.servers[0].s_addr, opts2.servers[0].s_addr);
113  EXPECT_EQ(opts.ndomains, opts2.ndomains);
114  EXPECT_EQ(std::string(opts.domains[0]), std::string(opts2.domains[0]));
115  EXPECT_EQ(std::string(opts.domains[1]), std::string(opts2.domains[1]));
116  EXPECT_EQ(std::string(opts.lookups), std::string(opts2.lookups));
117  EXPECT_EQ(std::string(opts.resolvconf_path), std::string(opts2.resolvconf_path));
118 
120  ares_destroy_options(&opts2);
122  ares_destroy(channel2);
123 }
124 
125 TEST_F(LibraryTest, ChannelAllocFail) {
127  for (int ii = 1; ii <= 25; ii++) {
128  ClearFails();
129  SetAllocFail(ii);
130  channel = nullptr;
131  int rc = ares_init(&channel);
132  // The number of allocations depends on local environment, so don't expect ENOMEM.
133  if (rc == ARES_ENOMEM) {
134  EXPECT_EQ(nullptr, channel);
135  } else {
137  }
138  }
139 }
140 
141 TEST_F(LibraryTest, OptionsChannelAllocFail) {
142  struct ares_options opts = {0};
143  int optmask = 0;
144  opts.flags = ARES_FLAG_USEVC;
145  optmask |= ARES_OPT_FLAGS;
146  opts.timeout = 2;
147  optmask |= ARES_OPT_TIMEOUT;
148  opts.tries = 2;
149  optmask |= ARES_OPT_TRIES;
150  opts.ndots = 4;
151  optmask |= ARES_OPT_NDOTS;
152  opts.udp_port = 54;
153  optmask |= ARES_OPT_UDP_PORT;
154  opts.tcp_port = 54;
155  optmask |= ARES_OPT_TCP_PORT;
156  opts.socket_send_buffer_size = 514;
157  optmask |= ARES_OPT_SOCK_SNDBUF;
158  opts.socket_receive_buffer_size = 514;
159  optmask |= ARES_OPT_SOCK_RCVBUF;
160  opts.ednspsz = 1280;
161  optmask |= ARES_OPT_EDNSPSZ;
162  opts.nservers = 2;
163  opts.servers = (struct in_addr *)malloc(opts.nservers * sizeof(struct in_addr));
164  opts.servers[0].s_addr = htonl(0x01020304);
165  opts.servers[1].s_addr = htonl(0x02030405);
166  optmask |= ARES_OPT_SERVERS;
167  opts.ndomains = 2;
168  opts.domains = (char **)malloc(opts.ndomains * sizeof(char *));
169  opts.domains[0] = strdup("example.com");
170  opts.domains[1] = strdup("example2.com");
171  optmask |= ARES_OPT_DOMAINS;
172  opts.lookups = strdup("b");
173  optmask |= ARES_OPT_LOOKUPS;
174  optmask |= ARES_OPT_ROTATE;
175  opts.resolvconf_path = strdup("/etc/resolv.conf");
176  optmask |= ARES_OPT_RESOLVCONF;
177 
178  ares_channel channel = nullptr;
179  for (int ii = 1; ii <= 8; ii++) {
180  ClearFails();
181  SetAllocFail(ii);
182  int rc = ares_init_options(&channel, &opts, optmask);
183  if (rc == ARES_ENOMEM) {
184  EXPECT_EQ(nullptr, channel);
185  } else {
186  EXPECT_EQ(ARES_SUCCESS, rc);
188  channel = nullptr;
189  }
190  }
191  ClearFails();
192 
194  EXPECT_NE(nullptr, channel);
195 
196  // Add some servers and a sortlist for flavour.
198  ares_set_servers_csv(channel, "1.2.3.4,0102:0304:0506:0708:0910:1112:1314:1516,2.3.4.5"));
199  EXPECT_EQ(ARES_SUCCESS, ares_set_sortlist(channel, "1.2.3.4 2.3.4.5"));
200 
201  ares_channel channel2 = nullptr;
202  for (int ii = 1; ii <= 18; ii++) {
203  ClearFails();
204  SetAllocFail(ii);
205  EXPECT_EQ(ARES_ENOMEM, ares_dup(&channel2, channel)) << ii;
206  EXPECT_EQ(nullptr, channel2) << ii;
207  }
208 
209  struct ares_options opts2;
210  int optmask2 = 0;
211  for (int ii = 1; ii <= 6; ii++) {
212  memset(&opts2, 0, sizeof(opts2));
213  ClearFails();
214  SetAllocFail(ii);
215  EXPECT_EQ(ARES_ENOMEM, ares_save_options(channel, &opts2, &optmask2)) << ii;
216  // May still have allocations even after ARES_ENOMEM return code.
217  ares_destroy_options(&opts2);
218  }
221 }
222 
223 TEST_F(LibraryTest, FailChannelInit) {
229  SetAllocFail(1);
230  ares_channel channel = nullptr;
232  EXPECT_EQ(nullptr, channel);
234 }
235 
236 #ifndef WIN32
237 TEST_F(LibraryTest, EnvInit) {
238  ares_channel channel = nullptr;
239  EnvValue v1("LOCALDOMAIN", "this.is.local");
240  EnvValue v2("RES_OPTIONS", "options debug ndots:3 retry:3 rotate retrans:2");
243 }
244 
245 TEST_F(LibraryTest, EnvInitAllocFail) {
247  EnvValue v1("LOCALDOMAIN", "this.is.local");
248  EnvValue v2("RES_OPTIONS", "options debug ndots:3 retry:3 rotate retrans:2");
249  for (int ii = 1; ii <= 10; ii++) {
250  ClearFails();
251  SetAllocFail(ii);
252  channel = nullptr;
253  int rc = ares_init(&channel);
254  if (rc == ARES_SUCCESS) {
256  } else {
257  EXPECT_EQ(ARES_ENOMEM, rc);
258  }
259  }
260 }
261 #endif
262 
263 TEST_F(DefaultChannelTest, SetAddresses) {
264  ares_set_local_ip4(channel_, 0x01020304);
265  byte addr6[16] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
266  0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10};
268  ares_set_local_dev(channel_, "dummy");
269 }
270 
271 TEST_F(DefaultChannelTest, SetSortlistFailures) {
272  EXPECT_EQ(ARES_ENODATA, ares_set_sortlist(nullptr, "1.2.3.4"));
274  EXPECT_EQ(ARES_SUCCESS, ares_set_sortlist(channel_, "xyzzy ; 0x123"));
275 }
276 
277 TEST_F(DefaultChannelTest, SetSortlistVariants) {
279  EXPECT_EQ(ARES_SUCCESS, ares_set_sortlist(channel_, "1.2.3.4 ; 2.3.4.5"));
284 }
285 
286 TEST_F(DefaultChannelTest, SetSortlistAllocFail) {
287  for (int ii = 1; ii <= 3; ii++) {
288  ClearFails();
289  SetAllocFail(ii);
290  EXPECT_EQ(ARES_ENOMEM, ares_set_sortlist(channel_, "12.13.0.0/16 1234::5678/40 1.2.3.4")) << ii;
291  }
292 }
293 
294 #ifdef USE_WINSOCK
295 TEST(Init, NoLibraryInit) {
296  ares_channel channel = nullptr;
298 }
299 #endif
300 
301 #ifdef HAVE_CONTAINER
302 // These tests rely on the ability of non-root users to create a chroot
303 // using Linux namespaces.
304 
305 
306 // The library uses a variety of information sources to initialize a channel,
307 // in particular to determine:
308 // - search: the search domains to use
309 // - servers: the name servers to use
310 // - lookup: whether to check files or DNS or both (e.g. "fb")
311 // - options: various resolver options
312 // - sortlist: the order of preference for IP addresses
313 //
314 // The first source from the following list is used:
315 // - init_by_options(): explicitly specified values in struct ares_options
316 // - init_by_environment(): values from the environment:
317 // - LOCALDOMAIN -> search (single value)
318 // - RES_OPTIONS -> options
319 // - init_by_resolv_conf(): values from various config files:
320 // - /etc/resolv.conf -> search, lookup, servers, sortlist, options
321 // - /etc/nsswitch.conf -> lookup
322 // - /etc/host.conf -> lookup
323 // - /etc/svc.conf -> lookup
324 // - init_by_defaults(): fallback values:
325 // - gethostname(3) -> domain
326 // - "fb" -> lookup
327 
328 NameContentList filelist = {
329  {"/etc/resolv.conf", "nameserver 1.2.3.4\n"
330  "sortlist 1.2.3.4/16 2.3.4.5\n"
331  "search first.com second.com\n"},
332  {"/etc/hosts", "3.4.5.6 ahostname.com\n"},
333  {"/etc/nsswitch.conf", "hosts: files\n"}};
334 CONTAINED_TEST_F(LibraryTest, ContainerChannelInit,
335  "myhostname", "mydomainname.org", filelist) {
336  ares_channel channel = nullptr;
338  std::vector<std::string> actual = GetNameServers(channel);
339  std::vector<std::string> expected = {"1.2.3.4"};
340  EXPECT_EQ(expected, actual);
341 
342  struct ares_options opts;
343  int optmask = 0;
344  ares_save_options(channel, &opts, &optmask);
345  EXPECT_EQ(2, opts.ndomains);
346  EXPECT_EQ(std::string("first.com"), std::string(opts.domains[0]));
347  EXPECT_EQ(std::string("second.com"), std::string(opts.domains[1]));
349 
350  HostResult result;
351  ares_gethostbyname(channel, "ahostname.com", AF_INET, HostCallback, &result);
352  ProcessWork(channel, NoExtraFDs, nullptr);
353  EXPECT_TRUE(result.done_);
354  std::stringstream ss;
355  ss << result.host_;
356  EXPECT_EQ("{'ahostname.com' aliases=[] addrs=[3.4.5.6]}", ss.str());
357 
359  return HasFailure();
360 }
361 
362 CONTAINED_TEST_F(LibraryTest, ContainerSortlistOptionInit,
363  "myhostname", "mydomainname.org", filelist) {
364  ares_channel channel = nullptr;
365  struct ares_options opts = {0};
366  int optmask = 0;
367  optmask |= ARES_OPT_SORTLIST;
368  opts.nsort = 0;
369  // Explicitly specifying an empty sortlist in the options should override the
370  // environment.
372  ares_save_options(channel, &opts, &optmask);
373  EXPECT_EQ(0, opts.nsort);
374  EXPECT_EQ(nullptr, opts.sortlist);
377 
379  return HasFailure();
380 }
381 
382 NameContentList fullresolv = {
383  {"/etc/resolv.conf", " nameserver 1.2.3.4 \n"
384  "search first.com second.com\n"
385  "lookup bind\n"
386  "options debug ndots:5\n"
387  "sortlist 1.2.3.4/16 2.3.4.5\n"}};
388 CONTAINED_TEST_F(LibraryTest, ContainerFullResolvInit,
389  "myhostname", "mydomainname.org", fullresolv) {
390  ares_channel channel = nullptr;
392 
393  struct ares_options opts;
394  int optmask = 0;
395  ares_save_options(channel, &opts, &optmask);
396  EXPECT_EQ(std::string("b"), std::string(opts.lookups));
397  EXPECT_EQ(5, opts.ndots);
399 
401  return HasFailure();
402 }
403 
404 // Allow path for resolv.conf to be configurable
405 NameContentList myresolvconf = {
406  {"/tmp/myresolv.cnf", " nameserver 1.2.3.4 \n"
407  "search first.com second.com\n"
408  "lookup bind\n"
409  "options debug ndots:5\n"
410  "sortlist 1.2.3.4/16 2.3.4.5\n"}};
411 CONTAINED_TEST_F(LibraryTest, ContainerMyResolvConfInit,
412  "myhostname", "mydomain.org", myresolvconf) {
413  char filename[] = "/tmp/myresolv.cnf";
414  ares_channel channel = nullptr;
415  struct ares_options options = {0};
416  options.resolvconf_path = strdup(filename);
417  int optmask = ARES_OPT_RESOLVCONF;
419 
420  optmask = 0;
421  free(options.resolvconf_path);
422  options.resolvconf_path = NULL;
423 
426  EXPECT_EQ(std::string(filename), std::string(options.resolvconf_path));
427 
430  return HasFailure();
431 }
432 
433 NameContentList hostconf = {
434  {"/etc/resolv.conf", "nameserver 1.2.3.4\n"
435  "sortlist1.2.3.4\n" // malformed line
436  "search first.com second.com\n"},
437  {"/etc/host.conf", "order bind hosts\n"}};
438 CONTAINED_TEST_F(LibraryTest, ContainerHostConfInit,
439  "myhostname", "mydomainname.org", hostconf) {
440  ares_channel channel = nullptr;
442 
443  struct ares_options opts;
444  int optmask = 0;
445  ares_save_options(channel, &opts, &optmask);
446  EXPECT_EQ(std::string("bf"), std::string(opts.lookups));
448 
450  return HasFailure();
451 }
452 
453 NameContentList svcconf = {
454  {"/etc/resolv.conf", "nameserver 1.2.3.4\n"
455  "search first.com second.com\n"},
456  {"/etc/svc.conf", "hosts= bind\n"}};
457 CONTAINED_TEST_F(LibraryTest, ContainerSvcConfInit,
458  "myhostname", "mydomainname.org", svcconf) {
459  ares_channel channel = nullptr;
461 
462  struct ares_options opts;
463  int optmask = 0;
464  ares_save_options(channel, &opts, &optmask);
465  EXPECT_EQ(std::string("b"), std::string(opts.lookups));
467 
469  return HasFailure();
470 }
471 
472 NameContentList malformedresolvconflookup = {
473  {"/etc/resolv.conf", "nameserver 1.2.3.4\n"
474  "lookup garbage\n"}}; // malformed line
475 CONTAINED_TEST_F(LibraryTest, ContainerMalformedResolvConfLookup,
476  "myhostname", "mydomainname.org", malformedresolvconflookup) {
477  ares_channel channel = nullptr;
479 
480  struct ares_options opts;
481  int optmask = 0;
482  ares_save_options(channel, &opts, &optmask);
483  EXPECT_EQ(std::string("fb"), std::string(opts.lookups));
485 
487  return HasFailure();
488 }
489 
490 // Failures when expected config filenames are inaccessible.
491 class MakeUnreadable {
492  public:
493  explicit MakeUnreadable(const std::string& filename)
494  : filename_(filename) {
495  chmod(filename_.c_str(), 0000);
496  }
497  ~MakeUnreadable() { chmod(filename_.c_str(), 0644); }
498  private:
499  std::string filename_;
500 };
501 
502 CONTAINED_TEST_F(LibraryTest, ContainerResolvConfNotReadable,
503  "myhostname", "mydomainname.org", filelist) {
504  ares_channel channel = nullptr;
505  MakeUnreadable hide("/etc/resolv.conf");
506  // Unavailable /etc/resolv.conf falls back to defaults
508  return HasFailure();
509 }
510 CONTAINED_TEST_F(LibraryTest, ContainerNsswitchConfNotReadable,
511  "myhostname", "mydomainname.org", filelist) {
512  ares_channel channel = nullptr;
513  // Unavailable /etc/nsswitch.conf falls back to defaults.
514  MakeUnreadable hide("/etc/nsswitch.conf");
516 
517  struct ares_options opts;
518  int optmask = 0;
519  ares_save_options(channel, &opts, &optmask);
520  EXPECT_EQ(std::string("fb"), std::string(opts.lookups));
522 
524  return HasFailure();
525 }
526 CONTAINED_TEST_F(LibraryTest, ContainerHostConfNotReadable,
527  "myhostname", "mydomainname.org", hostconf) {
528  ares_channel channel = nullptr;
529  // Unavailable /etc/host.conf falls back to defaults.
530  MakeUnreadable hide("/etc/host.conf");
533  return HasFailure();
534 }
535 CONTAINED_TEST_F(LibraryTest, ContainerSvcConfNotReadable,
536  "myhostname", "mydomainname.org", svcconf) {
537  ares_channel channel = nullptr;
538  // Unavailable /etc/svc.conf falls back to defaults.
539  MakeUnreadable hide("/etc/svc.conf");
542  return HasFailure();
543 }
544 
545 NameContentList rotateenv = {
546  {"/etc/resolv.conf", "nameserver 1.2.3.4\n"
547  "search first.com second.com\n"
548  "options rotate\n"}};
549 CONTAINED_TEST_F(LibraryTest, ContainerRotateInit,
550  "myhostname", "mydomainname.org", rotateenv) {
551  ares_channel channel = nullptr;
553 
554  struct ares_options opts;
555  int optmask = 0;
556  ares_save_options(channel, &opts, &optmask);
559 
561  return HasFailure();
562 }
563 
564 CONTAINED_TEST_F(LibraryTest, ContainerRotateOverride,
565  "myhostname", "mydomainname.org", rotateenv) {
566  ares_channel channel = nullptr;
567  struct ares_options opts = {0};
568  int optmask = ARES_OPT_NOROTATE;
570 
571  optmask = 0;
572  ares_save_options(channel, &opts, &optmask);
575 
577  return HasFailure();
578 }
579 
580 // Test that blacklisted IPv6 resolves are ignored. They're filtered from any
581 // source, so resolv.conf is as good as any.
582 NameContentList blacklistedIpv6 = {
583  {"/etc/resolv.conf", " nameserver 254.192.1.1\n" // 0xfe.0xc0.0x01.0x01
584  " nameserver fec0::dead\n" // Blacklisted
585  " nameserver ffc0::c001\n" // Not blacklisted
586  " domain first.com\n"},
587  {"/etc/nsswitch.conf", "hosts: files\n"}};
588 CONTAINED_TEST_F(LibraryTest, ContainerBlacklistedIpv6,
589  "myhostname", "mydomainname.org", blacklistedIpv6) {
590  ares_channel channel = nullptr;
592  std::vector<std::string> actual = GetNameServers(channel);
593  std::vector<std::string> expected = {
594  "254.192.1.1",
595  "ffc0:0000:0000:0000:0000:0000:0000:c001"
596  };
597  EXPECT_EQ(expected, actual);
598 
599  struct ares_options opts;
600  int optmask = 0;
601  ares_save_options(channel, &opts, &optmask);
602  EXPECT_EQ(1, opts.ndomains);
603  EXPECT_EQ(std::string("first.com"), std::string(opts.domains[0]));
605 
607  return HasFailure();
608 }
609 
610 NameContentList multiresolv = {
611  {"/etc/resolv.conf", " nameserver 1::2 ; ;;\n"
612  " domain first.com\n"},
613  {"/etc/nsswitch.conf", "hosts: files\n"}};
614 CONTAINED_TEST_F(LibraryTest, ContainerMultiResolvInit,
615  "myhostname", "mydomainname.org", multiresolv) {
616  ares_channel channel = nullptr;
618  std::vector<std::string> actual = GetNameServers(channel);
619  std::vector<std::string> expected = {"0001:0000:0000:0000:0000:0000:0000:0002"};
620  EXPECT_EQ(expected, actual);
621 
622  struct ares_options opts;
623  int optmask = 0;
624  ares_save_options(channel, &opts, &optmask);
625  EXPECT_EQ(1, opts.ndomains);
626  EXPECT_EQ(std::string("first.com"), std::string(opts.domains[0]));
628 
630  return HasFailure();
631 }
632 
633 NameContentList systemdresolv = {
634  {"/etc/resolv.conf", "nameserver 1.2.3.4\n"
635  "domain first.com\n"},
636  {"/etc/nsswitch.conf", "hosts: junk resolve files\n"}};
637 CONTAINED_TEST_F(LibraryTest, ContainerSystemdResolvInit,
638  "myhostname", "mydomainname.org", systemdresolv) {
639  ares_channel channel = nullptr;
641 
642  struct ares_options opts;
643  int optmask = 0;
644  ares_save_options(channel, &opts, &optmask);
645  EXPECT_EQ(std::string("bf"), std::string(opts.lookups));
647 
649  return HasFailure();
650 }
651 
652 NameContentList empty = {}; // no files
653 CONTAINED_TEST_F(LibraryTest, ContainerEmptyInit,
654  "host.domain.org", "domain.org", empty) {
655  ares_channel channel = nullptr;
657  std::vector<std::string> actual = GetNameServers(channel);
658  std::vector<std::string> expected = {"127.0.0.1"};
659  EXPECT_EQ(expected, actual);
660 
661  struct ares_options opts;
662  int optmask = 0;
663  ares_save_options(channel, &opts, &optmask);
664  EXPECT_EQ(1, opts.ndomains);
665  EXPECT_EQ(std::string("domain.org"), std::string(opts.domains[0]));
666  EXPECT_EQ(std::string("fb"), std::string(opts.lookups));
668 
669 
671  return HasFailure();
672 }
673 
674 #endif
675 
676 } // namespace test
677 } // namespace ares
ares_set_local_ip4
CARES_EXTERN void ares_set_local_ip4(ares_channel channel, unsigned int local_ip)
Definition: ares_init.c:2568
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
filename
const char * filename
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:135
ARES_ENOMEM
#define ARES_ENOMEM
Definition: ares.h:117
ares_options::servers
struct in_addr * servers
Definition: ares.h:268
ares_options
Definition: ares.h:259
ares::test::LibraryTest::afree
static void afree(void *ptr)
Definition: ares-test.cc:159
ares_library_init
CARES_EXTERN int ares_library_init(int flags)
Definition: ares_library_init.c:133
memset
return memset(p, 0, total)
ares_set_local_ip6
CARES_EXTERN void ares_set_local_ip6(ares_channel channel, const unsigned char *local_ip6)
Definition: ares_init.c:2574
test
Definition: spinlock_test.cc:36
ares_options::domains
char ** domains
Definition: ares.h:270
ARES_FLAG_USEVC
#define ARES_FLAG_USEVC
Definition: ares.h:142
options
double_dict options[]
Definition: capstone_test.c:55
ares_options::tcp_port
unsigned short tcp_port
Definition: ares.h:265
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
ares_init
CARES_EXTERN int ares_init(ares_channel *channelptr)
Definition: ares_init.c:98
cstest_report.opts
opts
Definition: cstest_report.py:81
ares_destroy_options
CARES_EXTERN void ares_destroy_options(struct ares_options *options)
Definition: ares_destroy.c:25
ARES_OPT_UDP_PORT
#define ARES_OPT_UDP_PORT
Definition: ares.h:157
ARES_OPT_NOROTATE
#define ARES_OPT_NOROTATE
Definition: ares.h:169
ARES_LIB_INIT_ALL
#define ARES_LIB_INIT_ALL
Definition: ares.h:217
google::protobuf::python::cmessage::Init
static int Init(CMessage *self, PyObject *args, PyObject *kwargs)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:1287
ARES_OPT_ROTATE
#define ARES_OPT_ROTATE
Definition: ares.h:167
ares_set_servers_csv
CARES_EXTERN int ares_set_servers_csv(ares_channel channel, const char *servers)
Definition: ares_options.c:395
ARES_OPT_DOMAINS
#define ARES_OPT_DOMAINS
Definition: ares.h:160
ARES_OPT_TIMEOUT
#define ARES_OPT_TIMEOUT
Definition: ares.h:154
ARES_OPT_TIMEOUTMS
#define ARES_OPT_TIMEOUTMS
Definition: ares.h:166
ARES_OPT_NDOTS
#define ARES_OPT_NDOTS
Definition: ares.h:156
ares_library_initialized
CARES_EXTERN int ares_library_initialized(void)
Definition: ares_library_init.c:193
ARES_OPT_FLAGS
#define ARES_OPT_FLAGS
Definition: ares.h:153
ARES_OPT_LOOKUPS
#define ARES_OPT_LOOKUPS
Definition: ares.h:161
ares_options::ndots
int ndots
Definition: ares.h:263
EXPECT_EQ
#define EXPECT_EQ(a, b)
Definition: iomgr/time_averaged_stats_test.cc:27
ares_library_init_mem
CARES_EXTERN int ares_library_init_mem(int flags, void *(*amalloc)(size_t size), void(*afree)(void *ptr), void *(*arealloc)(void *ptr, size_t size))
Definition: ares_library_init.c:156
channel
wrapped_grpc_channel * channel
Definition: src/php/ext/grpc/call.h:33
EXPECT_NE
#define EXPECT_NE(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2028
ares_dup
CARES_EXTERN int ares_dup(ares_channel *dest, ares_channel src)
Definition: ares_init.c:243
ARES_ENODATA
#define ARES_ENODATA
Definition: ares.h:101
ares_set_sortlist
CARES_EXTERN int ares_set_sortlist(ares_channel channel, const char *sortstr)
Definition: ares_init.c:2614
ARES_OPT_SOCK_RCVBUF
#define ARES_OPT_SOCK_RCVBUF
Definition: ares.h:165
ares::test::EnvValue
Definition: ares-test.h:386
addr6
static struct sockaddr_in6 addr6
Definition: test-getnameinfo.c:34
channel_
RefCountedPtr< Channel > channel_
Definition: channel_connectivity.cc:209
ares_options::nservers
int nservers
Definition: ares.h:269
ares_options::udp_port
unsigned short udp_port
Definition: ares.h:264
ARES_ENOTINITIALIZED
#define ARES_ENOTINITIALIZED
Definition: ares.h:129
ares_options::resolvconf_path
char * resolvconf_path
Definition: ares.h:278
ARES_OPT_TCP_PORT
#define ARES_OPT_TCP_PORT
Definition: ares.h:158
ares-test.h
ARES_SUCCESS
#define ARES_SUCCESS
Definition: ares.h:98
ARES_OPT_EDNSPSZ
#define ARES_OPT_EDNSPSZ
Definition: ares.h:168
google_benchmark.example.empty
def empty(state)
Definition: example.py:31
ARES_FLAG_PRIMARY
#define ARES_FLAG_PRIMARY
Definition: ares.h:143
ares::test::DefaultChannelTest
Definition: ares-test.h:91
ares_save_options
CARES_EXTERN int ares_save_options(ares_channel channel, struct ares_options *options, int *optmask)
Definition: ares_init.c:314
EXPECTED_NONINIT
#define EXPECTED_NONINIT
Definition: ares-test-init.cc:7
ARES_OPT_TRIES
#define ARES_OPT_TRIES
Definition: ares.h:155
ares_channeldata
Definition: ares_private.h:266
ares::test::HostCallback
void HostCallback(void *data, int status, int timeouts, struct hostent *hostent)
Definition: ares-test.cc:591
ARES_OPT_SOCK_SNDBUF
#define ARES_OPT_SOCK_SNDBUF
Definition: ares.h:164
ares_options::timeout
int timeout
Definition: ares.h:261
ares_options::flags
int flags
Definition: ares.h:260
ares_library_cleanup
CARES_EXTERN void ares_library_cleanup(void)
Definition: ares_library_init.c:171
ares_set_local_dev
CARES_EXTERN void ares_set_local_dev(ares_channel channel, const char *local_dev_name)
Definition: ares_init.c:2581
ares_destroy
CARES_EXTERN void ares_destroy(ares_channel channel)
Definition: ares_destroy.c:43
ARES_OPT_SORTLIST
#define ARES_OPT_SORTLIST
Definition: ares.h:163
ares::test::LibraryTest::arealloc
static void * arealloc(void *ptr, size_t size)
Definition: ares-test.cc:149
ares_options::tries
int tries
Definition: ares.h:262
ares::test::TEST
TEST(LibraryInit, Basic)
Definition: ares-test-init.cc:13
ares::test::NoExtraFDs
std::set< int > NoExtraFDs()
Definition: ares-test.cc:163
EXPECT_TRUE
#define EXPECT_TRUE(condition)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1967
ares::test::ProcessWork
void ProcessWork(ares_channel channel, std::function< std::set< int >()> get_extrafds, std::function< void(int)> process_extra)
Definition: ares-test.cc:64
ares::test::LibraryTest::amalloc
static void * amalloc(size_t size)
Definition: ares-test.cc:139
ARES_EBADQUERY
#define ARES_EBADQUERY
Definition: ares.h:109
ares_options::lookups
char * lookups
Definition: ares.h:272
ares_init_options
CARES_EXTERN int ares_init_options(ares_channel *channelptr, struct ares_options *options, int optmask)
Definition: ares_init.c:103
ARES_OPT_SERVERS
#define ARES_OPT_SERVERS
Definition: ares.h:159
ares::test::TEST_F
TEST_F(LibraryTest, OptionsChannelInit)
Definition: ares-test-init.cc:55
ARES_OPT_RESOLVCONF
#define ARES_OPT_RESOLVCONF
Definition: ares.h:170
ares_options::ndomains
int ndomains
Definition: ares.h:271
ares::test::GetNameServers
std::vector< std::string > GetNameServers(ares_channel channel)
Definition: ares-test.cc:720
ares_gethostbyname
CARES_EXTERN void ares_gethostbyname(ares_channel channel, const char *name, int family, ares_host_callback callback, void *arg)
Definition: ares_gethostbyname.c:75
ares
Definition: ares-test-ai.h:9
ares::test::LibraryTest
Definition: ares-test.h:60
strdup
#define strdup(ptr)
Definition: acountry.c:55


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:42