30 #pragma comment(lib, "ws2_32.lib") 32 #define WIN32_LEAN_AND_MEAN 43 #define snprintf _snprintf 44 #define vsnprintf _vsnprintf 45 #define strcasecmp stricmp 46 #define strncasecmp strnicmp 48 #define opendir nullhttpd_win32_opendir 49 #define closedir nullhttpd_win32_closedir 50 #define readdir nullhttpd_win32_readdir 51 #define seekdir nullhttpd_win32_seekdir 52 #define gettimeofday nullhttpd_win32_gettimeofday 53 #define sleep nullhttpd_win32_sleep 61 #include <arpa/inet.h> 62 #include <netinet/in.h> 63 #include <sys/resource.h> 64 #include <sys/socket.h> 66 #include <sys/types.h> 70 #ifdef NULLHTTPD_DYNAMIC 71 #ifdef NULLHTTPD_EXPORTS 72 #include <epicsExport.h> 76 #define NULLHTTPD_SHARE epicsShareExtern 78 #define NULLHTTPD_SHARE 83 #define APPTITLE "Null httpd" 84 #define DEFAULT_BASE_DIR "C:\\httpd" 86 #define DEFAULT_BASE_DIR "/usr/local/httpd" 88 #define SERVER_NAME "Null httpd 0.5.1" 90 #define MAX_POSTSIZE 33554432 91 #define MAX_REPLYSIZE 65536 94 #define S_IFMT _S_IFMT 95 #define S_IFDIR _S_IFDIR 96 #define S_IFCHR _S_IFCHR 97 #define S_IFIFO _S_IFIFO 98 #define S_IFREG _S_IFREG 99 #define S_IREAD _S_IREAD 100 #define S_IWRITE _S_IWRITE 101 #define S_IEXEC _S_IEXEC 102 #define S_IFLNK 0000000 103 #define S_IFSOCK 0000000 104 #define S_IFBLK 0000000 105 #define S_IROTH 0000004 106 #define S_IWOTH 0000002 107 #define S_IXOTH 0000001 108 #define S_ISDIR(x) (x & _S_IFDIR) 110 #define ATTRIBUTES (_A_RDONLY|_A_HIDDEN|_A_SYSTEM|_A_SUBDIR) 111 #define MAXNAMLEN 255 117 char d_name[MAXNAMLEN+1];
119 struct _dircontents {
121 struct _dircontents *_d_next;
123 typedef struct _dirdesc {
126 struct _dircontents *dd_contents;
127 struct _dircontents *dd_cp;
134 typedef HANDLE pthread_t;
135 typedef struct thread_attr {
137 DWORD dwCreatingFlag;
142 } pthread_condattr_t;
143 typedef unsigned int uint;
148 typedef CRITICAL_SECTION pthread_mutex_t;
152 char config_filename[255];
153 char server_base_dir[255];
154 char server_bin_dir[255];
155 char server_cgi_dir[255];
156 char server_etc_dir[255];
157 char server_htdocs_dir[255];
158 char server_hostname[64];
166 char in_Connection[16];
168 char in_ContentType[128];
169 char in_Cookie[1024];
171 char in_IfModifiedSince[64];
172 char in_PathInfo[128];
173 char in_Protocol[16];
174 char in_QueryString[1024];
175 char in_Referer[128];
176 char in_RemoteAddr[16];
178 char in_RequestMethod[8];
179 char in_RequestURI[1024];
180 char in_ScriptName[128];
181 char in_UserAgent[128];
184 char out_CacheControl[16];
185 char out_Connection[16];
188 char out_Expires[64];
189 char out_LastModified[64];
191 char out_Protocol[16];
192 char out_Server[128];
193 char out_ContentType[128];
203 unsigned long int id;
209 struct sockaddr_in ClientAddr;
241 unsigned sleep(
unsigned seconds);
242 DIR *opendir(
const char *);
243 void closedir(DIR *);
244 #define rewinddir(dirp) seekdir(dirp, 0L) 245 void seekdir(DIR *,
long);
247 struct direct *readdir(DIR *);
248 int gettimeofday(
struct timeval *tv,
struct timezone *tz);
250 int get_reg_entries(
void);
252 #define pthread_mutex_init(A,B) InitializeCriticalSection(A) 253 #define pthread_mutex_lock(A) (EnterCriticalSection(A),0) 254 #define pthread_mutex_unlock(A) LeaveCriticalSection(A) 255 #define pthread_mutex_destroy(A) DeleteCriticalSection(A) 256 #define pthread_handler_decl(A,B) unsigned __cdecl A(void *B) 257 #define pthread_self() GetCurrentThreadId() 258 typedef unsigned (__cdecl *pthread_handler)(
void *);
259 int pthread_attr_init(pthread_attr_t *connect_att);
260 int pthread_attr_setstacksize(pthread_attr_t *connect_att,
DWORD stack);
261 int pthread_attr_setprio(pthread_attr_t *connect_att,
int priority);
262 int pthread_attr_destroy(pthread_attr_t *connect_att);
263 int pthread_create(pthread_t *thread_id, pthread_attr_t *attr,
unsigned (__stdcall *func)(
void * ),
void *param);
264 void pthread_exit(
unsigned A);
275 void swapchar(
char *
string,
char oldchar,
char newchar);
277 char *
strcatf(
char *dest,
const char *format, ...);
278 int printhex(
const char *format, ...);
279 int printht(
const char *format, ...);
285 void send_header(
int sid,
int cacheable,
int status,
char *title,
char *extra_header,
char *mime_type,
int length, time_t mod);
286 void send_fileheader(
int sid,
int cacheable,
int status,
char *title,
char *extra_header,
char *mime_type,
int length, time_t mod);
288 void logaccess(
int loglevel,
const char *format, ...);
289 void logerror(
const char *format, ...);
292 int prints(
const char *format, ...);
293 int sgets(
char *buffer,
int max,
int fd);
short int server_loglevel
Definition: nullhttpd.h:160
time_t ctime
Definition: nullhttpd.h:210
void logerror(const char *format,...)
Definition: nullhttpd_server.c:56
#define NULLHTTPD_SHARE
Definition: nullhttpd.h:78
char program_name[255]
Definition: nullhttpd.h:234
int hex2int(char *pChars)
Definition: nullhttpd_format.c:54
void send_fileheader(int sid, int cacheable, int status, char *title, char *extra_header, char *mime_type, int length, time_t mod)
Definition: nullhttpd_http.c:235
void send_header(int sid, int cacheable, int status, char *title, char *extra_header, char *mime_type, int length, time_t mod)
Definition: nullhttpd_http.c:200
name
Definition: makeDbAndEdl.py:232
void decodeurl(char *pEncoded)
Definition: nullhttpd_format.c:21
time_t atime
Definition: nullhttpd.h:211
unsigned long int id
Definition: nullhttpd.h:203
short int out_bodydone
Definition: nullhttpd.h:196
void logaccess(int loglevel, const char *format,...)
Definition: nullhttpd_server.c:29
Definition: restApi.cpp:78
char * get_mime_type(char *name)
Definition: nullhttpd_http.c:37
pthread_mutex_t Global
Definition: nullhttpd.h:231
int in
Definition: nullhttpd.h:220
short int server_port
Definition: nullhttpd.h:159
int printhex(const char *format,...)
Definition: nullhttpd_format.c:136
Definition: nullhttpd.h:151
void fixslashes(char *pOriginal)
Definition: nullhttpd_format.c:45
int socket
Definition: nullhttpd.h:207
int nullhttpd_getsid(void)
Definition: nullhttpd_server.c:82
short int out_flushed
Definition: nullhttpd.h:197
int closeconnect(int sid, int exitflag)
Definition: nullhttpd_server.c:246
pthread_t handle
Definition: nullhttpd.h:202
NULLHTTPD_SHARE void accept_loop(void *x)
Definition: nullhttpd_server.c:595
int read_header(int sid)
Definition: nullhttpd_http.c:119
int sgets(char *buffer, int max, int fd)
Definition: nullhttpd_server.c:209
void striprn(char *string)
Definition: nullhttpd_format.c:80
#define MAX_REPLYSIZE
Definition: nullhttpd.h:91
char * nullhttpd_strcasestr(const char *src, const char *query)
Definition: nullhttpd_format.c:95
char * PostData
Definition: nullhttpd.h:212
void ReadPOSTData(int sid)
Definition: nullhttpd_http.c:91
int prints(const char *format,...)
Definition: nullhttpd_server.c:188
short int server_maxidle
Definition: nullhttpd.h:162
short int out_headdone
Definition: nullhttpd.h:195
int sockinit(void)
Definition: nullhttpd_server.c:385
void server_shutdown()
Definition: nullhttpd_server.c:303
pthread_mutex_t Crypt
Definition: nullhttpd.h:230
void printerror(int sid, int status, char *title, char *text)
Definition: nullhttpd_http.c:23
Definition: nullhttpd.h:164
void swapchar(char *string, char oldchar, char newchar)
Definition: nullhttpd_format.c:87
int out_ContentLength
Definition: nullhttpd.h:186
string text
Definition: makeAdl.py:440
int in_ContentLength
Definition: nullhttpd.h:167
int config_read(void)
this dummy function is here to satisfy nullhttpd
Definition: ffmpegServer.cpp:160
Definition: nullhttpd.h:201
CONFIG config
Definition: nullhttpd.h:235
void flushbuffer(int sid)
Definition: nullhttpd_server.c:170
int printht(const char *format,...)
Definition: nullhttpd_format.c:157
NULLHTTPD_SHARE void init(void)
Definition: nullhttpd_server.c:487
CONNECTION * conn
Definition: nullhttpd.h:236
char * strcatf(char *dest, const char *format,...)
Definition: nullhttpd_format.c:123
int in_RemotePort
Definition: nullhttpd.h:177
short int server_maxconn
Definition: nullhttpd.h:161
Definition: nullhttpd.h:215
int x
Definition: makeAdl.py:438
CONNDATA * dat
Definition: nullhttpd.h:213
short int out_status
Definition: nullhttpd.h:183
#define max(x, y)
Definition: mar3xx_pck.c:32
void dorequest(int sid)
This is called whenever a client requests a stream.
Definition: ffmpegServer.cpp:39
pthread_mutex_t SQL
Definition: nullhttpd.h:232
#define DWORD
Definition: pco_structures.h:443
int out
Definition: nullhttpd.h:221