"Fossies" - the Fresh Open Source Software Archive

Member "motion-Release-4.3.0/src/webu.h" (14 Jan 2020, 3807 Bytes) of package /linux/misc/motion-Release-4.3.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "webu.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  *      webu.h
    3  *
    4  *      Include file for webu.c
    5  *
    6  *      This software is distributed under the GNU Public License Version 2
    7  *      See also the file 'COPYING'.
    8  *
    9  */
   10 #ifndef _INCLUDE_WEBU_H_
   11 #define _INCLUDE_WEBU_H_
   12 
   13 
   14 /* Some defines of lengths for our buffers */
   15 #define WEBUI_LEN_PARM 512          /* Parameters specified */
   16 #define WEBUI_LEN_URLI 512          /* Maximum URL permitted */
   17 #define WEBUI_LEN_RESP 1024         /* Initial response size */
   18 #define WEBUI_MHD_OPTS 10           /* Maximum number of options permitted for MHD */
   19 #define WEBUI_LEN_LNK  15           /* Maximum length for chars in strminfo */
   20 
   21 enum WEBUI_CNCT{
   22   WEBUI_CNCT_CONTROL     = 0,
   23   WEBUI_CNCT_FULL        = 1,
   24   WEBUI_CNCT_SUB         = 2,
   25   WEBUI_CNCT_MOTION      = 3,
   26   WEBUI_CNCT_SOURCE      = 4,
   27   WEBUI_CNCT_STATIC      = 5,
   28   WEBUI_CNCT_UNKNOWN     = 99
   29 };
   30 
   31 struct webui_ctx {
   32     char *url;                   /* The URL sent from the client */
   33     char *uri_camid;            /* Parsed thread number from the url*/
   34     char *uri_cmd1;              /* Parsed command(action) from the url*/
   35     char *uri_cmd2;              /* Parsed command (set) from the url*/
   36     char *uri_parm1;             /* Parameter 1 for the command */
   37     char *uri_value1;            /* The value for parameter 1*/
   38     char *uri_parm2;             /* Parameter 2 for the command */
   39     char *uri_value2;            /* The value for parameter 2*/
   40 
   41     char *hostname;              /* Host name provided from header content*/
   42     char  hostproto[6];          /* Protocol for host http or https */
   43     char *clientip;              /* IP of the connecting client */
   44     char *auth_denied;          /* Denied access response to user*/
   45     char *auth_opaque;          /* Opaque string for digest authentication*/
   46     char *auth_realm;           /* Realm string for digest authentication*/
   47     char *auth_user;            /* Parsed user from config authentication string*/
   48     char *auth_pass;            /* Parsed password from config authentication string*/
   49     int  authenticated;         /* Boolean for whether authentication has been passed */
   50 
   51     int   cam_count;            /* Count of the number of cameras*/
   52     int   cam_threads;          /* Count of the number of camera threads running*/
   53     char *lang;                 /* Two character abbreviation for locale language*/
   54     char *lang_full;            /* Five character abbreviation for language-country*/
   55     int   thread_nbr;           /* Thread number provided from the uri */
   56     char *text_eol;             /* End of line for text interface either <br> or "" */
   57     enum WEBUI_CNCT cnct_type;  /* Type of connection we are processing */
   58 
   59     char            *resp_page;        /* The response that will be sent */
   60     size_t          resp_size;         /* The allocated size of the response */
   61     size_t          resp_used;         /* The amount of the response page used */
   62     uint64_t        stream_pos;        /* Stream position of sent image */
   63     int             stream_fps;        /* Stream rate per second */
   64     struct timeval  time_last;         /* Keep track of processing time for stream thread*/
   65     int             mhd_first;         /* Boolean for whether it is the first connection*/
   66 
   67     struct MHD_Connection  *connection; /* The MHD connection value from the client */
   68     struct context        **cntlst;     /* The context list of all cameras */
   69     struct context         *cnt;        /* The context information for the camera requested */
   70 
   71 };
   72 
   73 void webu_start(struct context **cnt);
   74 void webu_stop(struct context **cnt);
   75 void webu_process_action(struct webui_ctx *webui);
   76 int webu_process_config(struct webui_ctx *webui);
   77 int webu_process_track(struct webui_ctx *webui);
   78 void webu_write(struct webui_ctx *webui, const char *buf);
   79 
   80 #endif