-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphp_script.h
More file actions
80 lines (62 loc) · 1.84 KB
/
php_script.h
File metadata and controls
80 lines (62 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
$Author = Sargis Ananyan;
$Corp = RedM Inc;
$Web = https://redm.pro/;
$Lincese = BSD 3;
$Name = mLang;
$Description = A programming language for web programming.;
*/
#pragma once
//C interface
#ifdef __cplusplus
#include <cstring>
extern "C" {
#else
#include <string.h>
#endif
/** http_query_data **/
typedef struct {
char *uri, *get, *headers, *post, *request_method;
int uri_len, get_len, headers_len, post_len, request_method_len;
int keep_alive;
unsigned int ip;
unsigned int port;
} http_query_data;
http_query_data *http_query_data_create (const char *qUri, int qUriLen, const char *qGet, int qGetLen, const char *qHeaders,
int qHeadersLen, const char *qPost, int qPostLen, const char *request_method, int keep_alive, unsigned int ip, unsigned int port);
void http_query_data_free (http_query_data *d);
/** rpc_query_data **/
typedef struct {
int *data, len;
long long req_id;
/** PID **/
unsigned ip;
short port;
short pid;
int utime;
} rpc_query_data;
rpc_query_data *rpc_query_data_create (int *data, int len, long long req_id, unsigned int ip, short port, short pid, int utime);
void rpc_query_data_free (rpc_query_data *d);
/** php_query_data **/
typedef struct {
http_query_data *http_data;
rpc_query_data *rpc_data;
} php_query_data;
php_query_data *php_query_data_create (http_query_data *http_data, rpc_query_data *rpc_data);
void php_query_data_free (php_query_data *d);
/** script_t **/
typedef struct {
void (*run) (php_query_data *, void *mem, size_t mem_size);
void (*clear) (void);
} script_t;
script_t *get_script (const char *name);
void set_script (const char *name, void (*run)(php_query_data *, void *, size_t), void (*clear) (void));
/** script result **/
typedef struct {
int return_code, exit_code;
const char *headers, *body;
int headers_len, body_len;
} script_result;
#ifdef __cplusplus
}
#endif