]> git.sesse.net Git - vlc/blobdiff - src/network/getaddrinfo.c
Use vlc_accept()
[vlc] / src / network / getaddrinfo.c
index ac2d67b819ffea93b9bba7da4394ca35f7562fd7..7d56c2dccf386ce23e3f4a820d6e971453ee9ded 100644 (file)
 #include <string.h> /* strlen(), memcpy(), memset(), strchr() */
 #include <stdlib.h> /* malloc(), free(), strtoul() */
 #include <errno.h>
+#include <assert.h>
 
-#ifdef HAVE_SYS_TYPES_H
-#   include <sys/types.h>
-#endif
+#include <sys/types.h>
 #ifdef HAVE_ARPA_INET_H
 #   include <arpa/inet.h>
 #endif
@@ -563,6 +562,18 @@ int vlc_getnameinfo( const struct sockaddr *sa, int salen,
 }
 
 
+/**
+ * Resolves a host name to a list of socket addresses (like getaddrinfo()).
+ *
+ * @param p_this a VLC object
+ * @param node host name to resolve (encoded as UTF-8), or NULL
+ * @param i_port port number for the socket addresses
+ * @param p_hints parameters (see getaddrinfo() manual page)
+ * @param res pointer set to the resulting chained list.
+ * @return 0 on success, a getaddrinfo() error otherwise.
+ * On failure, *res is undefined. On success, it must be freed with
+ * vlc_freeaddrinfo().
+ */
 int vlc_getaddrinfo( vlc_object_t *p_this, const char *node,
                      int i_port, const struct addrinfo *p_hints,
                      struct addrinfo **res )
@@ -676,7 +687,9 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node,
 #endif
     ret = getaddrinfo (node, psz_service, &hints, res);
 
+#if defined(AI_IDN) || defined(WIN32)
 out:
+#endif
     LocaleFree (node);
     return ret;
 }