- This example show how to initialize µC/HTTPsHTTP-server:
- Initialize uC/HTTPs HTTP-server module objects.
- Initialize a web server's instance
- Start the web server's instance.
- This example assumes the presence of µC/TCP-IP and µC/FS. It is assume also that all prerequisite modules have been initialized before starting to initialize µC/HTTPs and any web server instance.
- Prerequisite modules must be initialized before calling any uC/HTTPs functions.
Obviously before starting or trying to reach web server. The files must loaded in the file system to be able to get it using an HTTP client.
Prior to do any call to uC/HTTPs, the module must be initialized. This is done by calling HTTPs_Init(). If the process is successful, the Web server internal data structures are initialized.Each web server must be initialized before it can be started or stopped. HTTPs_InstanceInit() is responsible to allocate memory for the instance, initialize internal data structure and create the web server instance's task..
The first argument is the instance configuration, which should be modified following you requirements. The intance's configuration set the server's port, the number of connection that can be accepted, the hooks functions, etc.
- The uC/TCP-IP Network file system abstraction layer folder for traditional file system;
'$uC-TCPIP/FS/<fs>/net_<fs>.h'
NetFS_API_FS_V4
Once a web server instance is initialized, it can be started using HTTPs_InstanceStart() to become come accessible. This function start the web server instance's task. Each instance has is own task and all accepted connection is processed with this single task.
The second argument is the pointer to the File system port API. uC/HTTPs is using the API defined by the uC/TCP-IP Network file system abstraction layer to access the File system. The API structure can be found in:
The static file system API is located under uC/HTTPs File system folder;
'$uc-HTTPs/FS/Static/http-s_fs_static.h'HTTPs_FS_API_Static
...
- server and any web server instance.