Typedefs | |
| typedef struct hp_transaction_tag | hp_transaction_s |
| typedef struct hp_header_field_tag | hp_header_field_s |
| typedef enum hp_role_tag | hp_role_e |
| typedef enum hp_parse_result_tag | hp_parse_result_e |
Enumerations | |
| enum | hp_role_tag { HP_ROLE_CLIENT = 0, HP_ROLE_SERVER } |
| enum | hp_parse_result_tag { HP_PARSE_OK = 0, HP_PARSE_ERROR, HP_PARSE_INCOMPLETE } |
Functions | |
| hp_transaction_s * | hp_create_transaction (const hp_role_e role) |
| Initialise a blank HTTP transaction. | |
| void | hp_transaction_free (hp_transaction_s *transaction) |
| Free a HTTP transaction. | |
| bool | hp_add_data (hp_transaction_s *transaction, const char *data, const size_t dataLen) |
| Call when you want to add data to a transaction. | |
| hp_parse_result_e | hp_parse_data (hp_transaction_s *transaction) |
| Parse the message buffered. | |
| const char * | hp_get_host (hp_transaction_s *transaction) |
| Return the host if given. | |
| unsigned short int | hp_get_host_port (const hp_transaction_s *transaction) |
| Returns the parsed host port (default of HTTP_DEFAULT_PORT if none given). | |
| http_method_e | hp_get_method (const hp_transaction_s *transaction) |
| Gets the method of the request. | |
| size_t | hp_get_raw_bytes (hp_transaction_s *transaction, char *buffer, const size_t bufferLen) |
| Gets the raw bytes from the transaction. | |
| size_t | hp_get_number_raw_bytes (const hp_transaction_s *transaction) |
| Returns how much raw data there is. | |
| bool | hp_set_header_field_value (const hp_transaction_s *transaction, const char *value) |
| Sets a header field value. | |
| typedef struct hp_header_field_tag hp_header_field_s |
| typedef enum hp_parse_result_tag hp_parse_result_e |
| typedef enum hp_role_tag hp_role_e |
| typedef struct hp_transaction_tag hp_transaction_s |
| enum hp_parse_result_tag |
| enum hp_role_tag |
| bool hp_add_data | ( | hp_transaction_s * | transaction, | |
| const char * | data, | |||
| const size_t | dataLen | |||
| ) |
Call when you want to add data to a transaction.
| transaction | The transaction to add data to. | |
| data | The data to add. | |
| dataLen | The length of the data to add. |
true on success. On error, false is returned. | hp_transaction_s* hp_create_transaction | ( | const hp_role_e | role | ) |
Initialise a blank HTTP transaction.
It must be freed with http_free_transaction().
| role | The role the parser will take. |
| const char* hp_get_host | ( | hp_transaction_s * | transaction | ) |
Return the host if given.
The hostname will not exceed HTTP_LIMIT_HOSTNAME_LENGTH.
already "cached"
| unsigned short int hp_get_host_port | ( | const hp_transaction_s * | transaction | ) |
Returns the parsed host port (default of HTTP_DEFAULT_PORT if none given).
| transaction | The transaction to return from. |
| http_method_e hp_get_method | ( | const hp_transaction_s * | transaction | ) |
Gets the method of the request.
| transaction | The transaction to return from. |
| size_t hp_get_number_raw_bytes | ( | const hp_transaction_s * | transaction | ) |
Returns how much raw data there is.
| transaction | The transaction to check if there is unread data on. |
| size_t hp_get_raw_bytes | ( | hp_transaction_s * | transaction, | |
| char * | buffer, | |||
| const size_t | bufferLen | |||
| ) |
Gets the raw bytes from the transaction.
| transaction | The raw bytes to return. | |
| buffer | The buffer to write to. | |
| bufferLen | The maximum size of buffer. |
| hp_parse_result_e hp_parse_data | ( | hp_transaction_s * | transaction | ) |
Parse the message buffered.
| transaction | The transaction to parse. |
true on success. On error, false is returned. | bool hp_set_header_field_value | ( | const hp_transaction_s * | transaction, | |
| const char * | value | |||
| ) |
| void hp_transaction_free | ( | hp_transaction_s * | transaction | ) |
Free a HTTP transaction.
| transaction | The transaction to free. |
1.6.2