Main Page
Data Structures
Files
File List
Globals
mcl_http_response.h
Go to the documentation of this file.
1
16
#ifndef MCL_HTTP_RESPONSE_H_
17
#define MCL_HTTP_RESPONSE_H_
18
19
#include "
mcl_core/mcl_core_common.h
"
20
#include "
mcl_core/mcl_list.h
"
21
22
#ifdef __cplusplus
23
extern
"C"
24
{
25
#endif
26
30
typedef
enum
E_MCL_HTTP_STATUS_CODE
31
{
32
MCL_HTTP_STATUS_CODE_UNKNOWN
= 0,
33
MCL_HTTP_STATUS_CODE_CONTINUE
= 100,
34
MCL_HTTP_STATUS_CODE_SUCCESS
= 200,
35
MCL_HTTP_STATUS_CODE_CREATED
= 201,
36
MCL_HTTP_STATUS_CODE_PARTIAL_CONTENT
= 206,
37
MCL_HTTP_STATUS_CODE_MOVED_PERMANENTLY
= 301,
38
MCL_HTTP_STATUS_CODE_USE_PROXY
= 305,
39
MCL_HTTP_STATUS_CODE_BAD_REQUEST
= 400,
40
MCL_HTTP_STATUS_CODE_UNAUTHORIZED
= 401,
41
MCL_HTTP_STATUS_CODE_FORBIDDEN
= 403,
42
MCL_HTTP_STATUS_CODE_NOT_FOUND
= 404,
43
MCL_HTTP_STATUS_CODE_METHOD_NOT_ALLOWED
= 405,
44
MCL_HTTP_STATUS_CODE_PROXY_AUTH_REQUIRED
= 407,
45
MCL_HTTP_STATUS_CODE_REQUEST_TIMEOUT
= 408,
46
MCL_HTTP_STATUS_CODE_CONFLICT
= 409,
47
MCL_HTTP_STATUS_CODE_PRECONDITION_FAILED
= 412,
48
MCL_HTTP_STATUS_CODE_PAYLOAD_TOO_LARGE
= 413,
49
MCL_HTTP_RESULT_CODE_TOO_MANY_REQUESTS
= 429,
50
MCL_HTTP_STATUS_CODE_INTERNAL_SERVER_ERR
= 500,
51
MCL_HTTP_STATUS_CODE_NOT_IMPLEMENTED
= 501,
52
MCL_HTTP_STATUS_CODE_BAD_GATEWAY
= 502,
53
MCL_HTTP_STATUS_CODE_SERVICE_UNAVAILABLE
= 503,
54
MCL_HTTP_STATUS_CODE_GATEWAY_TIMEOUT
= 504,
55
MCL_HTTP_STATUS_CODE_HTTP_VERSION_NOT_SUPPORTED
= 505
56
}
E_MCL_HTTP_STATUS_CODE
;
57
63
typedef
struct
mcl_http_response_t
64
{
65
mcl_list_t
*
header
;
66
mcl_uint8_t
*
payload
;
67
mcl_size_t
payload_size
;
68
E_MCL_HTTP_STATUS_CODE
status_code
;
69
}
mcl_http_response_t
;
70
86
extern
MCL_CORE_EXPORT
mcl_error_t
mcl_http_response_initialize
(
mcl_list_t
*
header
,
mcl_uint8_t
*
payload
,
mcl_size_t
payload_size
,
E_MCL_HTTP_STATUS_CODE
status_code
,
mcl_http_response_t
**http_response);
87
102
extern
MCL_CORE_EXPORT
mcl_error_t
mcl_http_response_get_header
(
mcl_http_response_t
*http_response,
const
char
*header_name,
char
**header_value);
103
110
extern
MCL_CORE_EXPORT
mcl_error_t
mcl_http_response_get_status
(
mcl_http_response_t
*http_response);
111
117
extern
MCL_CORE_EXPORT
void
mcl_http_response_destroy
(
mcl_http_response_t
**http_response);
118
119
#ifdef __cplusplus
120
}
121
#endif
122
123
#endif
MCL_HTTP_STATUS_CODE_PAYLOAD_TOO_LARGE
Actual code : 413.
Definition:
mcl_http_response.h:48
MCL_HTTP_STATUS_CODE_NOT_IMPLEMENTED
Actual code : 501.
Definition:
mcl_http_response.h:51
mcl_http_response_t::header
mcl_list_t * header
Header of http response.
Definition:
mcl_http_response.h:65
mcl_size_t
size_t mcl_size_t
Definition:
mcl_core_common.h:25
MCL_HTTP_STATUS_CODE_BAD_GATEWAY
Actual code : 502.
Definition:
mcl_http_response.h:52
mcl_http_response_t::status_code
E_MCL_HTTP_STATUS_CODE status_code
Status code of http response.
Definition:
mcl_http_response.h:68
mcl_http_response_t::payload_size
mcl_size_t payload_size
Payload size of http response.
Definition:
mcl_http_response.h:67
mcl_http_response_t
Definition:
mcl_http_response.h:63
MCL_HTTP_STATUS_CODE_METHOD_NOT_ALLOWED
Actual code : 405.
Definition:
mcl_http_response.h:43
mcl_http_response_initialize
MCL_CORE_EXPORT mcl_error_t mcl_http_response_initialize(mcl_list_t *header, mcl_uint8_t *payload, mcl_size_t payload_size, E_MCL_HTTP_STATUS_CODE status_code, mcl_http_response_t **http_response)
Definition:
http_response.c:17
mcl_error_t
mcl_int32_t mcl_error_t
Definition:
mcl_core_common.h:36
MCL_HTTP_STATUS_CODE_CONTINUE
Actual code : 100.
Definition:
mcl_http_response.h:33
MCL_HTTP_STATUS_CODE_UNAUTHORIZED
Actual code : 401.
Definition:
mcl_http_response.h:40
MCL_HTTP_RESULT_CODE_TOO_MANY_REQUESTS
Actual code : 429.
Definition:
mcl_http_response.h:49
MCL_HTTP_STATUS_CODE_PARTIAL_CONTENT
Actual code : 206.
Definition:
mcl_http_response.h:36
MCL_HTTP_STATUS_CODE_NOT_FOUND
Actual code : 404.
Definition:
mcl_http_response.h:42
MCL_HTTP_STATUS_CODE_INTERNAL_SERVER_ERR
Actual code : 500.
Definition:
mcl_http_response.h:50
MCL_HTTP_STATUS_CODE_CONFLICT
Actual code : 409.
Definition:
mcl_http_response.h:46
MCL_HTTP_STATUS_CODE_UNKNOWN
Unknown status code.
Definition:
mcl_http_response.h:32
mcl_list.h
List module interface header file.
MCL_HTTP_STATUS_CODE_MOVED_PERMANENTLY
Actual code : 301.
Definition:
mcl_http_response.h:37
MCL_HTTP_STATUS_CODE_REQUEST_TIMEOUT
Actual code : 408.
Definition:
mcl_http_response.h:45
mcl_http_response_t::payload
mcl_uint8_t * payload
Payload of http response.
Definition:
mcl_http_response.h:66
MCL_HTTP_STATUS_CODE_HTTP_VERSION_NOT_SUPPORTED
Actual code : 505.
Definition:
mcl_http_response.h:55
mcl_uint8_t
uint8_t mcl_uint8_t
Definition:
mcl_core_common.h:30
MCL_CORE_EXPORT
#define MCL_CORE_EXPORT
Definition:
mcl_config_setup.h:38
mcl_http_response_get_status
MCL_CORE_EXPORT mcl_error_t mcl_http_response_get_status(mcl_http_response_t *http_response)
Definition:
http_response.c:105
mcl_list_t
Definition:
mcl_list.h:35
MCL_HTTP_STATUS_CODE_USE_PROXY
Actual code : 305.
Definition:
mcl_http_response.h:38
MCL_HTTP_STATUS_CODE_PROXY_AUTH_REQUIRED
Actual code : 407.
Definition:
mcl_http_response.h:44
MCL_HTTP_STATUS_CODE_GATEWAY_TIMEOUT
Actual code : 504.
Definition:
mcl_http_response.h:54
MCL_HTTP_STATUS_CODE_FORBIDDEN
Actual code : 403.
Definition:
mcl_http_response.h:41
MCL_HTTP_STATUS_CODE_SUCCESS
Actual code : 200.
Definition:
mcl_http_response.h:34
mcl_http_response_destroy
MCL_CORE_EXPORT void mcl_http_response_destroy(mcl_http_response_t **http_response)
Definition:
http_response.c:174
mcl_http_response_get_header
MCL_CORE_EXPORT mcl_error_t mcl_http_response_get_header(mcl_http_response_t *http_response, const char *header_name, char **header_value)
Definition:
http_response.c:44
MCL_HTTP_STATUS_CODE_PRECONDITION_FAILED
Actual code : 412.
Definition:
mcl_http_response.h:47
MCL_HTTP_STATUS_CODE_BAD_REQUEST
Actual code : 400.
Definition:
mcl_http_response.h:39
MCL_HTTP_STATUS_CODE_SERVICE_UNAVAILABLE
Actual code : 503.
Definition:
mcl_http_response.h:53
mcl_core_common.h
Common module interface header file.
MCL_HTTP_STATUS_CODE_CREATED
Actual code : 201.
Definition:
mcl_http_response.h:35
E_MCL_HTTP_STATUS_CODE
E_MCL_HTTP_STATUS_CODE
Definition:
mcl_http_response.h:30
mcl_core
include
mcl_core
mcl_http_response.h
Generated by
1.8.11