Merge pull request #4791 from jmarshallnz/playlist_settings
[vuplus_xbmc] / lib / libhts / net.h
1 /*
2  *  Networking
3  *  Copyright (C) 2007-2008 Andreas Ă–man
4  *
5  *  This program is free software; you can redistribute it and/or
6  *  modify it under the terms of the GNU General Public License
7  *  as published by the Free Software Foundation; either version 2
8  *  of the License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #ifndef NET_H__
21 #define NET_H__
22
23 #include <sys/types.h>
24 #include <stdint.h>
25 #include "htsbuf.h"
26
27 #ifdef _MSC_VER
28 typedef SOCKET socket_t;
29 #else
30 typedef int socket_t;
31 #endif
32
33 socket_t htsp_tcp_connect(const char *hostname, int port, char *errbuf,
34                 size_t errbufsize, int timeout);
35
36 int htsp_tcp_write_queue(socket_t fd, htsbuf_queue_t *q);
37
38 int htsp_tcp_read_line(socket_t fd, char *buf, const size_t bufsize,
39                   htsbuf_queue_t *spill);
40
41 int htsp_tcp_read_data(socket_t fd, char *buf, const size_t bufsize,
42                   htsbuf_queue_t *spill);
43
44 int htsp_tcp_read(socket_t fd, void *buf, size_t len);
45
46 int htsp_tcp_read_timeout(socket_t fd, void *buf, size_t len, int timeout);
47
48 void htsp_tcp_close(socket_t fd);
49
50
51 #endif /* NET_H__ */