aisl-sdk/components/query.h

58 lines
1.2 KiB
C
Raw Normal View History

2019-04-09 13:23:40 +02:00
/******************************************************************************
*
* Copyright (c) 2017-2019 by Löwenware Ltd
* Please, refer LICENSE file for legal information
*
******************************************************************************/
/**
* @file query.h
* @author Ilja Kartašov <ik@lowenware.com>
* @brief HTTP POST/GET query stream parser header file
*
* @see https://lowenware.com/aisl
*/
#ifndef QUERY_H_9306EAEB_6DFC_4936_934A_6472F00E490C
#define QUERY_H_9306EAEB_6DFC_4936_934A_6472F00E490C
2019-04-09 13:23:40 +02:00
#include <stdint.h>
#include <stddef.h>
#include <aisl/aisl.h>
2019-04-09 13:23:40 +02:00
typedef int
(*AxQueryHandler)(const char *key, uint32_t k_len,
const char *val, uint32_t v_len,
void *p_ctx );
2019-04-09 13:23:40 +02:00
struct ax_query {
AxQueryHandler on_var;
void *p_ctx;
char *data;
size_t size;
size_t total;
char separator;
2019-04-09 13:23:40 +02:00
};
typedef struct ax_query * AxQuery;
2019-04-09 13:23:40 +02:00
AislStatus
ax_query_init(AxQuery query, size_t total, AxQueryHandler on_var, void *p_ctx);
2019-04-09 13:23:40 +02:00
void
ax_query_release(AxQuery query);
2019-04-09 13:23:40 +02:00
AislStatus
ax_query_feed(AxQuery query, const char *data, int32_t length);
2019-04-09 13:23:40 +02:00
void
ax_query__decode(char *e_str);
#endif /* !QUERY_H */