Lines Matching refs:ai

787 ai_find_by_family(struct evutil_addrinfo *ai, int family)  in ai_find_by_family()  argument
789 while (ai) { in ai_find_by_family()
790 if (ai->ai_family == family) in ai_find_by_family()
791 return ai; in ai_find_by_family()
792 ai = ai->ai_next; in ai_find_by_family()
798 ai_find_by_protocol(struct evutil_addrinfo *ai, int protocol) in ai_find_by_protocol() argument
800 while (ai) { in ai_find_by_protocol()
801 if (ai->ai_protocol == protocol) in ai_find_by_protocol()
802 return ai; in ai_find_by_protocol()
803 ai = ai->ai_next; in ai_find_by_protocol()
810 test_ai_eq_(const struct evutil_addrinfo *ai, const char *sockaddr_port, in test_ai_eq_() argument
819 tt_int_op(ai->ai_socktype, ==, socktype); in test_ai_eq_()
821 tt_int_op(ai->ai_protocol, ==, protocol); in test_ai_eq_()
829 if (ai->ai_family != ss.ss_family) { in test_ai_eq_()
831 ai->ai_family, ss.ss_family, line)); in test_ai_eq_()
834 if (ai->ai_addr->sa_family == AF_INET) { in test_ai_eq_()
835 struct sockaddr_in *sin = (struct sockaddr_in*)ai->ai_addr; in test_ai_eq_()
838 if (ai->ai_addrlen != sizeof(struct sockaddr_in)) { in test_ai_eq_()
843 struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)ai->ai_addr; in test_ai_eq_()
846 if (ai->ai_addrlen != sizeof(struct sockaddr_in6)) { in test_ai_eq_()
851 if (evutil_sockaddr_cmp(ai->ai_addr, (struct sockaddr*)&ss, 1)) { in test_ai_eq_()
927 struct evutil_addrinfo *ai = NULL, *a; in test_evutil_getaddrinfo() local
935 r = evutil_getaddrinfo("1.2.3.4", "8080", &hints, &ai); in test_evutil_getaddrinfo()
937 tt_assert(ai); in test_evutil_getaddrinfo()
938 tt_ptr_op(ai->ai_next, ==, NULL); /* no ambiguity */ in test_evutil_getaddrinfo()
939 test_ai_eq(ai, "1.2.3.4:8080", SOCK_STREAM, IPPROTO_TCP); in test_evutil_getaddrinfo()
940 evutil_freeaddrinfo(ai); in test_evutil_getaddrinfo()
941 ai = NULL; in test_evutil_getaddrinfo()
946 r = evutil_getaddrinfo("1001:b0b::f00f", "4321", &hints, &ai); in test_evutil_getaddrinfo()
948 tt_assert(ai); in test_evutil_getaddrinfo()
949 tt_ptr_op(ai->ai_next, ==, NULL); /* no ambiguity */ in test_evutil_getaddrinfo()
950 test_ai_eq(ai, "[1001:b0b::f00f]:4321", SOCK_DGRAM, IPPROTO_UDP); in test_evutil_getaddrinfo()
951 evutil_freeaddrinfo(ai); in test_evutil_getaddrinfo()
952 ai = NULL; in test_evutil_getaddrinfo()
959 r = evutil_getaddrinfo(NULL, "9999", &hints, &ai); in test_evutil_getaddrinfo()
961 tt_assert(ai); in test_evutil_getaddrinfo()
962 tt_ptr_op(ai->ai_next, ==, NULL); in test_evutil_getaddrinfo()
963 test_ai_eq(ai, "0.0.0.0:9999", SOCK_STREAM, IPPROTO_TCP); in test_evutil_getaddrinfo()
964 evutil_freeaddrinfo(ai); in test_evutil_getaddrinfo()
965 ai = NULL; in test_evutil_getaddrinfo()
967 r = evutil_getaddrinfo(NULL, "9998", &hints, &ai); in test_evutil_getaddrinfo()
968 tt_assert(ai); in test_evutil_getaddrinfo()
970 test_ai_eq(ai, "127.0.0.1:9998", SOCK_STREAM, IPPROTO_TCP); in test_evutil_getaddrinfo()
971 tt_ptr_op(ai->ai_next, ==, NULL); in test_evutil_getaddrinfo()
972 evutil_freeaddrinfo(ai); in test_evutil_getaddrinfo()
973 ai = NULL; in test_evutil_getaddrinfo()
977 r = evutil_getaddrinfo(NULL, "9997", &hints, &ai); in test_evutil_getaddrinfo()
978 tt_assert(ai); in test_evutil_getaddrinfo()
980 tt_ptr_op(ai->ai_next, ==, NULL); in test_evutil_getaddrinfo()
981 test_ai_eq(ai, "[::1]:9997", SOCK_STREAM, IPPROTO_TCP); in test_evutil_getaddrinfo()
982 evutil_freeaddrinfo(ai); in test_evutil_getaddrinfo()
983 ai = NULL; in test_evutil_getaddrinfo()
987 r = evutil_getaddrinfo(NULL, "9996", &hints, &ai); in test_evutil_getaddrinfo()
988 tt_assert(ai); in test_evutil_getaddrinfo()
990 tt_ptr_op(ai->ai_next, ==, NULL); in test_evutil_getaddrinfo()
991 test_ai_eq(ai, "[::]:9996", SOCK_STREAM, IPPROTO_TCP); in test_evutil_getaddrinfo()
992 evutil_freeaddrinfo(ai); in test_evutil_getaddrinfo()
993 ai = NULL; in test_evutil_getaddrinfo()
997 r = evutil_getaddrinfo(NULL, "9996", &hints, &ai); in test_evutil_getaddrinfo()
998 tt_assert(ai); in test_evutil_getaddrinfo()
1000 a = ai_find_by_family(ai, PF_INET6); in test_evutil_getaddrinfo()
1003 a = ai_find_by_family(ai, PF_INET); in test_evutil_getaddrinfo()
1006 evutil_freeaddrinfo(ai); in test_evutil_getaddrinfo()
1007 ai = NULL; in test_evutil_getaddrinfo()
1014 r = evutil_getaddrinfo("1.2.3.4", NULL, &hints, &ai); in test_evutil_getaddrinfo()
1016 a = ai_find_by_protocol(ai, IPPROTO_TCP); in test_evutil_getaddrinfo()
1019 a = ai_find_by_protocol(ai, IPPROTO_UDP); in test_evutil_getaddrinfo()
1022 evutil_freeaddrinfo(ai); in test_evutil_getaddrinfo()
1023 ai = NULL; in test_evutil_getaddrinfo()
1029 r = evutil_getaddrinfo("www.google.com", "80", &hints, &ai); in test_evutil_getaddrinfo()
1031 tt_ptr_op(ai, ==, NULL); in test_evutil_getaddrinfo()
1038 r = evutil_getaddrinfo("1.2.3.4", "http", &hints, &ai); in test_evutil_getaddrinfo()
1045 r = evutil_getaddrinfo("1.2.3.4", "http", &hints, &ai); in test_evutil_getaddrinfo()
1049 tt_assert(ai); in test_evutil_getaddrinfo()
1050 test_ai_eq(ai, "1.2.3.4:80", SOCK_STREAM, IPPROTO_TCP); in test_evutil_getaddrinfo()
1051 evutil_freeaddrinfo(ai); in test_evutil_getaddrinfo()
1052 ai = NULL; in test_evutil_getaddrinfo()
1056 if (ai) in test_evutil_getaddrinfo()
1057 evutil_freeaddrinfo(ai); in test_evutil_getaddrinfo()
1063 struct evutil_addrinfo *ai = NULL; in test_evutil_getaddrinfo_live() local
1077 r = evutil_getaddrinfo("www.google.com", "80", &hints, &ai); in test_evutil_getaddrinfo_live()
1081 tt_assert(ai); in test_evutil_getaddrinfo_live()
1082 tt_int_op(ai->ai_family, ==, PF_INET); in test_evutil_getaddrinfo_live()
1083 tt_int_op(ai->ai_protocol, ==, IPPROTO_TCP); in test_evutil_getaddrinfo_live()
1084 tt_int_op(ai->ai_socktype, ==, SOCK_STREAM); in test_evutil_getaddrinfo_live()
1085 tt_int_op(ai->ai_addrlen, ==, sizeof(struct sockaddr_in)); in test_evutil_getaddrinfo_live()
1086 sin = (struct sockaddr_in*)ai->ai_addr; in test_evutil_getaddrinfo_live()
1094 evutil_freeaddrinfo(ai); in test_evutil_getaddrinfo_live()
1095 ai = NULL; in test_evutil_getaddrinfo_live()
1099 r = evutil_getaddrinfo("ipv6.google.com", "80", &hints, &ai); in test_evutil_getaddrinfo_live()
1103 tt_assert(ai); in test_evutil_getaddrinfo_live()
1104 tt_int_op(ai->ai_family, ==, PF_INET6); in test_evutil_getaddrinfo_live()
1105 tt_int_op(ai->ai_addrlen, ==, sizeof(struct sockaddr_in6)); in test_evutil_getaddrinfo_live()
1106 sin6 = (struct sockaddr_in6*)ai->ai_addr; in test_evutil_getaddrinfo_live()
1116 if (ai) in test_evutil_getaddrinfo_live()
1117 evutil_freeaddrinfo(ai); in test_evutil_getaddrinfo_live()