├── Client ├── Add-on │ ├── 2lemetry.c │ ├── 2lemetry.h │ ├── Mem │ │ ├── Cfg │ │ │ └── Template │ │ │ │ ├── http-c_mem_cfg.c │ │ │ │ └── http-c_mem_cfg.h │ │ ├── http-c_mem.c │ │ └── http-c_mem.h │ ├── dropbox.c │ ├── dropbox.h │ ├── soundcloud.c │ ├── soundcloud.h │ ├── twilio.c │ └── twilio.h ├── Cfg │ └── Template │ │ ├── http-c_cfg.c │ │ └── http-c_cfg.h ├── Examples │ ├── http-c_app.c │ ├── http-c_app.h │ ├── http-c_hooks.c │ ├── http-c_hooks.h │ ├── static_files.c │ └── static_files.h └── Source │ ├── http-c.c │ ├── http-c.h │ ├── http-c_conn.c │ ├── http-c_conn.h │ ├── http-c_mem.c │ ├── http-c_mem.h │ ├── http-c_req.c │ ├── http-c_req.h │ ├── http-c_resp.c │ ├── http-c_resp.h │ ├── http-c_sock.c │ ├── http-c_sock.h │ ├── http-c_task.c │ ├── http-c_task.h │ ├── http-c_type.h │ ├── http-c_websock.c │ └── http-c_websock.h ├── Common ├── http.c ├── http.h ├── http_dict.c └── http_dict.h ├── LICENSE ├── NOTICE ├── README.rst └── Server ├── Add-on ├── Auth │ ├── http-s_auth.c │ └── http-s_auth.h ├── CtrlLayer │ ├── http-s_ctrl_layer.c │ ├── http-s_ctrl_layer.h │ ├── http-s_ctrl_layer_mem.c │ ├── http-s_ctrl_layer_mem.h │ ├── http-s_ctrl_layer_rest_cfg.c │ └── http-s_ctrl_layer_rest_cfg.h └── REST │ ├── http-s_rest.c │ ├── http-s_rest.h │ ├── http-s_rest_hook_cfg.c │ ├── http-s_rest_hook_cfg.h │ ├── http-s_rest_mem.c │ └── http-s_rest_mem.h ├── Cfg └── Template │ ├── http-s_cfg.h │ ├── http-s_instance_cfg.c │ └── http-s_instance_cfg.h ├── Examples ├── Basic │ ├── app_basic.c │ ├── app_basic.h │ ├── app_basic_http-s_hooks.c │ ├── app_basic_http-s_instance_cfg.c │ └── app_basic_http-s_instance_cfg.h ├── Common │ ├── HTML │ │ ├── 404.html │ │ ├── form.html │ │ ├── index.html │ │ ├── list.html │ │ ├── login.html │ │ ├── logo.gif │ │ └── uc_style.css │ └── StaticFiles │ │ ├── _404_html.h │ │ ├── form_html.h │ │ ├── generated_fs.c │ │ ├── generated_fs.h │ │ ├── index_html.h │ │ ├── list_html.h │ │ ├── login_html.h │ │ ├── logo_gif.h │ │ └── uc_style_css.h ├── CtrlLayer │ ├── app_global.c │ ├── app_global.h │ ├── app_global_auth_rights_cfg.h │ ├── app_global_ctrl_layer_cfg.c │ ├── app_global_ctrl_layer_cfg.h │ ├── app_global_http-s_instance_cfg.c │ └── app_global_http-s_instance_cfg.h ├── NoFS │ ├── app_no_fs.c │ ├── app_no_fs.h │ ├── app_no_fs_http-s_hooks.c │ ├── app_no_fs_http-s_instance_cfg.c │ └── app_no_fs_http-s_instance_cfg.h ├── REST │ ├── app_rest.c │ ├── app_rest.h │ ├── app_rest_http-s_instance_cfg.c │ └── app_rest_http-s_instance_cfg.h ├── ReadMe.txt └── SSL-TLS │ ├── Certificate-Key │ ├── cert.pem │ └── key.pem │ ├── http-s_hooks.c │ ├── http-s_instance_secure_cfg.c │ └── http-s_instance_secure_cfg.h ├── FS ├── Script │ └── GenerateFS.py └── Static │ ├── Cfg │ └── Template │ │ └── http-s_fs_static_cfg.h │ ├── http-s_fs_static.c │ ├── http-s_fs_static.h │ └── static_files.h └── Source ├── http-s.c ├── http-s.h ├── http-s_conn.c ├── http-s_conn.h ├── http-s_mem.c ├── http-s_mem.h ├── http-s_req.c ├── http-s_req.h ├── http-s_resp.c ├── http-s_resp.h ├── http-s_sock.c ├── http-s_sock.h ├── http-s_str.c ├── http-s_str.h ├── http-s_task.c └── http-s_task.h /Client/Add-on/Mem/Cfg/Template/http-c_mem_cfg.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP CLIENT MEMORY MODULE CONFIGURATION FILE 19 | * 20 | * Filename : http-c_mem_cfg.c 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | #define MICRIUM_SOURCE 26 | #define HTTPc_MEM_CFG_MODULE 27 | 28 | 29 | /* 30 | ********************************************************************************************************* 31 | ********************************************************************************************************* 32 | * INCLUDE FILES 33 | ********************************************************************************************************* 34 | ********************************************************************************************************* 35 | */ 36 | 37 | #include 38 | 39 | 40 | /* 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | * DEFAULT CONFIGURATION 44 | ********************************************************************************************************* 45 | ********************************************************************************************************* 46 | */ 47 | 48 | #define HTTPc_MEM_CFG_CONN_NBR_MAX 10u 49 | #define HTTPc_MEM_CFG_BUF_SIZE 1024u 50 | #define HTTPc_MEM_CFG_REQ_NBR_MAX 20u 51 | 52 | 53 | /* 54 | ********************************************************************************************************* 55 | ********************************************************************************************************* 56 | * HTTP CLIENT INSTANCE CONFIGURATION STRUCTURE 57 | ********************************************************************************************************* 58 | ********************************************************************************************************* 59 | */ 60 | 61 | const HTTPc_MEM_CFG HTTPcMem_Cfg = { 62 | 63 | HTTPc_MEM_CFG_CONN_NBR_MAX, 64 | HTTPc_MEM_CFG_REQ_NBR_MAX, 65 | HTTPc_MEM_CFG_BUF_SIZE, 66 | }; 67 | -------------------------------------------------------------------------------- /Client/Add-on/Mem/Cfg/Template/http-c_mem_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP CLIENT MEMORY MODULE CONFIGURATION FILE 19 | * 20 | * TEMPLATE 21 | * 22 | * Filename : http-c_mem_cfg.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | ********************************************************************************************************* 32 | ********************************************************************************************************* 33 | */ 34 | 35 | #ifdef HTTPc_MEM_MODULE_EN 36 | 37 | 38 | /* 39 | ********************************************************************************************************* 40 | ********************************************************************************************************* 41 | * INCLUDE FILES 42 | ********************************************************************************************************* 43 | ********************************************************************************************************* 44 | */ 45 | 46 | 47 | /* 48 | ********************************************************************************************************* 49 | * HTTP CLIENT RUNTIME CONFIGURATION 50 | ********************************************************************************************************* 51 | */ 52 | 53 | extern const HTTPc_MEM_CFG HTTPcMem_Cfg; 54 | 55 | 56 | /* 57 | ********************************************************************************************************* 58 | ********************************************************************************************************* 59 | * MODULE END 60 | ********************************************************************************************************* 61 | ********************************************************************************************************* 62 | */ 63 | 64 | #endif /* HTTPc_MEM_MODULE_EN */ 65 | -------------------------------------------------------------------------------- /Client/Add-on/dropbox.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP CLIENT DROPBOX MODULE 19 | * 20 | * Filename : dropbox.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * MODULE 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef DROPBOX_MODULE_PRESENT 34 | #define DROPBOX_MODULE_PRESENT 35 | 36 | /* 37 | ********************************************************************************************************* 38 | * FS MODULE 39 | * 40 | * Note(s): If the uC/FS is present in the project, you can enable it for the example application. 41 | ********************************************************************************************************* 42 | */ 43 | 44 | #define HTTPc_APP_FS_MODULE_PRESENT DEF_YES 45 | 46 | 47 | /* 48 | ********************************************************************************************************* 49 | ********************************************************************************************************* 50 | * INCLUDE FILES 51 | ********************************************************************************************************* 52 | ********************************************************************************************************* 53 | */ 54 | 55 | #include 56 | 57 | 58 | /* 59 | ********************************************************************************************************* 60 | ********************************************************************************************************* 61 | * DEFINES 62 | ********************************************************************************************************* 63 | ********************************************************************************************************* 64 | */ 65 | 66 | 67 | 68 | #define DROPBOX_CFG_CONN_BUF_SIZE 512u 69 | 70 | #define DROPBOX_CFG_HDR_VAL_LEN_MAX 300u 71 | 72 | #define DROPBOX_URL_LEN_MAX 50u 73 | 74 | 75 | #define DROPBOX_API_CONTENT_IPv4_ADDR "23.23.153.198" 76 | #define DROPBOX_API_IPv4_ADDR "50.19.116.212" 77 | 78 | #define DROPBOX_API_CONTENT_HOSTNAME "api-content.dropbox.com" 79 | #define DROPBOX_API_HOSTAME "api.dropbox.com" 80 | 81 | #define DROPBOX_URL_FILES_PUT "/1/files_put/auto/" 82 | #define DROPBOX_URL_FILES_GET "/1/files/auto/" 83 | #define DROPBOX_URL_FILES_OPS "/1/fileops/" 84 | 85 | 86 | 87 | 88 | /* 89 | ********************************************************************************************************* 90 | ********************************************************************************************************* 91 | * DATA TYPE 92 | ********************************************************************************************************* 93 | ********************************************************************************************************* 94 | */ 95 | 96 | typedef void (*DROPBOX_RX_DATA) (CPU_CHAR *remote_file_name, 97 | void *p_data, 98 | CPU_INT16U data_len, 99 | CPU_BOOLEAN last_chunk, 100 | void *p_user_ctx); 101 | 102 | 103 | /* 104 | ********************************************************************************************************* 105 | ********************************************************************************************************* 106 | * FUNCTION PROTOTYPES 107 | ********************************************************************************************************* 108 | ********************************************************************************************************* 109 | */ 110 | 111 | 112 | CPU_BOOLEAN Dropbox_Upload_File (CPU_CHAR *p_remote_file_name, 113 | CPU_CHAR *p_local_file_name, 114 | HTTP_CONTENT_TYPE content_type, 115 | CPU_SIZE_T content_len, 116 | CPU_CHAR *p_access_token); 117 | 118 | CPU_BOOLEAN Dropbox_Upload_Buf (CPU_CHAR *p_remote_file_name, 119 | CPU_INT08U *p_buf, 120 | HTTP_CONTENT_TYPE content_type, 121 | CPU_SIZE_T content_len, 122 | CPU_CHAR *p_access_token); 123 | 124 | CPU_BOOLEAN Dropbox_Download_Buf (CPU_CHAR *p_remote_file_name, 125 | CPU_CHAR *p_access_token, 126 | DROPBOX_RX_DATA fnct, 127 | void *p_ctx); 128 | 129 | CPU_BOOLEAN Dropbox_Download_File (CPU_CHAR *p_remote_file_name, 130 | CPU_CHAR *p_local_file_name, 131 | CPU_CHAR *p_access_token); 132 | 133 | CPU_BOOLEAN Dropbox_Delete_File (CPU_CHAR *p_remote_file_name, 134 | CPU_CHAR *p_access_token); 135 | 136 | 137 | 138 | /* 139 | ********************************************************************************************************* 140 | ********************************************************************************************************* 141 | * MODULE END 142 | ********************************************************************************************************* 143 | ********************************************************************************************************* 144 | */ 145 | 146 | #endif 147 | -------------------------------------------------------------------------------- /Client/Add-on/soundcloud.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP CLIENT SOUNDCLOUD SOURCE CODE 19 | * 20 | * Filename : soundcloud.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * MODULE 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef SOUNDCLOUD_MODULE_PRESENT 34 | #define SOUNDCLOUD_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | ********************************************************************************************************* 40 | * INCLUDE FILES 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | ********************************************************************************************************* 51 | * EXTERNS 52 | ********************************************************************************************************* 53 | ********************************************************************************************************* 54 | */ 55 | 56 | #ifdef SOUNDCLOUD_MODULE 57 | #define SOUNDCLOUD_EXT 58 | #else 59 | #define SOUNDCLOUD_EXT extern 60 | #endif 61 | 62 | 63 | /* 64 | ********************************************************************************************************* 65 | ********************************************************************************************************* 66 | * DEFAULT CONFIGURATION 67 | ********************************************************************************************************* 68 | ********************************************************************************************************* 69 | */ 70 | 71 | void SoundCloudTask_Init (void ); 72 | 73 | void SoundCloudTask (void *p_data); 74 | 75 | 76 | typedef struct stream_buffer { 77 | CPU_INT08U *WrAddress; 78 | CPU_INT08U *Start; 79 | CPU_BOOLEAN DecodingStarted; 80 | void *p_msg; 81 | } STREAM_BUFFER; 82 | 83 | 84 | /* 85 | ********************************************************************************************************* 86 | ********************************************************************************************************* 87 | * DEFINES 88 | ********************************************************************************************************* 89 | ********************************************************************************************************* 90 | */ 91 | 92 | 93 | 94 | #define SOUNDCLOUD_CFG_REQ_NBR_MAX 2u 95 | 96 | #define SOUNDCLOUD_CFG_CONN_NBR_MAX 3u 97 | #define SOUNDCLOUD_CFG_CONN_BUF_SIZE 5*1460u 98 | 99 | #define SOUNDCLOUD_CFG_HDR_NBR_MAX 10u 100 | #define SOUNDCLOUD_CFG_HDR_VAL_LEN_MAX 300u 101 | 102 | #define SOUNDCLOUD_URL_LEN_MAX 100u 103 | 104 | #define SOUNDCLOUD_CONN_RETRY_MAX 5 105 | 106 | 107 | #define SOUNDCLOUD_API_HOSTNAME "api.soundcloud.com" 108 | 109 | #define SOUNDCLOUD_URL_TRACKS "/tracks/" 110 | 111 | /* 112 | ********************************************************************************************************* 113 | ********************************************************************************************************* 114 | * GLOBAL VARIABLES 115 | ********************************************************************************************************* 116 | ********************************************************************************************************* 117 | */ 118 | 119 | SOUNDCLOUD_EXT CPU_INT16U SoundCloud_Buf[40]; 120 | 121 | SOUNDCLOUD_EXT STREAM_BUFFER stream_buff; 122 | 123 | SOUNDCLOUD_EXT HTTPc_CONN_OBJ SoundCloud_ConnTbl[SOUNDCLOUD_CFG_CONN_NBR_MAX]; 124 | SOUNDCLOUD_EXT HTTPc_REQ_OBJ SoundCloud_ReqTbl[SOUNDCLOUD_CFG_REQ_NBR_MAX]; 125 | SOUNDCLOUD_EXT HTTPc_RESP_OBJ SoundCloud_RespTbl[SOUNDCLOUD_CFG_REQ_NBR_MAX]; 126 | 127 | /* 128 | ********************************************************************************************************* 129 | ********************************************************************************************************* 130 | * FUNCTION PROTOTYPES 131 | ********************************************************************************************************* 132 | ********************************************************************************************************* 133 | */ 134 | 135 | 136 | CPU_BOOLEAN SoundCloud_GetStream (CPU_CHAR *p_url); 137 | 138 | CPU_BOOLEAN SoundCloud_PlayStream (CPU_CHAR *p_host, 139 | CPU_CHAR *p_url, 140 | CPU_CHAR *p_buf); 141 | 142 | CPU_INT32U SoundCloud_MP3Decode (void ); 143 | 144 | void SoundCloud_PlaytTrack (CPU_CHAR *track_id, 145 | CPU_CHAR *client_id); 146 | 147 | /* 148 | ********************************************************************************************************* 149 | ********************************************************************************************************* 150 | * MODULE END 151 | ********************************************************************************************************* 152 | ********************************************************************************************************* 153 | */ 154 | 155 | #endif /* SOUNDCLOUD_MODULE_PRESENT */ 156 | -------------------------------------------------------------------------------- /Client/Add-on/twilio.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP CLIENT TEST SOURCE CODE 19 | * 20 | * Filename : twilio.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * MODULE 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef TWILIO_MODULE_PRESENT 34 | #define TWILIO_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | ********************************************************************************************************* 40 | * INCLUDE FILES 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | ********************************************************************************************************* 51 | * EXTERNS 52 | ********************************************************************************************************* 53 | ********************************************************************************************************* 54 | */ 55 | 56 | #ifdef TWILIO_MODULE 57 | #define TWILIO_EXT 58 | #else 59 | #define TWILIO_EXT extern 60 | #endif 61 | 62 | 63 | /* 64 | ********************************************************************************************************* 65 | ********************************************************************************************************* 66 | * DEFAULT CONFIGURATION 67 | ********************************************************************************************************* 68 | ********************************************************************************************************* 69 | */ 70 | 71 | 72 | /* 73 | ********************************************************************************************************* 74 | ********************************************************************************************************* 75 | * DEFINES 76 | ********************************************************************************************************* 77 | ********************************************************************************************************* 78 | */ 79 | 80 | #define TWILIO_CFG_REQ_NBR_MAX 2u 81 | 82 | #define TWILIO_CFG_CONN_NBR_MAX 3u 83 | #define TWILIO_CFG_CONN_BUF_SIZE 4096u 84 | 85 | #define TWILIO_CFG_HDR_NBR_MAX 10u 86 | #define TWILIO_CFG_HDR_VAL_LEN_MAX 300u 87 | 88 | #define TWILIO_CFG_FORM_BUF_SIZE 256u 89 | #define TWILIO_CFG_FORM_FIELD_NBR_MAX 3u 90 | #define TWILIO_CFG_FORM_FIELD_KEY_LEN_MAX 100u 91 | #define TWILIO_CFG_FORM_FIELD_VAL_LEN_MAX 200u 92 | #define TWILIO_CFG_FORM_MULTIPART_NAME_LEN_MAX 100u 93 | #define TWILIO_CFG_FORM_MULTIPART_FILENAME_LEN_MAX 100u 94 | 95 | #define TWILIO_URL_LEN_MAX 100u 96 | 97 | #define TWILIO_API_HOSTNAME "api.twilio.com" 98 | 99 | #define TWILIO_URL_MESSAGES "/2010-04-01/Accounts/" 100 | 101 | /* 102 | ********************************************************************************************************* 103 | ********************************************************************************************************* 104 | * GLOBAL VARIABLES 105 | ********************************************************************************************************* 106 | ********************************************************************************************************* 107 | */ 108 | 109 | TWILIO_EXT CPU_CHAR Twilio_Buf[1024]; 110 | 111 | 112 | TWILIO_EXT CPU_CHAR Twilio_FormBuf[TWILIO_CFG_FORM_BUF_SIZE]; 113 | 114 | TWILIO_EXT HTTPc_KEY_VAL Twilio_FormKeyValTbl[TWILIO_CFG_FORM_FIELD_NBR_MAX]; 115 | TWILIO_EXT CPU_CHAR Twilio_FormKeyStrTbl[2*TWILIO_CFG_FORM_FIELD_NBR_MAX][TWILIO_CFG_FORM_FIELD_KEY_LEN_MAX]; 116 | TWILIO_EXT CPU_CHAR Twilio_FormValStrTbl[2*TWILIO_CFG_FORM_FIELD_NBR_MAX][TWILIO_CFG_FORM_FIELD_VAL_LEN_MAX]; 117 | TWILIO_EXT HTTPc_FORM_TBL_FIELD Twilio_FormTbl[TWILIO_CFG_FORM_FIELD_NBR_MAX]; 118 | 119 | 120 | /* 121 | ********************************************************************************************************* 122 | ********************************************************************************************************* 123 | * FUNCTION PROTOTYPES 124 | ********************************************************************************************************* 125 | ********************************************************************************************************* 126 | */ 127 | 128 | 129 | CPU_BOOLEAN Twilio_SendSMS (CPU_CHAR *p_from_phone_number, 130 | CPU_CHAR *p_to_phone_number, 131 | CPU_CHAR *p_message, 132 | CPU_CHAR *p_account_id, 133 | CPU_CHAR *p_auth_token); 134 | 135 | 136 | 137 | void Twilio_RespBodyHook (HTTPc_CONN_OBJ *p_conn, 138 | HTTPc_REQ_OBJ *p_req, 139 | HTTP_CONTENT_TYPE content_type, 140 | void *p_data, 141 | CPU_INT16U data_len, 142 | CPU_BOOLEAN last_chunk); 143 | 144 | 145 | 146 | /* 147 | ********************************************************************************************************* 148 | ********************************************************************************************************* 149 | * MODULE END 150 | ********************************************************************************************************* 151 | ********************************************************************************************************* 152 | */ 153 | 154 | #endif /* TWILIO_MODULE_PRESENT */ 155 | -------------------------------------------------------------------------------- /Client/Cfg/Template/http-c_cfg.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP CLIENT CONFIGURATION FILE 21 | * 22 | * Filename : http-c_cfg.c 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * INCLUDE FILES 31 | * 32 | * Note(s) : (1) All values that are used in this file and are defined in other header files should be 33 | * included in this file. Some values could be located in the same file such as task priority 34 | * and stack size. This template file assume that the following values are defined in app_cfg.h: 35 | * 36 | * HTTPc_OS_CFG_INSTANCE_TASK_PRIO 37 | * HTTPc_OS_CFG_INSTANCE_TASK_STK_SIZE 38 | * 39 | ********************************************************************************************************* 40 | ********************************************************************************************************* 41 | */ 42 | 43 | #include /* See Note #1. */ 44 | #include 45 | 46 | #include "http-c_cfg.h" 47 | 48 | 49 | /* 50 | ********************************************************************************************************* 51 | ********************************************************************************************************* 52 | * HTTP CLIENT SUITE CONFIGURATION OBJECT 53 | * 54 | * Note(s): (1) For additional information on the HTTP Client Configuration fields, refer to the 55 | * Micrium Documentation online at : https://doc.micrium.com/display/HTTPc/Run-Time Configuration 56 | ********************************************************************************************************* 57 | ********************************************************************************************************* 58 | */ 59 | 60 | const HTTPc_CFG HTTPc_Cfg = { 61 | 62 | /* 63 | *-------------------------------------------------------------------------------------------------------- 64 | * TASK CONFIGURATION 65 | *-------------------------------------------------------------------------------------------------------- 66 | */ 67 | 68 | 1u, /* .TaskDly_ms (HTTPc Task delay in milliseconds) */ 69 | 5u, /* .MsqQ_Size (Message Task Queue size) */ 70 | 71 | /* 72 | *-------------------------------------------------------------------------------------------------------- 73 | * CONNECTION CONFIGURATION 74 | *-------------------------------------------------------------------------------------------------------- 75 | */ 76 | 77 | 2000u, /* .ConnConnectTimeout_ms (Connect timeout in ms) */ 78 | 30u, /* .ConnInactivityTimeout_s (Inactivity timeout in s) */ 79 | DEF_FALSE, /* .ConnIsKeepAlive */ 80 | }; 81 | 82 | 83 | /* 84 | ********************************************************************************************************* 85 | ********************************************************************************************************* 86 | * HTTP CLIENT TASK CONFIGURATION OBJECT 87 | * 88 | * Note(s): (1) We recommend to configure the Network Protocol Stack task priorities & HTTP client task 89 | * priority as follows: 90 | * 91 | * NET_OS_CFG_IF_TX_DEALLOC_TASK_PRIO (Highest) 92 | * 93 | * HTTPc_OS_CFG_TASK_PRIO ( ... ) 94 | * 95 | * NET_OS_CFG_TMR_TASK_PRIO ( ... ) 96 | * 97 | * NET_OS_CFG_IF_RX_TASK_PRIO (Lowest ) 98 | * 99 | * We recommend that the uC/TCP-IP Timer task and network interface Receive task be lower 100 | * priority than almost all other application tasks; but we recommend that the network 101 | * interface Transmit De-allocation task be higher priority than all application tasks that 102 | * use uC/TCP-IP network services. 103 | * 104 | * However better performance can be observed when the HTTP Client is set with the lowest 105 | * priority. So some experimentation could be required to identify the better task priority 106 | * configuration. 107 | * 108 | * (2) TODO note on the HTTP Client stack's task size. 109 | * 110 | * (3) When the Stack pointer is defined as null pointer (DEF_NULL), the task's stack should be 111 | * automatically allowed on the heap of uC/LIB. 112 | ********************************************************************************************************* 113 | ********************************************************************************************************* 114 | */ 115 | 116 | #if (HTTPc_CFG_MODE_ASYNC_TASK_EN == DEF_ENABLED) 117 | 118 | #ifndef HTTPc_OS_CFG_TASK_PRIO 119 | #define HTTPc_OS_CFG_TASK_PRIO 20 120 | #endif 121 | 122 | #ifndef HTTPc_OS_CFG_TASK_STK_SIZE 123 | #define HTTPc_OS_CFG_TASK_STK_SIZE 1024 124 | #endif 125 | 126 | const HTTP_TASK_CFG HTTPc_TaskCfg = { 127 | HTTPc_OS_CFG_TASK_PRIO, /* HTTPc task priority (See Note #1). */ 128 | HTTPc_OS_CFG_TASK_STK_SIZE, /* HTTPc task stack size in bytes (See Note #2). */ 129 | DEF_NULL, /* HTTPc task stack pointer (See Note #3). */ 130 | }; 131 | #endif 132 | -------------------------------------------------------------------------------- /Client/Examples/static_files.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | #ifndef APP_STATIC_FILES_PRESENT 16 | #define APP_STATIC_FILES_PRESENT 17 | 18 | 19 | #define STATIC_LOGO_GIF_NAME "\\logo.gif" 20 | #define STATIC_INDEX_HTML_NAME "\\index.html" 21 | 22 | #define STATIC_LOGO_GIF_LEN 2066u 23 | #define STATIC_INDEX_HTML_LEN 3080u 24 | 25 | 26 | extern const unsigned char logo_gif[]; 27 | extern const unsigned char index_html[]; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /Client/Source/http-c_conn.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP CLIENT CONNECTION MODULE 21 | * 22 | * Filename : http-c_conn.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | * 32 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 33 | * inclusion through use of the HTTPc module present pre-processor macro definition. 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef HTTPc_CONN_MODULE_PRESENT /* See Note #1. */ 39 | #define HTTPc_CONN_MODULE_PRESENT 40 | 41 | 42 | /* 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | * INCLUDE FILES 46 | ********************************************************************************************************* 47 | ********************************************************************************************************* 48 | */ 49 | 50 | #include 51 | #include 52 | 53 | #include 54 | #include 55 | #include 56 | 57 | #include 58 | #include "../../Common/http.h" 59 | #include "http-c.h" 60 | 61 | 62 | /* 63 | ********************************************************************************************************* 64 | ********************************************************************************************************* 65 | * FUNCTION PROTOTYPES 66 | ********************************************************************************************************* 67 | ********************************************************************************************************* 68 | */ 69 | 70 | void HTTPcConn_Process (HTTPc_CONN *p_conn); 71 | 72 | void HTTPcConn_Connect (HTTPc_CONN *p_conn, 73 | HTTPc_ERR *p_err); 74 | 75 | void HTTPcConn_Close (HTTPc_CONN *p_conn, 76 | HTTPc_ERR *p_err); 77 | 78 | void HTTPcConn_TransProcess (HTTPc_CONN *p_conn); 79 | 80 | void HTTPcConn_TransParamReset (HTTPc_CONN *p_conn); 81 | 82 | CPU_BOOLEAN HTTPcConn_TransComplete (HTTPc_CONN *p_conn); 83 | 84 | void HTTPcConn_Add (HTTPc_CONN *p_conn); 85 | 86 | void HTTPcConn_Remove (HTTPc_CONN *p_conn); 87 | 88 | void HTTPcConn_ReqAdd (HTTPc_REQ *p_req, 89 | HTTPc_ERR *p_err); 90 | 91 | void HTTPcConn_ReqRemove (HTTPc_CONN *p_conn); 92 | 93 | 94 | /* 95 | ********************************************************************************************************* 96 | ********************************************************************************************************* 97 | * MODULE END 98 | ********************************************************************************************************* 99 | ********************************************************************************************************* 100 | */ 101 | 102 | #endif /* HTTPc_CONN_MODULE_PRESENT */ 103 | -------------------------------------------------------------------------------- /Client/Source/http-c_mem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP CLIENT MEMORY LIBRARY 21 | * 22 | * Filename : http-c_mem.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | * 32 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 33 | * inclusion through use of the HTTP memory module present pre-processor macro definition. 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef HTTPc_MEM_PRESENT /* See Note #1. */ 39 | #define HTTPc_MEM_PRESENT 40 | 41 | 42 | /* 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | * INCLUDE FILES 46 | ********************************************************************************************************* 47 | ********************************************************************************************************* 48 | */ 49 | 50 | #include "http-c.h" 51 | #ifdef HTTPc_WEBSOCK_MODULE_EN 52 | #include "http-c_websock.h" 53 | #endif 54 | 55 | 56 | /* 57 | ********************************************************************************************************* 58 | ********************************************************************************************************* 59 | * DATA TYPES 60 | ********************************************************************************************************* 61 | ********************************************************************************************************* 62 | */ 63 | 64 | typedef enum { 65 | HTTPc_MSG_TYPE_CONN_OPEN, 66 | HTTPc_MSG_TYPE_CONN_CLOSE, 67 | HTTPc_MSG_TYPE_REQ, 68 | HTTPc_MSG_TYPE_WEBSOCK_MSG, 69 | } HTTPc_MSG_TYPE; 70 | 71 | typedef struct httpc_task_msg { 72 | HTTPc_MSG_TYPE Type; 73 | void *DataPtr; 74 | } HTTPc_TASK_MSG; 75 | 76 | 77 | /* 78 | ********************************************************************************************************* 79 | ********************************************************************************************************* 80 | * FUNCTION PROTOTYPES 81 | ********************************************************************************************************* 82 | ********************************************************************************************************* 83 | */ 84 | 85 | void HTTPc_Mem_TaskMsgPoolInit (const HTTPc_CFG *p_cfg, 86 | MEM_SEG *p_seg, 87 | HTTPc_ERR *p_err); 88 | 89 | HTTPc_TASK_MSG *HTTPc_Mem_TaskMsgGet (void); 90 | 91 | void HTTPc_Mem_TaskMsgRelease (HTTPc_TASK_MSG *p_msg); 92 | 93 | 94 | #ifdef HTTPc_WEBSOCK_MODULE_EN 95 | void HTTPc_Mem_WebSockReqPoolInit (const HTTPc_CFG *p_cfg, 96 | MEM_SEG *p_seg, 97 | HTTPc_ERR *p_err); 98 | 99 | HTTPc_WEBSOCK_REQ *HTTPc_Mem_WebSockReqGet (void); 100 | 101 | void HTTPc_Mem_WebSockReqRelease (HTTPc_WEBSOCK_REQ *p_ws_req); 102 | #endif 103 | 104 | 105 | /* 106 | ********************************************************************************************************* 107 | ********************************************************************************************************* 108 | * MODULE END 109 | ********************************************************************************************************* 110 | ********************************************************************************************************* 111 | */ 112 | 113 | #endif /* End of HTTPc memory module include. */ 114 | 115 | -------------------------------------------------------------------------------- /Client/Source/http-c_req.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP CLIENT REQUEST MODULE 21 | * 22 | * Filename : http-c_req.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | * 32 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 33 | * inclusion through use of the HTTPc module present pre-processor macro definition. 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef HTTPc_REQ_MODULE_PRESENT /* See Note #1. */ 39 | #define HTTPc_REQ_MODULE_PRESENT 40 | 41 | 42 | /* 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | * HTTPc INCLUDE FILES 46 | ********************************************************************************************************* 47 | ********************************************************************************************************* 48 | */ 49 | 50 | #include 51 | #include 52 | 53 | #include 54 | #include 55 | #include 56 | 57 | #include 58 | #include 59 | 60 | #include 61 | #include "../../Common/http.h" 62 | #include "http-c.h" 63 | 64 | 65 | /* 66 | ********************************************************************************************************* 67 | ********************************************************************************************************* 68 | * DEFINES 69 | ********************************************************************************************************* 70 | ********************************************************************************************************* 71 | */ 72 | 73 | #define HTTPc_STR_BOUNDARY "rgifovj80325n" 74 | 75 | #define HTTPc_STR_BOUNDARY_LEN (sizeof(HTTPc_STR_BOUNDARY) -1) 76 | 77 | #define HTTPc_STR_BOUNDARY_START "--" HTTPc_STR_BOUNDARY 78 | 79 | #define HTTPc_STR_BOUNDARY_END "--" HTTPc_STR_BOUNDARY "--" 80 | 81 | #define HTTPc_STR_BOUNDARY_START_LEN (sizeof(HTTPc_STR_BOUNDARY_START) - 1) 82 | 83 | #define HTTPc_STR_BOUNDARY_END_LEN (sizeof(HTTPc_STR_BOUNDARY_END) - 1) 84 | 85 | 86 | /* 87 | ********************************************************************************************************* 88 | ********************************************************************************************************* 89 | * FUNCTION PROTOTYPES 90 | ********************************************************************************************************* 91 | ********************************************************************************************************* 92 | */ 93 | 94 | void HTTPcReq_Prepare ( HTTPc_CONN *p_conn, 95 | HTTPc_ERR *p_err); 96 | 97 | CPU_BOOLEAN HTTPcReq ( HTTPc_CONN *p_conn, 98 | HTTPc_ERR *p_err); 99 | 100 | CPU_CHAR *HTTPcReq_HdrCopyToBuf ( CPU_CHAR *p_buf, // TODO put function in HTTP common files ? 101 | CPU_INT16U buf_len, 102 | CPU_SIZE_T buf_len_rem, 103 | HTTP_HDR_FIELD hdr_type, 104 | const CPU_CHAR *p_val, 105 | CPU_SIZE_T val_len, 106 | CPU_BOOLEAN add_CRLF, 107 | HTTPc_ERR *p_err); 108 | 109 | 110 | /* 111 | ********************************************************************************************************* 112 | ********************************************************************************************************* 113 | * MODULE END 114 | ********************************************************************************************************* 115 | ********************************************************************************************************* 116 | */ 117 | 118 | #endif /* HTTPc_REQ_MODULE_PRESENT */ 119 | -------------------------------------------------------------------------------- /Client/Source/http-c_resp.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP CLIENT RESPONSE MODULE 21 | * 22 | * Filename : http-c_resp.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | * 32 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 33 | * inclusion through use of the HTTPc module present pre-processor macro definition. 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef HTTPc_RESP_MODULE_PRESENT /* See Note #1. */ 39 | #define HTTPc_RESP_MODULE_PRESENT 40 | 41 | 42 | /* 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | * HTTPc INCLUDE FILES 46 | ********************************************************************************************************* 47 | ********************************************************************************************************* 48 | */ 49 | 50 | #include 51 | #include 52 | 53 | #include 54 | #include 55 | #include 56 | 57 | #include 58 | #include 59 | 60 | #include 61 | #include "../../Common/http.h" 62 | #include "http-c.h" 63 | 64 | 65 | /* 66 | ********************************************************************************************************* 67 | ********************************************************************************************************* 68 | * FUNCTION PROTOTYPES 69 | ********************************************************************************************************* 70 | ********************************************************************************************************* 71 | */ 72 | 73 | CPU_BOOLEAN HTTPcResp (HTTPc_CONN *p_conn, 74 | HTTPc_ERR *p_err); 75 | 76 | 77 | /* 78 | ********************************************************************************************************* 79 | ********************************************************************************************************* 80 | * MODULE END 81 | ********************************************************************************************************* 82 | ********************************************************************************************************* 83 | */ 84 | 85 | #endif /* HTTPc_RESP_MODULE_PRESENT */ 86 | -------------------------------------------------------------------------------- /Client/Source/http-c_sock.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP CLIENT SOCKET MODULE 21 | * 22 | * Filename : http-c_sock.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | * 32 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 33 | * inclusion through use of the HTTPc module present pre-processor macro definition. 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef HTTPc_SOCK_MODULE_PRESENT /* See Note #1. */ 39 | #define HTTPc_SOCK_MODULE_PRESENT 40 | 41 | 42 | /* 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | * HTTPc INCLUDE FILES 46 | ********************************************************************************************************* 47 | ********************************************************************************************************* 48 | */ 49 | 50 | #include 51 | #include 52 | 53 | #include 54 | #include 55 | #include 56 | 57 | #include 58 | #include "../../Common/http.h" 59 | #include "http-c.h" 60 | 61 | 62 | /* 63 | ********************************************************************************************************* 64 | ********************************************************************************************************* 65 | * FUNCTION PROTOTYPES 66 | ********************************************************************************************************* 67 | ********************************************************************************************************* 68 | */ 69 | 70 | void HTTPcSock_Connect (HTTPc_CONN *p_conn, 71 | HTTPc_ERR *p_err); 72 | 73 | CPU_BOOLEAN HTTPcSock_ConnDataRx (HTTPc_CONN *p_conn, 74 | CPU_INT32U max_len, 75 | HTTPc_ERR *p_err); 76 | 77 | CPU_BOOLEAN HTTPcSock_ConnDataTx (HTTPc_CONN *p_conn, 78 | HTTPc_ERR *p_err); 79 | 80 | void HTTPcSock_Close (HTTPc_CONN *p_conn, 81 | HTTPc_ERR *p_err); 82 | 83 | void HTTPcSock_Sel (HTTPc_CONN *p_conn, 84 | HTTPc_ERR *p_err); 85 | 86 | CPU_BOOLEAN HTTPcSock_IsRxClosed (HTTPc_CONN *p_conn, 87 | HTTPc_ERR *p_err); 88 | 89 | 90 | /* 91 | ********************************************************************************************************* 92 | ********************************************************************************************************* 93 | * MODULE END 94 | ********************************************************************************************************* 95 | ********************************************************************************************************* 96 | */ 97 | 98 | #endif /* HTTPc_SOCK_MODULE_PRESENT */ 99 | -------------------------------------------------------------------------------- /Client/Source/http-c_task.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP CLIENT TASK MODULE 21 | * 22 | * Filename : http-c_task.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * HTTPc INCLUDE FILES 31 | ********************************************************************************************************* 32 | ********************************************************************************************************* 33 | */ 34 | 35 | #include /* CPU Configuration (see Note #2b) */ 36 | #include /* CPU Core Library (see Note #2a) */ 37 | 38 | #include /* Standard Defines (see Note #3a) */ 39 | #include /* Standard String Library (see Note #3a) */ 40 | #include /* Standard ASCII Library (see Note #3a) */ 41 | 42 | #include 43 | #include "../../Common/http.h" 44 | #include "http-c_mem.h" 45 | 46 | 47 | /* 48 | ********************************************************************************************************* 49 | ********************************************************************************************************* 50 | * MODULE 51 | * 52 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 53 | * inclusion through use of the HTTPc module present pre-processor macro definition. 54 | * 55 | * (2) The following HTTPc-Task-module configuration value MUST be pre-#define'd in 56 | * 'http-c.h' PRIOR to all other HTTPc modules that require the Task Layer configuration: 57 | * 58 | * HTTPc_TASK_MODULE_EN 59 | ********************************************************************************************************* 60 | ********************************************************************************************************* 61 | */ 62 | 63 | #ifndef HTTPc_TASK_MODULE_PRESENT /* See Note #1. */ 64 | #define HTTPc_TASK_MODULE_PRESENT 65 | 66 | #ifdef HTTPc_TASK_MODULE_EN /* See Note #2. */ 67 | 68 | 69 | /* 70 | ********************************************************************************************************* 71 | ********************************************************************************************************* 72 | * FUNCTION PROTOTYPES 73 | ********************************************************************************************************* 74 | ********************************************************************************************************* 75 | */ 76 | 77 | void HTTPcTask_Init (const HTTPc_CFG *p_cfg, 78 | const HTTP_TASK_CFG *p_task_cfg, 79 | HTTPc_ERR *p_err); 80 | 81 | void HTTPcTask ( void *p_data); 82 | 83 | void HTTPcTask_SetDly ( CPU_INT08U dly_ms, 84 | HTTPc_ERR *p_err); 85 | void HTTPcTask_MsgQueue ( HTTPc_MSG_TYPE type, 86 | void *p_data, 87 | HTTPc_ERR *p_err); 88 | 89 | void HTTPcTask_ConnAdd ( HTTPc_CONN *p_conn); 90 | 91 | void HTTPcTask_ConnRemove ( HTTPc_CONN *p_conn); 92 | 93 | #ifdef HTTPc_SIGNAL_TASK_MODULE_EN 94 | void HTTPcTask_ConnConnectSignalCreate ( HTTPc_CONN *p_conn, 95 | HTTPc_ERR *p_err); 96 | 97 | void HTTPcTask_ConnConnectSignalDel ( HTTPc_CONN *p_conn, 98 | HTTPc_ERR *p_err); 99 | 100 | void HTTPcTask_ConnCloseSignalCreate ( HTTPc_CONN *p_conn, 101 | HTTPc_ERR *p_err); 102 | 103 | void HTTPcTask_ConnCloseSignalDel ( HTTPc_CONN *p_conn, 104 | HTTPc_ERR *p_err); 105 | 106 | void HTTPcTask_TransDoneSignalCreate ( HTTPc_CONN *p_conn, 107 | HTTPc_ERR *p_err); 108 | 109 | void HTTPcTask_TransDoneSignalDel ( HTTPc_CONN *p_conn, 110 | HTTPc_ERR *p_err); 111 | 112 | void HTTPcTask_ConnConnectSignal ( HTTPc_CONN *p_conn, 113 | HTTPc_ERR *p_err); 114 | 115 | void HTTPcTask_ConnCloseSignal ( HTTPc_CONN *p_conn, 116 | HTTPc_ERR *p_err); 117 | 118 | void HTTPcTask_TransDoneSignal ( HTTPc_CONN *p_conn, 119 | HTTPc_ERR *p_err); 120 | 121 | void HTTPcTask_ConnConnectSignalWait ( HTTPc_CONN *p_conn, 122 | HTTPc_ERR *p_err); 123 | 124 | void HTTPcTask_ConnCloseSignalWait ( HTTPc_CONN *p_conn, 125 | HTTPc_ERR *p_err); 126 | 127 | void HTTPcTask_TransDoneSignalWait ( HTTPc_CONN *p_conn, 128 | HTTPc_ERR *p_err); 129 | 130 | void HTTPcTask_Wake ( HTTPc_CONN *p_conn, 131 | HTTPc_ERR *p_err); 132 | #endif 133 | 134 | 135 | /* 136 | ********************************************************************************************************* 137 | ********************************************************************************************************* 138 | * MODULE END 139 | ********************************************************************************************************* 140 | ********************************************************************************************************* 141 | */ 142 | 143 | #endif /* HTTPc_TASK_MODULE_EN */ 144 | #endif /* HTTPc_TASK_MODULE_PRESENT */ 145 | -------------------------------------------------------------------------------- /Client/Source/http-c_type.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP CLIENT 21 | * 22 | * Filename : http-c_type.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | * 32 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 33 | * inclusion through use of the HTTPc module present pre-processor macro definition. 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef HTTPc_TYPE_MODULE_PRESENT /* See Note #1. */ 39 | #define HTTPc_TYPE_MODULE_PRESENT 40 | 41 | /* 42 | ********************************************************************************************************* 43 | ********************************************************************************************************* 44 | * HTTPc INCLUDE FILES 45 | ********************************************************************************************************* 46 | ********************************************************************************************************* 47 | */ 48 | 49 | #include 50 | #include 51 | 52 | 53 | /* 54 | ********************************************************************************************************* 55 | ********************************************************************************************************* 56 | * DATA TYPES 57 | ********************************************************************************************************* 58 | ********************************************************************************************************* 59 | */ 60 | 61 | /* 62 | ********************************************************************************************************* 63 | * CONFIGURATION DATA TYPE 64 | ********************************************************************************************************* 65 | */ 66 | 67 | typedef struct httpc_cfg { 68 | 69 | /* 70 | *-------------------------------------------------------------------------------------------------------- 71 | * TASK CONFIGURATION 72 | *-------------------------------------------------------------------------------------------------------- 73 | */ 74 | 75 | CPU_INT08U TaskDly_ms; /* Task Delay in milliseconds. */ 76 | 77 | 78 | /* 79 | *-------------------------------------------------------------------------------------------------------- 80 | * CONNECTION CONFIGURATION 81 | *-------------------------------------------------------------------------------------------------------- 82 | */ 83 | CPU_INT08U MsgQ_Size; /* Message Queue Size. */ 84 | CPU_INT16U ConnConnectTimeout_ms; /* Connection Connect Timeout. */ 85 | CPU_INT16U ConnInactivityTimeout_s; /* Connection Inactivity Timeout. */ 86 | CPU_BOOLEAN ConnIsKeepAlive; /* Configure the connection to use keep-alive probes. */ 87 | } HTTPc_CFG; 88 | 89 | 90 | /* 91 | ********************************************************************************************************* 92 | ********************************************************************************************************* 93 | * MODULE END 94 | ********************************************************************************************************* 95 | ********************************************************************************************************* 96 | */ 97 | 98 | #endif /* HTTPc_TYPE_MODULE_PRESENT */ 99 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | ATTENTION ALL USERS OF THIS REPOSITORY: 2 | 3 | The original work found in this repository is provided by Silicon Labs under the 4 | Apache License, Version 2.0. 5 | 6 | Any third party may contribute derivative works to the original work in which 7 | modifications are clearly identified as being licensed under: 8 | 9 | (1) the Apache License, Version 2.0 or a compatible open source license; or 10 | (2) under a proprietary license with a copy of such license deposited. 11 | 12 | All posted derivative works must clearly identify which license choice has been 13 | elected. 14 | 15 | No such posted derivative works will be considered to be a “Contribution” under 16 | the Apache License, Version 2.0. 17 | 18 | SILICON LABS MAKES NO WARRANTY WITH RESPECT TO ALL POSTED THIRD PARTY CONTENT 19 | AND DISCLAIMS ALL OTHER WARRANTIES OR LIABILITIES, INCLUDING ALL WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, OWNERSHIP, 21 | NON-INFRINGEMENT, AND NON-MISAPPROPRIATION. 22 | 23 | In the event a derivative work is desired to be submitted to Silicon Labs as a 24 | “Contribution” under the Apache License, Version 2.0, a “Contributor” must give 25 | written email notice to micrium@weston-embedded.com. Unless an email response in 26 | the affirmative to accept the derivative work as a “Contribution”, such email 27 | submission should be considered to have not been incorporated into the original 28 | work. 29 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | .. raw:: html 2 | 3 | 4 |

5 | 6 |

7 |
8 | 9 | µC/OS is a full-featured embedded operating system originally developed by Micriµm™. In addition to the two highly popular kernels, µC/OS features support for TCP/IP, USB-Device, USB-Host, and Modbus, as well as a robust File System. 10 | 11 | Since its founding in 1999 as a private company, Micriµm and its team of engineers have offered world-class embedded software components for the most critical and demanding real-time applications. Recognized as having some of the cleanest code in the industry, with easy-to-understand documentation, the Micrium real-time kernels, and software components have successfully been deployed in thousands of products worldwide across a broad range of industries. Micrium’s µC/OS-II™ kernel has been certified for use in safety-critical applications and remains a respected favorite in the medical, aerospace, and industrial markets. µC/OS continues to be the RTOS of choice for engineers requiring the most reliable and trusted solution for their mission-critical applications. 12 | 13 | ---------- 14 | 15 | .. raw:: HTML 16 | 17 | 18 |

19 | 20 |

21 |
22 | 23 | Founded by a team of former Micrium employees, Weston Embedded Solutions is the official custodian for the µC/OS RTOS and Stacks software repository to ensure it remains the trusted choice for embedded engineers around the world. 24 | 25 | ---------- 26 | 27 | Product Documentation and Release Notes 28 | *************** 29 | https://micrium.atlassian.net/ 30 | 31 | Technical Support 32 | ***************** 33 | https://weston-embedded.com/micrium-support 34 | 35 | Example Projects 36 | ********* 37 | https://weston-embedded.com/micrium-examples 38 | 39 | Commercial Licensing Option 40 | ********* 41 | https://weston-embedded.com/products/cesium 42 | 43 | Who to Contact 44 | ********* 45 | https://weston-embedded.com/company/contact -------------------------------------------------------------------------------- /Server/Add-on/CtrlLayer/http-s_ctrl_layer_mem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTPs CONTROL LAYER MEMORY 19 | * 20 | * Filename : http-s_ctrl_layer_mem.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * MODULE 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef HTTPs_CTRL_LAYER_MEM_MODULE_PRESENT 34 | #define HTTPs_CTRL_LAYER_MEM_MODULE_PRESENT 35 | 36 | /* 37 | ********************************************************************************************************* 38 | ********************************************************************************************************* 39 | * INCLUDE FILES 40 | ********************************************************************************************************* 41 | ********************************************************************************************************* 42 | */ 43 | 44 | #include "http-s_ctrl_layer.h" 45 | 46 | 47 | /* 48 | ********************************************************************************************************* 49 | ********************************************************************************************************* 50 | * FUNCTION PROTOTYPES 51 | ********************************************************************************************************* 52 | ********************************************************************************************************* 53 | */ 54 | 55 | HTTPs_CTRL_LAYER_INST_DATA *HTTPsCtrlLayerMem_InstDataAlloc (void); 56 | 57 | CPU_BOOLEAN HTTPsCtrlLayerMem_InstDataPoolInit (HTTPs_CTRL_LAYER_INST_DATA *p_seg, 58 | CPU_SIZE_T pool_size_max); 59 | 60 | CPU_BOOLEAN HTTPsCtrlLayerMem_ConnDataPoolInit (HTTPs_CTRL_LAYER_INST_DATA *p_seg, 61 | CPU_SIZE_T pool_size_max); 62 | 63 | CPU_BOOLEAN HTTPsCtrlLayerMem_ConnDataEntryPoolInit (HTTPs_CTRL_LAYER_INST_DATA *p_seg, 64 | CPU_SIZE_T pool_size_max); 65 | 66 | HTTPs_CTRL_LAYER_DATA_ENTRY *HTTPsCtrlLayerMem_InstDataEntryAlloc (HTTPs_CTRL_LAYER_INST_DATA *p_seg); 67 | 68 | HTTPs_CTRL_LAYER_CONN_DATA *HTTPsCtrlLayerMem_ConnDataAlloc (HTTPs_CTRL_LAYER_INST_DATA *p_seg); 69 | 70 | void HTTPsCtrlLayer_ConnDataFree (HTTPs_CTRL_LAYER_INST_DATA *p_seg, 71 | HTTPs_CTRL_LAYER_CONN_DATA *p_conn_data); 72 | 73 | HTTPs_CTRL_LAYER_DATA_ENTRY *HTTPsCtrlLayer_ConnDataEntryAlloc (HTTPs_CTRL_LAYER_INST_DATA *p_seg, 74 | HTTPs_CTRL_LAYER_CONN_DATA *p_conn_data); 75 | 76 | void HTTPsCtrlLayer_ConnDataEntriesFree (HTTPs_CTRL_LAYER_INST_DATA *p_seg, 77 | HTTPs_CTRL_LAYER_CONN_DATA *p_conn_data); 78 | 79 | 80 | /* 81 | ********************************************************************************************************* 82 | ********************************************************************************************************* 83 | * MODULE END 84 | ********************************************************************************************************* 85 | ********************************************************************************************************* 86 | */ 87 | 88 | #endif /* HTTPs_CTRL_LAYER_MEM_MODULE_PRESENT */ 89 | -------------------------------------------------------------------------------- /Server/Add-on/CtrlLayer/http-s_ctrl_layer_rest_cfg.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTPs CONTROL LAYER REST CONFIGURATION 19 | * 20 | * Filename : http-s_ctrl_layer_rest_cfg.c 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * INCLUDE FILES 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #define MICRIUM_SOURCE 34 | #define HTTPs_CTRL_LAYER_REST_CFG_MODULE 35 | #include "http-s_ctrl_layer_rest_cfg.h" 36 | #include "../REST/http-s_rest.h" 37 | 38 | 39 | /* 40 | ********************************************************************************************************* 41 | ********************************************************************************************************* 42 | * LOCAL CONSTANTS 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | */ 46 | 47 | const HTTPs_CTRL_LAYER_APP_HOOKS HTTPsCtrlLayer_REST_App = { 48 | HTTPsREST_Init, 49 | HTTPsREST_RxHeader, 50 | HTTPsREST_Authenticate, 51 | HTTPsREST_RxBody, 52 | HTTPsREST_ReqRdySignal, 53 | DEF_NULL, /* Poll not used by REST. Same mechanism replaced by GET_CHUNK and RX_BODY */ 54 | DEF_NULL, /* Headers will be added before the chunk call */ 55 | DEF_NULL, /* No token replacement for REST */ 56 | HTTPsREST_GetChunk, 57 | HTTPsREST_OnTransComplete, 58 | DEF_NULL, /* If there is a connection error, it is most likely not recoverable. */ 59 | HTTPsREST_OnConnClosed 60 | }; 61 | 62 | -------------------------------------------------------------------------------- /Server/Add-on/CtrlLayer/http-s_ctrl_layer_rest_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTPs CONTROL LAYER REST CONFIGURATION 19 | * 20 | * Filename : http-s_ctrl_layer_rest_cfg.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * MODULE 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef HTTPs_CTRL_LAYER_REST_CFG_MODULE_PRESENT 34 | #define HTTPs_CTRL_LAYER_REST_CFG_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | ********************************************************************************************************* 40 | * INCLUDE FILES 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include "http-s_ctrl_layer.h" 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | ********************************************************************************************************* 51 | * GLOBAL VARIABLES 52 | ********************************************************************************************************* 53 | ********************************************************************************************************* 54 | */ 55 | 56 | extern const HTTPs_CTRL_LAYER_APP_HOOKS HTTPsCtrlLayer_REST_App; 57 | 58 | 59 | /* 60 | ********************************************************************************************************* 61 | ********************************************************************************************************* 62 | * MODULE END 63 | ********************************************************************************************************* 64 | ********************************************************************************************************* 65 | */ 66 | #endif /* HTTPs_CTRL_LAYER_REST_CFG_MODULE_PRESENT */ 67 | -------------------------------------------------------------------------------- /Server/Add-on/REST/http-s_rest_hook_cfg.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTPs REST HOOK CONFIGURATION 19 | * 20 | * Filename : http-s_rest_hook_cfg.c 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * INCLUDE FILES 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #define MICRIUM_SOURCE 34 | #define HTTPs_REST_HOOK_CFG_MODULE 35 | #include "http-s_rest_hook_cfg.h" 36 | 37 | 38 | /* 39 | ********************************************************************************************************* 40 | ********************************************************************************************************* 41 | * LOCAL CONSTANTS 42 | ********************************************************************************************************* 43 | ********************************************************************************************************* 44 | */ 45 | 46 | /* 47 | ********************************************************************************************************* 48 | * REST CONFIGURATION 49 | * 50 | * Note(s): The REST configuration in the REST resources list ID that the HTTP server will used for the 51 | * REST application. 52 | ********************************************************************************************************* 53 | */ 54 | 55 | const HTTPs_REST_CFG HTTPs_REST_Cfg = {0}; 56 | 57 | 58 | /* 59 | ********************************************************************************************************* 60 | * REST HOOK CONFIGURATION 61 | ********************************************************************************************************* 62 | */ 63 | 64 | const HTTPs_HOOK_CFG HTTPs_REST_HookCfg = { 65 | HTTPsREST_Init, 66 | HTTPsREST_RxHeader, 67 | HTTPsREST_Authenticate, 68 | HTTPsREST_RxBody, 69 | HTTPsREST_ReqRdySignal, 70 | DEF_NULL, /* Poll not used by REST. Same mechanism replaced by GET_CHUNK and RX_BODY */ 71 | DEF_NULL, /* Headers will be added before the chunk call */ 72 | DEF_NULL, /* No token replacement for REST */ 73 | HTTPsREST_GetChunk, 74 | HTTPsREST_OnTransComplete, 75 | DEF_NULL, 76 | DEF_NULL, /* If there is a connection error, it is most likely not recoverable. */ 77 | HTTPsREST_OnConnClosed 78 | }; 79 | -------------------------------------------------------------------------------- /Server/Add-on/REST/http-s_rest_hook_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTPs REST HOOK CONFIGURATION 19 | * 20 | * Filename : http-s_rest_hook_cfg.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * MODULE 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef HTTPs_REST_HOOK_CFG_MODULE_PRESENT 34 | #define HTTPs_REST_HOOK_CFG_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | ********************************************************************************************************* 40 | * INCLUDE FILES 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include "../../Source/http-s.h" 46 | #include "http-s_rest.h" 47 | 48 | 49 | /* 50 | ********************************************************************************************************* 51 | ********************************************************************************************************* 52 | * GLOBAL VARIABLES 53 | ********************************************************************************************************* 54 | ********************************************************************************************************* 55 | */ 56 | 57 | extern const HTTPs_HOOK_CFG HTTPs_REST_HookCfg; 58 | extern const HTTPs_REST_CFG HTTPs_REST_Cfg; 59 | 60 | 61 | /* 62 | ********************************************************************************************************* 63 | ********************************************************************************************************* 64 | * MODULE END 65 | ********************************************************************************************************* 66 | ********************************************************************************************************* 67 | */ 68 | #endif /* HTTPs_REST_HOOK_CFG_MODULE_PRESENT */ 69 | -------------------------------------------------------------------------------- /Server/Add-on/REST/http-s_rest_mem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTPs REST MEMORY 19 | * 20 | * Filename : http-s_rest_mem.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * MODULE 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef HTTPs_REST_MEM_MODULE_PRESENT 34 | #define HTTPs_REST_MEM_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | ********************************************************************************************************* 40 | * INCLUDE FILES 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include "http-s_rest.h" 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | ********************************************************************************************************* 51 | * EXTERNS 52 | ********************************************************************************************************* 53 | ********************************************************************************************************* 54 | */ 55 | 56 | #ifdef HTTPs_REST_MEM_MODULE 57 | #define HTTPs_REST_MEM_EXT 58 | #else 59 | #define HTTPs_REST_MEM_EXT extern 60 | #endif 61 | 62 | 63 | /* 64 | ********************************************************************************************************* 65 | ********************************************************************************************************* 66 | * DEFINES 67 | ********************************************************************************************************* 68 | ********************************************************************************************************* 69 | */ 70 | 71 | 72 | /* 73 | ********************************************************************************************************* 74 | ********************************************************************************************************* 75 | * GLOBAL VARIABLES 76 | ********************************************************************************************************* 77 | ********************************************************************************************************* 78 | */ 79 | 80 | HTTPs_REST_MEM_EXT SLIST_MEMBER *HTTPsREST_Mem_ResourceList; 81 | 82 | 83 | /* 84 | ********************************************************************************************************* 85 | ********************************************************************************************************* 86 | * FUNCTION PROTOTYPES 87 | ********************************************************************************************************* 88 | ********************************************************************************************************* 89 | */ 90 | 91 | HTTPs_REST_INST_DATA *HTTPsREST_Mem_Init_Pools ( CPU_SIZE_T max_request); 92 | 93 | HTTPs_REST_RESOURCE_LIST *HTTPsREST_Mem_GetResourceList ( CPU_INT32U list_ID); 94 | 95 | HTTPs_REST_REQUEST *HTTPsREST_Mem_AllocRequest ( HTTPs_REST_INST_DATA *p_inst_data); 96 | 97 | void HTTPsREST_Mem_FreeRequest ( HTTPs_REST_INST_DATA *p_inst_data, 98 | HTTPs_REST_REQUEST *p_request); 99 | 100 | CPU_BOOLEAN HTTPsREST_Mem_AllocResource ( CPU_INT32U listID, 101 | const HTTPs_REST_RESOURCE *resource); 102 | 103 | 104 | /* 105 | ********************************************************************************************************* 106 | ********************************************************************************************************* 107 | * MODULE END 108 | ********************************************************************************************************* 109 | ********************************************************************************************************* 110 | */ 111 | #endif /* HTTPs_REST_MEM_MODULE_PRESENT */ 112 | -------------------------------------------------------------------------------- /Server/Cfg/Template/http-s_instance_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP INSTANCE SERVER CONFIGURATION FILE 21 | * 22 | * TEMPLATE 23 | * 24 | * Filename : http-s_instance_cfg.h 25 | * Version : V3.01.01 26 | ********************************************************************************************************* 27 | */ 28 | 29 | #include 30 | #include 31 | 32 | 33 | /* 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | * FILES & FOLDERS STRING DEFINES 37 | ********************************************************************************************************* 38 | ********************************************************************************************************* 39 | */ 40 | 41 | #define HTTPs_CFG_INSTANCE_STR_FOLDER_ROOT "\\" 42 | 43 | #define HTTPs_CFG_INSTANCE_STR_FILE_DEFAULT "index.html" 44 | #define HTTPs_CFG_INSTANCE_STR_FILE_ERR_404 "404.html" 45 | 46 | #define HTTPs_CFG_INSTANCE_STR_FOLDER_UPLOAD "\\" 47 | 48 | 49 | /* 50 | ********************************************************************************************************* 51 | ********************************************************************************************************* 52 | * HTTP SERVER INSTANCE CONFIGURATION 53 | ********************************************************************************************************* 54 | ********************************************************************************************************* 55 | */ 56 | 57 | extern const NET_TASK_CFG HTTPs_TaskCfgInstance; 58 | extern const HTTPs_CFG HTTPs_CfgInstance; 59 | 60 | -------------------------------------------------------------------------------- /Server/Examples/Basic/app_basic.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP INSTANCE BASIC APPLICATION 19 | * 20 | * Filename : app_basic.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * MODULE 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef APP_BASIC_MODULE_PRESENT 34 | #define APP_BASIC_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | ********************************************************************************************************* 40 | * INCLUDE FILES 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | ********************************************************************************************************* 51 | * EXTERNS 52 | ********************************************************************************************************* 53 | ********************************************************************************************************* 54 | */ 55 | 56 | #ifdef APP_BASIC_MODULE 57 | #define APP_BASIC_EXT 58 | #else 59 | #define APP_BASIC_EXT extern 60 | #endif 61 | 62 | 63 | /* 64 | ********************************************************************************************************* 65 | ********************************************************************************************************* 66 | * DEFINES 67 | ********************************************************************************************************* 68 | ********************************************************************************************************* 69 | */ 70 | 71 | #define APP_BASIC_FS_DYN_EN DEF_DISABLED 72 | 73 | 74 | /* 75 | ********************************************************************************************************* 76 | ********************************************************************************************************* 77 | * GLOBAL VARIABLES 78 | ********************************************************************************************************* 79 | ********************************************************************************************************* 80 | */ 81 | 82 | APP_BASIC_EXT CPU_INT32U AppBasic_ErrCtr; 83 | 84 | 85 | /* 86 | ********************************************************************************************************* 87 | ********************************************************************************************************* 88 | * FUNCTION PROTOTYPES 89 | ********************************************************************************************************* 90 | ********************************************************************************************************* 91 | */ 92 | 93 | CPU_BOOLEAN AppBasic_Init (void); 94 | 95 | 96 | /* 97 | ********************************************************************************************************* 98 | ********************************************************************************************************* 99 | * MODULE END 100 | ********************************************************************************************************* 101 | ********************************************************************************************************* 102 | */ 103 | 104 | #endif /* APP_BASIC_MODULE_PRESENT */ 105 | -------------------------------------------------------------------------------- /Server/Examples/Basic/app_basic_http-s_instance_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP INSTANCE SERVER CONFIGURATION FILE 19 | * 20 | * Filename : app_basic_http-s_instance_cfg.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | #include 26 | 27 | 28 | /* 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | * HTTP SERVER INSTANCE CONFIGURATION 32 | ********************************************************************************************************* 33 | ********************************************************************************************************* 34 | */ 35 | 36 | extern const NET_TASK_CFG HTTPs_TaskCfgInstance_AppBasic; 37 | extern const HTTPs_CFG HTTPs_CfgInstance_AppBasic; 38 | 39 | -------------------------------------------------------------------------------- /Server/Examples/Common/HTML/404.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | µC/HTTPs 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
14 | 15 |

A Member of the µC/TCP-IP Product Family

16 |
17 | 18 |
19 | 20 |
21 |

ERROR 404: NOT FOUND

22 |
23 | 24 | 27 | 28 |
29 | 30 |
31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Server/Examples/Common/HTML/form.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | µC/HTTPs 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 15 |

A Member of the µC/TCP-IP Product Family

16 |
17 | 18 |
19 | 20 |
21 |

22 |

23 | First name: 24 | 25 |
26 | Last name: 27 | 28 |

29 | 30 |

31 |
32 | 33 |
34 |
35 | 36 |
37 |

38 |

39 |
40 | 41 | 44 |
45 |
46 | 47 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /Server/Examples/Common/HTML/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | µC/HTTPs 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
14 | 15 |

A Member of the µC/TCP-IP Product Family

16 |
17 | 18 |
19 | 20 |
21 |

Your HTTP server is working properly.

22 |

µC/TCP-IP Version: ${NET_VERSION}

23 |

µC/HTTP-server Version: ${HTTPs_VERSION}

24 |
25 | 26 | 36 | 37 | 40 |
41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Server/Examples/Common/HTML/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | µC/HTTPs 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
14 | 15 |

A Member of the µC/TCP-IP Product Family

16 |
17 | 18 |
19 |
20 |

Welcome!

21 |
22 |

23 | Enter user ID and password: 24 |
25 | User ID 26 | Password 27 | 28 |

29 |
30 | 31 | 34 |
35 |
36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Server/Examples/Common/HTML/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weston-embedded/uC-HTTP/fa84fe9842c96b7cdb5933b9f22bace35e755d1d/Server/Examples/Common/HTML/logo.gif -------------------------------------------------------------------------------- /Server/Examples/Common/HTML/uc_style.css: -------------------------------------------------------------------------------- 1 | 2 | html { height:100%; } 3 | 4 | body { background:#666666; color:#0a0a0a; font-family:Arial, sans-serif; font-size:14px; line-height:21px; height:100%; } 5 | * { font-size:1em; margin:0; padding:0; } 6 | 7 | ul, ol { padding-left:1.6em; } 8 | 9 | option { min-width: 1.5em; } 10 | 11 | input { font-size:12px; } 12 | input.bluebutton { background:#dde2e6; border:2px solid #000000; color:#223d50; font-weight:bold; padding:3px 5px 3px 5px; /*margin:30px 20px 14px 20px;*/ } 13 | 14 | button { font-size:12px; } 15 | button.bluebutton { background:#dde2e6; border:2px solid #000000; color:#223d50; font-weight:bold; padding:3px 5px 3px 5px; } 16 | 17 | table, td { border:none; margin:0; padding:0; } 18 | 19 | p.user { color:#223d50 !important; } 20 | 21 | #controls { float:right; margin:0 30px 0 0; width:370px; } 22 | #controls .img { float:left; } 23 | 24 | #copyright { clear:both; font-size:10px; padding:30px 0 0 0; text-align:right; } 25 | 26 | #refresh { clear:both; text-align:left; margin: 0 0 0 0; } 27 | 28 | #info_form form { display: table; } 29 | #info_form p { display: table-row; color: #223d50; } 30 | #info_form label { display: table-cell; padding-top: 5px; padding-bottom: 5px;} 31 | #info_form input { width: 90%; padding: 5px; display: table-cell; padding-top: 5px; padding-bottom: 5px;} 32 | 33 | #list { float:left; margin:0 30px 0 0; width:500px; } 34 | #list a:link { color:#cccccc; } 35 | #list a:visited { color:#cccccc; } 36 | #list a:hover { color:#fa9500; } 37 | #list a:active { color:#fa9500; } 38 | 39 | #information { float:left; margin:0 30px 0 0; width:370px; } 40 | #information a:link { color:#cccccc; } 41 | #information a:visited { color:#cccccc; } 42 | #information a:hover { color:#fa9500; } 43 | #information a:active { color:#fa9500; } 44 | 45 | #links { float:right; margin:0 0 0 0; width:370px; } 46 | #links a:link { color:#cccccc; } 47 | #links a:visited { color:#cccccc; } 48 | #links a:hover { color:#fa9500; } 49 | #links a:active { color:#fa9500; } 50 | 51 | #return { float:right; margin:0 0 0 0; } 52 | 53 | #pagebody { background:#223d50; padding:0 0 30px 0; } 54 | #pagebody h2 { color:#ffffff; font-size:18px; font-weight:bold; margin:30px 0 14px 30px; } 55 | #pagebody p { color:#ffffff; margin:0 30px 20px 30px; } 56 | #pagebody p.alertbox { background:#fa9500; margin:30px 20px 20px 20px; padding:5px 10px 5px 10px; } 57 | 58 | #pagewrapper { background:#666666; margin:0 auto 0 auto; width:800px; } 59 | 60 | #topbanner { background:#dde2e6; padding:20px; } 61 | #topbanner p { color:#223d50; } -------------------------------------------------------------------------------- /Server/Examples/Common/StaticFiles/_404_html.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | #ifndef _404_HTML_H 16 | #define _404_HTML_H 17 | 18 | #define _404_HTML_NAME "404.html" 19 | #define _404_HTML_CONTENT "\x3c\x21\x44\x4f\x43\x54\x59\x50\x45\x20\x48\x54\x4d\x4c\x20\x50\x55\x42\x4c\x49"\ 20 | "\x43\x20\x22\x2d\x2f\x2f\x57\x33\x43\x2f\x2f\x44\x54\x44\x20\x48\x54\x4d\x4c\x20"\ 21 | "\x34\x2e\x30\x31\x2f\x2f\x45\x4e\x22\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x22"\ 22 | "\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x77\x33\x2e\x6f\x72\x67\x2f\x54\x52"\ 23 | "\x2f\x68\x74\x6d\x6c\x34\x2f\x73\x74\x72\x69\x63\x74\x2e\x64\x74\x64\x22\x3e\x0d"\ 24 | "\x0a\x3c\x68\x74\x6d\x6c\x3e\x0d\x0a\x3c\x68\x65\x61\x64\x3e\x0d\x0a\x20\x20\x20"\ 25 | "\x20\x3c\x74\x69\x74\x6c\x65\x3e\x26\x6d\x69\x63\x72\x6f\x3b\x43\x2f\x48\x54\x54"\ 26 | "\x50\x73\x3c\x2f\x74\x69\x74\x6c\x65\x3e\x0d\x0a\x20\x20\x20\x20\x3c\x6d\x65\x74"\ 27 | "\x61\x20\x6e\x61\x6d\x65\x3d\x22\x67\x65\x6e\x65\x72\x61\x74\x6f\x72\x22\x20\x63"\ 28 | "\x6f\x6e\x74\x65\x6e\x74\x3d\x22\x42\x42\x45\x64\x69\x74\x20\x39\x2e\x33\x22\x3e"\ 29 | "\x0d\x0a\x20\x20\x20\x20\x3c\x6c\x69\x6e\x6b\x20\x72\x65\x6c\x3d\x22\x73\x74\x79"\ 30 | "\x6c\x65\x73\x68\x65\x65\x74\x22\x20\x74\x79\x70\x65\x3d\x22\x74\x65\x78\x74\x2f"\ 31 | "\x63\x73\x73\x22\x20\x68\x72\x65\x66\x3d\x22\x75\x63\x5f\x73\x74\x79\x6c\x65\x2e"\ 32 | "\x63\x73\x73\x22\x3e\x0d\x0a\x3c\x2f\x68\x65\x61\x64\x3e\x0d\x0a\x3c\x62\x6f\x64"\ 33 | "\x79\x3e\x0d\x0a\x0d\x0a\x3c\x64\x69\x76\x20\x69\x64\x3d\x22\x70\x61\x67\x65\x77"\ 34 | "\x72\x61\x70\x70\x65\x72\x22\x3e\x0d\x0a\x0d\x0a\x20\x20\x20\x20\x3c\x64\x69\x76"\ 35 | "\x20\x69\x64\x3d\x22\x74\x6f\x70\x62\x61\x6e\x6e\x65\x72\x22\x3e\x0d\x0a\x20\x20"\ 36 | "\x20\x20\x20\x20\x20\x20\x3c\x69\x6d\x67\x20\x73\x72\x63\x3d\x22\x6c\x6f\x67\x6f"\ 37 | "\x2e\x67\x69\x66\x22\x20\x61\x6c\x74\x3d\x22\x22\x20\x77\x69\x64\x74\x68\x3d\x22"\ 38 | "\x32\x31\x32\x22\x20\x68\x65\x69\x67\x68\x74\x3d\x22\x34\x31\x22\x3e\x0d\x0a\x20"\ 39 | "\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x3e\x3c\x73\x74\x72\x6f\x6e\x67\x3e\x41\x20"\ 40 | "\x4d\x65\x6d\x62\x65\x72\x20\x6f\x66\x20\x74\x68\x65\x20\x26\x6d\x69\x63\x72\x6f"\ 41 | "\x3b\x43\x2f\x54\x43\x50\x2d\x49\x50\x20\x50\x72\x6f\x64\x75\x63\x74\x20\x46\x61"\ 42 | "\x6d\x69\x6c\x79\x3c\x2f\x73\x74\x72\x6f\x6e\x67\x3e\x3c\x2f\x70\x3e\x0d\x0a\x20"\ 43 | "\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0d\x0a\x0d\x0a\x20\x20\x20\x20\x3c\x64\x69"\ 44 | "\x76\x20\x69\x64\x3d\x22\x70\x61\x67\x65\x62\x6f\x64\x79\x22\x3e\x0d\x0a\x0d\x0a"\ 45 | "\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x69\x64\x3d\x22\x69\x6e\x66"\ 46 | "\x6f\x72\x6d\x61\x74\x69\x6f\x6e\x22\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20"\ 47 | "\x20\x20\x20\x20\x3c\x70\x20\x63\x6c\x61\x73\x73\x3d\x22\x61\x6c\x65\x72\x74\x62"\ 48 | "\x6f\x78\x22\x3e\x45\x52\x52\x4f\x52\x20\x34\x30\x34\x3a\x20\x4e\x4f\x54\x20\x46"\ 49 | "\x4f\x55\x4e\x44\x3c\x2f\x70\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f"\ 50 | "\x64\x69\x76\x3e\x0d\x0a\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76"\ 51 | "\x20\x69\x64\x3d\x22\x63\x6f\x70\x79\x72\x69\x67\x68\x74\x22\x3e\x0d\x0a\x20\x20"\ 52 | "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x3e\x43\x6f\x70\x79\x72\x69\x67"\ 53 | "\x68\x74\x20\x32\x30\x31\x33\x20\x4d\x69\x63\x72\x69\x26\x6d\x69\x63\x72\x6f\x3b"\ 54 | "\x6d\x20\x49\x6e\x63\x2e\x3c\x2f\x70\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20"\ 55 | "\x3c\x2f\x64\x69\x76\x3e\x0d\x0a\x0d\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e"\ 56 | "\x0d\x0a\x0d\x0a\x3c\x2f\x64\x69\x76\x3e\x0d\x0a\x0d\x0a\x3c\x2f\x62\x6f\x64\x79"\ 57 | "\x3e\x0d\x0a\x3c\x2f\x68\x74\x6d\x6c\x3e\x0d\x0a" 58 | #define _404_HTML_SIZE (sizeof(_404_HTML_CONTENT)-1) 59 | 60 | #endif /* _404_HTML_H */ -------------------------------------------------------------------------------- /Server/Examples/Common/StaticFiles/generated_fs.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | #include 16 | #include "generated_fs.h" 17 | #include 18 | 19 | typedef struct gen_file_desc { 20 | CPU_CHAR *Name; 21 | CPU_CHAR *Content; 22 | CPU_INT32U Size; 23 | } GEN_FILE_DESC; 24 | 25 | static const GEN_FILE_DESC FileTbl[] = { 26 | {_404_HTML_NAME, _404_HTML_CONTENT, _404_HTML_SIZE}, 27 | {FORM_HTML_NAME, FORM_HTML_CONTENT, FORM_HTML_SIZE}, 28 | {INDEX_HTML_NAME, INDEX_HTML_CONTENT, INDEX_HTML_SIZE}, 29 | {LIST_HTML_NAME, LIST_HTML_CONTENT, LIST_HTML_SIZE}, 30 | {LOGIN_HTML_NAME, LOGIN_HTML_CONTENT, LOGIN_HTML_SIZE}, 31 | {LOGO_GIF_NAME, LOGO_GIF_CONTENT, LOGO_GIF_SIZE}, 32 | {UC_STYLE_CSS_NAME, UC_STYLE_CSS_CONTENT, UC_STYLE_CSS_SIZE}, 33 | {0, 0, 0} 34 | }; 35 | 36 | CPU_BOOLEAN GeneratedFS_FileAdd() { 37 | const GEN_FILE_DESC *p_file_desc = &FileTbl[0]; 38 | CPU_BOOLEAN result = DEF_OK; 39 | 40 | 41 | while ((p_file_desc->Name != 0) && (result == DEF_OK)) { 42 | result = HTTPs_FS_AddFile(p_file_desc->Name, p_file_desc->Content, p_file_desc->Size); 43 | p_file_desc++; 44 | } 45 | 46 | return (result); 47 | } 48 | -------------------------------------------------------------------------------- /Server/Examples/Common/StaticFiles/generated_fs.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | #ifndef GENERATED_FS_H 16 | #define GENERATED_FS_H 17 | 18 | #include "_404_html.h" 19 | #include "form_html.h" 20 | #include "index_html.h" 21 | #include "list_html.h" 22 | #include "login_html.h" 23 | #include "logo_gif.h" 24 | #include "uc_style_css.h" 25 | 26 | CPU_BOOLEAN GeneratedFS_FileAdd(); 27 | 28 | #endif /* GENERATED_FS_H */ -------------------------------------------------------------------------------- /Server/Examples/Common/StaticFiles/index_html.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | #ifndef INDEX_HTML_H 16 | #define INDEX_HTML_H 17 | 18 | #define INDEX_HTML_NAME "index.html" 19 | #define INDEX_HTML_CONTENT "\x3c\x21\x44\x4f\x43\x54\x59\x50\x45\x20\x48\x54\x4d\x4c\x20\x50\x55\x42\x4c\x49"\ 20 | "\x43\x20\x22\x2d\x2f\x2f\x57\x33\x43\x2f\x2f\x44\x54\x44\x20\x48\x54\x4d\x4c\x20"\ 21 | "\x34\x2e\x30\x31\x2f\x2f\x45\x4e\x22\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x22"\ 22 | "\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x77\x33\x2e\x6f\x72\x67\x2f\x54\x52"\ 23 | "\x2f\x68\x74\x6d\x6c\x34\x2f\x73\x74\x72\x69\x63\x74\x2e\x64\x74\x64\x22\x3e\x0d"\ 24 | "\x0a\x3c\x68\x74\x6d\x6c\x3e\x0d\x0a\x3c\x68\x65\x61\x64\x3e\x0d\x0a\x09\x3c\x74"\ 25 | "\x69\x74\x6c\x65\x3e\x26\x6d\x69\x63\x72\x6f\x3b\x43\x2f\x48\x54\x54\x50\x73\x3c"\ 26 | "\x2f\x74\x69\x74\x6c\x65\x3e\x0d\x0a\x09\x3c\x6d\x65\x74\x61\x20\x6e\x61\x6d\x65"\ 27 | "\x3d\x22\x67\x65\x6e\x65\x72\x61\x74\x6f\x72\x22\x20\x63\x6f\x6e\x74\x65\x6e\x74"\ 28 | "\x3d\x22\x42\x42\x45\x64\x69\x74\x20\x39\x2e\x33\x22\x3e\x0d\x0a\x20\x20\x20\x20"\ 29 | "\x3c\x6c\x69\x6e\x6b\x20\x72\x65\x6c\x3d\x22\x73\x74\x79\x6c\x65\x73\x68\x65\x65"\ 30 | "\x74\x22\x20\x74\x79\x70\x65\x3d\x22\x74\x65\x78\x74\x2f\x63\x73\x73\x22\x20\x68"\ 31 | "\x72\x65\x66\x3d\x22\x75\x63\x5f\x73\x74\x79\x6c\x65\x2e\x63\x73\x73\x22\x3e\x0d"\ 32 | "\x0a\x3c\x2f\x68\x65\x61\x64\x3e\x0d\x0a\x3c\x62\x6f\x64\x79\x3e\x0d\x0a\x0d\x0a"\ 33 | "\x3c\x64\x69\x76\x20\x69\x64\x3d\x22\x70\x61\x67\x65\x77\x72\x61\x70\x70\x65\x72"\ 34 | "\x22\x3e\x0d\x0a\x0d\x0a\x09\x3c\x64\x69\x76\x20\x69\x64\x3d\x22\x74\x6f\x70\x62"\ 35 | "\x61\x6e\x6e\x65\x72\x22\x3e\x0d\x0a\x09\x09\x3c\x69\x6d\x67\x20\x73\x72\x63\x3d"\ 36 | "\x22\x6c\x6f\x67\x6f\x2e\x67\x69\x66\x22\x20\x61\x6c\x74\x3d\x22\x22\x20\x77\x69"\ 37 | "\x64\x74\x68\x3d\x22\x32\x31\x32\x22\x20\x68\x65\x69\x67\x68\x74\x3d\x22\x34\x31"\ 38 | "\x22\x3e\x0d\x0a\x09\x09\x3c\x70\x3e\x3c\x73\x74\x72\x6f\x6e\x67\x3e\x41\x20\x4d"\ 39 | "\x65\x6d\x62\x65\x72\x20\x6f\x66\x20\x74\x68\x65\x20\x26\x6d\x69\x63\x72\x6f\x3b"\ 40 | "\x43\x2f\x54\x43\x50\x2d\x49\x50\x20\x50\x72\x6f\x64\x75\x63\x74\x20\x46\x61\x6d"\ 41 | "\x69\x6c\x79\x3c\x2f\x73\x74\x72\x6f\x6e\x67\x3e\x3c\x2f\x70\x3e\x0d\x0a\x09\x3c"\ 42 | "\x2f\x64\x69\x76\x3e\x0d\x0a\x09\x0d\x0a\x09\x3c\x64\x69\x76\x20\x69\x64\x3d\x22"\ 43 | "\x70\x61\x67\x65\x62\x6f\x64\x79\x22\x3e\x0d\x0a\x09\x0d\x0a\x09\x09\x3c\x64\x69"\ 44 | "\x76\x20\x69\x64\x3d\x22\x69\x6e\x66\x6f\x72\x6d\x61\x74\x69\x6f\x6e\x22\x3e\x0d"\ 45 | "\x0a\x09\x09\x09\x3c\x70\x20\x63\x6c\x61\x73\x73\x3d\x22\x61\x6c\x65\x72\x74\x62"\ 46 | "\x6f\x78\x22\x3e\x59\x6f\x75\x72\x20\x48\x54\x54\x50\x20\x73\x65\x72\x76\x65\x72"\ 47 | "\x20\x69\x73\x20\x77\x6f\x72\x6b\x69\x6e\x67\x20\x70\x72\x6f\x70\x65\x72\x6c\x79"\ 48 | "\x2e\x3c\x2f\x70\x3e\x0d\x0a\x09\x09\x09\x3c\x70\x3e\x3c\x61\x20\x68\x72\x65\x66"\ 49 | "\x3d\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x64\x6f\x63\x2e\x6d\x69\x63\x72\x69\x75"\ 50 | "\x6d\x2e\x63\x6f\x6d\x2f\x64\x69\x73\x70\x6c\x61\x79\x2f\x54\x43\x50\x49\x50\x44"\ 51 | "\x4f\x43\x2f\x64\x6f\x63\x75\x6d\x65\x6e\x74\x61\x74\x69\x6f\x6e\x22\x20\x74\x61"\ 52 | "\x72\x67\x65\x74\x3d\x22\x5f\x62\x6c\x61\x6e\x6b\x22\x3e\x26\x6d\x69\x63\x72\x6f"\ 53 | "\x3b\x43\x2f\x54\x43\x50\x2d\x49\x50\x3c\x2f\x61\x3e\x20\x56\x65\x72\x73\x69\x6f"\ 54 | "\x6e\x3a\x20\x24\x7b\x4e\x45\x54\x5f\x56\x45\x52\x53\x49\x4f\x4e\x7d\x3c\x2f\x70"\ 55 | "\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x3e\x3c\x61"\ 56 | "\x20\x68\x72\x65\x66\x3d\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x64\x6f\x63\x2e\x6d"\ 57 | "\x69\x63\x72\x69\x75\x6d\x2e\x63\x6f\x6d\x2f\x64\x69\x73\x70\x6c\x61\x79\x2f\x68"\ 58 | "\x74\x74\x70\x64\x6f\x63\x2f\x64\x6f\x63\x22\x20\x74\x61\x72\x67\x65\x74\x3d\x22"\ 59 | "\x5f\x62\x6c\x61\x6e\x6b\x22\x3e\x26\x6d\x69\x63\x72\x6f\x3b\x43\x2f\x48\x54\x54"\ 60 | "\x50\x2d\x73\x65\x72\x76\x65\x72\x3c\x2f\x61\x3e\x20\x56\x65\x72\x73\x69\x6f\x6e"\ 61 | "\x3a\x20\x24\x7b\x48\x54\x54\x50\x73\x5f\x56\x45\x52\x53\x49\x4f\x4e\x7d\x3c\x2f"\ 62 | "\x70\x3e\x20\x20\x20\x20\x20\x20\x0d\x0a\x09\x09\x3c\x2f\x64\x69\x76\x3e\x0d\x0a"\ 63 | "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c"\ 64 | "\x64\x69\x76\x20\x69\x64\x3d\x22\x6c\x69\x6e\x6b\x73\x22\x3e\x20\x0d\x0a\x20\x20"\ 65 | "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x42\x52\x3e\x20\x3c\x42\x52\x3e\x20"\ 66 | "\x3c\x42\x52\x3e\x20\x3c\x42\x52\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20"\ 67 | "\x20\x20\x20\x3c\x70\x3e\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x66\x6f\x72\x6d\x2e"\ 68 | "\x68\x74\x6d\x6c\x22\x3e\x3c\x62\x75\x74\x74\x6f\x6e\x20\x63\x6c\x61\x73\x73\x3d"\ 69 | "\x22\x62\x6c\x75\x65\x62\x75\x74\x74\x6f\x6e\x22\x3e\x46\x6f\x72\x6d\x20\x45\x78"\ 70 | "\x61\x6d\x70\x6c\x65\x20\x50\x61\x67\x65\x3c\x2f\x62\x75\x74\x74\x6f\x6e\x3e\x3c"\ 71 | "\x2f\x61\x3e\x3c\x2f\x70\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"\ 72 | "\x20\x3c\x70\x3e\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x6c\x69\x73\x74\x2e\x68\x74"\ 73 | "\x6d\x6c\x22\x3e\x3c\x62\x75\x74\x74\x6f\x6e\x20\x63\x6c\x61\x73\x73\x3d\x22\x62"\ 74 | "\x6c\x75\x65\x62\x75\x74\x74\x6f\x6e\x22\x3e\x52\x45\x53\x54\x20\x45\x78\x61\x6d"\ 75 | "\x70\x6c\x65\x20\x50\x61\x67\x65\x3c\x2f\x62\x75\x74\x74\x6f\x6e\x3e\x3c\x2f\x61"\ 76 | "\x3e\x3c\x2f\x70\x3e\x20\x20\x20\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"\ 77 | "\x20\x20\x3c\x66\x6f\x72\x6d\x20\x61\x63\x74\x69\x6f\x6e\x3d\x22\x6c\x6f\x67\x6f"\ 78 | "\x75\x74\x22\x20\x6d\x65\x74\x68\x6f\x64\x3d\x22\x50\x4f\x53\x54\x22\x3e\x20\x0d"\ 79 | "\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x3e"\ 80 | "\x0d\x0a\x09\x09\x09\x09\x09\x3c\x69\x6e\x70\x75\x74\x20\x74\x79\x70\x65\x3d\x22"\ 81 | "\x73\x75\x62\x6d\x69\x74\x22\x20\x6e\x61\x6d\x65\x3d\x22\x4c\x6f\x67\x20\x6f\x75"\ 82 | "\x74\x22\x20\x76\x61\x6c\x75\x65\x3d\x22\x4c\x6f\x67\x20\x6f\x75\x74\x22\x20\x63"\ 83 | "\x6c\x61\x73\x73\x3d\x22\x62\x6c\x75\x65\x62\x75\x74\x74\x6f\x6e\x22\x3e\x09\x0d"\ 84 | "\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x70"\ 85 | "\x3e\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"\ 86 | "\x20\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x66\x6f\x72"\ 87 | "\x6d\x3e\x09\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0d"\ 88 | "\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a\x09\x09\x3c\x64\x69\x76\x20\x69\x64"\ 89 | "\x3d\x22\x63\x6f\x70\x79\x72\x69\x67\x68\x74\x22\x3e\x0d\x0a\x09\x09\x09\x3c\x70"\ 90 | "\x3e\x43\x6f\x70\x79\x72\x69\x67\x68\x74\x20\x32\x30\x31\x34\x20\x4d\x69\x63\x72"\ 91 | "\x69\x26\x6d\x69\x63\x72\x6f\x3b\x6d\x20\x49\x6e\x63\x2e\x3c\x2f\x70\x3e\x0d\x0a"\ 92 | "\x09\x09\x3c\x2f\x64\x69\x76\x3e\x0d\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e"\ 93 | "\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a\x3c\x2f\x64\x69\x76\x3e\x0d\x0a\x0d\x0a"\ 94 | "\x3c\x2f\x62\x6f\x64\x79\x3e\x0d\x0a\x3c\x2f\x68\x74\x6d\x6c\x3e\x0d\x0a" 95 | #define INDEX_HTML_SIZE (sizeof(INDEX_HTML_CONTENT)-1) 96 | 97 | #endif /* INDEX_HTML_H */ -------------------------------------------------------------------------------- /Server/Examples/Common/StaticFiles/login_html.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | #ifndef LOGIN_HTML_H 16 | #define LOGIN_HTML_H 17 | 18 | #define LOGIN_HTML_NAME "login.html" 19 | #define LOGIN_HTML_CONTENT "\x3c\x21\x44\x4f\x43\x54\x59\x50\x45\x20\x48\x54\x4d\x4c\x20\x50\x55\x42\x4c\x49"\ 20 | "\x43\x20\x22\x2d\x2f\x2f\x57\x33\x43\x2f\x2f\x44\x54\x44\x20\x48\x54\x4d\x4c\x20"\ 21 | "\x34\x2e\x30\x31\x2f\x2f\x45\x4e\x22\x20\x22\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77"\ 22 | "\x77\x2e\x77\x33\x2e\x6f\x72\x67\x2f\x54\x52\x2f\x68\x74\x6d\x6c\x34\x2f\x73\x74"\ 23 | "\x72\x69\x63\x74\x2e\x64\x74\x64\x22\x3e\x0d\x0a\x3c\x68\x74\x6d\x6c\x3e\x0d\x0a"\ 24 | "\x0d\x0a\x3c\x68\x65\x61\x64\x3e\x0d\x0a\x09\x3c\x74\x69\x74\x6c\x65\x3e\x26\x6d"\ 25 | "\x69\x63\x72\x6f\x3b\x43\x2f\x48\x54\x54\x50\x73\x3c\x2f\x74\x69\x74\x6c\x65\x3e"\ 26 | "\x0d\x0a\x09\x3c\x6d\x65\x74\x61\x20\x6e\x61\x6d\x65\x3d\x22\x67\x65\x6e\x65\x72"\ 27 | "\x61\x74\x6f\x72\x22\x20\x63\x6f\x6e\x74\x65\x6e\x74\x3d\x22\x42\x42\x45\x64\x69"\ 28 | "\x74\x20\x39\x2e\x33\x22\x3e\x0d\x0a\x20\x20\x20\x20\x3c\x6c\x69\x6e\x6b\x20\x72"\ 29 | "\x65\x6c\x3d\x22\x73\x74\x79\x6c\x65\x73\x68\x65\x65\x74\x22\x20\x74\x79\x70\x65"\ 30 | "\x3d\x22\x74\x65\x78\x74\x2f\x63\x73\x73\x22\x20\x68\x72\x65\x66\x3d\x22\x75\x63"\ 31 | "\x5f\x73\x74\x79\x6c\x65\x2e\x63\x73\x73\x22\x3e\x0d\x0a\x3c\x2f\x68\x65\x61\x64"\ 32 | "\x3e\x0d\x0a\x0d\x0a\x3c\x62\x6f\x64\x79\x3e\x0d\x0a\x3c\x64\x69\x76\x20\x69\x64"\ 33 | "\x3d\x22\x70\x61\x67\x65\x77\x72\x61\x70\x70\x65\x72\x22\x3e\x0d\x0a\x0d\x0a\x09"\ 34 | "\x3c\x64\x69\x76\x20\x69\x64\x3d\x22\x74\x6f\x70\x62\x61\x6e\x6e\x65\x72\x22\x3e"\ 35 | "\x0d\x0a\x09\x09\x3c\x69\x6d\x67\x20\x73\x72\x63\x3d\x22\x6c\x6f\x67\x6f\x2e\x67"\ 36 | "\x69\x66\x22\x20\x61\x6c\x74\x3d\x22\x22\x20\x77\x69\x64\x74\x68\x3d\x22\x32\x31"\ 37 | "\x32\x22\x20\x68\x65\x69\x67\x68\x74\x3d\x22\x34\x31\x22\x3e\x0d\x0a\x09\x09\x3c"\ 38 | "\x70\x3e\x3c\x73\x74\x72\x6f\x6e\x67\x3e\x41\x20\x4d\x65\x6d\x62\x65\x72\x20\x6f"\ 39 | "\x66\x20\x74\x68\x65\x20\x26\x6d\x69\x63\x72\x6f\x3b\x43\x2f\x54\x43\x50\x2d\x49"\ 40 | "\x50\x20\x50\x72\x6f\x64\x75\x63\x74\x20\x46\x61\x6d\x69\x6c\x79\x3c\x2f\x73\x74"\ 41 | "\x72\x6f\x6e\x67\x3e\x3c\x2f\x70\x3e\x0d\x0a\x09\x3c\x2f\x64\x69\x76\x3e\x0d\x0a"\ 42 | "\x20\x20\x20\x20\x0d\x0a\x09\x3c\x64\x69\x76\x20\x69\x64\x3d\x22\x70\x61\x67\x65"\ 43 | "\x62\x6f\x64\x79\x22\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x62\x72\x3e"\ 44 | "\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x20\x63\x6c\x61\x73\x73\x3d\x22"\ 45 | "\x61\x6c\x65\x72\x74\x62\x6f\x78\x22\x3e\x57\x65\x6c\x63\x6f\x6d\x65\x21\x3c\x2f"\ 46 | "\x70\x3e\x09\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x66\x6f\x72\x6d\x20\x4d"\ 47 | "\x45\x54\x48\x4f\x44\x3d\x50\x4f\x53\x54\x20\x41\x43\x54\x49\x4f\x4e\x3d\x22\x6c"\ 48 | "\x6f\x67\x6d\x65\x22\x20\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"\ 49 | "\x20\x3c\x70\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"\ 50 | "\x20\x20\x3c\x66\x6f\x6e\x74\x20\x73\x69\x7a\x65\x3d\x22\x32\x22\x3e\x20\x3c\x73"\ 51 | "\x74\x72\x6f\x6e\x67\x3e\x20\x45\x6e\x74\x65\x72\x20\x75\x73\x65\x72\x20\x49\x44"\ 52 | "\x20\x61\x6e\x64\x20\x70\x61\x73\x73\x77\x6f\x72\x64\x3a\x20\x3c\x2f\x73\x74\x72"\ 53 | "\x6f\x6e\x67\x3e\x3c\x2f\x66\x6f\x6e\x74\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20"\ 54 | "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x62\x72\x3e\x0d\x0a\x20\x20\x20\x20\x20"\ 55 | "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x55\x73\x65\x72\x20\x49\x44\x20"\ 56 | "\x3c\x69\x6e\x70\x75\x74\x20\x74\x79\x70\x65\x3d\x22\x74\x65\x78\x74\x22\x20\x73"\ 57 | "\x69\x7a\x65\x3d\x22\x32\x30\x22\x20\x6e\x61\x6d\x65\x3d\x22\x75\x73\x65\x72\x6e"\ 58 | "\x61\x6d\x65\x22\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"\ 59 | "\x20\x20\x20\x20\x50\x61\x73\x73\x77\x6f\x72\x64\x20\x3c\x69\x6e\x70\x75\x74\x20"\ 60 | "\x74\x79\x70\x65\x3d\x22\x70\x61\x73\x73\x77\x6f\x72\x64\x22\x20\x73\x69\x7a\x65"\ 61 | "\x3d\x22\x32\x30\x22\x20\x6e\x61\x6d\x65\x3d\x22\x70\x61\x73\x73\x77\x6f\x72\x64"\ 62 | "\x22\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"\ 63 | "\x3c\x69\x6e\x70\x75\x74\x20\x74\x79\x70\x65\x3d\x22\x73\x75\x62\x6d\x69\x74\x22"\ 64 | "\x20\x6e\x61\x6d\x65\x3d\x22\x6c\x6f\x67\x69\x6e\x22\x20\x76\x61\x6c\x75\x65\x3d"\ 65 | "\x22\x4c\x6f\x67\x69\x6e\x22\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x6c\x75\x65\x62"\ 66 | "\x75\x74\x74\x6f\x6e\x22\x3e\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a\x20\x20\x20"\ 67 | "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x70\x3e\x0d\x0a\x20\x20\x20\x20\x20"\ 68 | "\x20\x20\x20\x3c\x2f\x66\x6f\x72\x6d\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20"\ 69 | "\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x69\x64\x3d\x22\x63"\ 70 | "\x6f\x70\x79\x72\x69\x67\x68\x74\x22\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20"\ 71 | "\x20\x20\x20\x20\x3c\x70\x3e\x43\x6f\x70\x79\x72\x69\x67\x68\x74\x20\x32\x30\x31"\ 72 | "\x34\x20\x4d\x69\x63\x72\x69\x26\x6d\x69\x63\x72\x6f\x3b\x6d\x20\x49\x6e\x63\x2e"\ 73 | "\x3c\x2f\x70\x3e\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e"\ 74 | "\x0d\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0d\x0a\x3c\x2f\x64\x69\x76\x3e"\ 75 | "\x0d\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x0d\x0a\x0d\x0a\x3c\x2f\x68\x74\x6d\x6c\x3e"\ 76 | "\x0d\x0a" 77 | #define LOGIN_HTML_SIZE (sizeof(LOGIN_HTML_CONTENT)-1) 78 | 79 | #endif /* LOGIN_HTML_H */ -------------------------------------------------------------------------------- /Server/Examples/CtrlLayer/app_global.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP APPLICATION WITH CONTROL LAYER 19 | * 20 | * Filename : app_global.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | * Note(s) : (1) This application regroup with the control layer a login layer, a default page app layer 24 | * and a REST app layer. 25 | ********************************************************************************************************* 26 | */ 27 | 28 | /* 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | * MODULE 32 | ********************************************************************************************************* 33 | ********************************************************************************************************* 34 | */ 35 | 36 | #ifndef APP_GLOBAL_MODULE_PRESENT 37 | #define APP_GLOBAL_MODULE_PRESENT 38 | 39 | 40 | /* 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | * INCLUDE FILES 44 | ********************************************************************************************************* 45 | ********************************************************************************************************* 46 | */ 47 | 48 | #include 49 | #include 50 | 51 | #include "app_global_ctrl_layer_cfg.h" 52 | #include "app_global_http-s_instance_cfg.h" 53 | 54 | #include 55 | 56 | 57 | /* 58 | ********************************************************************************************************* 59 | ********************************************************************************************************* 60 | * GLOBAL VARIABLES 61 | ********************************************************************************************************* 62 | ********************************************************************************************************* 63 | */ 64 | 65 | extern HTTPs_CTRL_LAYER_AUTH_INST AppGlobal_AuthInst; 66 | 67 | extern HTTPs_CTRL_LAYER_APP_INST AppGlobal_AppInst_AuthUnprotected; 68 | extern HTTPs_CTRL_LAYER_APP_INST AppGlobal_AppInst_AuthProtected; 69 | 70 | extern HTTPs_CTRL_LAYER_APP_INST AppGlobal_AppInst_REST; 71 | 72 | extern HTTPs_CTRL_LAYER_APP_INST AppGlobal_AppInst_Basic; 73 | 74 | 75 | /* 76 | ********************************************************************************************************* 77 | ********************************************************************************************************* 78 | * FUNCTION PROTOTYPES 79 | ********************************************************************************************************* 80 | ********************************************************************************************************* 81 | */ 82 | 83 | CPU_BOOLEAN AppGlobal_Init (void); 84 | 85 | CPU_BOOLEAN AppGlobal_REST_ResourcesInit (void); 86 | 87 | AUTH_RIGHT AppGlobal_Auth_GetRequiredRightsHook (const HTTPs_INSTANCE *p_instance, 88 | const HTTPs_CONN *p_conn); 89 | 90 | CPU_BOOLEAN AppGlobal_Auth_ParseLoginHook (const HTTPs_INSTANCE *p_instance, 91 | const HTTPs_CONN *p_conn, 92 | HTTPs_AUTH_STATE state, 93 | HTTPs_AUTH_RESULT *p_result); 94 | 95 | CPU_BOOLEAN AppGlobal_Auth_ParseLogoutHook (const HTTPs_INSTANCE *p_instance, 96 | const HTTPs_CONN *p_conn, 97 | HTTPs_AUTH_STATE state); 98 | 99 | CPU_BOOLEAN AppGlobal_Basic_ReqHook (const HTTPs_INSTANCE *p_instance, 100 | HTTPs_CONN *p_conn, 101 | const void *p_hook_cfg); 102 | 103 | CPU_BOOLEAN AppGlobal_Basic_TokenValGetHook (const HTTPs_INSTANCE *p_instance, 104 | HTTPs_CONN *p_conn, 105 | const void *p_hook_cfg, 106 | const CPU_CHAR *p_token, 107 | CPU_INT16U token_len, 108 | CPU_CHAR *p_val, 109 | CPU_INT16U val_len_max); 110 | 111 | CPU_BOOLEAN AppGlobal_Basic_RespChunkDataGetHook (const HTTPs_INSTANCE *p_instance, 112 | HTTPs_CONN *p_conn, 113 | const void *p_hook_cfg, 114 | void *p_buf, 115 | CPU_SIZE_T buf_len_max, 116 | CPU_SIZE_T *p_tx_len); 117 | 118 | 119 | /* 120 | ********************************************************************************************************* 121 | ********************************************************************************************************* 122 | * MODULE END 123 | ********************************************************************************************************* 124 | ********************************************************************************************************* 125 | */ 126 | 127 | #endif /* APP_GLOBAL_MODULE_PRESENT */ 128 | -------------------------------------------------------------------------------- /Server/Examples/CtrlLayer/app_global_auth_rights_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP APPLICATION AUTHORIZATION RIGHTS 19 | * 20 | * Filename : app_global_auth_rights_cfg.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * MODULE 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef APP_GLOBAL_AUTH_RIGHTS_CFG_MODULE_PRESENT 34 | #define APP_GLOBAL_AUTH_RIGHTS_CFG_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | ********************************************************************************************************* 40 | * INCLUDES 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | ********************************************************************************************************* 51 | * DEFINES 52 | * 53 | * Notes: (1) This is the definition of different authentication rights. 54 | * The are 28 AUTH_RIGHTs available to be mapped. 55 | ********************************************************************************************************* 56 | ********************************************************************************************************* 57 | */ 58 | 59 | #define HTTP_USER_ACCESS AUTH_RIGHT_2 60 | 61 | 62 | /* 63 | ********************************************************************************************************* 64 | ********************************************************************************************************* 65 | * MODULE END 66 | ********************************************************************************************************* 67 | ********************************************************************************************************* 68 | */ 69 | #endif /* APP_GLOBAL_AUTH_RIGHTS_CFG_MODULE_PRESENT */ 70 | -------------------------------------------------------------------------------- /Server/Examples/CtrlLayer/app_global_ctrl_layer_cfg.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP APPLICATION CONTROL LAYER CONFIGURATION 19 | * 20 | * Filename : app_global_ctrl_layer_cfg.c 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * INCLUDE FILES 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #include "app_global.h" 34 | 35 | 36 | /* 37 | ********************************************************************************************************* 38 | ********************************************************************************************************* 39 | * LOCAL GLOBAL VARIABLES 40 | ********************************************************************************************************* 41 | ********************************************************************************************************* 42 | */ 43 | 44 | /* 45 | ********************************************************************************************************* 46 | * Create a list of all authentications a user has to go through 47 | ********************************************************************************************************* 48 | */ 49 | 50 | HTTPs_CTRL_LAYER_AUTH_INST *AppGlobal_AuthFilters[] = { 51 | &AppGlobal_AuthInst 52 | }; 53 | 54 | 55 | /* 56 | ********************************************************************************************************* 57 | * Create a list of all the application an logged user can use. 58 | ********************************************************************************************************* 59 | */ 60 | 61 | HTTPs_CTRL_LAYER_APP_INST *AppGlobal_AuthentifiedServices[] = { 62 | &AppGlobal_AppInst_AuthProtected, 63 | &AppGlobal_AppInst_REST, 64 | &AppGlobal_AppInst_Basic 65 | }; 66 | 67 | 68 | /* 69 | ********************************************************************************************************* 70 | * Create a list of all the application an unlogged user can use. 71 | ********************************************************************************************************* 72 | */ 73 | 74 | HTTPs_CTRL_LAYER_APP_INST *AppGlobal_AuthApps[] = { 75 | &AppGlobal_AppInst_AuthUnprotected 76 | }; 77 | 78 | 79 | /* 80 | ********************************************************************************************************* 81 | * Create the configuration for the control layer. 82 | ********************************************************************************************************* 83 | */ 84 | 85 | HTTPs_CTRL_LAYER_CFG AppGlobal_ProtectedServices = { 86 | AppGlobal_AuthFilters, 87 | sizeof(AppGlobal_AuthFilters) / sizeof(HTTPs_CTRL_LAYER_AUTH_INST *), 88 | AppGlobal_AuthentifiedServices, 89 | sizeof(AppGlobal_AuthentifiedServices) / sizeof(HTTPs_CTRL_LAYER_AUTH_INST *), 90 | }; 91 | 92 | 93 | /* 94 | ********************************************************************************************************* 95 | * Create the configuration for the control layer 96 | ********************************************************************************************************* 97 | */ 98 | 99 | HTTPs_CTRL_LAYER_CFG AppGlobal_UnprotectedServices = { 100 | DEF_NULL, 101 | 0, 102 | AppGlobal_AuthApps, 103 | sizeof(AppGlobal_AuthApps) / sizeof(HTTPs_CTRL_LAYER_APP_INST *), 104 | }; 105 | 106 | 107 | /* 108 | ********************************************************************************************************* 109 | * List the configurations in a priority order. 110 | ********************************************************************************************************* 111 | */ 112 | 113 | HTTPs_CTRL_LAYER_CFG *AppGlobal_CtrlLayerCfgs[] = { 114 | &AppGlobal_ProtectedServices, 115 | &AppGlobal_UnprotectedServices 116 | }; 117 | 118 | 119 | /* 120 | ********************************************************************************************************* 121 | * Create the control layer configuration list. 122 | ********************************************************************************************************* 123 | */ 124 | 125 | HTTPs_CTRL_LAYER_CFG_LIST AppGlobal_CtrlLayerCfgList = { 126 | AppGlobal_CtrlLayerCfgs, 127 | sizeof(AppGlobal_CtrlLayerCfgs) / sizeof(HTTPs_CTRL_LAYER_CFG *) 128 | }; 129 | 130 | -------------------------------------------------------------------------------- /Server/Examples/CtrlLayer/app_global_ctrl_layer_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP APPLICATION CONTROL LAYER CONFIGURATION 19 | * 20 | * Filename : app_global_ctrl_layer_cfg.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * MODULE 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef APP_GLOBAL_CTRL_LAYER_CFG_MODULE_PRESENT 34 | #define APP_GLOBAL_CTRL_LAYER_CFG_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | ********************************************************************************************************* 40 | * INCLUDE FILES 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | ********************************************************************************************************* 51 | * GLOBAL VARIABLES 52 | ********************************************************************************************************* 53 | ********************************************************************************************************* 54 | */ 55 | 56 | extern HTTPs_CTRL_LAYER_CFG_LIST AppGlobal_CtrlLayerCfgList; 57 | 58 | 59 | /* 60 | ********************************************************************************************************* 61 | ********************************************************************************************************* 62 | * MODULE END 63 | ********************************************************************************************************* 64 | ********************************************************************************************************* 65 | */ 66 | 67 | #endif /* APP_GLOBAL_CTRL_LAYER_CFG_MODULE_PRESENT */ 68 | -------------------------------------------------------------------------------- /Server/Examples/CtrlLayer/app_global_http-s_instance_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP INSTANCE SERVER CONFIGURATION FILE 19 | * 20 | * TEMPLATE 21 | * 22 | * Filename : app_global_http-s_instance_cfg.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * NETWORK DEVICE CONFIGURATION 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #include 34 | 35 | 36 | extern const NET_TASK_CFG HTTPs_TaskCfgInstance_AppGlobal; 37 | extern const HTTPs_CFG HTTPs_CfgInstance_AppGlobal; 38 | 39 | 40 | -------------------------------------------------------------------------------- /Server/Examples/NoFS/app_no_fs.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP INSTANCE INITALIZATION WITH NO FS APPLICATION 19 | * 20 | * Filename : app_no_fs.c 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | * Note(s) : (1) This example shows how to initialize uC/HTTPs without the need of a File System, 24 | * initialize a web server instance and start it. 25 | * 26 | * (2) This example is for : 27 | * 28 | * (a) uC/TCPIP - V3.00.01 and up 29 | * 30 | * (3) This file is an example about how to use uC/HTTPs, It may not cover all case needed by a real 31 | * application. Also some modification might be needed, insert the code to perform the stated 32 | * actions wherever 'TODO' comments are found. 33 | * 34 | * (a) For example this example doesn't manage the link state (plugs and unplugs), this can 35 | * be a problem when switching from a network to another network. 36 | * 37 | * (b) This example is not fully tested, so it is not guaranteed that all cases are cover 38 | * properly. 39 | ********************************************************************************************************* 40 | */ 41 | 42 | /* 43 | ********************************************************************************************************* 44 | * INCLUDE FILES 45 | ********************************************************************************************************* 46 | */ 47 | 48 | #include 49 | #include "app_no_fs.h" 50 | #include "app_no_fs_http-s_instance_cfg.h" 51 | 52 | 53 | /* 54 | ********************************************************************************************************* 55 | * AppNoFS_Init() 56 | * 57 | * Description : (1) Initialize uC/HTTPs and start a web server instance: 58 | * 59 | * (a) Initialize uC/HTTPs module. 60 | * (b) Initialize a web server instance. 61 | * (c) Start that web server instance. 62 | * 63 | * Argument(s) : none. 64 | * 65 | * Return(s) : DEF_OK, if successfully initialized and started (can access the web server).* 66 | * DEF_FAIL, otherwise. 67 | * 68 | * Caller(s) : Application. 69 | * 70 | * Note(s) : (2) Prerequisite modules must be initialized before calling any uC/HTTPs functions: 71 | * 72 | * (a) RTOS, such as uCOS-II or uCOS-III 73 | * (b) uC/LIB 74 | * (c) uC/CPU 75 | * (d) uC/TCP-IP 76 | * 77 | * (3) Prior to do any call to uC/HTTPs, the module must be initialized. This is done by 78 | * calling HTTPs_Init(). If the process is successful, the Web server internal data structures are 79 | * initialized. 80 | * 81 | * (4) Each web server must be initialized before it can be started or stopped. HTTPs_InstanceInit() 82 | * is responsible to allocate memory for the instance, initialize internal data structure and 83 | * create the web server instance's task. 84 | * 85 | * (a) The first argument is the instance configuration, which should be modified following you 86 | * requirements. The intance's configuration set the server's port, the number of connection that 87 | * can be accepted, the hooks functions, etc. 88 | * 89 | * (b) The second argument is the instance task configuration. It set the task priority, the task 90 | * stack size, etc. 91 | * 92 | * (5) Once a web server instance is initialized, it can be started using HTTPs_InstanceStart() to 93 | * become come accessible. This function start the web server instance's task. Each instance has 94 | * is own task and all accepted connection is processed with this single task. 95 | ********************************************************************************************************* 96 | */ 97 | 98 | CPU_BOOLEAN AppNoFS_Init (void) 99 | { 100 | HTTPs_INSTANCE *p_https_instance; 101 | HTTPs_ERR http_err; 102 | 103 | 104 | /* TODO: Prerequisites modules must be initialized prior calling any of the following functions. See Note #2. */ 105 | 106 | /* -------------- INITALIZE HTTPS MODULE -------------- */ 107 | HTTPs_Init(DEF_NULL, &http_err); /* See Note #3. */ 108 | if (http_err != HTTPs_ERR_NONE) { 109 | return (DEF_FAIL); 110 | } 111 | 112 | /* ---------- INITALIZE WEB SERVER INSTANCE ----------- */ 113 | p_https_instance = HTTPs_InstanceInit(&HTTPs_CfgInstance_NoFS, /* Instance configuration. See Note #4a. */ 114 | &HTTPs_TaskCfgInstance_NoFS, /* Instance Task Configuration. See Note #4b. */ 115 | &http_err); 116 | if (http_err != HTTPs_ERR_NONE) { 117 | return (DEF_FAIL); 118 | } 119 | 120 | /* ------------ START WEB SERVER INSTANCE ------------- */ 121 | HTTPs_InstanceStart(p_https_instance, /* Instance handle. See Note #5. */ 122 | &http_err); 123 | if (http_err != HTTPs_ERR_NONE) { 124 | return (DEF_FAIL); 125 | } 126 | 127 | return (DEF_OK); 128 | } 129 | 130 | -------------------------------------------------------------------------------- /Server/Examples/NoFS/app_no_fs.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP INSTANCE INITALIZATION WITH NO FS APPLICATION 19 | * 20 | * Filename : app_no_fs.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * MODULE 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef APP_NO_FS_MODULE_PRESENT 34 | #define APP_NO_FS_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | ********************************************************************************************************* 40 | * INCLUDE FILES 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include 46 | 47 | #if 1 48 | #include 49 | #endif 50 | 51 | 52 | /* 53 | ********************************************************************************************************* 54 | ********************************************************************************************************* 55 | * FUNCTION PROTOTYPES 56 | ********************************************************************************************************* 57 | ********************************************************************************************************* 58 | */ 59 | 60 | CPU_BOOLEAN AppNoFS_Init (void); 61 | 62 | 63 | /* 64 | ********************************************************************************************************* 65 | ********************************************************************************************************* 66 | * MODULE END 67 | ********************************************************************************************************* 68 | ********************************************************************************************************* 69 | */ 70 | 71 | #endif /* APP_NO_FS_MODULE_PRESENT */ 72 | -------------------------------------------------------------------------------- /Server/Examples/NoFS/app_no_fs_http-s_instance_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP INSTANCE SERVER CONFIGURATION FILE 19 | * 20 | * Filename : app_no_fs_http-s_instance_cfg.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | #include 26 | 27 | 28 | /* 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | * HTTP SERVER INSTANCE CONFIGURATION 32 | ********************************************************************************************************* 33 | ********************************************************************************************************* 34 | */ 35 | 36 | extern const NET_TASK_CFG HTTPs_TaskCfgInstance_NoFS; 37 | extern const HTTPs_CFG HTTPs_CfgInstance_NoFS; 38 | 39 | -------------------------------------------------------------------------------- /Server/Examples/REST/app_rest.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP LOGIN APPLICATION 19 | * 20 | * Filename : app_rest.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | ********************************************************************************************************* 28 | * MODULE 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef APP_REST_MODULE_PRESENT 34 | #define APP_REST_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | ********************************************************************************************************* 40 | * INCLUDE FILES 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | ********************************************************************************************************* 51 | * GLOBAL VARIABLES 52 | ********************************************************************************************************* 53 | ********************************************************************************************************* 54 | */ 55 | 56 | extern HTTPs_REST_RESOURCE AppREST_List_Resource; 57 | extern HTTPs_REST_RESOURCE AppREST_User_Resource; 58 | 59 | 60 | /* 61 | ********************************************************************************************************* 62 | ********************************************************************************************************* 63 | * FUNCTION PROTOTYPES 64 | ********************************************************************************************************* 65 | ********************************************************************************************************* 66 | */ 67 | 68 | CPU_BOOLEAN AppREST_Init (void); 69 | 70 | CPU_BOOLEAN AppREST_MemInit (void); 71 | 72 | CPU_BOOLEAN AppREST_ResourcesInit (void); 73 | 74 | 75 | /* 76 | ********************************************************************************************************* 77 | ********************************************************************************************************* 78 | * MODULE END 79 | ********************************************************************************************************* 80 | ********************************************************************************************************* 81 | */ 82 | 83 | #endif /* APP_REST_MODULE_PRESENT */ 84 | -------------------------------------------------------------------------------- /Server/Examples/REST/app_rest_http-s_instance_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP INSTANCE SERVER CONFIGURATION FILE 19 | * 20 | * TEMPLATE 21 | * 22 | * Filename : app_rest_http-s_instance_cfg.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * DEFINES 31 | ********************************************************************************************************* 32 | ********************************************************************************************************* 33 | */ 34 | 35 | #define APP_REST_HTTPs_CONN_NBR_MAX 6 36 | 37 | /* 38 | ********************************************************************************************************* 39 | ********************************************************************************************************* 40 | * HTTP SERVER INSTANCE CONFIGURATION 41 | ********************************************************************************************************* 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include 46 | 47 | 48 | extern const NET_TASK_CFG HTTPs_TaskCfgInstance_REST; 49 | extern const HTTPs_CFG HTTPs_CfgInstance_REST; 50 | 51 | 52 | -------------------------------------------------------------------------------- /Server/Examples/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Common Folder: 2 | ************** 3 | This folder contain the web resources (HTML, css, images, etc) used for most of the example applications. 4 | 5 | 6 | Example Folders: 7 | **************** 8 | 9 | Basic: 10 | ------ 11 | This example is a basic web server application. An introduction page can be fetch from a web browser. The hook 12 | functions in this example are used to do dynamic content with token replacement, do redirecting, parse form data 13 | and construct custom response body in JSON. 14 | No add-ons are used in this example. 15 | 16 | NoFS: 17 | ----- 18 | This simple example shows how to configure and start an HTTP server instance with no File System. When the default 19 | page is fetch from a web browser, the server stack will answer with a simple "hello word". 20 | 21 | REST: 22 | ----- 23 | This example is a RESTful application to view, add, modify and delete resources (simply a users list in this 24 | example). It uses the REST add-on module. All the information passed between the HTTP client and server are 25 | constructed in JSON. 26 | 27 | CtrlLayer: 28 | ---------- 29 | This example combine a login barrier (using the Auth module) with the Basic and REST applications all in one 30 | example through the Control Layer module. 31 | 32 | SSL-TLS: 33 | -------- 34 | This folder is not an example application but only an example of HTTP server instance configuration and hook 35 | functions for a secure HTTP application. 36 | 37 | 38 | Notes: 39 | ****** 40 | 1) The REST example make use of the JQuery libraries. Therefore the host used as the HTTP client most also have 41 | access to the Internet to fetch those library files. 42 | 43 | 2) To further test your HTTP server application or to simply upload files to your server, we recommend the POSTMAN 44 | add-on of Chrome. It allows to construct your custom HTTP requests. 45 | 46 | 3) Those examples have been tested with Firefox and Chrome. There is no guarantee that they will work with other 47 | web browsers since some JavaScript codes included have not been check to be all platform supporting. -------------------------------------------------------------------------------- /Server/Examples/SSL-TLS/Certificate-Key/cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEEjCCAvqgAwIBAgIBBzANBgkqhkiG9w0BAQUFADAaMRgwFgYDVQQDEw9WYWxp 3 | Y29yZS1EQzEtQ0EwHhcNMTEwMzE4MTcwMTQyWhcNMjEwMzE1MTcwMTQyWjCBkDEL 4 | MAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQ8wDQYDVQQHEwZJcnZpbmUxHjAcBgNV 5 | BAoTFVZhbGljb3JlIFRlY2hub2xvZ2llczEhMB8GA1UEAxMYbGFuLWZ3LTAxLnZh 6 | bGljb3JlLmxvY2FsMSAwHgYJKoZIhvcNAQkBFhFhZG1pbkBsb2NhbGRvbWFpbjCC 7 | ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALwGOahytiwshzz1s/ngxy1+ 8 | +VrXZYjKSEzMYbJCUhK9xA5fz8pGtOZIXI+CasZPSbXv+ZDLGpSpeFnOL49plYRs 9 | vmTxg2n3AlZbP6pD9OPU8rmufsTvXAmQGxxIkdmWiXYJk0pbj+U698me6DKMV/sy 10 | 3ekQaQC2I2nr8uQw8RhuNhhlkWyjBWdXnS2mLNLSan2Jnt8rumtAi3B+vF5Vf0Fa 11 | kLJNt45R0f5jjuab+qw4PKMZEQbqe0XTNzkxdD0XNRBdKlajffoZPBJ7xkfuKUA3 12 | cMjXKzetABoKvsv+ElfvqlrI9RXvTXy52EaQmVhiOyBHrScq4RbwtDQsd59Qmk0C 13 | AwEAAaOB6zCB6DAJBgNVHRMEAjAAMBEGCWCGSAGG+EIBAQQEAwIGQDA0BglghkgB 14 | hvhCAQ0EJxYlRWFzeS1SU0EgR2VuZXJhdGVkIFNlcnZlciBDZXJ0aWZpY2F0ZTAd 15 | BgNVHQ4EFgQUrq5KF11M9rpKm75nAs+MaiK0niYwUQYDVR0jBEowSIAU2Q9eGjzS 16 | LZhvlRRKO6c4Q5ATtuChHqQcMBoxGDAWBgNVBAMTD1ZhbGljb3JlLURDMS1DQYIQ 17 | T9aBcT0uXoxJmC0ohp7oSTATBgNVHSUEDDAKBggrBgEFBQcDATALBgNVHQ8EBAMC 18 | BaAwDQYJKoZIhvcNAQEFBQADggEBAAUMm/9G+mhxVIYK4anc34FMqu88NQy8lrh0 19 | loNfHhIEKnerzMz+nQGidf+KBg5K5U2Jo8e9gVnrzz1gh2RtUFvDjgosGIrgYZMN 20 | yreNUD2I7sWtuWFQyEuewbs8h2MECs2xVktkqp5KPmJGCYGhXbi+zuqi/19cIsly 21 | yS01kmexwcFMXyX4YOVbG+JFHy1b4zFvWgSDULj14AuKfc8RiZNvMRMWR/Jqlpr5 22 | xWQRSmkjuzQMFavs7soZ+kHp9vnFtY2D6gF2cailk0sdG0uuyPBVxEJ2meifG6eb 23 | o3FQzdtIrB6oMFHEU00P38SJq+mrDItPDRXNLa2Nrtc1EJtmjws= 24 | -----END CERTIFICATE----- 25 | -------------------------------------------------------------------------------- /Server/Examples/SSL-TLS/Certificate-Key/key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEogIBAAKCAQEAvAY5qHK2LCyHPPWz+eDHLX75WtdliMpITMxhskJSEr3EDl/P 3 | yka05khcj4Jqxk9Jte/5kMsalKl4Wc4vj2mVhGy+ZPGDafcCVls/qkP049Tyua5+ 4 | xO9cCZAbHEiR2ZaJdgmTSluP5Tr3yZ7oMoxX+zLd6RBpALYjaevy5DDxGG42GGWR 5 | bKMFZ1edLaYs0tJqfYme3yu6a0CLcH68XlV/QVqQsk23jlHR/mOO5pv6rDg8oxkR 6 | Bup7RdM3OTF0PRc1EF0qVqN9+hk8EnvGR+4pQDdwyNcrN60AGgq+y/4SV++qWsj1 7 | Fe9NfLnYRpCZWGI7IEetJyrhFvC0NCx3n1CaTQIDAQABAoIBAEbbqbr7j//RwB2P 8 | EwZmWWmh4mMDrbYBVYHrvB2rtLZvYYVxQiOexenK92b15TtbAhJYn5qbkCbaPwrJ 9 | E09eoQRI3u+3vKigd/cHaFTIS2/Y/qhPRGL/OZY5Ap6EEsMHYkJjlWh+XRosQNlw 10 | 01zJWxbFsq90ib3E5k+ypdStRQ7JQ9ntvDAP6MDp3DF2RYf22Tpr9t3Oi2mUirOl 11 | piOEB55wydSyIhSHusbms3sp2uvQBYJjZP7eENEQz55PebTzl9UF2dgJ0wJFS073 12 | rvp46fibcch1L7U6v8iUNaS47GTs3MMyO4zda73ufhYwZLU5gL8oEDY3tf/J8zuC 13 | mNurr0ECgYEA8i1GgstYBFSCH4bhd2mLu39UVsIvHaD38mpJE6avCNOUq3Cyz9qr 14 | NzewG7RyqR43HsrVqUSQKzlAGWqG7sf+jkiam3v6VW0y05yqDjs+SVW+ZN5CKyn3 15 | sMZV0ei4MLrfxWneQaKy/EUTJMlz3rLSDM/hpJoA/gOo9BIFRf2HPkkCgYEAxsGq 16 | LYU+ZEKXKehVesh8rIic4QXwzeDmpMF2wTq6GnFq2D4vWPyVGDWdORcIO2BojDWV 17 | EZ8e7F2SghbmeTjXGADldYXQiQyt4Wtm+oJ6d+/juKSrQ1HIPzn1qgXDNLPfjd9o 18 | 9lX5lGlRn49Jrx/kKQAPTcnCa1IirIcsmcdiy+UCgYBEbOBwUi3zQ0Fk0QJhb/Po 19 | LSjSPpl7YKDN4JP3NnBcKRPngLc1HU6lElny6gA/ombmj17hLZsia1GeHMg1LVLS 20 | NtdgOR5ZBrqGqcwuqzSFGfHqpBXEBl6SludmoL9yHUreh3QhzWuO9aFcEoNnl9Tb 21 | g9z4Wf8Pxk71byYISYLt6QKBgERActjo3ZD+UPyCHQBp4m45B246ZQO9zFYdXVNj 22 | gE7eTatuR0IOkoBawN++6gPByoUDTWpcsvjF9S6ZAJH2E97ZR/KAfijh4r/66sTx 23 | k26mQRPB8FHQvqv/kj3NdsgdUJJeeqPEyEzPkcjyIoJxuB7gN2El/I5wCRon3Qf9 24 | sQ6FAoGAfVOaROSAtq/bq9JIL60kkhA9sr3KmX52PnOR2hW0caWi96j+2jlmPT93 25 | 4A2LIVUo6hCsHLSCFoWWiyX9pIqyYTn5L1EmeBO0+E8BH9F/te9+ZZ53U+quwc/X 26 | AZ6Pseyhj7S9wkI5hZ9SO1gcK4rWrAK/UFOIzzlACr5INr723vw= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /Server/Examples/SSL-TLS/http-s_instance_secure_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * HTTP INSTANCE SERVER CONFIGURATION FILE 19 | * 20 | * Filename : http-s_instance_secure_cfg.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | #include 26 | 27 | 28 | /* 29 | ********************************************************************************************************* 30 | ********************************************************************************************************* 31 | * FILES & FOLDERS STRING DEFINES 32 | ********************************************************************************************************* 33 | ********************************************************************************************************* 34 | */ 35 | 36 | #define HTTPs_CFG_INSTANCE_SECURE_STR_FOLDER_ROOT "\\" 37 | 38 | #define HTTPs_CFG_INSTANCE_SECURE_STR_FILE_DEFAULT "index.html" 39 | #define HTTPs_CFG_INSTANCE_SECURE_STR_FILE_ERR_404 "404.html" 40 | 41 | #define HTTPs_CFG_INSTANCE_SECURE_STR_FOLDER_UPLOAD "\\" 42 | 43 | 44 | /* 45 | ********************************************************************************************************* 46 | ********************************************************************************************************* 47 | * HTTP SERVER INSTANCE CONFIGURATION 48 | ********************************************************************************************************* 49 | ********************************************************************************************************* 50 | */ 51 | 52 | extern const NET_TASK_CFG HTTPs_TaskCfgInstance_Secure; 53 | extern const HTTPs_CFG HTTPs_CfgInstance_Secure; 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Server/FS/Static/Cfg/Template/http-s_fs_static_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * NET FS STATIC CONFIGURATION 19 | * 20 | * Filename : http-s_fs_static_cfg.h 21 | * Version : V3.01.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | #ifndef HTTPs_FS_STATIC_CFG_MODULE_PRESENT 26 | #define HTTPs_FS_STATIC_CFG_MODULE_PRESENT 27 | 28 | 29 | /* 30 | ********************************************************************************************************* 31 | * NET FS CFG 32 | ********************************************************************************************************* 33 | */ 34 | 35 | /* Configure external argument check feature ... */ 36 | #define HTTPs_FS_CFG_ARG_CHK_EXT_EN DEF_ENABLED 37 | /* DEF_DISABLED External argument check DISABLED */ 38 | /* DEF_ENABLED External argument check ENABLED */ 39 | 40 | 41 | #define HTTPs_FS_CFG_MAX_FILE_NAME_LEN 256 /* Configure maximum file name length. */ 42 | #define HTTPs_FS_CFG_NBR_FILES 15 /* Configure number of files. */ 43 | #define HTTPs_FS_CFG_NBR_DIRS 1 /* Configure number of directories. */ 44 | 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Server/FS/Static/http-s_fs_static.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * NET FILE SYSTEM PORT 19 | * 20 | * HTTPs STATIC FILE SYSTEM 21 | * 22 | * Filename : http-s_fs_static.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | ********************************************************************************************************* 32 | ********************************************************************************************************* 33 | */ 34 | 35 | #ifndef HTTPs_FS_STATIC_MODULE_PRESENT 36 | #define HTTPs_FS_STATIC_MODULE_PRESENT 37 | 38 | 39 | /* 40 | ********************************************************************************************************* 41 | ********************************************************************************************************* 42 | * INCLUDE FILES 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | */ 46 | 47 | #include 48 | #include 49 | #include 50 | 51 | 52 | /* 53 | ********************************************************************************************************* 54 | ********************************************************************************************************* 55 | * GLOBAL VARIABLES 56 | ********************************************************************************************************* 57 | ********************************************************************************************************* 58 | */ 59 | 60 | extern const NET_FS_API HTTPs_FS_API_Static; 61 | 62 | 63 | /* 64 | ********************************************************************************************************* 65 | ********************************************************************************************************* 66 | * FUNCTION PROTOTYPES 67 | ********************************************************************************************************* 68 | ********************************************************************************************************* 69 | */ 70 | 71 | CPU_BOOLEAN HTTPs_FS_Init (void); 72 | 73 | CPU_BOOLEAN HTTPs_FS_AddFile (CPU_CHAR *p_name, 74 | void *p_data, 75 | CPU_INT32U size); 76 | 77 | CPU_BOOLEAN HTTPs_FS_SetTime (NET_FS_DATE_TIME *p_time); 78 | 79 | 80 | 81 | /* 82 | ********************************************************************************************************* 83 | ********************************************************************************************************* 84 | * MODULE END 85 | ********************************************************************************************************* 86 | ********************************************************************************************************* 87 | */ 88 | 89 | #endif /* HTTPs_FS_STATIC_MODULE_PRESENT */ 90 | 91 | 92 | -------------------------------------------------------------------------------- /Server/Source/http-s_conn.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP SERVER CONNECTION MODULE 21 | * 22 | * Filename : http-s_conn.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | * 32 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 33 | * inclusion through use of the HTTPs module present pre-processor macro definition. 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef HTTPs_CONN_MODULE_PRESENT /* See Note #1. */ 39 | #define HTTPs_CONN_MODULE_PRESENT 40 | 41 | 42 | /* 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | * INCLUDE FILES 46 | ********************************************************************************************************* 47 | ********************************************************************************************************* 48 | */ 49 | 50 | #include 51 | #include 52 | 53 | #include "http-s.h" 54 | 55 | /* 56 | ********************************************************************************************************* 57 | ********************************************************************************************************* 58 | * FUNCTION PROTOTYPES 59 | ********************************************************************************************************* 60 | ********************************************************************************************************* 61 | */ 62 | 63 | void HTTPsConn_Process (HTTPs_INSTANCE *p_instance); 64 | 65 | 66 | /* 67 | ********************************************************************************************************* 68 | ********************************************************************************************************* 69 | * MODULE END 70 | ********************************************************************************************************* 71 | ********************************************************************************************************* 72 | */ 73 | 74 | #endif /* HTTPs_CONN_MODULE_PRESENT */ 75 | -------------------------------------------------------------------------------- /Server/Source/http-s_req.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP SERVER REQUEST MODULE 21 | * 22 | * Filename : http-s_req.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | * 32 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 33 | * inclusion through use of the HTTPs module present pre-processor macro definition. 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef HTTPs_REQ_MODULE_PRESENT /* See Note #1. */ 39 | #define HTTPs_REQ_MODULE_PRESENT 40 | 41 | 42 | /* 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | * INCLUDE FILES 46 | ********************************************************************************************************* 47 | ********************************************************************************************************* 48 | */ 49 | 50 | #include 51 | #include 52 | 53 | #include "http-s.h" 54 | 55 | 56 | /* 57 | ********************************************************************************************************* 58 | ********************************************************************************************************* 59 | * FUNCTION PROTOTYPES 60 | ********************************************************************************************************* 61 | ********************************************************************************************************* 62 | */ 63 | 64 | void HTTPsReq_Handle (HTTPs_INSTANCE *p_instance, 65 | HTTPs_CONN *p_conn); 66 | 67 | void HTTPsReq_Body (HTTPs_INSTANCE *p_instance, 68 | HTTPs_CONN *p_conn); 69 | 70 | CPU_BOOLEAN HTTPsReq_RdySignal (HTTPs_INSTANCE *p_instance, 71 | HTTPs_CONN *p_conn); 72 | 73 | 74 | /* 75 | ********************************************************************************************************* 76 | ********************************************************************************************************* 77 | * MODULE END 78 | ********************************************************************************************************* 79 | ********************************************************************************************************* 80 | */ 81 | 82 | #endif /* HTTPs_REQ_MODULE_PRESENT */ 83 | -------------------------------------------------------------------------------- /Server/Source/http-s_resp.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP SERVER RESPONSE MODULE 21 | * 22 | * Filename : http-s_resp.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | * 32 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 33 | * inclusion through use of the HTTPs module present pre-processor macro definition. 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef HTTPs_RESP_MODULE_PRESENT /* See Note #1. */ 39 | #define HTTPs_RESP_MODULE_PRESENT 40 | 41 | 42 | /* 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | * INCLUDE FILES 46 | ********************************************************************************************************* 47 | ********************************************************************************************************* 48 | */ 49 | 50 | #include 51 | #include 52 | 53 | #include "http-s.h" 54 | 55 | /* 56 | ********************************************************************************************************* 57 | ********************************************************************************************************* 58 | * FUNCTION PROTOTYPES 59 | ********************************************************************************************************* 60 | ********************************************************************************************************* 61 | */ 62 | 63 | CPU_BOOLEAN HTTPsResp_Prepare (HTTPs_INSTANCE *p_instance, 64 | HTTPs_CONN *p_conn); 65 | 66 | CPU_BOOLEAN HTTPsResp_Handle (HTTPs_INSTANCE *p_instance, 67 | HTTPs_CONN *p_conn); 68 | 69 | void HTTPsResp_DataComplete (HTTPs_INSTANCE *p_instance, 70 | HTTPs_CONN *p_conn); 71 | 72 | 73 | /* 74 | ********************************************************************************************************* 75 | ********************************************************************************************************* 76 | * MODULE END 77 | ********************************************************************************************************* 78 | ********************************************************************************************************* 79 | */ 80 | 81 | #endif /* HTTPs_RESP_MODULE_PRESENT */ 82 | -------------------------------------------------------------------------------- /Server/Source/http-s_sock.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP SERVER SOCKET MODULE 21 | * 22 | * Filename : http-s_sock.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | * 32 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 33 | * inclusion through use of the HTTPs module present pre-processor macro definition. 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef HTTPs_SOCK_MODULE_PRESENT /* See Note #1. */ 39 | #define HTTPs_SOCK_MODULE_PRESENT 40 | 41 | 42 | /* 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | * INCLUDE FILES 46 | ********************************************************************************************************* 47 | ********************************************************************************************************* 48 | */ 49 | 50 | #include 51 | #include 52 | 53 | #include "http-s.h" 54 | 55 | /* 56 | ********************************************************************************************************* 57 | ********************************************************************************************************* 58 | * FUNCTION PROTOTYPES 59 | ********************************************************************************************************* 60 | ********************************************************************************************************* 61 | */ 62 | 63 | NET_SOCK_ID HTTPsSock_ListenInit (const HTTPs_CFG *p_cfg, 64 | NET_SOCK_PROTOCOL_FAMILY family, 65 | HTTPs_ERR *p_err); 66 | 67 | void HTTPsSock_ListenClose ( HTTPs_INSTANCE *p_instance, 68 | NET_SOCK_ID sock_listen_id); 69 | 70 | NET_SOCK_QTY HTTPsSock_ConnSel ( HTTPs_INSTANCE *p_instance, 71 | CPU_BOOLEAN accept); 72 | 73 | CPU_BOOLEAN HTTPsSock_ConnDataRx ( HTTPs_INSTANCE *p_instance, 74 | HTTPs_CONN *p_conn); 75 | 76 | CPU_BOOLEAN HTTPsSock_ConnDataTx ( HTTPs_INSTANCE *p_instance, 77 | HTTPs_CONN *p_conn); 78 | 79 | void HTTPsSock_ConnClose ( HTTPs_INSTANCE *p_instance, 80 | HTTPs_CONN *p_conn); 81 | 82 | 83 | /* 84 | ********************************************************************************************************* 85 | ********************************************************************************************************* 86 | * MODULE END 87 | ********************************************************************************************************* 88 | ********************************************************************************************************* 89 | */ 90 | 91 | #endif /* HTTPs_SOCK_MODULE_PRESENT */ 92 | -------------------------------------------------------------------------------- /Server/Source/http-s_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP SERVER STRING MODULE 21 | * 22 | * Filename : http-s_str.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | * 32 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 33 | * inclusion through use of the HTTPs module present pre-processor macro definition. 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef HTTPs_STR_MODULE_PRESENT /* See Note #1. */ 39 | #define HTTPs_STR_MODULE_PRESENT 40 | 41 | 42 | /* 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | * INCLUDE FILES 46 | ********************************************************************************************************* 47 | ********************************************************************************************************* 48 | */ 49 | 50 | #include 51 | #include 52 | 53 | #include "http-s.h" 54 | 55 | /* 56 | ********************************************************************************************************* 57 | ********************************************************************************************************* 58 | * FUNCTION PROTOTYPES 59 | ********************************************************************************************************* 60 | ********************************************************************************************************* 61 | */ 62 | 63 | #if ((HTTPs_CFG_FORM_EN == DEF_ENABLED) && \ 64 | (HTTPs_CFG_FORM_MULTIPART_EN == DEF_ENABLED)) 65 | CPU_BOOLEAN HTTPs_StrPathFormat ( CPU_CHAR *p_filename, 66 | CPU_CHAR *p_folder, 67 | CPU_CHAR *p_path_dst, 68 | CPU_SIZE_T path_len_max, 69 | CPU_CHAR path_sep); 70 | #endif 71 | 72 | #if (HTTPs_CFG_ABSOLUTE_URI_EN == DEF_ENABLED) 73 | CPU_CHAR *HTTPs_StrPathGet ( CPU_CHAR *p_path, 74 | CPU_INT16U path_len_max, 75 | CPU_CHAR *p_host, 76 | CPU_INT16U host_len_max, 77 | CPU_BOOLEAN *p_resp_location); 78 | #endif 79 | 80 | #if ((HTTPs_CFG_FORM_EN == DEF_ENABLED) && \ 81 | (HTTPs_CFG_FORM_MULTIPART_EN == DEF_ENABLED)) 82 | CPU_CHAR *HTTPs_StrMemSrch (const CPU_CHAR *p_data, 83 | CPU_INT32U data_len, 84 | const CPU_CHAR *p_str, 85 | CPU_INT32U str_len); 86 | #endif 87 | 88 | 89 | /* 90 | ********************************************************************************************************* 91 | ********************************************************************************************************* 92 | * MODULE END 93 | ********************************************************************************************************* 94 | ********************************************************************************************************* 95 | */ 96 | 97 | #endif /* HTTPs_STR_MODULE_PRESENT */ 98 | -------------------------------------------------------------------------------- /Server/Source/http-s_task.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/HTTP 4 | * Hypertext Transfer Protocol 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * HTTP SERVER TASK MODULE 21 | * 22 | * Filename : http-s_task.h 23 | * Version : V3.01.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | * 32 | * Note(s) : (1) This main network protocol suite header file is protected from multiple pre-processor 33 | * inclusion through use of the HTTPs module present pre-processor macro definition. 34 | ********************************************************************************************************* 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef HTTPs_TASK_MODULE_PRESENT /* See Note #1. */ 39 | #define HTTPs_TASK_MODULE_PRESENT 40 | 41 | 42 | /* 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | * INCLUDE FILES 46 | ********************************************************************************************************* 47 | ********************************************************************************************************* 48 | */ 49 | 50 | #include 51 | #include 52 | #include 53 | 54 | #include "http-s.h" 55 | 56 | 57 | /* 58 | ********************************************************************************************************* 59 | ********************************************************************************************************* 60 | * FUNCTION PROTOTYPES 61 | ********************************************************************************************************* 62 | ********************************************************************************************************* 63 | */ 64 | 65 | KAL_LOCK_HANDLE HTTPsTask_LockCreate (HTTPs_ERR *p_err); 66 | 67 | void HTTPsTask_LockAcquire (KAL_LOCK_HANDLE os_lock_obj, 68 | HTTPs_ERR *p_err); 69 | 70 | void HTTPsTask_LockRelease (KAL_LOCK_HANDLE os_lock_obj); 71 | 72 | void HTTPsTask_InstanceObjInit (HTTPs_INSTANCE *p_instance, 73 | HTTPs_ERR *p_err); 74 | 75 | void HTTPsTask_InstanceTaskCreate (HTTPs_INSTANCE *p_instance, 76 | HTTPs_ERR *p_err); 77 | 78 | void HTTPsTask_InstanceTaskDel (HTTPs_INSTANCE *p_instance); 79 | 80 | void HTTPsTask_InstanceStopReqSignal (HTTPs_INSTANCE *p_instance, 81 | HTTPs_ERR *p_err); 82 | 83 | CPU_BOOLEAN HTTPsTask_InstanceStopReqPending (HTTPs_INSTANCE *p_instance); 84 | 85 | void HTTPsTask_InstanceStopCompletedSignal (HTTPs_INSTANCE *p_instance); 86 | 87 | void HTTPsTask_InstanceStopCompletedPending (HTTPs_INSTANCE *p_instance, 88 | HTTPs_ERR *p_err); 89 | 90 | void HTTPsTask_TimeDly_ms (CPU_INT32U time_dly_ms); 91 | 92 | 93 | /* 94 | ********************************************************************************************************* 95 | ********************************************************************************************************* 96 | * MODULE END 97 | ********************************************************************************************************* 98 | ********************************************************************************************************* 99 | */ 100 | 101 | #endif /* HTTPs_TASK_MODULE_PRESENT */ 102 | --------------------------------------------------------------------------------