Esempio n. 1
0
int main() {
    char version[10];
    INIT_SOCKETS_FOR_WINDOWS;

    if( mongo_get_server_version( version ) != -1 && version[0] != '1' ) {
        test_read_timeout();
    }
    test_getaddrinfo();
    test_error_messages();

    return 0;
}
Esempio n. 2
0
static void server_task(INT stacd, VP exinf)
{
	DEBUG_PRINT(("server task started\n"));

	ping(inet_addr(IP_T_ENGINE_ORG)); // t-engine.org
	traceroute(inet_addr(IP_T_ENGINE_ORG)); // t-engine.org
	//traceroute(inet_addr(IP_GOOGLE_CO_JP)); // google.co.jp

	test_tcp_server();

	test_getaddrinfo();
	test_getnameinfo();

	test_http();

	tk_sig_sem(semid, 1);

	tk_exd_tsk();
}
Esempio n. 3
0
int
main(void) {
	lwres_result_t ret;

	lwres_udp_port = 9210;
	lwres_resolv_conf = "resolv.conf";

	ret = lwres_context_create(&ctx, NULL, NULL, NULL, 0);
	CHECK(ret, "lwres_context_create");

	ret = lwres_conf_parse(ctx, "resolv.conf");
	CHECK(ret, "lwres_conf_parse");

	test_noop();

	test_gabn("a.example1", LWRES_R_SUCCESS, "10.0.1.1",
		  LWRES_ADDRTYPE_V4);
	test_gabn("a.example1.", LWRES_R_SUCCESS, "10.0.1.1",
		  LWRES_ADDRTYPE_V4);
	test_gabn("a.example2", LWRES_R_SUCCESS, "10.0.2.1",
		  LWRES_ADDRTYPE_V4);
	test_gabn("a.example2.", LWRES_R_SUCCESS, "10.0.2.1",
		  LWRES_ADDRTYPE_V4);
	test_gabn("a.example3", LWRES_R_NOTFOUND, NULL, LWRES_ADDRTYPE_V4);
	test_gabn("a.example3.", LWRES_R_NOTFOUND, NULL, LWRES_ADDRTYPE_V4);
	test_gabn("a", LWRES_R_SUCCESS, "10.0.1.1", LWRES_ADDRTYPE_V4);
	test_gabn("a.", LWRES_R_NOTFOUND, NULL, LWRES_ADDRTYPE_V4);

	test_gabn("a2", LWRES_R_SUCCESS, "10.0.1.1", LWRES_ADDRTYPE_V4);
	test_gabn("a3", LWRES_R_NOTFOUND, NULL, LWRES_ADDRTYPE_V4);

	test_gabn("b.example1", LWRES_R_SUCCESS,
		  "eeee:eeee:eeee:eeee:ffff:ffff:ffff:ffff",
		  LWRES_ADDRTYPE_V6);
	test_gabn("b.example1.", LWRES_R_SUCCESS,
		  "eeee:eeee:eeee:eeee:ffff:ffff:ffff:ffff",
		  LWRES_ADDRTYPE_V6);
	test_gabn("b.example2", LWRES_R_SUCCESS,
		  "eeee:eeee:eeee:eeee:ffff:ffff:ffff:ffff",
		  LWRES_ADDRTYPE_V6);
	test_gabn("b.example2.", LWRES_R_SUCCESS,
		  "eeee:eeee:eeee:eeee:ffff:ffff:ffff:ffff",
		  LWRES_ADDRTYPE_V6);
	test_gabn("b.example3", LWRES_R_NOTFOUND, NULL, LWRES_ADDRTYPE_V6);
	test_gabn("b.example3.", LWRES_R_NOTFOUND, NULL, LWRES_ADDRTYPE_V6);
	test_gabn("b", LWRES_R_SUCCESS,
		  "eeee:eeee:eeee:eeee:ffff:ffff:ffff:ffff",
		  LWRES_ADDRTYPE_V6);
	test_gabn("b.", LWRES_R_NOTFOUND, NULL, LWRES_ADDRTYPE_V6);

	test_gabn("d.example1", LWRES_R_NOTFOUND, NULL, LWRES_ADDRTYPE_V6);

	test_gabn("x", LWRES_R_SUCCESS, "10.1.10.1", LWRES_ADDRTYPE_V4);
	test_gabn("x.", LWRES_R_SUCCESS, "10.1.10.1", LWRES_ADDRTYPE_V4);

	test_gnba("10.10.10.1", LWRES_ADDRTYPE_V4, LWRES_R_SUCCESS,
		  "ipv4.example");
	test_gnba("10.10.10.17", LWRES_ADDRTYPE_V4, LWRES_R_NOTFOUND,
		  NULL);
	test_gnba("0123:4567:89ab:cdef:0123:4567:89ab:cdef",
		  LWRES_ADDRTYPE_V6, LWRES_R_SUCCESS, "ip6.int.example");
	test_gnba("0123:4567:89ab:cdef:0123:4567:89ab:cde0",
		  LWRES_ADDRTYPE_V6, LWRES_R_NOTFOUND, NULL);
	test_gnba("1123:4567:89ab:cdef:0123:4567:89ab:cdef",
		  LWRES_ADDRTYPE_V6, LWRES_R_SUCCESS, "ip6.arpa.example");
	test_gnba("1123:4567:89ab:cdef:0123:4567:89ab:cde0",
		  LWRES_ADDRTYPE_V6, LWRES_R_NOTFOUND, NULL);

	test_gethostbyname("a.example1.", "10.0.1.1");
	test_gethostbyname("q.example1.", NULL);

	test_gethostbyname2("a.example1.", "10.0.1.1", AF_INET);
	test_gethostbyname2("b.example1.",
			    "eeee:eeee:eeee:eeee:ffff:ffff:ffff:ffff",
			    AF_INET6);
	test_gethostbyname2("q.example1.", NULL, AF_INET);

	test_getipnodebyname("a.example1.", "10.0.1.1", AF_INET, 0, 0);
	test_getipnodebyname("b.example1.",
			     "eeee:eeee:eeee:eeee:ffff:ffff:ffff:ffff",
			     AF_INET6, 0, 0);
	test_getipnodebyname("a.example1.",
			     "::ffff:10.0.1.1", AF_INET6, 1, 0);
	test_getipnodebyname("a.example1.",
			     "::ffff:10.0.1.1", AF_INET6, 1, 1);
	test_getipnodebyname("b.example1.",
			     "eeee:eeee:eeee:eeee:ffff:ffff:ffff:ffff",
			     AF_INET6, 1, 1);
	test_getipnodebyname("q.example1.", NULL, AF_INET, 0, 0);

	test_gethostbyaddr("10.10.10.1", AF_INET, "ipv4.example");
	test_gethostbyaddr("10.10.10.17", AF_INET, NULL);
	test_gethostbyaddr("0123:4567:89ab:cdef:0123:4567:89ab:cdef",
			   AF_INET6, "ip6.int.example");
	test_gethostbyaddr("1123:4567:89ab:cdef:0123:4567:89ab:cdef",
			   AF_INET6, "ip6.arpa.example");

	test_getipnodebyaddr("10.10.10.1", AF_INET, "ipv4.example");
	test_getipnodebyaddr("10.10.10.17", AF_INET, NULL);
	test_getipnodebyaddr("0123:4567:89ab:cdef:0123:4567:89ab:cdef",
			     AF_INET6, "ip6.int.example");
	test_getipnodebyaddr("1123:4567:89ab:cdef:0123:4567:89ab:cdef",
			     AF_INET6, "ip6.arpa.example");

	test_getaddrinfo("a.example1.", AF_INET, 1, 1, "10.0.1.1");
	test_getaddrinfo("a.example1.", AF_INET, 1, 0, "10.0.1.1");
	test_getaddrinfo("a.example1.", AF_INET, 0, 1, NULL);
	test_getaddrinfo("b.example1.", AF_INET6, 1, 1,
			 "eeee:eeee:eeee:eeee:ffff:ffff:ffff:ffff");
	test_getaddrinfo("b.example1.", AF_INET6, 1, 0, NULL);
	test_getaddrinfo("b.example1.", AF_INET6, 0, 1,
			 "eeee:eeee:eeee:eeee:ffff:ffff:ffff:ffff");

	test_getnameinfo("10.10.10.1", AF_INET, "ipv4.example");
	test_getnameinfo("10.10.10.17", AF_INET, NULL);
	test_getnameinfo("0123:4567:89ab:cdef:0123:4567:89ab:cdef",
			 AF_INET6, "ip6.int.example");
	test_getnameinfo("1123:4567:89ab:cdef:0123:4567:89ab:cdef",
			 AF_INET6, "ip6.arpa.example");
	test_getnameinfo("1122:3344:5566:7788:99aa:bbcc:ddee:ff00",
			 AF_INET6, "dname.example1");

	test_getrrsetbyname("a", 1, 1, 1, 0, 1);
	test_getrrsetbyname("a.example1.", 1, 1, 1, 0, 1);
	test_getrrsetbyname("e.example1.", 1, 1, 1, 1, 1);
	test_getrrsetbyname("e.example1.", 1, 255, 1, 1, 0);
	test_getrrsetbyname("e.example1.", 1, 46, 2, 0, 1);
	test_getrrsetbyname("", 1, 1, 0, 0, 0);

	if (fails == 0)
		printf("I:ok\n");
	return (fails);
}