2001-09-09 22:24:39 -04:00
|
|
|
/* httpp.h
|
|
|
|
**
|
|
|
|
** http parsing library
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __HTTPP_H
|
|
|
|
#define __HTTPP_H
|
|
|
|
|
2003-03-09 17:56:46 -05:00
|
|
|
#include <avl/avl.h>
|
2001-09-09 22:24:39 -04:00
|
|
|
|
|
|
|
#define HTTPP_VAR_PROTOCOL "__protocol"
|
|
|
|
#define HTTPP_VAR_VERSION "__version"
|
|
|
|
#define HTTPP_VAR_URI "__uri"
|
|
|
|
#define HTTPP_VAR_REQ_TYPE "__req_type"
|
2002-08-05 10:48:04 -04:00
|
|
|
#define HTTPP_VAR_ERROR_MESSAGE "__errormessage"
|
2002-08-16 10:22:44 -04:00
|
|
|
#define HTTPP_VAR_ERROR_CODE "__errorcode"
|
2003-03-07 23:57:02 -05:00
|
|
|
#define HTTPP_VAR_ICYPASSWORD "__icy_password"
|
2001-09-09 22:24:39 -04:00
|
|
|
|
|
|
|
typedef enum httpp_request_type_tag {
|
2003-03-14 21:10:19 -05:00
|
|
|
httpp_req_none, httpp_req_get, httpp_req_post, httpp_req_head,
|
|
|
|
httpp_req_source, httpp_req_play, httpp_req_stats, httpp_req_unknown
|
2001-09-09 22:24:39 -04:00
|
|
|
} httpp_request_type_e;
|
|
|
|
|
|
|
|
typedef struct http_var_tag {
|
2003-03-14 21:10:19 -05:00
|
|
|
char *name;
|
|
|
|
char *value;
|
2001-09-09 22:24:39 -04:00
|
|
|
} http_var_t;
|
|
|
|
|
|
|
|
typedef struct http_varlist_tag {
|
2003-03-14 21:10:19 -05:00
|
|
|
http_var_t var;
|
|
|
|
struct http_varlist_tag *next;
|
2001-09-09 22:24:39 -04:00
|
|
|
} http_varlist_t;
|
|
|
|
|
|
|
|
typedef struct http_parser_tag {
|
2003-03-14 21:10:19 -05:00
|
|
|
httpp_request_type_e req_type;
|
|
|
|
char *uri;
|
|
|
|
avl_tree *vars;
|
|
|
|
avl_tree *queryvars;
|
2001-09-09 22:24:39 -04:00
|
|
|
} http_parser_t;
|
|
|
|
|
2003-07-06 21:49:27 -04:00
|
|
|
#ifdef _mangle
|
|
|
|
# define httpp_create_parser _mangle(httpp_create_parser)
|
|
|
|
# define httpp_initialize _mangle(httpp_initialize)
|
|
|
|
# define httpp_parse _mangle(httpp_parse)
|
|
|
|
# define httpp_parse_icy _mangle(httpp_parse_icy)
|
|
|
|
# define httpp_parse_response _mangle(httpp_parse_response)
|
|
|
|
# define httpp_setvar _mangle(httpp_setvar)
|
|
|
|
# define httpp_getvar _mangle(httpp_getvar)
|
|
|
|
# define httpp_set_query_param _mangle(httpp_set_query_param)
|
|
|
|
# define httpp_get_query_param _mangle(httpp_get_query_param)
|
|
|
|
# define httpp_destroy _mangle(httpp_destroy)
|
|
|
|
# define httpp_clear _mangle(httpp_clear)
|
|
|
|
#endif
|
|
|
|
|
2001-09-09 22:24:39 -04:00
|
|
|
http_parser_t *httpp_create_parser(void);
|
|
|
|
void httpp_initialize(http_parser_t *parser, http_varlist_t *defaults);
|
|
|
|
int httpp_parse(http_parser_t *parser, char *http_data, unsigned long len);
|
2003-03-07 23:57:02 -05:00
|
|
|
int httpp_parse_icy(http_parser_t *parser, char *http_data, unsigned long len);
|
2002-08-05 10:48:04 -04:00
|
|
|
int httpp_parse_response(http_parser_t *parser, char *http_data, unsigned long len, char *uri);
|
2001-09-09 22:24:39 -04:00
|
|
|
void httpp_setvar(http_parser_t *parser, char *name, char *value);
|
|
|
|
char *httpp_getvar(http_parser_t *parser, char *name);
|
2002-12-31 01:28:39 -05:00
|
|
|
void httpp_set_query_param(http_parser_t *parser, char *name, char *value);
|
|
|
|
char *httpp_get_query_param(http_parser_t *parser, char *name);
|
2001-09-09 22:24:39 -04:00
|
|
|
void httpp_destroy(http_parser_t *parser);
|
2002-05-03 11:04:56 -04:00
|
|
|
void httpp_clear(http_parser_t *parser);
|
2001-09-09 22:24:39 -04:00
|
|
|
|
|
|
|
#endif
|