2001-05-29 17:03:17 +00:00
|
|
|
/*
|
|
|
|
* Network layer for MPlayer
|
2010-01-30 22:26:47 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2001 Bertrand Baudet <bertrand_baudet@yahoo.com>
|
|
|
|
*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2001-05-29 17:03:17 +00:00
|
|
|
*/
|
2001-05-20 12:58:41 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_NETWORK_H
|
|
|
|
#define MPLAYER_NETWORK_H
|
2001-05-29 17:03:17 +00:00
|
|
|
|
2001-12-10 01:34:08 +00:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/types.h>
|
2003-06-11 16:48:09 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
2009-02-01 13:42:27 +00:00
|
|
|
#if !HAVE_WINSOCK2_H
|
2003-06-11 16:48:09 +00:00
|
|
|
#include <netdb.h>
|
|
|
|
#include <netinet/in.h>
|
2001-12-10 01:34:08 +00:00
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <arpa/inet.h>
|
2003-06-11 16:48:09 +00:00
|
|
|
#endif
|
2001-12-10 01:34:08 +00:00
|
|
|
|
2010-02-22 13:27:58 +00:00
|
|
|
#include "stream.h"
|
2001-05-29 17:03:17 +00:00
|
|
|
#include "url.h"
|
2002-06-17 08:18:45 +00:00
|
|
|
#include "http.h"
|
2001-05-20 12:58:41 +00:00
|
|
|
|
2010-06-27 15:04:13 +00:00
|
|
|
#ifdef MSG_NOSIGNAL
|
|
|
|
#define DEFAULT_SEND_FLAGS MSG_NOSIGNAL
|
|
|
|
#else
|
|
|
|
#define DEFAULT_SEND_FLAGS 0
|
|
|
|
#endif
|
|
|
|
|
2009-02-01 13:16:46 +00:00
|
|
|
#if !HAVE_CLOSESOCKET
|
2008-09-01 07:31:57 +00:00
|
|
|
#define closesocket close
|
|
|
|
#endif
|
2009-02-01 13:16:46 +00:00
|
|
|
#if !HAVE_SOCKLEN_T
|
2008-10-12 12:12:41 +00:00
|
|
|
typedef int socklen_t;
|
|
|
|
#endif
|
2008-09-01 07:31:57 +00:00
|
|
|
|
2001-06-04 17:52:33 +00:00
|
|
|
#define BUFFER_SIZE 2048
|
|
|
|
|
2005-05-29 12:54:00 +00:00
|
|
|
typedef struct {
|
2006-07-27 17:35:06 +00:00
|
|
|
const char *mime_type;
|
2005-05-29 12:54:00 +00:00
|
|
|
int demuxer_type;
|
|
|
|
} mime_struct_t;
|
|
|
|
|
2010-09-09 10:30:58 +00:00
|
|
|
extern const mime_struct_t mime_type_table[];
|
|
|
|
|
2011-03-17 08:58:49 +00:00
|
|
|
extern char **network_http_header_fields;
|
|
|
|
|
2006-02-09 14:08:03 +00:00
|
|
|
streaming_ctrl_t *streaming_ctrl_new(void);
|
2001-11-20 22:20:20 +00:00
|
|
|
int streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size);
|
2001-06-04 17:52:33 +00:00
|
|
|
|
2001-11-20 22:20:20 +00:00
|
|
|
int nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl );
|
2012-11-18 19:46:12 +00:00
|
|
|
int nop_streaming_seek( int fd, int64_t pos, streaming_ctrl_t *stream_ctrl );
|
2005-05-29 12:54:00 +00:00
|
|
|
void streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl );
|
2001-05-20 12:58:41 +00:00
|
|
|
|
2012-11-18 19:46:12 +00:00
|
|
|
int http_send_request(URL_t *url, int64_t pos);
|
2002-06-17 08:18:45 +00:00
|
|
|
HTTP_header_t *http_read_response(int fd);
|
|
|
|
|
2002-10-29 09:18:53 +00:00
|
|
|
int http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry);
|
2012-10-30 17:28:34 +00:00
|
|
|
URL_t* check4proxies(const URL_t *url);
|
|
|
|
URL_t *url_new_with_proxy(const char *urlstr);
|
2002-10-29 09:18:53 +00:00
|
|
|
|
2012-11-18 19:46:12 +00:00
|
|
|
int http_seek(stream_t *stream, int64_t pos);
|
2010-02-22 13:50:48 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_NETWORK_H */
|