1 | /** |
---|
2 | * @file rtems/rtems-shttpd.h |
---|
3 | */ |
---|
4 | |
---|
5 | #ifndef _rtems_rtems_webserver_h |
---|
6 | #define _rtems_rtems_webserver_h |
---|
7 | |
---|
8 | #ifdef HAVE_CONFIG_H |
---|
9 | #include "config.h" |
---|
10 | #endif |
---|
11 | |
---|
12 | #include "shttpd.h" |
---|
13 | |
---|
14 | #include <rtems.h> |
---|
15 | #include <sys/socket.h> |
---|
16 | #include <netinet/in.h> |
---|
17 | #include <dirent.h> |
---|
18 | #include <arpa/inet.h> |
---|
19 | |
---|
20 | /* RTEMS is an Real Time Embedded operating system, for operation in hardware. |
---|
21 | It does not have SSL or CGI support, as it does not have dynamic library |
---|
22 | loading or sub-processes. */ |
---|
23 | #define EMBEDDED |
---|
24 | #define NO_SSL |
---|
25 | #define NO_CGI |
---|
26 | |
---|
27 | #define DIRSEP '/' |
---|
28 | #define IS_DIRSEP_CHAR(c) ((c) == '/') |
---|
29 | #define O_BINARY 0 |
---|
30 | #define closesocket(a) close(a) |
---|
31 | #define ERRNO errno |
---|
32 | |
---|
33 | /* RTEMS version is Thread Safe */ |
---|
34 | #define InitializeCriticalSection(x) rtems_semaphore_create( \ |
---|
35 | rtems_build_name('H','T','P','X'), \ |
---|
36 | 1, /* Not Held Yet.*/ \ |
---|
37 | RTEMS_FIFO | \ |
---|
38 | RTEMS_BINARY_SEMAPHORE, \ |
---|
39 | 0, \ |
---|
40 | x); |
---|
41 | #define EnterCriticalSection(x) rtems_semaphore_obtain(*(x),RTEMS_WAIT,RTEMS_NO_TIMEOUT) |
---|
42 | #define LeaveCriticalSection(x) rtems_semaphore_release(*(x)) |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | #ifdef __cplusplus |
---|
47 | extern "C" { |
---|
48 | #endif |
---|
49 | |
---|
50 | typedef void (*rtems_shttpd_addpages)(struct shttpd_ctx *ctx); |
---|
51 | typedef void (*rtems_shttpd_init)(void); |
---|
52 | |
---|
53 | rtems_status_code rtems_initialize_webserver(rtems_task_priority initial_priority, |
---|
54 | size_t stack_size, |
---|
55 | rtems_mode initial_modes, |
---|
56 | rtems_attribute attribute_set, |
---|
57 | rtems_shttpd_init init_callback, |
---|
58 | rtems_shttpd_addpages addpages_callback, |
---|
59 | char *webroot, |
---|
60 | unsigned int port |
---|
61 | ); |
---|
62 | void rtems_terminate_webserver(void); |
---|
63 | int rtems_webserver_ok(void); |
---|
64 | |
---|
65 | #ifdef __cplusplus |
---|
66 | } |
---|
67 | #endif |
---|
68 | #endif |
---|