]> git.sesse.net Git - vlc/blobdiff - include/vlc_network.h
Single service DCCP/RTP/AVP input
[vlc] / include / vlc_network.h
index bc35ffe9d7d7b3ff5fb098339d8c6fbe5025c853..988d8d57410d9b10b405434b23b2ad834fe5fc29 100644 (file)
@@ -70,16 +70,25 @@ extern "C" {
 /* Portable networking layer communication */
 int net_Socket (vlc_object_t *obj, int family, int socktype, int proto);
 
-#define net_ConnectTCP(a, b, c) __net_ConnectTCP(VLC_OBJECT(a), b, c)
-#define net_OpenTCP(a, b, c) __net_ConnectTCP(VLC_OBJECT(a), b, c)
-VLC_EXPORT( int, __net_ConnectTCP, ( vlc_object_t *p_this, const char *psz_host, int i_port ) );
+#define net_Connect(a, b, c, d, e) __net_Connect(VLC_OBJECT(a), b, c, d, e)
+VLC_EXPORT( int, __net_Connect, (vlc_object_t *p_this, const char *psz_host, int i_port, int socktype, int protocol) );
 
-int *net_Listen (vlc_object_t *p_this, const char *psz_host, int i_port,
-                                int family, int socktype, int protocol);
+VLC_EXPORT( int *, net_Listen, (vlc_object_t *p_this, const char *psz_host, int i_port,
+                                int family, int socktype, int protocol) );
 VLC_EXPORT( int, net_ListenSingle, (vlc_object_t *p_this, const char *psz_host, int i_port, int family, int socktype, int protocol) );
 
 #define net_ListenTCP(a, b, c) __net_ListenTCP(VLC_OBJECT(a), b, c)
-VLC_EXPORT( int *, __net_ListenTCP, ( vlc_object_t *, const char *, int ) );
+#define net_ConnectTCP(a, b, c) __net_ConnectTCP(VLC_OBJECT(a), b, c)
+
+static inline int *__net_ListenTCP (vlc_object_t *obj, const char *host, int port)
+{
+    return net_Listen (obj, host, port, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP);
+}
+
+static inline int __net_ConnectTCP (vlc_object_t *obj, const char *host, int port)
+{
+    return __net_Connect (obj, host, port, SOCK_STREAM, IPPROTO_TCP);
+}
 
 #define net_Accept(a, b, c) __net_Accept(VLC_OBJECT(a), b, c)
 VLC_EXPORT( int, __net_Accept, ( vlc_object_t *, int *, mtime_t ) );
@@ -89,7 +98,7 @@ VLC_EXPORT( int, __net_ConnectDgram, ( vlc_object_t *p_this, const char *psz_hos
 
 static inline int net_ConnectUDP (vlc_object_t *obj, const char *host, int port, int hlim)
 {
-    return net_ConnectDgram (obj, host, port, hlim, 0);
+    return net_ConnectDgram (obj, host, port, hlim, IPPROTO_UDP);
 }
 
 static inline int net_ListenUDP1 (vlc_object_t *obj, const char *host, int port)
@@ -138,7 +147,7 @@ VLC_EXPORT( int, __net_vaPrintf, ( vlc_object_t *p_this, int fd, const v_socket_
 
 #ifndef HAVE_INET_PTON
 /* only in core, so no need for C++ extern "C" */
-int inet_pton(int af, const char *src, void *dst);
+VLC_EXPORT (int, inet_pton, (int af, const char *src, void *dst) );
 #endif
 
 #ifndef HAVE_POLL
@@ -154,9 +163,9 @@ enum
 
 struct pollfd
 {
-       int fd;
-       int events;
-       int revents;
+    int fd;
+    int events;
+    int revents;
 };
 
 int poll (struct pollfd *fds, unsigned nfds, int timeout);