[riot-notifications] [RIOT-OS/RIOT] netutils: add netutils_parse_hostname() (#16634)

José Alamos notifications at github.com
Wed Jul 14 14:47:26 CEST 2021


@jia200x commented on this pull request.



> +#include "net/utils.h"
+#ifdef MODULE_SOCK_DNS
+#include "net/sock/dns.h"
+#endif
+
+/* get the next netif, returns true if there are more */
+static bool _netif_get(netif_t **current_netif)
+{
+    netif_t *netif = *current_netif;
+    netif = netif_iter(netif);
+
+    *current_netif = netif;
+    return netif_iter(netif);
+}
+
+int netutils_parse_hostname(const char *hostname, ipv6_addr_t *addr, netif_t **netif)

I think this:
> maybe pass an address family to it? And only support inet6 for now.

which I read the same as:
> How about making the out parameter for the address an array instead and have an address family parameter (that may or may not be AF_UNSPEC for dual stack support later down the road)?

make the most sense IMO. 

```suggestion
int netutils_parse_hostname(const char *hostname, void *addr, int family, netif_t **netif)
```

Since there's only support for IPv6 netif's (LWIP doesn't expose `netif`s yet...), it should be enough to `assert(family == AF_INET6)` and keep the current implementation.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16634#discussion_r669582354
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210714/af3225d3/attachment-0001.htm>


More information about the notifications mailing list