Commit e5c2a63d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use separate functions for RTSP and HTTP hosts

Also prefix with vlc_ for namespace cleanliness.
parent 73a0a9f9
......@@ -99,8 +99,9 @@ struct httpd_message_t
};
/* create a new host */
VLC_API httpd_host_t * httpd_HostNew( vlc_object_t *, const char *psz_host, int i_port ) VLC_USED;
VLC_API httpd_host_t * httpd_TLSHostNew( vlc_object_t *, const char *, int ) VLC_USED;
VLC_API httpd_host_t *vlc_http_HostNew( vlc_object_t *, const char *psz_host, int i_port ) VLC_USED;
VLC_API httpd_host_t *vlc_https_HostNew( vlc_object_t *, const char *, int ) VLC_USED;
VLC_API httpd_host_t *vlc_rtsp_HostNew( vlc_object_t *, const char *, int ) VLC_USED;
/* delete a host */
VLC_API void httpd_HostDelete( httpd_host_t * );
......
......@@ -96,7 +96,7 @@ int HTTPOpen( access_t *p_access )
msg_Dbg( p_access, "base %s:%d", psz_address, i_port );
p_sys->p_httpd_host = httpd_HostNew( VLC_OBJECT(p_access), psz_address,
p_sys->p_httpd_host = vlc_http_HostNew( VLC_OBJECT(p_access), psz_address,
i_port );
if ( p_sys->p_httpd_host == NULL )
{
......
......@@ -190,14 +190,14 @@ static int Open( vlc_object_t *p_this )
{
if( i_bind_port <= 0 )
i_bind_port = DEFAULT_SSL_PORT;
p_sys->p_httpd_host = httpd_TLSHostNew( VLC_OBJECT(p_access),
p_sys->p_httpd_host = vlc_https_HostNew( VLC_OBJECT(p_access),
psz_bind_addr, i_bind_port );
}
else
{
if( i_bind_port <= 0 )
i_bind_port = DEFAULT_PORT;
p_sys->p_httpd_host = httpd_HostNew( VLC_OBJECT(p_access),
p_sys->p_httpd_host = vlc_http_HostNew( VLC_OBJECT(p_access),
psz_bind_addr, i_bind_port );
}
......
......@@ -70,7 +70,7 @@ static int vlclua_httpd_tls_host_new( lua_State *L )
vlc_object_t *p_this = vlclua_get_this( L );
const char *psz_host = luaL_checkstring( L, 1 );
int i_port = luaL_checkint( L, 2 );
httpd_host_t *p_host = httpd_HostNew( p_this, psz_host, i_port );
httpd_host_t *p_host = vlc_http_HostNew( p_this, psz_host, i_port );
if( !p_host )
return luaL_error( L, "Failed to create HTTP host \"%s:%d\" ",
psz_host, i_port );
......
......@@ -282,7 +282,7 @@ static int Open( vlc_object_t *p_this )
p_sys->psz_raw_mux = var_CreateGetString( p_this, "rtsp-raw-mux" );
p_sys->p_rtsp_host =
httpd_HostNew( VLC_OBJECT(p_vod), url.psz_host, url.i_port );
vlc_rtsp_HostNew( VLC_OBJECT(p_vod), url.psz_host, url.i_port );
if( !p_sys->p_rtsp_host )
{
msg_Err( p_vod, "cannot create RTSP server (%s:%i)",
......
......@@ -1320,7 +1320,7 @@ static int HttpSetup( sout_stream_t *p_stream, const vlc_url_t *url)
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
p_sys->p_httpd_host = httpd_HostNew( VLC_OBJECT(p_stream), url->psz_host,
p_sys->p_httpd_host = vlc_http_HostNew( VLC_OBJECT(p_stream), url->psz_host,
url->i_port > 0 ? url->i_port : 80 );
if( p_sys->p_httpd_host )
{
......
......@@ -120,7 +120,7 @@ rtsp_stream_t *RtspSetup( vlc_object_t *owner, vod_media_t *media,
msg_Dbg( owner, "RTSP stream: host %s port %d at %s",
url->psz_host, rtsp->port, rtsp->psz_path );
rtsp->host = httpd_HostNew( VLC_OBJECT(owner), url->psz_host,
rtsp->host = vlc_rtsp_HostNew( VLC_OBJECT(owner), url->psz_host,
rtsp->port );
if( rtsp->host == NULL )
goto error;
......
......@@ -159,7 +159,9 @@ httpd_FileNew
httpd_HandlerDelete
httpd_HandlerNew
httpd_HostDelete
httpd_HostNew
vlc_http_HostNew
vlc_https_HostNew
vlc_rtsp_HostNew
httpd_MsgAdd
httpd_MsgGet
httpd_RedirectDelete
......@@ -169,7 +171,6 @@ httpd_StreamDelete
httpd_StreamHeader
httpd_StreamNew
httpd_StreamSend
httpd_TLSHostNew
httpd_UrlCatch
httpd_UrlDelete
httpd_UrlNew
......
......@@ -93,18 +93,25 @@ void httpd_HostDelete (httpd_host_t *h)
assert (0);
}
httpd_host_t *httpd_HostNew (vlc_object_t *obj, const char *host, int port)
httpd_host_t *vlc_http_HostNew (vlc_object_t *obj, const char *host, int port)
{
(void) host; (void) port;
msg_Err (obj, "VLC httpd support not compiled-in!");
msg_Err (obj, "HTTP server not compiled-in!");
return NULL;
}
httpd_host_t *httpd_TLSHostNew (vlc_object_t *obj, const char *host, int port)
httpd_host_t *vlc_https_HostNew (vlc_object_t *obj, const char *host, int port)
{
return httpd_HostNew (obj, host, port);
}
httpd_host_t *vlc_rtsp_HostNew (vlc_object_t *obj, const char *host, int port)
{
(void) host; (void) port;
msg_Err (obj, "RTSP server not compiled-in!");
return NULL;
}
void httpd_MsgAdd (httpd_message_t *m, const char *name, const char *fmt, ...)
{
(void) m; (void) name; (void) fmt;
......
......@@ -968,13 +968,13 @@ static httpd_host_t *httpd_HostCreate( vlc_object_t *, const char *, int,
vlc_tls_creds_t * );
/* create a new host */
httpd_host_t *httpd_HostNew( vlc_object_t *p_this, const char *psz_host,
httpd_host_t *vlc_http_HostNew( vlc_object_t *p_this, const char *psz_host,
int i_port )
{
return httpd_HostCreate( p_this, psz_host, i_port, NULL );
}
httpd_host_t *httpd_TLSHostNew( vlc_object_t *obj, const char *host, int port )
httpd_host_t *vlc_https_HostNew( vlc_object_t *obj, const char *host, int port )
{
char *cert = var_InheritString( obj, "http-cert" );
if( cert == NULL )
......@@ -1028,6 +1028,12 @@ error:
return NULL;
}
httpd_host_t *vlc_rtsp_HostNew( vlc_object_t *p_this, const char *psz_host,
int i_port )
{
return httpd_HostCreate( p_this, psz_host, i_port, NULL );
}
static vlc_mutex_t httpd_mutex = VLC_STATIC_MUTEX;
static httpd_host_t *httpd_HostCreate( vlc_object_t *p_this,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment