Lines Matching refs:a

10         SocketAddress a;  in test_socket_address_parse_one()  local
14 r = socket_address_parse(&a, in); in test_socket_address_parse_one()
16 r = socket_address_print(&a, &out); in test_socket_address_parse_one()
20 assert_se(a.type == 0); in test_socket_address_parse_one()
31 assert_se(a.sockaddr.sa.sa_family == family); in test_socket_address_parse_one()
102 SocketAddress a; in TEST() local
104 assert_se(socket_address_parse_netlink(&a, "junk") < 0); in TEST()
105 assert_se(socket_address_parse_netlink(&a, "") < 0); in TEST()
107 assert_se(socket_address_parse_netlink(&a, "route") >= 0); in TEST()
108 assert_se(a.sockaddr.nl.nl_family == AF_NETLINK); in TEST()
109 assert_se(a.sockaddr.nl.nl_groups == 0); in TEST()
110 assert_se(a.protocol == NETLINK_ROUTE); in TEST()
111 assert_se(socket_address_parse_netlink(&a, "route") >= 0); in TEST()
112 assert_se(socket_address_parse_netlink(&a, "route 10") >= 0); in TEST()
113 assert_se(a.sockaddr.nl.nl_family == AF_NETLINK); in TEST()
114 assert_se(a.sockaddr.nl.nl_groups == 10); in TEST()
115 assert_se(a.protocol == NETLINK_ROUTE); in TEST()
118 assert_se(socket_address_parse_netlink(&a, " kobject-uevent ") >= 0); in TEST()
119 assert_se(a.sockaddr.nl.nl_family == AF_NETLINK); in TEST()
120 assert_se(a.sockaddr.nl.nl_groups == 0); in TEST()
121 assert_se(a.protocol == NETLINK_KOBJECT_UEVENT); in TEST()
122 assert_se(socket_address_parse_netlink(&a, " \t kobject-uevent \t 10") >= 0); in TEST()
123 assert_se(a.sockaddr.nl.nl_family == AF_NETLINK); in TEST()
124 assert_se(a.sockaddr.nl.nl_groups == 10); in TEST()
125 assert_se(a.protocol == NETLINK_KOBJECT_UEVENT); in TEST()
126 assert_se(socket_address_parse_netlink(&a, "kobject-uevent\t10") >= 0); in TEST()
127 assert_se(a.sockaddr.nl.nl_family == AF_NETLINK); in TEST()
128 assert_se(a.sockaddr.nl.nl_groups == 10); in TEST()
129 assert_se(a.protocol == NETLINK_KOBJECT_UEVENT); in TEST()
132 assert_se(socket_address_parse_netlink(&a, "kobject-uevent\t10 ") < 0); in TEST()
135 assert_se(socket_address_parse_netlink(&a, "kobject-uevent -1") < 0); in TEST()
138 assert_se(socket_address_parse_netlink(&a, "\xff") < 0); in TEST()
142 SocketAddress a, b; in TEST() local
144 assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0); in TEST()
146 assert_se(!socket_address_equal(&a, &b)); in TEST()
148 assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0); in TEST()
150 assert_se(!socket_address_equal(&a, &b)); in TEST()
152 assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0); in TEST()
154 assert_se(!socket_address_equal(&a, &b)); in TEST()
156 assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0); in TEST()
158 assert_se(!socket_address_equal(&a, &b)); in TEST()
160 assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0); in TEST()
162 assert_se(socket_address_equal(&a, &b)); in TEST()
164 assert_se(socket_address_parse(&a, "/foo/bar") >= 0); in TEST()
166 assert_se(socket_address_equal(&a, &b)); in TEST()
168 assert_se(socket_address_parse(&a, "[::1]:8888") >= 0); in TEST()
170 assert_se(socket_address_equal(&a, &b)); in TEST()
172 assert_se(socket_address_parse(&a, "@abstract") >= 0); in TEST()
174 assert_se(socket_address_equal(&a, &b)); in TEST()
176 assert_se(socket_address_parse_netlink(&a, "firewall") >= 0); in TEST()
178 assert_se(socket_address_equal(&a, &b)); in TEST()
180 assert_se(socket_address_parse(&a, "vsock:2:1234") >= 0); in TEST()
182 assert_se(socket_address_equal(&a, &b)); in TEST()
184 assert_se(!socket_address_equal(&a, &b)); in TEST()
186 assert_se(!socket_address_equal(&a, &b)); in TEST()
190 SocketAddress a; in TEST() local
192 assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0); in TEST()
193 assert_se(!socket_address_get_path(&a)); in TEST()
195 assert_se(socket_address_parse(&a, "@abstract") >= 0); in TEST()
196 assert_se(!socket_address_get_path(&a)); in TEST()
198 assert_se(socket_address_parse(&a, "[::1]:8888") >= 0); in TEST()
199 assert_se(!socket_address_get_path(&a)); in TEST()
201 assert_se(socket_address_parse(&a, "/foo/bar") >= 0); in TEST()
202 assert_se(streq(socket_address_get_path(&a), "/foo/bar")); in TEST()
204 assert_se(socket_address_parse(&a, "vsock:2:1234") >= 0); in TEST()
205 assert_se(!socket_address_get_path(&a)); in TEST()
209 SocketAddress a; in TEST() local
211 assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0); in TEST()
212 assert_se( socket_address_is(&a, "192.168.1.1:8888", 0 /* unspecified yet */)); in TEST()
213 assert_se(!socket_address_is(&a, "route", 0)); in TEST()
214 assert_se(!socket_address_is(&a, "route", SOCK_STREAM)); in TEST()
215 assert_se(!socket_address_is(&a, "192.168.1.1:8888", SOCK_RAW)); in TEST()
216 assert_se(!socket_address_is(&a, "192.168.1.1:8888", SOCK_STREAM)); in TEST()
217 a.type = SOCK_STREAM; in TEST()
218 assert_se( socket_address_is(&a, "192.168.1.1:8888", SOCK_STREAM)); in TEST()
222 SocketAddress a; in TEST() local
224 assert_se(socket_address_parse_netlink(&a, "route 10") >= 0); in TEST()
225 assert_se( socket_address_is_netlink(&a, "route 10")); in TEST()
226 assert_se(!socket_address_is_netlink(&a, "192.168.1.1:8888")); in TEST()
227 assert_se(!socket_address_is_netlink(&a, "route 1")); in TEST()
230 static void test_in_addr_ifindex_to_string_one(int f, const char *a, int ifindex, const char *b) { in test_in_addr_ifindex_to_string_one() argument
235 assert_se(in_addr_from_string(f, a, &ua) >= 0); in test_in_addr_ifindex_to_string_one()
279 static void test_in_addr_ifindex_name_from_string_auto_one(const char *a, const char *expected) { in test_in_addr_ifindex_name_from_string_auto_one() argument
284 … assert_se(in_addr_ifindex_name_from_string_auto(a, &family, &ua, &ifindex, &server_name) >= 0); in test_in_addr_ifindex_name_from_string_auto_one()
297 union in_addr_union a; in test_in_addr_port_ifindex_name_from_string_auto_one() local
306 … assert_se(in_addr_port_ifindex_name_from_string_auto(str, &f, &a, &p, &i, &name) == 0); in test_in_addr_port_ifindex_name_from_string_auto_one()
311 assert_se(in_addr_port_ifindex_name_to_string(f, &a, p, i, name, &x) >= 0); in test_in_addr_port_ifindex_name_from_string_auto_one()
316 … assert_se(in_addr_port_ifindex_name_from_string_auto(str, &f, &a, NULL, &i, &fake) == -EINVAL); in test_in_addr_port_ifindex_name_from_string_auto_one()
319 … assert_se(in_addr_port_ifindex_name_from_string_auto(str, &f, &a, NULL, &i, &name) == 0); in test_in_addr_port_ifindex_name_from_string_auto_one()
323 assert_se(in_addr_port_ifindex_name_to_string(f, &a, 0, i, name, &x) >= 0); in test_in_addr_port_ifindex_name_from_string_auto_one()
328 … assert_se(in_addr_port_ifindex_name_from_string_auto(str, &f, &a, &p, NULL, &fake) == -EINVAL); in test_in_addr_port_ifindex_name_from_string_auto_one()
331 … assert_se(in_addr_port_ifindex_name_from_string_auto(str, &f, &a, &p, NULL, &name) == 0); in test_in_addr_port_ifindex_name_from_string_auto_one()
335 assert_se(in_addr_port_ifindex_name_to_string(f, &a, p, 0, name, &x) >= 0); in test_in_addr_port_ifindex_name_from_string_auto_one()
340 … assert_se(in_addr_port_ifindex_name_from_string_auto(str, &f, &a, &p, &i, NULL) == -EINVAL); in test_in_addr_port_ifindex_name_from_string_auto_one()
343 … assert_se(in_addr_port_ifindex_name_from_string_auto(str, &f, &a, &p, &i, NULL) == 0); in test_in_addr_port_ifindex_name_from_string_auto_one()
347 assert_se(in_addr_port_ifindex_name_to_string(f, &a, p, i, NULL, &x) >= 0); in test_in_addr_port_ifindex_name_from_string_auto_one()