#include <stdint.h>
#include <stddef.h>
#include <zephyr/sys/iterable_sections.h>
Go to the source code of this file.
|
#define | HTTP_RESOURCE_DEFINE(_name, _service, _resource, _detail) |
| Define a static HTTP resource.
|
|
#define | HTTP_SERVICE_DEFINE_EMPTY(_name, _host, _port, _concurrent, _backlog, _detail) __z_http_service_define(_name, _host, _port, _concurrent, _backlog, _detail, NULL, NULL) |
| Define an HTTP service without static resources.
|
|
#define | HTTP_SERVICE_DEFINE(_name, _host, _port, _concurrent, _backlog, _detail) |
| Define an HTTP service with static resources.
|
|
#define | HTTP_SERVICE_COUNT(_dst) STRUCT_SECTION_COUNT(http_service_desc, _dst) |
| Count the number of HTTP services.
|
|
#define | HTTP_SERVICE_RESOURCE_COUNT(_service) ((_service)->res_end - (_service)->res_begin) |
| Count HTTP service static resources.
|
|
#define | HTTP_SERVICE_FOREACH(_it) STRUCT_SECTION_FOREACH(http_service_desc, _it) |
| Iterate over all HTTP services.
|
|
#define | HTTP_RESOURCE_FOREACH(_service, _it) STRUCT_SECTION_FOREACH_ALTERNATE(http_resource_desc_##_service, http_resource_desc, _it) |
| Iterate over static HTTP resources associated with a given _service .
|
|
#define | HTTP_SERVICE_FOREACH_RESOURCE(_service, _it) |
| Iterate over all static resources associated with _service .
|
|
◆ HTTP_RESOURCE_DEFINE
#define HTTP_RESOURCE_DEFINE |
( |
|
_name, |
|
|
|
_service, |
|
|
|
_resource, |
|
|
|
_detail |
|
) |
| |
Value:
_name) = { \
.resource = _resource, \
.detail = (_detail), \
}
#define STRUCT_SECTION_ITERABLE_ALTERNATE(secname, struct_type, varname)
Defines a new element of alternate data type for an iterable section.
Definition: iterable_sections.h:188
Define a static HTTP resource.
A static HTTP resource is one that is known prior to system initialization. In contrast, dynamic resources may be discovered upon system initialization. Dynamic resources may also be inserted, or removed by events originating internally or externally to the system at runtime.
- Note
- The
_resource
is the URL without the associated protocol, host, or URL parameters. E.g. the resource for http://www.foo.com/bar/baz.html#param1=value1
would be /bar/baz.html
. It is often referred to as the "path" of the URL. Every (service, resource)
pair should be unique. The _resource
must be non-NULL.
- Parameters
-
_name | Name of the resource. |
_service | Name of the associated service. |
_resource | Pathname-like string identifying the resource. |
_detail | Implementation-specific detail associated with the resource. |
◆ HTTP_RESOURCE_FOREACH
Iterate over static HTTP resources associated with a given _service
.
- Note
- This macro requires that
_service
is defined with HTTP_SERVICE_DEFINE.
- Parameters
-
◆ HTTP_SERVICE_COUNT
Count the number of HTTP services.
- Parameters
-
[out] | _dst | Pointer to location where result is written. |
◆ HTTP_SERVICE_DEFINE
#define HTTP_SERVICE_DEFINE |
( |
|
_name, |
|
|
|
_host, |
|
|
|
_port, |
|
|
|
_concurrent, |
|
|
|
_backlog, |
|
|
|
_detail |
|
) |
| |
Value:
__z_http_service_define(_name, _host, _port, _concurrent, _backlog, _detail, \
&_CONCAT(_http_resource_desc_##_name, _list_start)[0], \
&_CONCAT(_http_resource_desc_##_name, _list_end)[0])
Define an HTTP service with static resources.
- Note
- The
_host
parameter must be non-NULL
. It is used to specify an IP address either in IPv4 or IPv6 format a fully-qualified hostname or a virtual host.
-
The
_port
parameter must be non-NULL
. It points to a location that specifies the port number to use for the service. If the specified port number is zero, then an ephemeral port number will be used and the actual port number assigned will be written back to memory. For ephemeral port numbers, the memory pointed to by _port
must be writeable.
- Parameters
-
| _name | Name of the service. |
| _host | IP address or hostname associated with the service. |
[in,out] | _port | Pointer to port associated with the service. |
| _concurrent | Maximum number of concurrent clients. |
| _backlog | Maximum number queued connections. |
| _detail | Implementation-specific detail associated with the service. |
◆ HTTP_SERVICE_DEFINE_EMPTY
#define HTTP_SERVICE_DEFINE_EMPTY |
( |
|
_name, |
|
|
|
_host, |
|
|
|
_port, |
|
|
|
_concurrent, |
|
|
|
_backlog, |
|
|
|
_detail |
|
) |
| __z_http_service_define(_name, _host, _port, _concurrent, _backlog, _detail, NULL, NULL) |
Define an HTTP service without static resources.
- Note
- The
_host
parameter must be non-NULL
. It is used to specify an IP address either in IPv4 or IPv6 format a fully-qualified hostname or a virtual host.
-
The
_port
parameter must be non-NULL
. It points to a location that specifies the port number to use for the service. If the specified port number is zero, then an ephemeral port number will be used and the actual port number assigned will be written back to memory. For ephemeral port numbers, the memory pointed to by _port
must be writeable.
- Parameters
-
| _name | Name of the service. |
| _host | IP address or hostname associated with the service. |
[in,out] | _port | Pointer to port associated with the service. |
| _concurrent | Maximum number of concurrent clients. |
| _backlog | Maximum number queued connections. |
| _detail | Implementation-specific detail associated with the service. |
◆ HTTP_SERVICE_FOREACH
Iterate over all HTTP services.
- Parameters
-
◆ HTTP_SERVICE_FOREACH_RESOURCE
#define HTTP_SERVICE_FOREACH_RESOURCE |
( |
|
_service, |
|
|
|
_it |
|
) |
| |
Value:
__ASSERT(_it <= (_service)->res_end, "unexpected list end location"); \
_it < (_service)->res_end; \
}); \
_it++)
Iterate over all static resources associated with _service
.
- Note
- This macro is suitable for a
_service
defined with either HTTP_SERVICE_DEFINE or HTTP_SERVICE_DEFINE_EMPTY.
- Parameters
-
◆ HTTP_SERVICE_RESOURCE_COUNT
#define HTTP_SERVICE_RESOURCE_COUNT |
( |
|
_service | ) |
((_service)->res_end - (_service)->res_begin) |
Count HTTP service static resources.
- Parameters
-
_service | Pointer to a service. |