xref: /unit/go/nxt_cgo_lib.h (revision 1316:5b767c6bfd0a)
1 
2 /*
3  * Copyright (C) Max Romanov
4  * Copyright (C) NGINX, Inc.
5  */
6 
7 #ifndef _NXT_CGO_LIB_H_INCLUDED_
8 #define _NXT_CGO_LIB_H_INCLUDED_
9 
10 
11 #include <stdint.h>
12 #include <stdlib.h>
13 #include <sys/types.h>
14 
15 typedef struct {
16     int  length;
17     char  *start;
18 } nxt_cgo_str_t;
19 
20 int nxt_cgo_run(uintptr_t handler);
21 
22 int nxt_cgo_response_create(uintptr_t req, int code, int fields,
23     uint32_t fields_size);
24 
25 int nxt_cgo_response_add_field(uintptr_t req, uintptr_t name, uint8_t name_len,
26     uintptr_t value, uint32_t value_len);
27 
28 int nxt_cgo_response_send(uintptr_t req);
29 
30 ssize_t nxt_cgo_response_write(uintptr_t req, uintptr_t src, uint32_t len);
31 
32 ssize_t nxt_cgo_request_read(uintptr_t req, uintptr_t dst, uint32_t dst_len);
33 
34 int nxt_cgo_request_close(uintptr_t req);
35 
36 void nxt_cgo_request_done(uintptr_t req, int res);
37 
38 void nxt_cgo_warn(uintptr_t msg, uint32_t msg_len);
39 
40 #endif /* _NXT_CGO_LIB_H_INCLUDED_ */
41