Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

vlc_httpd.h

00001 /*****************************************************************************
00002  * vlc_httpd.h: builtin HTTP/RTSP server.
00003  *****************************************************************************
00004  * Copyright (C) 2004 the VideoLAN team
00005  * $Id: vlc_httpd.h 12408 2005-08-26 18:15:21Z massiot $
00006  *
00007  * Authors: Laurent Aimar <[email protected]>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef _VLC_HTTPD_H
00025 #define _VLC_HTTPD_H 1
00026 
00027 /* NEVER touch that, it's here only because src/misc/objects.c
00028  * need sizeof(httpd_t) */
00029 struct httpd_t
00030 {
00031     VLC_COMMON_MEMBERS
00032 
00033     int          i_host;
00034     httpd_host_t **host;
00035 };
00036 
00037 enum
00038 {
00039     HTTPD_MSG_NONE,
00040 
00041     /* answer */
00042     HTTPD_MSG_ANSWER,
00043 
00044     /* channel communication */
00045     HTTPD_MSG_CHANNEL,
00046 
00047     /* http request */
00048     HTTPD_MSG_GET,
00049     HTTPD_MSG_HEAD,
00050     HTTPD_MSG_POST,
00051 
00052     /* rtsp request */
00053     HTTPD_MSG_OPTIONS,
00054     HTTPD_MSG_DESCRIBE,
00055     HTTPD_MSG_SETUP,
00056     HTTPD_MSG_PLAY,
00057     HTTPD_MSG_PAUSE,
00058     HTTPD_MSG_TEARDOWN,
00059 
00060     /* just to track the count of MSG */
00061     HTTPD_MSG_MAX
00062 };
00063 
00064 enum
00065 {
00066     HTTPD_PROTO_NONE,
00067     HTTPD_PROTO_HTTP,
00068     HTTPD_PROTO_RTSP,
00069 };
00070 
00071 struct httpd_message_t
00072 {
00073     httpd_client_t *cl; /* NULL if not throught a connection e vlc internal */
00074 
00075     int     i_type;
00076     int     i_proto;
00077     int     i_version;
00078 
00079     /* for an answer */
00080     int     i_status;
00081     char    *psz_status;
00082 
00083     /* for a query */
00084     char    *psz_url;
00085     /* FIXME find a clean way to handle GET(psz_args)
00086        and POST(body) through the same code */
00087     uint8_t *psz_args;
00088 
00089     /* for rtp over rtsp */
00090     int     i_channel;
00091 
00092     /* options */
00093     int     i_name;
00094     char    **name;
00095     int     i_value;
00096     char    **value;
00097 
00098     /* body */
00099     int64_t i_body_offset;
00100     int     i_body;
00101     uint8_t *p_body;
00102 
00103 };
00104 
00105 /* I keep the definition here, easier than looking at vlc_common.h
00106 
00107  * answer could be null, int this case no answer is requested
00108 typedef int (*httpd_callback_t)( httpd_callback_sys_t *, httpd_client_t *, httpd_message_t *answer, httpd_message_t *query );
00109 typedef struct httpd_callback_sys_t httpd_callback_sys_t;
00110 
00111 typedef struct httpd_file_t     httpd_file_t;
00112 typedef struct httpd_file_sys_t httpd_file_sys_t;
00113 typedef int (*httpd_file_callback_t)( httpd_file_sys_t*, httpd_file_t *, uint8_t *psz_request, uint8_t **pp_data, int *pi_data );
00114 */
00115 
00116 /* create a new host */
00117 VLC_EXPORT( httpd_host_t *, httpd_HostNew, ( vlc_object_t *, const char *psz_host, int i_port ) );
00118 VLC_EXPORT( httpd_host_t *, httpd_TLSHostNew, ( vlc_object_t *, const char *, int, const char *, const char *, const char *, const char * ) );
00119 
00120 /* delete a host */
00121 VLC_EXPORT( void,           httpd_HostDelete, ( httpd_host_t * ) );
00122 
00123 /* register a new url */
00124 VLC_EXPORT( httpd_url_t *,  httpd_UrlNew, ( httpd_host_t *, const char *psz_url, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl ) );
00125 VLC_EXPORT( httpd_url_t *,  httpd_UrlNewUnique, ( httpd_host_t *, const char *psz_url, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl ) );
00126 /* register callback on a url */
00127 VLC_EXPORT( int,            httpd_UrlCatch, ( httpd_url_t *, int i_msg, httpd_callback_t, httpd_callback_sys_t * ) );
00128 /* delete an url */
00129 VLC_EXPORT( void,           httpd_UrlDelete, ( httpd_url_t * ) );
00130 
00131 /* Default client mode is FILE, use these to change it */
00132 VLC_EXPORT( void,           httpd_ClientModeStream, ( httpd_client_t *cl ) );
00133 VLC_EXPORT( void,           httpd_ClientModeBidir, ( httpd_client_t *cl ) );
00134 VLC_EXPORT( char*,          httpd_ClientIP, ( httpd_client_t *cl, char *psz_ip ) );
00135 VLC_EXPORT( char*,          httpd_ServerIP, ( httpd_client_t *cl, char *psz_ip ) );
00136 
00137 /* High level */
00138 
00139 VLC_EXPORT( httpd_file_t *, httpd_FileNew, ( httpd_host_t *, const char *psz_url, const char *psz_mime, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl, httpd_file_callback_t pf_fill, httpd_file_sys_t * ) );
00140 VLC_EXPORT( void,           httpd_FileDelete, ( httpd_file_t * ) );
00141 
00142 
00143 VLC_EXPORT( httpd_handler_t *, httpd_HandlerNew, ( httpd_host_t *, const char *psz_url, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl, httpd_handler_callback_t pf_fill, httpd_handler_sys_t * ) );
00144 VLC_EXPORT( void,           httpd_HandlerDelete, ( httpd_handler_t * ) );
00145 
00146 
00147 VLC_EXPORT( httpd_redirect_t *, httpd_RedirectNew, ( httpd_host_t *, const char *psz_url_dst, const char *psz_url_src ) );
00148 VLC_EXPORT( void,               httpd_RedirectDelete, ( httpd_redirect_t * ) );
00149 
00150 
00151 VLC_EXPORT( httpd_stream_t *, httpd_StreamNew,    ( httpd_host_t *, const char *psz_url, const char *psz_mime, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl ) );
00152 VLC_EXPORT( void,             httpd_StreamDelete, ( httpd_stream_t * ) );
00153 VLC_EXPORT( int,              httpd_StreamHeader, ( httpd_stream_t *, uint8_t *p_data, int i_data ) );
00154 VLC_EXPORT( int,              httpd_StreamSend,   ( httpd_stream_t *, uint8_t *p_data, int i_data ) );
00155 
00156 
00157 /* Msg functions facilities */
00158 VLC_EXPORT( void,         httpd_MsgInit, ( httpd_message_t * )  );
00159 VLC_EXPORT( void,         httpd_MsgAdd, ( httpd_message_t *, char *psz_name, char *psz_value, ... ) );
00160 /* return "" if not found. The string is not allocated */
00161 VLC_EXPORT( char *,       httpd_MsgGet, ( httpd_message_t *, char *psz_name ) );
00162 VLC_EXPORT( void,         httpd_MsgClean, ( httpd_message_t * ) );
00163 
00164 #endif /* _VLC_HTTPD_H */

Generated on Tue Dec 20 10:14:19 2005 for vlc-0.8.4a by  doxygen 1.4.2