This commit is contained in:
pvvx 2017-04-23 12:26:57 +03:00
parent fa343db334
commit 2e503268fa
18 changed files with 191 additions and 81 deletions

View file

@ -15,12 +15,21 @@
#define WEB_SVERSION "0.2.0"
#define DEFAULT_WEB_PORT USE_WEB // 80
#define USE_WEB_AUTH_LEVEL 1
/****************************************************************************
Section:
Commands and Server Responses
***************************************************************************/
typedef enum
{
WEB_AUTH_NONE = 0,
WEB_AUTH_LEVEL_USER,
WEB_AUTH_LEVEL_USER1,
WEB_AUTH_LEVEL_WEBFS,
WEB_AUTH_LEVEL_OTA,
WEB_AUTH_LEVEL_SUPERVISOR
} WEB_AUTH_LEVEL_TYPE;
// File type definitions
typedef enum
{
@ -90,6 +99,10 @@ typedef struct
uint32 web_disc_par; // параметры функции вызываемой по закрытию соединения
#ifdef WEBSOCKET_ENA
WS_FRSTAT ws; // параметры websoc
#endif
#if USE_WEB_AUTH_LEVEL
uint8 auth_level; // Уровень авторизации по паролю
uint8 auth_realm; // Требуемый уровень авторизации (минимальный уровень)
#endif
uint8 fileType; // File type to return with Content-Type (if SCB_FCALBACK)
} WEB_SRV_CONN;

View file

@ -13,12 +13,10 @@
#define WEB_NAME_VERSION "PVs/0.2"
// #define WEBSOCKET_ENA 1
// lifetime (sec) of static responses as string 60*60*24*14=1209600"
#define FILE_CACHE_MAX_AGE_SEC 3600 // время для кеша файлов, ставить 0 пока тест!
#define MAX_HTTP_HEAD_BUF 3070 // максимальный размер HTTP запроса (GET)
#define MAX_HTTP_HEAD_BUF TCP_SRV_SERVER_MAX_RXBUF // максимальный размер HTTP запроса (GET)
#define RESCHKS_SEND_SIZE 16
#define RESCHKE_SEND_SIZE 8
@ -45,5 +43,6 @@ bool web_inc_fclose(WEB_SRV_CONN *web_conn);
bool web_trim_bufi(TCP_SERV_CONN *ts_conn, uint8 *pdata, uint32 data_len);
bool web_feee_bufi(TCP_SERV_CONN *ts_conn);
//uint8 * head_find_ctr(HTTP_CONN *CurHTTP, const uint8 * c, int clen, int dlen);
uint8 UserAuthorization(uint8 *pbuf, size_t declen);
#endif /* _INCLUDE_WEB_SRV_INT_H_ */