VLC  3.0.0-git
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
httpd.c File Reference
Include dependency graph for httpd.c:

Data Structures

struct  httpd_host_t
struct  httpd_url_t
struct  httpd_client_t
struct  httpd_file_t
struct  httpd_handler_t
struct  httpd_redirect_t
struct  httpd_stream_t
struct  httpd

Macros

#define HTTPD_CL_BUFSIZE   10000

Enumerations

enum  {
  HTTPD_CLIENT_RECEIVING, HTTPD_CLIENT_RECEIVE_DONE, HTTPD_CLIENT_SENDING, HTTPD_CLIENT_SEND_DONE,
  HTTPD_CLIENT_WAITING, HTTPD_CLIENT_DEAD, HTTPD_CLIENT_TLS_HS_IN, HTTPD_CLIENT_TLS_HS_OUT
}
enum  { HTTPD_CLIENT_FILE, HTTPD_CLIENT_STREAM }

Functions

static void httpd_ClientClean (httpd_client_t *cl)
static void httpd_AppendData (httpd_stream_t *stream, uint8_t *p_data, int i_data)
static const char * httpd_ReasonFromCode (unsigned i_code)
static size_t httpd_HtmlError (char **body, int code, const char *url)
static int httpd_FileCallBack (httpd_callback_sys_t *p_sys, httpd_client_t *cl, httpd_message_t *answer, const httpd_message_t *query)
httpd_file_thttpd_FileNew (httpd_host_t *host, const char *psz_url, const char *psz_mime, const char *psz_user, const char *psz_password, httpd_file_callback_t pf_fill, httpd_file_sys_t *p_sys)
httpd_file_sys_thttpd_FileDelete (httpd_file_t *file)
static int httpd_HandlerCallBack (httpd_callback_sys_t *p_sys, httpd_client_t *cl, httpd_message_t *answer, const httpd_message_t *query)
httpd_handler_thttpd_HandlerNew (httpd_host_t *host, const char *psz_url, const char *psz_user, const char *psz_password, httpd_handler_callback_t pf_fill, httpd_handler_sys_t *p_sys)
httpd_handler_sys_thttpd_HandlerDelete (httpd_handler_t *handler)
static int httpd_RedirectCallBack (httpd_callback_sys_t *p_sys, httpd_client_t *cl, httpd_message_t *answer, const httpd_message_t *query)
httpd_redirect_thttpd_RedirectNew (httpd_host_t *host, const char *psz_url_dst, const char *psz_url_src)
void httpd_RedirectDelete (httpd_redirect_t *rdir)
static int httpd_StreamCallBack (httpd_callback_sys_t *p_sys, httpd_client_t *cl, httpd_message_t *answer, const httpd_message_t *query)
httpd_stream_thttpd_StreamNew (httpd_host_t *host, const char *psz_url, const char *psz_mime, const char *psz_user, const char *psz_password)
int httpd_StreamHeader (httpd_stream_t *stream, uint8_t *p_data, int i_data)
int httpd_StreamSend (httpd_stream_t *stream, const block_t *p_block)
void httpd_StreamDelete (httpd_stream_t *stream)
static void * httpd_HostThread (void *)
static httpd_host_thttpd_HostCreate (vlc_object_t *, const char *, const char *, vlc_tls_creds_t *)
httpd_host_tvlc_http_HostNew (vlc_object_t *p_this)
httpd_host_tvlc_https_HostNew (vlc_object_t *obj)
httpd_host_tvlc_rtsp_HostNew (vlc_object_t *p_this)
void httpd_HostDelete (httpd_host_t *host)
httpd_url_thttpd_UrlNew (httpd_host_t *host, const char *psz_url, const char *psz_user, const char *psz_password)
int httpd_UrlCatch (httpd_url_t *url, int i_msg, httpd_callback_t cb, httpd_callback_sys_t *p_sys)
void httpd_UrlDelete (httpd_url_t *url)
static void httpd_MsgInit (httpd_message_t *msg)
static void httpd_MsgClean (httpd_message_t *msg)
const char * httpd_MsgGet (const httpd_message_t *msg, const char *name)
void httpd_MsgAdd (httpd_message_t *msg, const char *name, const char *psz_value,...)
static void httpd_ClientInit (httpd_client_t *cl, mtime_t now)
char * httpd_ClientIP (const httpd_client_t *cl, char *ip, int *port)
char * httpd_ServerIP (const httpd_client_t *cl, char *ip, int *port)
static httpd_client_thttpd_ClientNew (int fd, vlc_tls_t *p_tls, mtime_t now)
static ssize_t httpd_NetRecv (httpd_client_t *cl, uint8_t *p, size_t i_len)
static ssize_t httpd_NetSend (httpd_client_t *cl, const uint8_t *p, size_t i_len)
static void httpd_ClientRecv (httpd_client_t *cl)
static void httpd_ClientSend (httpd_client_t *cl)
static void httpd_ClientTlsHandshake (httpd_client_t *cl)
static bool httpdAuthOk (const char *user, const char *pass, const char *b64)
static void httpdLoop (httpd_host_t *host)
int httpd_StreamSetHTTPHeaders (httpd_stream_t *p_stream, httpd_header *p_headers, size_t i_headers)

Variables

static struct httpd httpd
struct {
   const char   name [16]
   int   i_type
   int   i_proto
msg_type []

Macro Definition Documentation

#define HTTPD_CL_BUFSIZE   10000

Enumeration Type Documentation

anonymous enum
Enumerator:
HTTPD_CLIENT_RECEIVING 
HTTPD_CLIENT_RECEIVE_DONE 
HTTPD_CLIENT_SENDING 
HTTPD_CLIENT_SEND_DONE 
HTTPD_CLIENT_WAITING 
HTTPD_CLIENT_DEAD 
HTTPD_CLIENT_TLS_HS_IN 
HTTPD_CLIENT_TLS_HS_OUT 
anonymous enum
Enumerator:
HTTPD_CLIENT_FILE 
HTTPD_CLIENT_STREAM 

Function Documentation

static void httpd_AppendData ( httpd_stream_t stream,
uint8_t *  p_data,
int  i_data 
)
static
static void httpd_ClientClean ( httpd_client_t cl)
static
static void httpd_ClientInit ( httpd_client_t cl,
mtime_t  now 
)
static
char* httpd_ClientIP ( const httpd_client_t cl,
char *  ip,
int *  port 
)
static httpd_client_t* httpd_ClientNew ( int  fd,
vlc_tls_t p_tls,
mtime_t  now 
)
static
static void httpd_ClientRecv ( httpd_client_t cl)
static
static void httpd_ClientSend ( httpd_client_t cl)
static
static void httpd_ClientTlsHandshake ( httpd_client_t cl)
static
static int httpd_FileCallBack ( httpd_callback_sys_t p_sys,
httpd_client_t cl,
httpd_message_t answer,
const httpd_message_t query 
)
static
httpd_file_sys_t* httpd_FileDelete ( httpd_file_t file)
httpd_file_t* httpd_FileNew ( httpd_host_t host,
const char *  psz_url,
const char *  psz_mime,
const char *  psz_user,
const char *  psz_password,
httpd_file_callback_t  pf_fill,
httpd_file_sys_t p_sys 
)
static int httpd_HandlerCallBack ( httpd_callback_sys_t p_sys,
httpd_client_t cl,
httpd_message_t answer,
const httpd_message_t query 
)
static
httpd_handler_sys_t* httpd_HandlerDelete ( httpd_handler_t handler)
httpd_handler_t* httpd_HandlerNew ( httpd_host_t host,
const char *  psz_url,
const char *  psz_user,
const char *  psz_password,
httpd_handler_callback_t  pf_fill,
httpd_handler_sys_t p_sys 
)
static httpd_host_t * httpd_HostCreate ( vlc_object_t p_this,
const char *  hostvar,
const char *  portvar,
vlc_tls_creds_t p_tls 
)
static
void httpd_HostDelete ( httpd_host_t host)
static void * httpd_HostThread ( void *  data)
static
static size_t httpd_HtmlError ( char **  body,
int  code,
const char *  url 
)
static
void httpd_MsgAdd ( httpd_message_t msg,
const char *  name,
const char *  psz_value,
  ... 
)
static void httpd_MsgClean ( httpd_message_t msg)
static
const char* httpd_MsgGet ( const httpd_message_t msg,
const char *  name 
)
static void httpd_MsgInit ( httpd_message_t msg)
static
static ssize_t httpd_NetRecv ( httpd_client_t cl,
uint8_t *  p,
size_t  i_len 
)
static
static ssize_t httpd_NetSend ( httpd_client_t cl,
const uint8_t *  p,
size_t  i_len 
)
static
static const char* httpd_ReasonFromCode ( unsigned  i_code)
static
static int httpd_RedirectCallBack ( httpd_callback_sys_t p_sys,
httpd_client_t cl,
httpd_message_t answer,
const httpd_message_t query 
)
static
void httpd_RedirectDelete ( httpd_redirect_t rdir)
httpd_redirect_t* httpd_RedirectNew ( httpd_host_t host,
const char *  psz_url_dst,
const char *  psz_url_src 
)
char* httpd_ServerIP ( const httpd_client_t cl,
char *  ip,
int *  port 
)
static int httpd_StreamCallBack ( httpd_callback_sys_t p_sys,
httpd_client_t cl,
httpd_message_t answer,
const httpd_message_t query 
)
static
void httpd_StreamDelete ( httpd_stream_t stream)
int httpd_StreamHeader ( httpd_stream_t stream,
uint8_t *  p_data,
int  i_data 
)
httpd_stream_t* httpd_StreamNew ( httpd_host_t host,
const char *  psz_url,
const char *  psz_mime,
const char *  psz_user,
const char *  psz_password 
)
int httpd_StreamSend ( httpd_stream_t stream,
const block_t p_block 
)
int httpd_StreamSetHTTPHeaders ( httpd_stream_t p_stream,
httpd_header p_headers,
size_t  i_headers 
)
int httpd_UrlCatch ( httpd_url_t url,
int  i_msg,
httpd_callback_t  cb,
httpd_callback_sys_t p_sys 
)
void httpd_UrlDelete ( httpd_url_t url)
httpd_url_t* httpd_UrlNew ( httpd_host_t host,
const char *  psz_url,
const char *  psz_user,
const char *  psz_password 
)
static bool httpdAuthOk ( const char *  user,
const char *  pass,
const char *  b64 
)
static

References vlc_b64_decode().

Referenced by httpdLoop().

static void httpdLoop ( httpd_host_t host)
static

References httpd_client_t::answer, httpd_client_t::b_stream_mode, httpd_url_t::catch, httpd_url_t::cb, pollfd::events, httpd_client_t::fd, pollfd::fd, HTTPD_CLIENT_DEAD, HTTPD_CLIENT_RECEIVE_DONE, HTTPD_CLIENT_RECEIVING, HTTPD_CLIENT_SEND_DONE, HTTPD_CLIENT_SENDING, HTTPD_CLIENT_TLS_HS_IN, HTTPD_CLIENT_TLS_HS_OUT, HTTPD_CLIENT_WAITING, httpd_ClientClean(), httpd_ClientNew(), httpd_ClientRecv(), httpd_ClientSend(), httpd_ClientTlsHandshake(), httpd_HtmlError(), HTTPD_MSG_ANSWER, HTTPD_MSG_NONE, HTTPD_MSG_OPTIONS, httpd_MsgAdd(), httpd_MsgClean(), httpd_MsgGet(), httpd_MsgInit(), HTTPD_PROTO_HTTP, HTTPD_PROTO_NONE, HTTPD_PROTO_RTSP, httpdAuthOk(), httpd_client_t::i_activity_date, httpd_client_t::i_activity_timeout, httpd_message_t::i_body, httpd_message_t::i_body_offset, httpd_client_t::i_buffer, httpd_client_t::i_buffer_size, httpd_message_t::i_proto, httpd_client_t::i_ref, httpd_client_t::i_state, httpd_message_t::i_status, httpd_message_t::i_type, httpd_message_t::i_version, mdate(), msg_Err, msleep, mutex_cleanup_push, httpd_message_t::p_body, httpd_client_t::p_buffer, httpd_url_t::p_sys, poll(), POLLIN, POLLOUT, httpd_url_t::psz_password, httpd_message_t::psz_url, httpd_url_t::psz_url, httpd_url_t::psz_user, httpd_client_t::query, query, pollfd::revents, strcasecmp(), TAB_APPEND, TAB_REMOVE, httpd_client_t::url, vlc_accept(), vlc_cleanup_pop, vlc_cond_wait(), vlc_mutex_lock(), vlc_mutex_unlock(), vlc_restorecancel(), vlc_savecancel(), vlc_strerror_c(), vlc_tls_SessionCreate(), and xmalloc().

Referenced by httpd_HostThread().

httpd_host_t* vlc_http_HostNew ( vlc_object_t p_this)

References httpd_HostCreate(), and msg_Err.

httpd_host_t* vlc_https_HostNew ( vlc_object_t obj)
httpd_host_t* vlc_rtsp_HostNew ( vlc_object_t p_this)

References httpd_HostCreate(), and msg_Err.

Variable Documentation

struct httpd httpd
static
int i_proto
int i_type
struct { ... } msg_type[]

Referenced by httpd_ClientRecv().

const char name[16]