VLC 4.0.0-dev
Loading...
Searching...
No Matches
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
}
 

Functions

static void httpd_ClientDestroy (httpd_client_t *cl)
 
static void httpd_AppendData (httpd_stream_t *stream, uint8_t *p_data, int i_data)
 
static int cmp_code (const void *k, const void *e)
 
static const char * httpd_ReasonFromCode (unsigned i_code)
 
static size_t httpd_HtmlError (char **body, int code, const char *url)
 
static int httpd_UrlCatchCall (httpd_url_t *url, httpd_client_t *client)
 
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, void *p_sys)
 
void * httpd_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_server_t *, unsigned)
 
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,...)
 
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 (vlc_tls_t *sock)
 
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 int httpd_ClientRecv (httpd_client_t *cl)
 
static int httpd_ClientSend (httpd_client_t *cl)
 
static void httpd_ClientTlsHandshake (httpd_host_t *host, 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, const httpd_header *p_headers, size_t i_headers)
 

Variables

static struct httpd httpd = { { .value = 0, .recursion = 0, .owner = 0, } , { &httpd.hosts , &httpd.hosts } }
 
struct { 
 
   const char   name [16] 
 
   int   i_type 
 
   int   i_proto 
 
msg_type [] 
 

Macro Definition Documentation

◆ HTTPD_CL_BUFSIZE

#define HTTPD_CL_BUFSIZE   10000

Enumeration Type Documentation

◆ anonymous enum

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 

Function Documentation

◆ cmp_code()

static int cmp_code ( const void *  k,
const void *  e 
)
static

Referenced by httpd_ReasonFromCode().

◆ httpd_AppendData()

static void httpd_AppendData ( httpd_stream_t stream,
uint8_t *  p_data,
int  i_data 
)
static

◆ httpd_ClientDestroy()

◆ httpd_ClientIP()

char * httpd_ClientIP ( const httpd_client_t cl,
char *  ip,
int *  port 
)

◆ httpd_ClientNew()

◆ httpd_ClientRecv()

◆ httpd_ClientSend()

◆ httpd_ClientTlsHandshake()

◆ httpd_FileCallBack()

◆ httpd_FileDelete()

httpd_file_sys_t * httpd_FileDelete ( httpd_file_t file)

◆ httpd_FileNew()

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 
)

◆ httpd_HandlerCallBack()

◆ httpd_HandlerDelete()

void * httpd_HandlerDelete ( httpd_handler_t handler)

◆ httpd_HandlerNew()

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,
void *  p_sys 
)

◆ httpd_HostCreate()

◆ httpd_HostDelete()

◆ httpd_HostThread()

static void * httpd_HostThread ( void *  data)
static

◆ httpd_HtmlError()

static size_t httpd_HtmlError ( char **  body,
int  code,
const char *  url 
)
static

◆ httpd_MsgAdd()

◆ httpd_MsgClean()

◆ httpd_MsgGet()

const char * httpd_MsgGet ( const httpd_message_t msg,
const char *  name 
)

◆ httpd_MsgInit()

◆ httpd_NetRecv()

static ssize_t httpd_NetRecv ( httpd_client_t cl,
uint8_t *  p,
size_t  i_len 
)
static

◆ httpd_NetSend()

static ssize_t httpd_NetSend ( httpd_client_t cl,
const uint8_t *  p,
size_t  i_len 
)
static

◆ httpd_ReasonFromCode()

static const char * httpd_ReasonFromCode ( unsigned  i_code)
static

◆ httpd_RedirectCallBack()

◆ httpd_RedirectDelete()

void httpd_RedirectDelete ( httpd_redirect_t rdir)

◆ httpd_RedirectNew()

httpd_redirect_t * httpd_RedirectNew ( httpd_host_t host,
const char *  psz_url_dst,
const char *  psz_url_src 
)

◆ httpd_ServerIP()

char * httpd_ServerIP ( const httpd_client_t cl,
char *  ip,
int *  port 
)

◆ httpd_StreamCallBack()

◆ httpd_StreamDelete()

◆ httpd_StreamHeader()

int httpd_StreamHeader ( httpd_stream_t stream,
uint8_t *  p_data,
int  i_data 
)

◆ httpd_StreamNew()

◆ httpd_StreamSend()

◆ httpd_StreamSetHTTPHeaders()

◆ httpd_UrlCatch()

◆ httpd_UrlCatchCall()

◆ httpd_UrlDelete()

◆ httpd_UrlNew()

◆ httpdAuthOk()

static bool httpdAuthOk ( const char *  user,
const char *  pass,
const char *  b64 
)
static

References vlc_b64_decode().

Referenced by httpdLoop().

◆ httpdLoop()

static void httpdLoop ( httpd_host_t host)
static

References httpd_client_t::answer, ARRAY_SIZE, httpd_client_t::b_stream_mode, httpd_url_t::catch, httpd_url_t::cb, httpd_host_t::client_count, httpd_host_t::clients, pollfd::events, pollfd::fd, httpd_host_t::fds, 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_ClientDestroy(), 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, httpd_UrlCatchCall(), httpdAuthOk(), 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_state, httpd_message_t::i_status, httpd_client_t::i_timeout_date, httpd_message_t::i_type, httpd_message_t::i_version, httpd_host_t::lock, msg_Err, httpd_host_t::nfd, httpd_client_t::node, p, httpd_message_t::p_body, httpd_client_t::p_buffer, httpd_url_t::p_sys, httpd_host_t::p_tls, 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, pollfd::revents, httpd_client_t::sock, strcasecmp(), httpd_host_t::timeout_sec, unlikely, httpd_client_t::url, httpd_host_t::urls, vlc_accept(), vlc_close(), vlc_list_append(), vlc_list_foreach, vlc_mutex_lock(), vlc_mutex_unlock(), vlc_restorecancel(), vlc_savecancel(), vlc_strerror_c(), VLC_TICK_FROM_SEC, vlc_tick_now(), vlc_tls_Close(), vlc_tls_GetPollFD(), vlc_tls_ServerSessionCreate(), vlc_tls_SessionDelete(), vlc_tls_SocketOpen(), and xmalloc().

Referenced by httpd_HostThread().

◆ vlc_http_HostNew()

httpd_host_t * vlc_http_HostNew ( vlc_object_t p_this)

References httpd_HostCreate().

◆ vlc_https_HostNew()

◆ vlc_rtsp_HostNew()

httpd_host_t * vlc_rtsp_HostNew ( vlc_object_t p_this)

Variable Documentation

◆ httpd

struct httpd httpd = { { .value = 0, .recursion = 0, .owner = 0, } , { &httpd.hosts , &httpd.hosts } }
static

◆ i_proto

int i_proto

◆ i_type

◆ [struct]

const struct { ... } msg_type[]
Initial value:
=
{
}
@ HTTPD_MSG_HEAD
Definition vlc_httpd.h:41
@ HTTPD_MSG_GETPARAMETER
Definition vlc_httpd.h:50
@ HTTPD_MSG_PAUSE
Definition vlc_httpd.h:49
@ HTTPD_MSG_PLAY
Definition vlc_httpd.h:48
@ HTTPD_MSG_SETUP
Definition vlc_httpd.h:47
@ HTTPD_MSG_DESCRIBE
Definition vlc_httpd.h:46
@ HTTPD_MSG_TEARDOWN
Definition vlc_httpd.h:51
@ HTTPD_MSG_GET
Definition vlc_httpd.h:40
@ HTTPD_MSG_POST
Definition vlc_httpd.h:42
@ HTTPD_MSG_OPTIONS
Definition vlc_httpd.h:45
@ HTTPD_PROTO_HTTP
Definition vlc_httpd.h:60
@ HTTPD_PROTO_RTSP
Definition vlc_httpd.h:61

Referenced by httpd_ClientRecv().

◆ name

const char name[16]

Referenced by AboveCallback(), aout_filter_Create(), aout_FiltersNewWithClock(), aout_HotplugNotify(), aout_HotplugReport(), AppendFilter(), AppendRemapFilter(), AutoScaleCallback(), ChangeFilters(), cmp_entity(), config_ChainParse(), config_FindConfig(), config_GetFloat(), config_GetInt(), config_GetIntChoices(), config_GetPsz(), config_GetPszChoices(), config_GetSysPath(), config_GetType(), config_IsSafe(), config_LoadCmdLine(), config_PutFloat(), config_PutInt(), config_Write(), demux_IsPathExtension(), Destroy(), filter_AddProxyCallbacks(), filter_chain_AppendFilter(), filter_chain_AppendFromString(), filter_chain_AppendInner(), filter_DelProxyCallbacks(), FitCallback(), getaddrinfo(), getenv(), hpack_append_hdr(), hpack_decode(), hpack_decode_hdr_index(), hpack_decode_hdr_indexed(), hpack_decode_hdr_noindex(), hpack_decode_tbl_update(), hpack_encode_hdr_neverindex(), httpd_ClientRecv(), httpd_MsgAdd(), httpd_MsgGet(), httpd_StreamSetHTTPHeaders(), info_category_AddInfo(), info_category_DeleteInfo(), info_category_FindInfo(), info_category_New(), info_category_VaAddInfo(), info_New(), input_ExtractAttachmentAndCacheArt(), input_GetAttachment(), input_item_AddOpaque(), libvlc_InternalActionsInit(), libvlc_InternalAddIntf(), makeipv4info(), module_exists(), module_find(), module_list_cap(), module_match_name(), process_list(), SelectClockSource(), sout_StreamChainNew(), sout_StreamNew(), sout_StreamNewEmpty(), stream_FilterChainNew(), stream_HasExtension(), system_ConfigureDbus(), TriggerCallback(), TriggerListCallback(), var_Copy(), var_CopyDevice(), var_GetCoords(), var_InheritAddress(), var_InheritBool(), var_InheritFloat(), var_InheritInteger(), var_InheritString(), var_NAndInteger(), var_OrInteger(), var_SetCoords(), vlc_actions_get_id(), vlc_CPU_functions_init_once(), vlc_decoder_device_Create(), vlc_demux_chained_New(), vlc_dlsym(), vlc_filter_LoadModule(), vlc_getaddrinfo_i11e(), vlc_gl_Create(), vlc_gl_CreateOffscreen(), vlc_gl_GetProcAddress(), vlc_http_msg_add_header(), vlc_http_msg_find_header(), vlc_http_msg_get_header(), vlc_http_msg_get_time(), vlc_http_msg_h2_headers(), vlc_http_msg_headers(), vlc_http_msg_vadd_header(), vlc_https_connect(), vlc_keycode2str(), vlc_media_source_New(), vlc_media_source_provider_Add(), vlc_media_source_provider_Find(), vlc_media_source_provider_GetMediaSource(), vlc_ml_playlist_create(), vlc_ml_playlist_rename(), vlc_module_load(), vlc_module_store(), vlc_param_Find(), vlc_player_aout_EnableFilter(), vlc_player_osd_Program(), vlc_player_program_New(), vlc_player_program_Update(), vlc_player_track_priv_New(), vlc_player_track_priv_Update(), vlc_player_vout_SetVar(), vlc_plugin_desc_cb(), vlc_plugin_get_symbol(), vlc_plugin_gpa_cb(), vlc_plugin_Symbol(), vlc_rtp_add_media_types(), vlc_rtp_mux_request(), vlc_rtp_pt_request_mux(), vlc_sd_probe_Add(), vlc_sdp_attr_first_by_name(), vlc_sdp_attr_get(), vlc_sdp_attr_present(), vlc_sdp_attr_value(), vlc_sdp_fmtp_get_str(), vlc_sdp_fmtp_get_u16(), vlc_sdp_fmtp_get_u8(), vlc_sdp_fmtp_get_ull(), vlc_sdp_media_attr_get(), vlc_sdp_media_attr_present(), vlc_sdp_media_attr_value(), vlc_str2keycode(), vlc_strfplayer(), vlc_thread_set_name(), vlc_tls_SocketOpenTCP(), vlc_tls_SocketOpenTLS(), vlc_window_ReportOutputDevice(), vout_display_window_OutputEvent(), vout_snapshot_SaveImage(), WallPaperCallback(), and ZoomCallback().