AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch_rest_nginx.h
Go to the documentation of this file.
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++23 standard
3 Copyright (C) 2026 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <https://www.gnu.org/licenses/>.
19*/
20#ifndef ANCH_REST_NGINX_H
21#define ANCH_REST_NGINX_H
22
36
37#include <stddef.h>
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
44#define ANCH_REST_NGINX_ABI_VERSION 2u
45
47#define ANCH_REST_APPLICATION_SYMBOL "anch_rest_application"
48
50#define ANCH_REST_READ_ERROR ((size_t) -1)
51
53#define ANCH_REST_UNKNOWN_LENGTH (-1LL)
54
56typedef struct {
58 const char* data;
60 size_t len;
62
70
72typedef struct {
74 void* ctx;
75
86 size_t (*read)(void* ctx, char* data, size_t size);
88
104
106typedef struct {
108 void* ctx;
109
112
125 int (*start)(void* ctx, unsigned int status, const anch_rest_header_t* headers, size_t headers_count,
126 long long content_length);
127
137 size_t (*write)(void* ctx, const char* data, size_t len);
139
141typedef struct {
143 unsigned int abi_version;
144
154 void* (*create)(const char* config, char* error, size_t error_size);
155
161 void (*destroy)(void* app);
162
174 int (*handle)(void* app, const anch_rest_request_t* request, const anch_rest_response_writer_t* writer);
176
178typedef const anch_rest_application_t* (*anch_rest_application_fn)(void);
179
180#ifdef __cplusplus
181}
182#endif
183
184#endif // ANCH_REST_NGINX_H
Definition anch_rest_nginx.h:141
void(*) destroy(void *app)
Definition anch_rest_nginx.h:161
int(*) handle(void *app, const anch_rest_request_t *request, const anch_rest_response_writer_t *writer)
Definition anch_rest_nginx.h:174
unsigned int abi_version
Definition anch_rest_nginx.h:143
Definition anch_rest_nginx.h:72
void * ctx
Definition anch_rest_nginx.h:74
size_t(*) read(void *ctx, char *data, size_t size)
Definition anch_rest_nginx.h:86
Definition anch_rest_nginx.h:64
anch_rest_str_t value
Definition anch_rest_nginx.h:68
anch_rest_str_t name
Definition anch_rest_nginx.h:66
Definition anch_rest_nginx.h:90
size_t headers_count
Definition anch_rest_nginx.h:98
int has_body
Definition anch_rest_nginx.h:100
anch_rest_str_t target
Definition anch_rest_nginx.h:94
const anch_rest_header_t * headers
Definition anch_rest_nginx.h:96
anch_rest_body_reader_t body
Definition anch_rest_nginx.h:102
anch_rest_str_t method
Definition anch_rest_nginx.h:92
Definition anch_rest_nginx.h:106
size_t(*) write(void *ctx, const char *data, size_t len)
Definition anch_rest_nginx.h:137
int(*) start(void *ctx, unsigned int status, const anch_rest_header_t *headers, size_t headers_count, long long content_length)
Definition anch_rest_nginx.h:125
void * ctx
Definition anch_rest_nginx.h:108
size_t buffer_size
Definition anch_rest_nginx.h:111
Definition anch_rest_nginx.h:56
size_t len
Definition anch_rest_nginx.h:60
const char * data
Definition anch_rest_nginx.h:58