X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_network.h;h=0a51a12ee3107d0ca4c83f87685519712938de4c;hb=c60652e38ac6afd74bd8225e9dae5406f13aaa4f;hp=19502d22761061769dc7116db9e58dca015c3b7e;hpb=6bf374569a1dd0ffcb624d7e35f032e424c07b14;p=vlc diff --git a/include/vlc_network.h b/include/vlc_network.h index 19502d2276..0a51a12ee3 100644 --- a/include/vlc_network.h +++ b/include/vlc_network.h @@ -77,20 +77,25 @@ 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 /* 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) { @@ -217,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