windows crappy tools dont know __func__
[platform/upstream/libwebsockets.git] / test-server / test-server.h
1 #include "lws_config.h"
2
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <getopt.h>
6 #include <signal.h>
7 #include <string.h>
8 #include <sys/stat.h>
9 #include <fcntl.h>
10 #include <assert.h>
11
12 #include "../lib/libwebsockets.h"
13
14 #ifdef _WIN32
15 #include <io.h>
16 #ifdef EXTERNAL_POLL
17 #define poll WSAPoll
18 #endif
19 #include "gettimeofday.h"
20 #else
21 #include <syslog.h>
22 #include <sys/time.h>
23 #include <unistd.h>
24 #endif
25
26 extern int close_testing;
27 extern int max_poll_elements;
28
29 #ifdef EXTERNAL_POLL
30 extern struct libwebsocket_pollfd *pollfds;
31 extern int *fd_lookup;
32 extern int count_pollfds;
33 #endif
34 extern volatile int force_exit;
35 extern struct libwebsocket_context *context;
36 extern char *resource_path;
37
38 #ifndef __func__
39 #define __func__ __FUNCTION__
40 #endif
41
42 struct per_session_data__http {
43         int fd;
44 };
45
46 /*
47  * one of these is auto-created for each connection and a pointer to the
48  * appropriate instance is passed to the callback in the user parameter
49  *
50  * for this example protocol we use it to individualize the count for each
51  * connection.
52  */
53
54 struct per_session_data__dumb_increment {
55         int number;
56 };
57
58 struct per_session_data__lws_mirror {
59         struct libwebsocket *wsi;
60         int ringbuffer_tail;
61 };
62
63 extern int callback_http(struct libwebsocket_context *context,
64                          struct libwebsocket *wsi,
65                          enum libwebsocket_callback_reasons reason,
66                          void *user, void *in, size_t len);
67 extern int callback_lws_mirror(struct libwebsocket_context *context,
68                                struct libwebsocket *wsi,
69                                enum libwebsocket_callback_reasons reason,
70                                void *user, void *in, size_t len);
71 extern int callback_dumb_increment(struct libwebsocket_context *context,
72                                struct libwebsocket *wsi,
73                                enum libwebsocket_callback_reasons reason,
74                                void *user, void *in, size_t len);
75
76 extern void
77 dump_handshake_info(struct libwebsocket *wsi);