Code Review
/
src
/
app-framework-binder.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
changing the license to apache 2
[src/app-framework-binder.git]
/
include
/
afb-req-itf.h
diff --git
a/include/afb-req-itf.h
b/include/afb-req-itf.h
index
a9b768d
..
357ffd7
100644
(file)
--- a/
include/afb-req-itf.h
+++ b/
include/afb-req-itf.h
@@
-15,20
+15,23
@@
* limitations under the License.
*/
* limitations under the License.
*/
+#pragma once
+
struct json_object;
struct afb_arg {
const char *name;
const char *value;
struct json_object;
struct afb_arg {
const char *name;
const char *value;
- size_t size;
- int is_file;
+ const char *path;
};
struct afb_req_itf {
};
struct afb_req_itf {
+ struct json_object *(*json)(void *data);
struct afb_arg (*get)(void *data, const char *name);
struct afb_arg (*get)(void *data, const char *name);
- void (*iterate)(void *data, int (*iterator)(void *closure, struct afb_arg arg), void *closure);
- void (*fail)(void *data, const char *status, const char *info);
void (*success)(void *data, struct json_object *obj, const char *info);
void (*success)(void *data, struct json_object *obj, const char *info);
+ void (*fail)(void *data, const char *status, const char *info);
+ const char *(*raw)(void *data, size_t *size);
+ void (*send)(void *data, char *buffer, size_t size);
int (*session_create)(void *data);
int (*session_check)(void *data, int refresh);
void (*session_close)(void *data);
int (*session_create)(void *data);
int (*session_check)(void *data, int refresh);
void (*session_close)(void *data);
@@
-37,7
+40,7
@@
struct afb_req_itf {
struct afb_req {
const struct afb_req_itf *itf;
void *data;
struct afb_req {
const struct afb_req_itf *itf;
void *data;
- void *context;
+ void *
*
context;
};
static inline struct afb_arg afb_req_get(struct afb_req req, const char *name)
};
static inline struct afb_arg afb_req_get(struct afb_req req, const char *name)
@@
-45,19
+48,24
@@
static inline struct afb_arg afb_req_get(struct afb_req req, const char *name)
return req.itf->get(req.data, name);
}
return req.itf->get(req.data, name);
}
-static inline const char *afb_req_
argument
(struct afb_req req, const char *name)
+static inline const char *afb_req_
value
(struct afb_req req, const char *name)
{
return afb_req_get(req, name).value;
}
{
return afb_req_get(req, name).value;
}
-static inline
int afb_req_is_argument_file
(struct afb_req req, const char *name)
+static inline
const char *afb_req_path
(struct afb_req req, const char *name)
{
{
- return afb_req_get(req, name).
is_file
;
+ return afb_req_get(req, name).
path
;
}
}
-static inline
void afb_req_iterate(struct afb_req req, int (*iterator)(void *closure, struct afb_arg arg), void *closure
)
+static inline
struct json_object *afb_req_json(struct afb_req req
)
{
{
- req.itf->iterate(req.data, iterator, closure);
+ return req.itf->json(req.data);
+}
+
+static inline void afb_req_success(struct afb_req req, struct json_object *obj, const char *info)
+{
+ req.itf->success(req.data, obj, info);
}
static inline void afb_req_fail(struct afb_req req, const char *status, const char *info)
}
static inline void afb_req_fail(struct afb_req req, const char *status, const char *info)
@@
-65,9
+73,14
@@
static inline void afb_req_fail(struct afb_req req, const char *status, const ch
req.itf->fail(req.data, status, info);
}
req.itf->fail(req.data, status, info);
}
-static inline
void afb_req_success(struct afb_req req, struct json_object *obj, const char *info
)
+static inline
const char *afb_req_raw(struct afb_req req, size_t *size
)
{
{
- req.itf->success(req.data, obj, info);
+ return req.itf->raw(req.data, size);
+}
+
+static inline void afb_req_send(struct afb_req req, char *buffer, size_t size)
+{
+ req.itf->send(req.data, buffer, size);
}
static inline int afb_req_session_create(struct afb_req req)
}
static inline int afb_req_session_create(struct afb_req req)