summaryrefslogtreecommitdiff
path: root/src/protocol_decoder/http/http_entry.h
blob: 7d3b384b9a20cf06619d6539c34d624a99284647 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef _HTTP_ENTRY_H
#define _HTTP_ENTRY_H

#ifdef __cpluscplus
extern "C"
{
#endif

#include "session.h"

struct http_string
{
    char *str;
    size_t len;
};

struct http_request_line
{
    struct http_string method;
    struct http_string uri;
    struct http_string version;

    int major_version;
    int minor_version;
};

struct http_response_line
{
    struct http_string version;
    struct http_string status;

    int major_version;
    int minor_version;
    int status_code;
};

struct http_decoder;

/******************************************************************************
 * For HTTP consumer
 ******************************************************************************/

void http_session_get_request_line(struct stellar_session *http_session, struct http_request_line *line);
void http_session_get_response_line(struct stellar_session *http_session, struct http_response_line *line);

void http_session_get_request_raw_body(struct stellar_session *http_session, struct http_string *body);
void http_session_get_response_raw_body(struct stellar_session *http_session, struct http_string *body);

void http_session_get_request_decompress_body(struct stellar_session *http_session, struct http_string *body);
void http_session_get_response_decompress_body(struct stellar_session *http_session, struct http_string *body);

size_t http_session_get_request_header(struct stellar_session *http_session, struct http_string *header_key, struct http_string header_val[], size_t val_size);
size_t http_session_get_response_header(struct stellar_session *http_session, struct http_string *header_key, struct http_string header_val[], size_t val_size);

void http_session_iter_request_header(struct stellar_session *http_session, size_t *iter_index, struct http_string *header_key, struct http_string *header_val);
void http_session_iter_response_header(struct stellar_session *http_session, size_t *iter_index, struct http_string *header_key, struct http_string *header_val);

/******************************************************************************
 * For HTTP decoder
 ******************************************************************************/

void http_entry(struct stellar_session *tcp_session, const char *tcp_event, int thread_id);

/******************************************************************************
 * For gtest
 ******************************************************************************/

#ifdef __cpluscplus
}
#endif

#endif