KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
parser.h File Reference
#include <keel/allocator.h>
#include <keel/request.h>
Include dependency graph for parser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  KlRequestParser
 
struct  KlResponseParser
 

Macros

#define kl_parser_llhttp   kl_request_parser_llhttp
 Backward compatibility alias for kl_request_parser_llhttp.
 

Typedefs

typedef struct KlRequestParser KlRequestParser
 
typedef KlRequestParser KlParser
 Backward compatibility — existing code can use the old name.
 
typedef struct KlClientResponse KlClientResponse
 
typedef struct KlResponseParser KlResponseParser
 
typedef KlResponseParser *(* KlResponseParserFactory) (size_t max_response_size, KlAllocator *alloc)
 Factory function for creating response parsers.
 

Enumerations

enum  KlParseResult { KL_PARSE_OK , KL_PARSE_INCOMPLETE , KL_PARSE_HEADERS_OK , KL_PARSE_ERROR }
 

Functions

KlRequestParserkl_request_parser_llhttp (KlAllocator *alloc)
 Create an llhttp-based HTTP/1.1 request parser.
 
KlResponseParserkl_response_parser_llhttp (size_t max_response_size, KlAllocator *alloc)
 Create an llhttp-based HTTP/1.1 response parser.
 

Macro Definition Documentation

◆ kl_parser_llhttp

#define kl_parser_llhttp   kl_request_parser_llhttp

Backward compatibility alias for kl_request_parser_llhttp.

Typedef Documentation

◆ KlRequestParser

◆ KlParser

Backward compatibility — existing code can use the old name.

◆ KlClientResponse

◆ KlResponseParser

◆ KlResponseParserFactory

typedef KlResponseParser *(* KlResponseParserFactory) (size_t max_response_size, KlAllocator *alloc)

Factory function for creating response parsers.

Enumeration Type Documentation

◆ KlParseResult

Enumerator
KL_PARSE_OK 

Full request/response parsed

KL_PARSE_INCOMPLETE 

Need more data

KL_PARSE_HEADERS_OK 

headers complete, body pending

KL_PARSE_ERROR 

Parse error

Function Documentation

◆ kl_request_parser_llhttp()

KlRequestParser * kl_request_parser_llhttp ( KlAllocator alloc)

Create an llhttp-based HTTP/1.1 request parser.

Parameters
allocAllocator for parser state.
Returns
Parser instance, or NULL on allocation failure.

◆ kl_response_parser_llhttp()

KlResponseParser * kl_response_parser_llhttp ( size_t  max_response_size,
KlAllocator alloc 
)

Create an llhttp-based HTTP/1.1 response parser.

Parameters
max_response_sizeMaximum response body size (0 = no limit).
allocAllocator for parser state.
Returns
Parser instance, or NULL on allocation failure.