summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Sergey Mironov <grrwlf@gmail.com>2014-02-26 08:21:52 +0000
committerGravatar Sergey Mironov <grrwlf@gmail.com>2014-02-26 08:21:52 +0000
commit4f43eb61c7218b1440e217b86c35a9317def94f0 (patch)
tree862a66aa60eaf19fe465d3f7a5e0830d69fb81f3 /include
parent1a679fb6adff73688ffd59a31f1847aca55e7525 (diff)
Define uw_loggers structure, allow FFI code to access it
Diffstat (limited to 'include')
-rw-r--r--include/urweb/request.h11
-rw-r--r--include/urweb/types_cpp.h6
-rw-r--r--include/urweb/urweb_cpp.h6
3 files changed, 15 insertions, 8 deletions
diff --git a/include/urweb/request.h b/include/urweb/request.h
index a1a7d78d..0b19e7f4 100644
--- a/include/urweb/request.h
+++ b/include/urweb/request.h
@@ -7,13 +7,13 @@
typedef struct uw_rc *uw_request_context;
-void uw_request_init(uw_app *app, void *logger_data, uw_logger log_error, uw_logger log_debug);
+void uw_request_init(uw_app *app, uw_loggers* ls);
void uw_sign(const char *in, char *out);
uw_request_context uw_new_request_context(void);
void uw_free_request_context(uw_request_context);
-request_result uw_request(uw_request_context, uw_context,
+request_result uw_request(uw_request_context rc, uw_context ctx,
char *method, char *path, char *query_string,
char *body, size_t body_len,
void (*on_success)(uw_context), void (*on_failure)(uw_context),
@@ -22,13 +22,12 @@ request_result uw_request(uw_request_context, uw_context,
int (*send)(int sockfd, const void *buf, ssize_t len),
int (*close)(int fd));
-uw_context uw_request_new_context(int id, uw_app*, void *logger_data, uw_logger log_error, uw_logger log_debug);
+uw_context uw_request_new_context(int id, uw_app *app, uw_loggers *ls);
typedef struct {
uw_app *app;
- void *logger_data;
- uw_logger log_error, log_debug;
-} loggers;
+ uw_loggers *loggers;
+} pruner_data;
void *client_pruner(void *data);
diff --git a/include/urweb/types_cpp.h b/include/urweb/types_cpp.h
index cd80b0e7..0c431ff8 100644
--- a/include/urweb/types_cpp.h
+++ b/include/urweb/types_cpp.h
@@ -106,6 +106,12 @@ typedef struct {
int is_html5;
} uw_app;
+typedef struct {
+ /* uw_app *app; */
+ void *logger_data;
+ uw_logger log_error, log_debug;
+} uw_loggers;
+
#define ERROR_BUF_LEN 1024
typedef struct {
diff --git a/include/urweb/urweb_cpp.h b/include/urweb/urweb_cpp.h
index 1bb6b2f2..b016f038 100644
--- a/include/urweb/urweb_cpp.h
+++ b/include/urweb/urweb_cpp.h
@@ -14,13 +14,13 @@ void uw_global_init(void);
void uw_app_init(uw_app*);
void uw_client_connect(unsigned id, int pass, int sock,
- int (*send)(int sockfd, const void *buf, size_t len),
+ int (*send)(int sockfd, const void *buf, ssize_t len),
int (*close)(int fd),
void *logger_data, uw_logger log_error);
void uw_prune_clients(struct uw_context *);
failure_kind uw_initialize(struct uw_context *);
-struct uw_context * uw_init(int id, void *logger_data, uw_logger log_debug);
+struct uw_context * uw_init(int id, uw_loggers *lg);
void uw_close(struct uw_context *);
int uw_set_app(struct uw_context *, uw_app*);
uw_app *uw_get_app(struct uw_context *);
@@ -36,6 +36,8 @@ failure_kind uw_begin_init(struct uw_context *);
void uw_set_on_success(char *);
void uw_set_headers(struct uw_context *, char *(*get_header)(void *, const char *), void *get_header_data);
void uw_set_env(struct uw_context *, char *(*get_env)(void *, const char *), void *get_env_data);
+uw_loggers* uw_get_loggers(struct uw_context *ctx);
+uw_loggers* uw_get_loggers(struct uw_context *ctx);
failure_kind uw_begin(struct uw_context *, char *path);
void uw_ensure_transaction(struct uw_context *);
failure_kind uw_begin_onError(struct uw_context *, char *msg);