xine-lib 1.2.11
Data Structures | Macros | Functions
input_http.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <zlib.h>
#include <xine/xine_internal.h>
#include <xine/xineutils.h>
#include <xine/input_plugin.h>
#include "tls/xine_tls.h"
#include "net_buf_ctrl.h"
#include "group_network.h"
#include "http_helper.h"
#include "input_helper.h"

Data Structures

struct  http_input_plugin_t
 
struct  http_input_class_t
 

Macros

#define LOG_MODULE   "input_http"
 
#define LOG_VERBOSE
 
#define BUFSIZE   1024
 
#define DEFAULT_HTTP_PORT   80
 
#define DEFAULT_HTTPS_PORT   443
 
#define MODE_CHUNKED   0x0001 /* content sent portion-wise */
 
#define MODE_DEFLATED   0x0002 /* content needs inflating */
 
#define MODE_HAS_TYPE   0x0004 /* there is (at least the type of) content */
 
#define MODE_HAS_LENGTH   0x0008 /* content size is known */
 
#define MODE_AGAIN   0x0010 /* follow a redirection */
 
#define MODE_INFLATING   0x0020 /* zlib inflater is up */
 
#define MODE_DONE   0x0040 /* end of content reached */
 
#define MODE_HAVE_CHUNK   0x0100 /* there are content portions left */
 
#define MODE_HAVE_SBUF   0x0200 /* there are content bytes in sbuf */
 
#define MODE_HAVE_READ   0x0400 /* socket still has data to read */
 
#define MODE_SEEKABLE   0x1000 /* server supports byte ranges */
 
#define MODE_NSV   0x2000 /* we have a nullsoft stream */
 
#define MODE_LASTFM   0x4000 /* we have a last.fm stream */
 
#define MODE_SHOUTCAST   0x8000 /* content has info inserts */
 
#define SIZEOF_LITERALS   205
 
#define SIZEOF_NUMS   (1 * 24)
 
#define ADDLIT(s)   { static const char ls[] = s; memcpy (q, s, sizeof (ls)); q += sizeof (ls) - 1; }
 
#define ADDSTR(s)   q += strlcpy (q, s, e - q); if (q > e) q = e
 
#define V_NSV   (('N' << 24) | ('S' << 16) | ('V' << 8))
 

Functions

static void uint64_2str (char **s, uint64_t v)
 
static void uint32_2str (char **s, uint32_t u)
 
static uint64_t str2uint64 (uint8_t **s)
 
static uint32_t str2uint32 (uint8_t **s)
 
static uint32_t hexstr2uint32 (uint8_t **s)
 
static void sbuf_init (http_input_plugin_t *this)
 
static void sbuf_reset (http_input_plugin_t *this)
 
static int32_t sbuf_get_string (http_input_plugin_t *this, uint8_t **buf)
 
static int sbuf_skip_gzip_head (uint8_t *buf, uint32_t len)
 
static ssize_t sbuf_get_bytes (http_input_plugin_t *this, uint8_t *buf, size_t len)
 
static void proxy_host_change_cb (void *this_gen, xine_cfg_entry_t *cfg)
 
static void proxy_port_change_cb (void *this_gen, xine_cfg_entry_t *cfg)
 
static void proxy_user_change_cb (void *this_gen, xine_cfg_entry_t *cfg)
 
static void proxy_password_change_cb (void *this_gen, xine_cfg_entry_t *cfg)
 
static void no_proxy_list_change_cb (void *this_gen, xine_cfg_entry_t *cfg)
 
static void prot_version_change_cb (void *this_gen, xine_cfg_entry_t *cfg)
 
static void head_dump_name_change_cb (void *this_gen, xine_cfg_entry_t *cfg)
 
static int _x_use_proxy (xine_t *xine, http_input_class_t *this, const char *host)
 
static size_t http_plugin_basicauth (const char *user, const char *password, char *dest, size_t len)
 
static int http_plugin_read_metainf (http_input_plugin_t *this)
 
static ssize_t http_plugin_read_int (http_input_plugin_t *this, uint8_t *buf, size_t total)
 
static off_t http_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t nlen)
 
static off_t http_plugin_get_length (input_plugin_t *this_gen)
 
static uint32_t http_plugin_get_capabilities (input_plugin_t *this_gen)
 
static off_t http_plugin_get_current_pos (input_plugin_t *this_gen)
 
static void http_close (http_input_plugin_t *this)
 
static int http_restart (http_input_plugin_t *this, off_t abs_offset)
 
static off_t http_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin)
 
static const char * http_plugin_get_mrl (input_plugin_t *this_gen)
 
static void http_plugin_dispose (input_plugin_t *this_gen)
 
static void report_progress (xine_stream_t *stream, int p)
 
static xio_handshake_status_t http_plugin_handshake (void *userdata, int fh)
 
static int http_plugin_open (input_plugin_t *this_gen)
 
static int http_can_handle (xine_stream_t *stream, const char *mrl)
 
static int http_plugin_get_optional_data (input_plugin_t *this_gen, void *const data, int data_type)
 
static input_plugin_thttp_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *mrl)
 
static void http_class_dispose (input_class_t *this_gen)
 
void * input_http_init_class (xine_t *xine, const void *data)
 

Macro Definition Documentation

◆ ADDLIT

#define ADDLIT (   s)    { static const char ls[] = s; memcpy (q, s, sizeof (ls)); q += sizeof (ls) - 1; }

◆ ADDSTR

#define ADDSTR (   s)    q += strlcpy (q, s, e - q); if (q > e) q = e

◆ BUFSIZE

#define BUFSIZE   1024

◆ DEFAULT_HTTP_PORT

#define DEFAULT_HTTP_PORT   80

◆ DEFAULT_HTTPS_PORT

#define DEFAULT_HTTPS_PORT   443

◆ LOG_MODULE

#define LOG_MODULE   "input_http"

◆ LOG_VERBOSE

#define LOG_VERBOSE

◆ MODE_AGAIN

#define MODE_AGAIN   0x0010 /* follow a redirection */

◆ MODE_CHUNKED

#define MODE_CHUNKED   0x0001 /* content sent portion-wise */

◆ MODE_DEFLATED

#define MODE_DEFLATED   0x0002 /* content needs inflating */

◆ MODE_DONE

#define MODE_DONE   0x0040 /* end of content reached */

◆ MODE_HAS_LENGTH

#define MODE_HAS_LENGTH   0x0008 /* content size is known */

◆ MODE_HAS_TYPE

#define MODE_HAS_TYPE   0x0004 /* there is (at least the type of) content */

◆ MODE_HAVE_CHUNK

#define MODE_HAVE_CHUNK   0x0100 /* there are content portions left */

◆ MODE_HAVE_READ

#define MODE_HAVE_READ   0x0400 /* socket still has data to read */

◆ MODE_HAVE_SBUF

#define MODE_HAVE_SBUF   0x0200 /* there are content bytes in sbuf */

◆ MODE_INFLATING

#define MODE_INFLATING   0x0020 /* zlib inflater is up */

◆ MODE_LASTFM

#define MODE_LASTFM   0x4000 /* we have a last.fm stream */

◆ MODE_NSV

#define MODE_NSV   0x2000 /* we have a nullsoft stream */

◆ MODE_SEEKABLE

#define MODE_SEEKABLE   0x1000 /* server supports byte ranges */

◆ MODE_SHOUTCAST

#define MODE_SHOUTCAST   0x8000 /* content has info inserts */

◆ SIZEOF_LITERALS

#define SIZEOF_LITERALS   205

◆ SIZEOF_NUMS

#define SIZEOF_NUMS   (1 * 24)

◆ V_NSV

#define V_NSV   (('N' << 24) | ('S' << 16) | ('V' << 8))

Function Documentation

◆ _x_use_proxy()

static int _x_use_proxy ( xine_t xine,
http_input_class_t this,
const char *  host 
)
static

References _, lprintf, NULL, xine_log(), and XINE_LOG_MSG.

Referenced by http_plugin_open().

◆ head_dump_name_change_cb()

static void head_dump_name_change_cb ( void *  this_gen,
xine_cfg_entry_t cfg 
)
static

◆ hexstr2uint32()

static uint32_t hexstr2uint32 ( uint8_t **  s)
inlinestatic

References tab_unhex.

Referenced by sbuf_get_bytes().

◆ http_can_handle()

static int http_can_handle ( xine_stream_t stream,
const char *  mrl 
)
static

◆ http_class_dispose()

static void http_class_dispose ( input_class_t this_gen)
static

◆ http_class_get_instance()

static input_plugin_t * http_class_get_instance ( input_class_t cls_gen,
xine_stream_t stream,
const char *  mrl 
)
static

◆ http_close()

static void http_close ( http_input_plugin_t this)
static

◆ http_plugin_basicauth()

static size_t http_plugin_basicauth ( const char *  user,
const char *  password,
char *  dest,
size_t  len 
)
static

◆ http_plugin_dispose()

static void http_plugin_dispose ( input_plugin_t this_gen)
static

◆ http_plugin_get_capabilities()

static uint32_t http_plugin_get_capabilities ( input_plugin_t this_gen)
static

◆ http_plugin_get_current_pos()

static off_t http_plugin_get_current_pos ( input_plugin_t this_gen)
static

Referenced by http_class_get_instance().

◆ http_plugin_get_length()

static off_t http_plugin_get_length ( input_plugin_t this_gen)
static

Referenced by http_class_get_instance().

◆ http_plugin_get_mrl()

static const char * http_plugin_get_mrl ( input_plugin_t this_gen)
static

Referenced by http_class_get_instance().

◆ http_plugin_get_optional_data()

static int http_plugin_get_optional_data ( input_plugin_t this_gen,
void *const  data,
int  data_type 
)
static

◆ http_plugin_handshake()

static xio_handshake_status_t http_plugin_handshake ( void *  userdata,
int  fh 
)
static

◆ http_plugin_open()

static int http_plugin_open ( input_plugin_t this_gen)
static

◆ http_plugin_read()

static off_t http_plugin_read ( input_plugin_t this_gen,
void *  buf_gen,
off_t  nlen 
)
static

References http_plugin_read_int(), and lprintf.

Referenced by http_class_get_instance().

◆ http_plugin_read_int()

static ssize_t http_plugin_read_int ( http_input_plugin_t this,
uint8_t *  buf,
size_t  total 
)
static

◆ http_plugin_read_metainf()

static int http_plugin_read_metainf ( http_input_plugin_t this)
static

◆ http_plugin_seek()

static off_t http_plugin_seek ( input_plugin_t this_gen,
off_t  offset,
int  origin 
)
static

◆ http_restart()

static int http_restart ( http_input_plugin_t this,
off_t  abs_offset 
)
static

◆ input_http_init_class()

void * input_http_init_class ( xine_t xine,
const void *  data 
)

◆ no_proxy_list_change_cb()

static void no_proxy_list_change_cb ( void *  this_gen,
xine_cfg_entry_t cfg 
)
static

◆ prot_version_change_cb()

static void prot_version_change_cb ( void *  this_gen,
xine_cfg_entry_t cfg 
)
static

◆ proxy_host_change_cb()

static void proxy_host_change_cb ( void *  this_gen,
xine_cfg_entry_t cfg 
)
static

◆ proxy_password_change_cb()

static void proxy_password_change_cb ( void *  this_gen,
xine_cfg_entry_t cfg 
)
static

◆ proxy_port_change_cb()

static void proxy_port_change_cb ( void *  this_gen,
xine_cfg_entry_t cfg 
)
static

◆ proxy_user_change_cb()

static void proxy_user_change_cb ( void *  this_gen,
xine_cfg_entry_t cfg 
)
static

◆ report_progress()

static void report_progress ( xine_stream_t stream,
int  p 
)
static

◆ sbuf_get_bytes()

static ssize_t sbuf_get_bytes ( http_input_plugin_t this,
uint8_t *  buf,
size_t  len 
)
static

◆ sbuf_get_string()

static int32_t sbuf_get_string ( http_input_plugin_t this,
uint8_t **  buf 
)
static

◆ sbuf_init()

static void sbuf_init ( http_input_plugin_t this)
static

◆ sbuf_reset()

static void sbuf_reset ( http_input_plugin_t this)
static

◆ sbuf_skip_gzip_head()

static int sbuf_skip_gzip_head ( uint8_t *  buf,
uint32_t  len 
)
static

Referenced by sbuf_get_bytes().

◆ str2uint32()

static uint32_t str2uint32 ( uint8_t **  s)
inlinestatic

Referenced by http_plugin_handshake().

◆ str2uint64()

static uint64_t str2uint64 ( uint8_t **  s)
inlinestatic

Referenced by http_plugin_handshake().

◆ uint32_2str()

static void uint32_2str ( char **  s,
uint32_t  u 
)
inlinestatic

Referenced by http_plugin_handshake().

◆ uint64_2str()

static void uint64_2str ( char **  s,
uint64_t  v 
)
inlinestatic

Referenced by http_plugin_handshake().