vo_glamo: sub.h was moved to sub directory in c9026cb3210205b07e2e068467a18ee40f9259a3
[mplayer/glamo.git] / stream / network.h
blob1c395acc49dd63056e0cde43fb963c2c9c66c887
1 /*
2 * Network layer for MPlayer
4 * Copyright (C) 2001 Bertrand Baudet <bertrand_baudet@yahoo.com>
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef MPLAYER_NETWORK_H
24 #define MPLAYER_NETWORK_H
26 #include <fcntl.h>
27 #include <sys/time.h>
28 #include <sys/types.h>
30 #include "config.h"
31 #if !HAVE_WINSOCK2_H
32 #include <netdb.h>
33 #include <netinet/in.h>
34 #include <sys/socket.h>
35 #include <arpa/inet.h>
36 #endif
38 #include "stream.h"
39 #include "url.h"
40 #include "http.h"
42 #ifdef MSG_NOSIGNAL
43 #define DEFAULT_SEND_FLAGS MSG_NOSIGNAL
44 #else
45 #define DEFAULT_SEND_FLAGS 0
46 #endif
48 #if !HAVE_CLOSESOCKET
49 #define closesocket close
50 #endif
51 #if !HAVE_SOCKLEN_T
52 typedef int socklen_t;
53 #endif
55 #define BUFFER_SIZE 2048
57 typedef struct {
58 const char *mime_type;
59 int demuxer_type;
60 } mime_struct_t;
62 extern const mime_struct_t mime_type_table[];
64 streaming_ctrl_t *streaming_ctrl_new(void);
65 int streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size);
67 int nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl );
68 int nop_streaming_seek( int fd, off_t pos, streaming_ctrl_t *stream_ctrl );
69 void streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl );
71 int http_send_request(URL_t *url, off_t pos);
72 HTTP_header_t *http_read_response(int fd);
74 int http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry);
75 URL_t* check4proxies(URL_t *url);
77 void fixup_network_stream_cache(stream_t *stream);
78 int http_seek(stream_t *stream, off_t pos);
80 #endif /* MPLAYER_NETWORK_H */