X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_network.h;h=0a51a12ee3107d0ca4c83f87685519712938de4c;hb=12ade3e3bc975d5426ba4af155b7372c31093b31;hp=29078adead998869a949ab207bf84294604210cc;hpb=9242bbe164af2629b2746bbdebb80f5ced1f307d;p=vlc diff --git a/include/vlc_network.h b/include/vlc_network.h index 29078adead..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) { @@ -146,6 +151,7 @@ VLC_EXPORT( char *, net_Gets, ( vlc_object_t *p_this, int fd, const v_socket_t * 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) @@ -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