Plugin API: Export PLUGIN_TRACE macro function
[MonkeyD.git] / src / include / utils.h
blobcf7bdd1a5a564bd40887ff8cae20e2425e98982d
1 /* Monkey HTTP Daemon
2 * ------------------
3 * Copyright (C) 2001-2007, Eduardo Silva P.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef MK_UTILS_H
21 #define MK_UTILS_H
23 /* Defining TRUE and FALSE */
24 #include <sys/types.h>
25 #include <sys/stat.h>
26 #include <unistd.h>
27 #define TRUE 1
28 #define FALSE 0
30 /* Tipo de envio de datos en fdprintf(...) */
31 #define CHUNKED 0
32 #define NO_CHUNKED 1
34 #include "request.h"
35 #include "memory.h"
37 #ifdef TRACE
38 #define MK_TRACE(...) mk_utils_trace(__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
39 #define PLUGIN_TRACE(...) mk_api->trace(__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
40 #endif
42 /* utils.c */
43 int SendFile(int socket, struct client_request *cr, struct request *request);
44 int AccessFile(struct stat file);
45 int ExecFile(char *pathfile);
46 int hex2int(char *pChars);
47 char *strstr2(char *s, char *t);
49 mk_pointer PutDate_string(time_t date);
51 time_t PutDate_unix(char *date);
53 char *get_real_string(mk_pointer req_uri);
55 char *get_name_protocol(int remote_protocol);
57 char *m_build_buffer(char **buffer, unsigned long *len, const char *format,
58 ...);
60 int mk_buffer_cat(mk_pointer * p, char *buf1, char *buf2);
62 #define SYML_NOT -1
63 #define SYML_OK 0
64 #define SYML_VAR_OFF 1
65 #define SYML_ERR_NOTFOUND 2
66 #define SYML_ERR_FORBIDDEN 3
68 int Check_symlink(const char *path);
69 char *get_end_position(char *buf);
71 int mk_utils_set_daemon();
72 mk_pointer mk_utils_int2mkp(int n);
74 #ifdef TRACE
75 void mk_utils_trace(const char *function, char *file, int line, const char* format, ...);
76 #endif
78 #endif