Zephyr API Documentation
3.5.0
A Scalable Open Source RTOS
3.5.0
Toggle main menu visibility
Main Page
Related Pages
Modules
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
service.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2022 Meta
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_NET_HTTP_SERVICE_H_
8
#define ZEPHYR_INCLUDE_NET_HTTP_SERVICE_H_
9
10
#include <
stdint.h
>
11
#include <stddef.h>
12
13
#include <
zephyr/sys/iterable_sections.h
>
14
15
#ifdef __cplusplus
16
extern
"C"
{
17
#endif
18
19
struct
http_resource_desc
{
20
const
char
*
resource
;
21
void
*
detail
;
22
};
23
41
#define HTTP_RESOURCE_DEFINE(_name, _service, _resource, _detail) \
42
const STRUCT_SECTION_ITERABLE_ALTERNATE(http_resource_desc_##_service, http_resource_desc, \
43
_name) = { \
44
.resource = _resource, \
45
.detail = (_detail), \
46
}
47
48
struct
http_service_desc
{
49
const
char
*
host
;
50
uint16_t
*
port
;
51
void
*
detail
;
52
size_t
concurrent
;
53
size_t
backlog
;
54
struct
http_resource_desc
*
res_begin
;
55
struct
http_resource_desc
*
res_end
;
56
};
57
58
#define __z_http_service_define(_name, _host, _port, _concurrent, _backlog, _detail, _res_begin, \
59
_res_end) \
60
static const STRUCT_SECTION_ITERABLE(http_service_desc, _name) = { \
61
.host = _host, \
62
.port = (uint16_t *)(_port), \
63
.detail = (void *)(_detail), \
64
.concurrent = (_concurrent), \
65
.backlog = (_backlog), \
66
.res_begin = (_res_begin), \
67
.res_end = (_res_end), \
68
}
69
88
#define HTTP_SERVICE_DEFINE_EMPTY(_name, _host, _port, _concurrent, _backlog, _detail) \
89
__z_http_service_define(_name, _host, _port, _concurrent, _backlog, _detail, NULL, NULL)
90
109
#define HTTP_SERVICE_DEFINE(_name, _host, _port, _concurrent, _backlog, _detail) \
110
extern struct http_resource_desc _CONCAT(_http_resource_desc_##_name, _list_start)[]; \
111
extern struct http_resource_desc _CONCAT(_http_resource_desc_##_name, _list_end)[]; \
112
__z_http_service_define(_name, _host, _port, _concurrent, _backlog, _detail, \
113
&_CONCAT(_http_resource_desc_##_name, _list_start)[0], \
114
&_CONCAT(_http_resource_desc_##_name, _list_end)[0])
115
121
#define HTTP_SERVICE_COUNT(_dst) STRUCT_SECTION_COUNT(http_service_desc, _dst)
122
128
#define HTTP_SERVICE_RESOURCE_COUNT(_service) ((_service)->res_end - (_service)->res_begin)
129
135
#define HTTP_SERVICE_FOREACH(_it) STRUCT_SECTION_FOREACH(http_service_desc, _it)
136
145
#define HTTP_RESOURCE_FOREACH(_service, _it) \
146
STRUCT_SECTION_FOREACH_ALTERNATE(http_resource_desc_##_service, http_resource_desc, _it)
147
157
#define HTTP_SERVICE_FOREACH_RESOURCE(_service, _it) \
158
for (struct http_resource_desc *_it = (_service)->res_begin; ({ \
159
__ASSERT(_it <= (_service)->res_end, "unexpected list end location"
); \
160
_it < (_service)->res_end; \
161
}); \
162
_it++)
163
164
#ifdef __cplusplus
165
}
166
#endif
167
168
#endif
/* ZEPHYR_INCLUDE_NET_HTTP_SERVICE_H_ */
stdint.h
uint16_t
__UINT16_TYPE__ uint16_t
Definition:
stdint.h:89
http_resource_desc
Definition:
service.h:19
http_resource_desc::resource
const char * resource
Definition:
service.h:20
http_resource_desc::detail
void * detail
Definition:
service.h:21
http_service_desc
Definition:
service.h:48
http_service_desc::port
uint16_t * port
Definition:
service.h:50
http_service_desc::res_begin
struct http_resource_desc * res_begin
Definition:
service.h:54
http_service_desc::host
const char * host
Definition:
service.h:49
http_service_desc::res_end
struct http_resource_desc * res_end
Definition:
service.h:55
http_service_desc::detail
void * detail
Definition:
service.h:51
http_service_desc::concurrent
size_t concurrent
Definition:
service.h:52
http_service_desc::backlog
size_t backlog
Definition:
service.h:53
iterable_sections.h
zephyr
net
http
service.h
Generated on Fri Oct 20 2023 10:27:12 for Zephyr API Documentation by
1.9.6