#include <Server/Source/http-s.h>
#include <FS/uC-FS-V4/net_fs_v4.h> /* See Note #4. */
CPU_BOOLEAN AppHTTPsInit (void)
{
HTTPs_INSTANCE *p_https_instance;
HTTPs_ERR http_err;
/* Prerequisites modules must be initialized prior calling any of the following functions. See Note #1. */
/* Make sure File System (such as uC/FS) is initialized before starting the instance. See Note #2. */
/* Make sure Files that must serve by the web server is loaded in the file system. See Note #2. */
/* -------------- INITALIZE HTTPS MODULE -------------- */
HTTPs_Init(DEF_NULL, &http_err); /* See Note #3. */
if (http_err != HTTPs_ERR_NONE) {
return (DEF_FAIL);
}
/* ---------- INITALIZE WEB SERVER INSTANCE ----------- */
p_https_instance = HTTPs_InstanceInit(&HTTPs_CfgInstance, /* Instance configuration. See Note #4a. */
&HTTPs_TaskCfgInstance, /* Task Instance configuration. See Note #4b. */
&http_err);
if (http_err != HTTPs_ERR_NONE) {
return (DEF_FAIL);
}
/* ------------ START WEB SERVER INSTANCE ------------- */
HTTPs_InstanceStart(p_https_instance, /* Instance handle. See Note #5. */
&http_err);
if (http_err != HTTPs_ERR_NONE) {
return (DEF_FAIL);
}
return (DEF_OK);
} |