Changeset e948fde in mainline
- Timestamp:
- 2013-09-29T21:43:49Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5a324d99
- Parents:
- f023251
- Location:
- uspace
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/dnsres/dnsres.c
rf023251 re948fde 54 54 } 55 55 56 uint16_t af;56 uint16_t ver; 57 57 char *hname; 58 58 … … 63 63 } 64 64 65 af = AF_INET;65 ver = ip_v4; 66 66 hname = argv[2]; 67 67 } else if (str_cmp(argv[1], "-6") == 0) { … … 71 71 } 72 72 73 af = AF_INET6;73 ver = ip_v6; 74 74 hname = argv[2]; 75 75 } else { 76 af = 0;76 ver = ip_any; 77 77 hname = argv[1]; 78 78 } 79 79 80 80 dnsr_hostinfo_t *hinfo; 81 int rc = dnsr_name2host(hname, &hinfo, af);81 int rc = dnsr_name2host(hname, &hinfo, ver); 82 82 if (rc != EOK) { 83 83 printf("%s: Error resolving '%s'.\n", NAME, hname); -
uspace/app/nettest1/nettest1.c
rf023251 re948fde 59 59 #define NETTEST1_TEXT "Networking test 1 - sockets" 60 60 61 static uint16_t family = AF_ INET;61 static uint16_t family = AF_NONE; 62 62 static sock_type_t type = SOCK_DGRAM; 63 63 static size_t size = 27; … … 335 335 /* Interpret as a host name */ 336 336 dnsr_hostinfo_t *hinfo = NULL; 337 rc = dnsr_name2host(addr_s, &hinfo, family);337 rc = dnsr_name2host(addr_s, &hinfo, ipver_from_af(family)); 338 338 339 339 if (rc != EOK) { … … 348 348 struct sockaddr_in6 addr6; 349 349 uint16_t af = inet_addr_sockaddr_in(&addr_addr, &addr, &addr6); 350 351 if (family == AF_NONE) 352 family = af; 350 353 351 354 if (af != family) { -
uspace/app/nettest2/nettest2.c
rf023251 re948fde 60 60 #define NETTEST2_TEXT "Networking test 2 - transfer" 61 61 62 static uint16_t family = PF_INET;62 static uint16_t family = AF_NONE; 63 63 static size_t size = 28; 64 64 static bool verbose = false; … … 271 271 /* Interpret as a host name */ 272 272 dnsr_hostinfo_t *hinfo = NULL; 273 rc = dnsr_name2host(addr_s, &hinfo, family);273 rc = dnsr_name2host(addr_s, &hinfo, ipver_from_af(family)); 274 274 275 275 if (rc != EOK) { … … 284 284 struct sockaddr_in6 addr6; 285 285 uint16_t af = inet_addr_sockaddr_in(&addr_addr, &addr, &addr6); 286 287 if (family == AF_NONE) 288 family = af; 286 289 287 290 if (af != family) { -
uspace/app/nettest3/nettest3.c
rf023251 re948fde 78 78 if (rc != EOK) { 79 79 /* Try interpreting as a host name */ 80 rc = dnsr_name2host(argv[1], &hinfo, AF_INET);80 rc = dnsr_name2host(argv[1], &hinfo, ip_v4); 81 81 if (rc != EOK) { 82 82 printf("Error resolving host '%s'.\n", argv[1]); 83 83 return rc; 84 84 } 85 85 86 86 uint16_t af = inet_addr_sockaddr_in(&hinfo->addr, &addr, NULL); 87 87 if (af != AF_INET) { -
uspace/app/nterm/conn.c
rf023251 re948fde 84 84 /* Interpret as a host name */ 85 85 dnsr_hostinfo_t *hinfo = NULL; 86 rc = dnsr_name2host(addr_s, &hinfo, 0);86 rc = dnsr_name2host(addr_s, &hinfo, ip_any); 87 87 88 88 if (rc != EOK) { -
uspace/app/ping/ping.c
rf023251 re948fde 262 262 if (rc != EOK) { 263 263 /* Try interpreting as a host name */ 264 rc = dnsr_name2host(argv[optind], &hinfo, AF_INET);264 rc = dnsr_name2host(argv[optind], &hinfo, ip_v4); 265 265 if (rc != EOK) { 266 266 printf("Error resolving host '%s'.\n", argv[optind]); -
uspace/app/ping6/ping6.c
rf023251 re948fde 262 262 if (rc != EOK) { 263 263 /* Try interpreting as a host name */ 264 rc = dnsr_name2host(argv[optind], &hinfo, AF_INET);264 rc = dnsr_name2host(argv[optind], &hinfo, ip_v6); 265 265 if (rc != EOK) { 266 266 printf("Error resolving host '%s'.\n", argv[optind]); -
uspace/lib/c/generic/dnsr.c
rf023251 re948fde 67 67 } 68 68 69 int dnsr_name2host(const char *name, dnsr_hostinfo_t **rinfo, uint16_t af)69 int dnsr_name2host(const char *name, dnsr_hostinfo_t **rinfo, ip_ver_t ver) 70 70 { 71 71 dnsr_hostinfo_t *info = calloc(1, sizeof(dnsr_hostinfo_t)); … … 76 76 77 77 ipc_call_t answer; 78 aid_t req = async_send_1(exch, DNSR_NAME2HOST, (sysarg_t) af,78 aid_t req = async_send_1(exch, DNSR_NAME2HOST, (sysarg_t) ver, 79 79 &answer); 80 80 -
uspace/lib/c/generic/inet/addr.c
rf023251 re948fde 250 250 } 251 251 252 ip_ver_t ipver_from_af(int af) 253 { 254 switch (af) { 255 case AF_NONE: 256 return ip_any; 257 case AF_INET: 258 return ip_v4; 259 case AF_INET6: 260 return ip_v6; 261 default: 262 assert(false); 263 return EINVAL; 264 } 265 } 266 252 267 void inet_naddr_addr(const inet_naddr_t *naddr, inet_addr_t *addr) 253 268 { -
uspace/lib/c/include/inet/addr.h
rf023251 re948fde 134 134 sockaddr_in6_t *); 135 135 136 extern ip_ver_t ipver_from_af(int af); 137 136 138 #endif 137 139 -
uspace/lib/c/include/inet/dnsr.h
rf023251 re948fde 51 51 52 52 extern int dnsr_init(void); 53 extern int dnsr_name2host(const char *, dnsr_hostinfo_t **, uint16_t);53 extern int dnsr_name2host(const char *, dnsr_hostinfo_t **, ip_ver_t); 54 54 extern void dnsr_hostinfo_destroy(dnsr_hostinfo_t *); 55 55 extern int dnsr_get_srvaddr(inet_addr_t *); -
uspace/lib/http/http.c
rf023251 re948fde 165 165 /* Interpret as a host name */ 166 166 dnsr_hostinfo_t *hinfo = NULL; 167 rc = dnsr_name2host(http->host, &hinfo, AF_NONE);167 rc = dnsr_name2host(http->host, &hinfo, ip_any); 168 168 169 169 if (rc != EOK) -
uspace/srv/net/dnsrsrv/dnsrsrv.c
rf023251 re948fde 89 89 log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_get_srvaddr_srv()"); 90 90 91 uint16_t af= IPC_GET_ARG1(*icall);91 ip_ver_t ver = IPC_GET_ARG1(*icall); 92 92 93 93 char *name; … … 100 100 101 101 dns_host_info_t *hinfo; 102 rc = dns_name2host(name, &hinfo, af);102 rc = dns_name2host(name, &hinfo, ver); 103 103 if (rc != EOK) { 104 104 async_answer_0(iid, rc); -
uspace/srv/net/dnsrsrv/query.c
rf023251 re948fde 190 190 } 191 191 192 int dns_name2host(const char *name, dns_host_info_t **rinfo, uint16_t af)192 int dns_name2host(const char *name, dns_host_info_t **rinfo, ip_ver_t ver) 193 193 { 194 194 dns_host_info_t *info = calloc(1, sizeof(dns_host_info_t)); … … 198 198 int rc; 199 199 200 switch ( af) {201 case AF_NONE:200 switch (ver) { 201 case ip_any: 202 202 rc = dns_name_query(name, DTYPE_AAAA, info); 203 203 … … 206 206 207 207 break; 208 case AF_INET:208 case ip_v4: 209 209 rc = dns_name_query(name, DTYPE_A, info); 210 210 break; 211 case AF_INET6:211 case ip_v6: 212 212 rc = dns_name_query(name, DTYPE_AAAA, info); 213 213 break; -
uspace/srv/net/dnsrsrv/query.h
rf023251 re948fde 37 37 #define QUERY_H 38 38 39 #include <inet/addr.h> 39 40 #include "dns_type.h" 40 41 41 extern int dns_name2host(const char *, dns_host_info_t **, uint16_t);42 extern int dns_name2host(const char *, dns_host_info_t **, ip_ver_t); 42 43 extern void dns_hostinfo_destroy(dns_host_info_t *); 43 44
Note:
See TracChangeset
for help on using the changeset viewer.