⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ws_defs.h

📁 基于nucleus实时操作系统的webserver源代码
💻 H
📖 第 1 页 / 共 2 页
字号:

/* GENERAL SERVER DATA STRUCTURES */

/* Stores authentication state variables
 * for each connection 
 */
typedef struct _WS_AUTH{

        INT         ws_state;                           /* authentication state of this connection */
        UINT32      ws_countdown;                       /* countdown untill this structure is re-claimed */
        UINT8       ws_ip[WS_IP_SIZE];                  /* ip address of the client */
        CHAR        ws_salt[WS_NUM_SEED][WS_CRYPT_LEN]; /* sent to user to combine with user plaintext */
 struct _WS_AUTH    *ws_next;                           /* linked list of structures */
}WS_AUTH;

/* Keys to the server */
typedef struct {
    
        UINT32      ws_timeoutval;                      /* timeout value for user_auth */
        UINT32      ws_last_time;                       /* last time value */
        INT         ws_flags;                           /* mask to declare conditions of match */
        WS_AUTH     ws_user_auth[WS_AUTH_MAX_USERS];
        CHAR        ws_key[WS_CRYPT_LEN + 1];           /* encryption key for this server */
        INT         ws_auth_state;                      /* 1- Means in process of authenticating
                                                         * 0- Means authenticated.
                                                         */
        CHAR        ws_auth_uri[WS_URI_LEN];
        CHAR        ws_auth_public[WS_URI_LEN];         /* directory tree excempt from authentication */
}WS_MASTER_AUTH;


/* Server information */
typedef struct _WS_SERVER{

        INT             ws_flags;                       /* server state */
 struct _WS_SERVER      *ws_next;                       /* next server (multiple server support ) */
        INT             ws_bytes_in;                    /* total bytes recieved */
        INT             ws_bytes_out;                   /* total bytes sent */
        UINT8           ws_ip[WS_IP_SIZE];              /* ip address of the server */
        UINT16          ws_port;                        /* port the server listens to (default 80 ) */
        WS_MASTER_AUTH  ws_master;                      /* authentication info for this server */

}WS_SERVER;


/* Socket information */
typedef struct _WS_SOCKET_STRUCT{
    
 struct _WS_SOCKET_STRUCT   *ws_next_link;
 struct _WS_SOCKET_STRUCT   *ws_prev_link;
        INT                 ws_socketd;
        UNSIGNED            ws_time_click;
        INT                 ws_http_ver;                /*         10 =  HTTP 1.0
                                                         *         11 =  HTTP 1.1
                                                         */
}WS_SOCKET_STRUCT;    


/* Socket information list header */
typedef struct _WS_SOCK_LIST{
    
        WS_SOCKET_STRUCT    *ws_sock_list_head;         /*  Socket List Head */
        WS_SOCKET_STRUCT    *ws_sock_list_tail;         /*  Socket List Tail */
} WS_SOCK_LIST;


/* HTTP SPECIFIC DATA STRUCTURES */

/* Plugin request information */
typedef struct _WS_TOKEN_INFO{
        INT16           *ws_token_array;
        CHAR HUGE       *ws_token_string;
}WS_TOKEN_INFO;

typedef struct {
    
        CHAR            *ws_header;
        CHAR            *ws_data;    
        INT32           ws_tsize;
        INT32           ws_free_buf_sz;
        INT             ws_header_size;
        INT             ws_header_set;
        INT             ws_no_pluginhead;
}WS_HTTP_PLUGIN;

typedef struct _WS_REQ_DATA {
    
        CHAR            ws_lbuf[WS_RECEIVE_SIZE + 2];       /* raw HTTP request from client is stored here */
        CHAR            ws_out_head[WS_OUT_BUFSZ / 2];   /* space to store the response header for this request */
        CHAR            ws_ssi_buf[WS_SSI_LINE];
        CHAR            ws_obuf[WS_OUT_BUFSZ];              /* output buffer for WS_Write_To_Net() */
}WS_REQ_DATA;

typedef struct {

        WS_TOKEN_INFO       ws_pg_args;                    /* plugin arguments (if request is a POST ) */
        WS_SERVER           *ws_server;                    /* pointer to infor for this server */
        CHAR                *ws_headers;                   /* Any header info the client may have sent */
        CHAR                *ws_fname;                     /* URI (filename) of the requested entity GET,POST */
        CHAR                *ws_response;                  /* the HTTP response to the current request */
        struct _WS_STAT     *ws_stat;                      /* internal stat structure */
        WS_REQ_DATA         *ws_rdata;                     /* per request allocated data */
        UINT8               ws_ip[WS_IP_SIZE];             /* ip address of client */
        INT                 ws_nbytes;                     /* number of bytes in input buffer */
        INT                 ws_sd;                         /* socket descripter for this connection */
        INT16               ws_method;                     /* HTTP method of this request GET, POST, HEAD etc */
        UINT16              ws_obufcnt;
        INT                 *ws_http_ver;
        INT                 ws_first;
        CHAR                ws_user[33];                   /* Name of authenticated user */
        CHAR                *ws_line;
        WS_HTTP_PLUGIN      ws_hp;
}WS_REQUEST;


/* used to map a plugin URI to
 * a plugin entry address
 */
struct WS_PLUGIN_STRUCT{                          

        CHAR            *ws_name;                          /* a name in our file-space which when accessed */
        INT             (*plugin)(WS_REQUEST *);  /* triggers a call to this function */
};


/* used to create the Mime_Table */
typedef struct _WS_MIME_TABLE_STRUCT{
    
        CHAR * ws_ext;
        CHAR * ws_mime_type;
}WS_MIME_TABLE;

/* FILE SYSTEM DATA STRUCTURES */

/* the incore filesystem table */

typedef struct _WS_FS_FILE{

        CHAR        ws_name[WS_URI_LEN];              /* name */
        CHAR        *ws_addr;                      /* starting address */
        INT16       ws_type;                       /* mode */
        INT32       ws_length;                     /* real length */
        INT32       ws_clength;                    /* compressed length */
 struct _WS_FS_FILE * ws_next;                     /* next file in chain */
}WS_FS_FILE;

/* used to describe file infomation */
typedef struct _WS_STAT {  

        CHAR            *ws_address;                /* address if incore file */
        INT             (*plugin)(WS_REQUEST *);    /* triggers a call to this function */
        INT32           ws_size;
        INT             ws_flags;
}WS_STAT;

typedef struct 
{
    CHAR    *fstart;                    /* start of "file" */
    CHAR    *cur_pos;                   /* current position in "file" */
    INT32   length;                     /* length of "file" */
    UINT8   mask;
    INT     rack;
    INT     pacifier_counter;
    INT     mode;
    WS_REQUEST *fd;
} WS_BIT_FILE;

typedef struct
{
    UINT16 low_count;
    UINT16 high_count;
    UINT16 scale;
} WS_SYMBOL;

#ifdef __cplusplus
}
#endif /* _cplusplus */

#endif /* _WS_DEFS_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -