|
Packit Service |
102f81 |
/* httpp.h
|
|
Packit Service |
102f81 |
**
|
|
Packit Service |
102f81 |
** http parsing library
|
|
Packit Service |
102f81 |
**
|
|
Packit Service |
102f81 |
** This program is distributed under the GNU General Public License, version 2.
|
|
Packit Service |
102f81 |
** A copy of this license is included with this source.
|
|
Packit Service |
102f81 |
*/
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
#ifndef __HTTPP_H
|
|
Packit Service |
102f81 |
#define __HTTPP_H
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
#include <avl/avl.h>
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
#define HTTPP_VAR_PROTOCOL "__protocol"
|
|
Packit Service |
102f81 |
#define HTTPP_VAR_VERSION "__version"
|
|
Packit Service |
102f81 |
#define HTTPP_VAR_URI "__uri"
|
|
Packit Service |
102f81 |
#define HTTPP_VAR_RAWURI "__rawuri"
|
|
Packit Service |
102f81 |
#define HTTPP_VAR_REQ_TYPE "__req_type"
|
|
Packit Service |
102f81 |
#define HTTPP_VAR_ERROR_MESSAGE "__errormessage"
|
|
Packit Service |
102f81 |
#define HTTPP_VAR_ERROR_CODE "__errorcode"
|
|
Packit Service |
102f81 |
#define HTTPP_VAR_ICYPASSWORD "__icy_password"
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
typedef enum httpp_request_type_tag {
|
|
Packit Service |
102f81 |
httpp_req_none, httpp_req_get, httpp_req_post, httpp_req_head,
|
|
Packit Service |
102f81 |
httpp_req_source, httpp_req_play, httpp_req_stats, httpp_req_unknown
|
|
Packit Service |
102f81 |
} httpp_request_type_e;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
typedef struct http_var_tag {
|
|
Packit Service |
102f81 |
char *name;
|
|
Packit Service |
102f81 |
char *value;
|
|
Packit Service |
102f81 |
} http_var_t;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
typedef struct http_varlist_tag {
|
|
Packit Service |
102f81 |
http_var_t var;
|
|
Packit Service |
102f81 |
struct http_varlist_tag *next;
|
|
Packit Service |
102f81 |
} http_varlist_t;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
typedef struct http_parser_tag {
|
|
Packit Service |
102f81 |
httpp_request_type_e req_type;
|
|
Packit Service |
102f81 |
char *uri;
|
|
Packit Service |
102f81 |
avl_tree *vars;
|
|
Packit Service |
102f81 |
avl_tree *queryvars;
|
|
Packit Service |
102f81 |
} http_parser_t;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
#ifdef _mangle
|
|
Packit Service |
102f81 |
# define httpp_create_parser _mangle(httpp_create_parser)
|
|
Packit Service |
102f81 |
# define httpp_initialize _mangle(httpp_initialize)
|
|
Packit Service |
102f81 |
# define httpp_parse _mangle(httpp_parse)
|
|
Packit Service |
102f81 |
# define httpp_parse_icy _mangle(httpp_parse_icy)
|
|
Packit Service |
102f81 |
# define httpp_parse_response _mangle(httpp_parse_response)
|
|
Packit Service |
102f81 |
# define httpp_setvar _mangle(httpp_setvar)
|
|
Packit Service |
102f81 |
# define httpp_getvar _mangle(httpp_getvar)
|
|
Packit Service |
102f81 |
# define httpp_set_query_param _mangle(httpp_set_query_param)
|
|
Packit Service |
102f81 |
# define httpp_get_query_param _mangle(httpp_get_query_param)
|
|
Packit Service |
102f81 |
# define httpp_destroy _mangle(httpp_destroy)
|
|
Packit Service |
102f81 |
# define httpp_clear _mangle(httpp_clear)
|
|
Packit Service |
102f81 |
#endif
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
http_parser_t *httpp_create_parser(void);
|
|
Packit Service |
102f81 |
void httpp_initialize(http_parser_t *parser, http_varlist_t *defaults);
|
|
Packit Service |
102f81 |
int httpp_parse(http_parser_t *parser, char *http_data, unsigned long len);
|
|
Packit Service |
102f81 |
int httpp_parse_icy(http_parser_t *parser, char *http_data, unsigned long len);
|
|
Packit Service |
102f81 |
int httpp_parse_response(http_parser_t *parser, char *http_data, unsigned long len, char *uri);
|
|
Packit Service |
102f81 |
void httpp_setvar(http_parser_t *parser, const char *name, const char *value);
|
|
Packit Service |
102f81 |
char *httpp_getvar(http_parser_t *parser, const char *name);
|
|
Packit Service |
102f81 |
void httpp_set_query_param(http_parser_t *parser, char *name, char *value);
|
|
Packit Service |
102f81 |
char *httpp_get_query_param(http_parser_t *parser, char *name);
|
|
Packit Service |
102f81 |
void httpp_destroy(http_parser_t *parser);
|
|
Packit Service |
102f81 |
void httpp_clear(http_parser_t *parser);
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
#endif
|