# define net_errno errno
#endif
+int vlc_socket (int, int, int, bool nonblock) LIBVLC_USED;
+
+struct sockaddr;
+VLC_EXPORT( int, vlc_accept, ( int, struct sockaddr *, socklen_t *, bool ) LIBVLC_USED );
+
# ifdef __cplusplus
extern "C" {
# endif
/* Portable networking layer communication */
int net_Socket (vlc_object_t *obj, int family, int socktype, int proto);
-int net_SetupSocket (int fd);
VLC_EXPORT( int, net_Connect, (vlc_object_t *p_this, const char *psz_host, int i_port, int socktype, int protocol) );
#define net_Connect(a, b, c, d, e) net_Connect(VLC_OBJECT(a), b, c, d, e)
-VLC_EXPORT( int *, net_Listen, (vlc_object_t *p_this, const char *psz_host, int i_port, int protocol) );
+VLC_EXPORT( int *, net_Listen, (vlc_object_t *p_this, const char *psz_host, int i_port, int socktype, int protocol) );
-#define net_ListenTCP(a, b, c) net_Listen(VLC_OBJECT(a), b, c, IPPROTO_TCP)
+#define net_ListenTCP(a, b, c) net_Listen(VLC_OBJECT(a), b, c, \
+ SOCK_STREAM, IPPROTO_TCP)
static inline int net_ConnectTCP (vlc_object_t *obj, const char *host, int port)
{
VLC_EXPORT( ssize_t, net_Printf, ( vlc_object_t *p_this, int fd, const v_socket_t *, const char *psz_fmt, ... ) LIBVLC_FORMAT( 4, 5 ) );
+#define net_Printf(o,fd,vs,...) net_Printf(VLC_OBJECT(o),fd,vs, __VA_ARGS__)
VLC_EXPORT( ssize_t, net_vaPrintf, ( vlc_object_t *p_this, int fd, const v_socket_t *, const char *psz_fmt, va_list args ) );
#define net_vaPrintf(a,b,c,d,e) net_vaPrintf(VLC_OBJECT(a),b,c,d,e)
# endif
# define NI_MAXNUMERICHOST 64
-# ifndef NI_NUMERICHOST
-# define NI_NUMERICHOST 0x01
-# define NI_NUMERICSERV 0x02
-# define NI_NOFQDN 0x04
-# define NI_NAMEREQD 0x08
-# define NI_DGRAM 0x10
-# endif
-
-# ifndef HAVE_STRUCT_ADDRINFO
-struct addrinfo
-{
- int ai_flags;
- int ai_family;
- int ai_socktype;
- int ai_protocol;
- size_t ai_addrlen;
- struct sockaddr *ai_addr;
- char *ai_canonname;
- struct addrinfo *ai_next;
-};
-# define AI_PASSIVE 1
-# define AI_CANONNAME 2
-# define AI_NUMERICHOST 4
-# endif /* if !HAVE_STRUCT_ADDRINFO */
-
#ifndef AI_NUMERICSERV
# define AI_NUMERICSERV 0
#endif
-VLC_EXPORT( const char *, vlc_gai_strerror, ( int ) );
VLC_EXPORT( int, vlc_getnameinfo, ( const struct sockaddr *, int, char *, int, int *, int ) );
VLC_EXPORT( int, vlc_getaddrinfo, ( vlc_object_t *, const char *, int, const struct addrinfo *, struct addrinfo ** ) );
-VLC_EXPORT( void, vlc_freeaddrinfo, ( struct addrinfo * ) );
static inline bool