diff options
Diffstat (limited to 'include/response.h')
-rwxr-xr-x | include/response.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/include/response.h b/include/response.h new file mode 100755 index 0000000..e4242a5 --- /dev/null +++ b/include/response.h @@ -0,0 +1,50 @@ +#ifndef _RESPONSE_H_ +#define _RESPONSE_H_ + +enum ResponseStatus { + SUCCESS = 10, + CONTENT_UNCHANGED = 11, + + PERMANENT_REDIRECT = 20, + TEMPORARY_REDIRECT = 21, + + MALFORMED_REQUEST = 30, + INVALID_REQUEST = 31, + NOT_AVAILABLE = 32, + + INTERNAL_ERROR = 40, + NOT_SUPPORTED = 41, + SLOW_DOWN = 42, + + CLIENT_CERTIFICATE_REQUIRED = 50 +}; + +struct mime_type { + char *type; + char *subtype; +}; + +struct response { + enum ResponseStatus status; + char *message; + struct mime_type type; + unsigned int length; + char *hash; + char *content; +}; + +/** + * Parses a string into a `struct response`. + */ +int parse_response(struct response *res, char *s); + +/** + * Deallocates `struct response *res`. + */ +void free_response(struct response *res); + +enum ResponseError { + INVALID_STATUS = -1, + UNKNOWN_KEY = -2, +}; +#endif |