X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_network.h;h=aca2b0a70498e9c721bae34ac3660a30e935d008;hb=22dbf2bfad420b171fee86c1a97a433929e6fc1e;hp=260634ef341a397ee4fc8f72d29df9f2d8b70449;hpb=449fd28aaf007c6411251dae9d0dbfdc65b135d1;p=vlc diff --git a/include/vlc_network.h b/include/vlc_network.h index 260634ef34..aca2b0a704 100644 --- a/include/vlc_network.h +++ b/include/vlc_network.h @@ -24,10 +24,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -#if !defined( __LIBVLC__ ) - #error You are not libvlc or one of its plugins. You cannot include this file -#endif - #ifndef __VLC_NETWORK_H # define __VLC_NETWORK_H @@ -41,6 +37,27 @@ # define ENETUNREACH WSAENETUNREACH # define net_errno (WSAGetLastError()) extern const char *net_strerror( int val ); + +struct iovec +{ + void *iov_base; + size_t iov_len; +}; + +struct msghdr +{ + void *msg_name; + size_t msg_namelen; + struct iovec *msg_iov; + size_t msg_iovlen; + void *msg_control; + size_t msg_controllen; + int msg_flags; +}; + +#define sendmsg vlc_sendmsg +#define recvmsg vlc_recvmsg + # ifndef IPV6_V6ONLY # define IPV6_V6ONLY 27 # endif @@ -58,6 +75,9 @@ extern const char *net_strerror( int val ); # define net_errno errno #endif +VLC_EXPORT( ssize_t, vlc_sendmsg, ( int, struct msghdr *, int ) ); +VLC_EXPORT( ssize_t, vlc_recvmsg, ( int, struct msghdr *, int ) ); + # ifdef __cplusplus extern "C" { # endif @@ -125,25 +145,24 @@ VLC_EXPORT( ssize_t, __net_Write, ( vlc_object_t *p_this, int fd, const v_socket #define net_Gets(a,b,c) __net_Gets(VLC_OBJECT(a),b,c) 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, ... ) ATTRIBUTE_FORMAT( 4, 5 ) ); +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_vaPrintf(a,b,c,d,e) __net_vaPrintf(VLC_OBJECT(a),b,c,d,e) VLC_EXPORT( ssize_t, __net_vaPrintf, ( vlc_object_t *p_this, int fd, const v_socket_t *, const char *psz_fmt, va_list args ) ); +/* Don't go to an extra call layer if we have the symbol */ #ifndef HAVE_INET_PTON -/* only in core, so no need for C++ extern "C" */ - VLC_EXPORT (int, inet_pton, (int af, const char *src, void *dst) ); +#define inet_pton vlc_inet_pton #endif - #ifndef HAVE_INET_NTOP -#ifdef WIN32 -/* only in core, so no need for C++ extern "C" */ - VLC_EXPORT (const char *, inet_ntop, (int af, const void *src, - char *dst, socklen_t cnt) ); -#endif +#define inet_ntop vlc_inet_ntop #endif +VLC_EXPORT (int, vlc_inet_pton, (int af, const char *src, void *dst) ); +VLC_EXPORT (const char *, vlc_inet_ntop, (int af, const void *src, + char *dst, socklen_t cnt) ); + #ifndef HAVE_POLL enum { @@ -250,6 +269,10 @@ struct addrinfo # 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 ** ) );