cshiori  1
 全て クラス ファイル 関数 変数 列挙型 列挙値 マクロ定義 ページ
cshiori.h
[詳解]
1 
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string.h>
18 #include <math.h>
19 #include "bool.h"
20 
21 #ifndef CSHIORI_H
22 #define CSHIORI_H
23 
24 #define LF "\r\n"
25 #define LF_LEN 2
26 
31  NONE,
32  GET,
34 };
35 
39 #define CSHIORI_REQUEST_MESSAGE_REFERENCE_SIZE 100
40 
49  char *version;
50  /* common headers */
51  char *id;
52  char *sender;
53  char *charset;
56  char *status;
57  char *base_id;
58  /* all headers */
59  char **names;
60  char **values;
61  size_t header_size;
62 };
63 
67 #define CSHIORI_RESPONSE_MESSAGE_REFERENCE_SIZE 100
68 
75  short status_code;
76  char *version;
77  /* common headers */
78  char *value;
79  char *sender;
80  char *charset;
82 // char **names;
83 // char **values;
84 // size_t header_size;
85 };
86 
103 bool cshiori_load(const char* dirpath, bool (*load)(const char*));
104 
127 char* cshiori_request(char** const lines, const size_t lines_length, struct cshiori_response_message* (*request)(struct cshiori_request_message*, struct cshiori_response_message*));
128 
144 bool cshiori_unload(bool (*unload)(void));
145 
153 
160 
168 char* cshiori_request_message_get(struct cshiori_request_message* req, const char* const name);
169 
182 bool cshiori_request_message_set(struct cshiori_request_message* req, char* const name, char* const value);
183 
191 
198 
199 /*
200 void cshiori_response_message_get(struct cshiori_response_message* res, const char* const name);
201 
202 void cshiori_response_message_set(struct cshiori_response_message* res, const char* const name, const char* const value);
203 */
204 
208 #define CSHIORI_SHIORI_REQUEST_PARSE_HEADER_UNIT_SIZE 10
209 
217 struct cshiori_request_message* cshiori_shiori_request_parse(char** const lines, const size_t lines_length);
218 
225 char* cshiori_shiori_request_build(const struct cshiori_request_message* const req);
226 
233 char* cshiori_shiori_response_build(const struct cshiori_response_message* const res);
234 
241 
248 
249 #endif
enum cshiori_request_method method
Definition: cshiori.h:48
char * cshiori_shiori_request_build(const struct cshiori_request_message *const req)
SHIORI/3.x Requestをビルドします。
Definition: cshiori.c:218
struct cshiori_request_message * cshiori_request_message_new(void)
SHIORI/3.x Requestをmallocします。
Definition: cshiori.c:26
SHIORI_EXPORT bool SHIORI_CALL unload(void)
モジュール切り離し直前に呼ばれる
Definition: shiori.c:71
SHIORI/3.x Request.
Definition: cshiori.h:47
bool cshiori_request_message_set(struct cshiori_request_message *req, char *const name, char *const value)
SHIORI/3.x Requestのヘッダを設定します。
Definition: cshiori.c:73
Definition: cshiori.h:32
cshiori_request_method
SHIORI/3.x Request METHOD.
Definition: cshiori.h:30
char * charset
Definition: cshiori.h:53
char * base_id
Definition: cshiori.h:57
char * cshiori_shiori_response_build_internal_server_error()
SHIORI/3.x Response 500 Internal Server Errorをビルドします。
Definition: cshiori.c:345
char * version
Definition: cshiori.h:49
short status_code
Definition: cshiori.h:75
#define CSHIORI_REQUEST_MESSAGE_REFERENCE_SIZE
cshiori_request_message で配列参照可能なreferenceのサイズ
Definition: cshiori.h:39
char * cshiori_request_message_get(struct cshiori_request_message *req, const char *const name)
SHIORI/3.x Requestのヘッダを取得します。
Definition: cshiori.c:62
char * charset
Definition: cshiori.h:80
char * id
Definition: cshiori.h:51
char * security_level
Definition: cshiori.h:55
void cshiori_response_message_delete(struct cshiori_response_message *res)
SHIORI/3.x Responseをfreeします。
Definition: cshiori.c:113
SHIORI_EXPORT bool SHIORI_CALL load(const MEMORY_HANDLE h, long len)
モジュール読み込み直後に呼ばれる
Definition: shiori.c:16
char * reference[CSHIORI_REQUEST_MESSAGE_REFERENCE_SIZE]
Definition: cshiori.h:54
char * sender
Definition: cshiori.h:52
char * status
Definition: cshiori.h:56
SHIORI/3.x Response.
Definition: cshiori.h:74
char * cshiori_request(char **const lines, const size_t lines_length, struct cshiori_response_message *(*request)(struct cshiori_request_message *, struct cshiori_response_message *))
SHIORI/3.x request.
Definition: cshiori.c:7
char * cshiori_shiori_response_build_bad_request()
SHIORI/3.x Response 400 Bad Requestをビルドします。
Definition: cshiori.c:334
char ** names
Definition: cshiori.h:59
char * sender
Definition: cshiori.h:79
Definition: cshiori.h:31
char * version
Definition: cshiori.h:76
struct cshiori_request_message * cshiori_shiori_request_parse(char **const lines, const size_t lines_length)
SHIORI/3.x Requestをパースします。
Definition: cshiori.c:123
SHIORI_EXPORT MEMORY_HANDLE SHIORI_CALL request(const MEMORY_HANDLE h, long *len)
偽AIリクエスト
Definition: shiori.c:25
char * reference[CSHIORI_RESPONSE_MESSAGE_REFERENCE_SIZE]
Definition: cshiori.h:81
bool cshiori_unload(bool(*unload)(void))
SHIORI/3.x unload.
Definition: cshiori.c:22
bool cshiori_load(const char *dirpath, bool(*load)(const char *))
SHIORI/3.x load.
Definition: cshiori.c:3
void cshiori_request_message_delete(struct cshiori_request_message *req)
SHIORI/3.x Requestをfreeします。
Definition: cshiori.c:44
char ** values
Definition: cshiori.h:60
size_t header_size
Definition: cshiori.h:61
char * cshiori_shiori_response_build(const struct cshiori_response_message *const res)
SHIORI/3.x Responseをビルドします。
Definition: cshiori.c:275
#define CSHIORI_RESPONSE_MESSAGE_REFERENCE_SIZE
cshiori_response_message で配列参照可能なreferenceのサイズ
Definition: cshiori.h:67
char * value
Definition: cshiori.h:78
Definition: cshiori.h:33
struct cshiori_response_message * cshiori_response_message_new(void)
SHIORI/3.x Responseをmallocします。
Definition: cshiori.c:101