X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_network.h;h=0a51a12ee3107d0ca4c83f87685519712938de4c;hb=12ade3e3bc975d5426ba4af155b7372c31093b31;hp=8f938f6e82fcb15a11248b14f6ebc3cbb4e6e72a;hpb=af64d14a00bbaca4c17b7f3feb7399d7a0363f23;p=vlc diff --git a/include/vlc_network.h b/include/vlc_network.h index 8f938f6e82..0a51a12ee3 100644 --- a/include/vlc_network.h +++ b/include/vlc_network.h @@ -77,6 +77,11 @@ struct msghdr # 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 @@ -87,9 +92,10 @@ int net_Socket (vlc_object_t *obj, int family, int socktype, int proto); 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) { @@ -216,39 +222,12 @@ VLC_EXPORT (int, vlc_poll, (struct pollfd *fds, unsigned nfds, int timeout)); # 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