jf-framework
Loading...
Searching...
No Matches
http.h File Reference
#include <export.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for http.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  HttpRequest
struct  HttpResponse

Enumerations

enum  HttpStatus {
  HTTP_CONTINUE = 100 , HTTP_SWITCHING_PROTOCOLS = 101 , HTTP_PROCESSING = 102 , HTTP_OK = 200 ,
  HTTP_CREATED = 201 , HTTP_ACCEPTED = 202 , HTTP_NO_CONTENT = 204 , HTTP_PARTIAL_CONTENT = 206 ,
  HTTP_MULTIPLE_CHOICES = 300 , HTTP_MOVED_PERMANENTLY = 301 , HTTP_FOUND = 302 , HTTP_SEE_OTHER = 303 ,
  HTTP_NOT_MODIFIED = 304 , HTTP_TEMPORARY_REDIRECT = 307 , HTTP_PERMANENT_REDIRECT = 308 , HTTP_BAD_REQUEST = 400 ,
  HTTP_UNAUTHORIZED = 401 , HTTP_FORBIDDEN = 403 , HTTP_NOT_FOUND = 404 , HTTP_METHOD_NOT_ALLOWED = 405 ,
  HTTP_REQUEST_TIMEOUT = 408 , HTTP_CONFLICT = 409 , HTTP_GONE = 410 , HTTP_LENGTH_REQUIRED = 411 ,
  HTTP_PAYLOAD_TOO_LARGE = 413 , HTTP_UNSUPPORTED_MEDIA_TYPE = 415 , HTTP_TOO_MANY_REQUESTS = 429 , HTTP_INTERNAL_SERVER_ERROR = 500 ,
  HTTP_NOT_IMPLEMENTED = 501 , HTTP_BAD_GATEWAY = 502 , HTTP_SERVICE_UNAVAILABLE = 503 , HTTP_GATEWAY_TIMEOUT = 504 ,
  HTTP_VERSION_NOT_SUPPORTED = 505
}

Functions

uint32_t jf_ParseHttpRequest (HttpRequest *httpRequest, const char *buffer, size_t length)
 Parses the HTTP request.
void jf_InitHttpResponse (HttpResponse *response)
 Initializes response struct.
uint32_t jf_SendHttpResponse (int32_t sockfd, const HttpResponse *response)
 Sends HTTP response.
 __attribute__ ((visibility("default"))) void jf_Send(HttpResponse *httpResponse

Variables

const char * contentType
const char const char * body
const char const char HttpStatus status
const char * string
const char * path
const char * html
const char * json
const char * destination
const char * key
const char * name
const char const char * value

Detailed Description

Author
Avis

Function Documentation

◆ jf_InitHttpResponse()

void jf_InitHttpResponse ( HttpResponse * response)

Initializes response struct.

Author
Avis
Here is the caller graph for this function:

◆ jf_ParseHttpRequest()

uint32_t jf_ParseHttpRequest ( HttpRequest * httpRequest,
const char * buffer,
size_t length )

Parses the HTTP request.

Authors
Avis, victor
Parameters
httpRequestHTTP request struct output param
bufferRaw buffer
lengthLength of raw buffer
Returns
0 if failure in parsing packet
Here is the caller graph for this function:

◆ jf_SendHttpResponse()

uint32_t jf_SendHttpResponse ( int32_t sockfd,
const HttpResponse * response )

Sends HTTP response.

Author
Avis
Returns
Returns 0 on failure, 1 on success
Here is the caller graph for this function: