#include <h2_utils.hpp>
|
| static int | sendConnectionHeader (struct ClientSessionData *clientSessData) |
| |
| static int | sessionOnReceived (struct ClientSessionData *clientSessData) |
| |
| static struct ClientSessionData * | createClientSessionData (struct ApplicationContext *appCtx, int sock, struct sockaddr *clientAddress, int addressLength) |
| |
| static string | bytesToString (const unsigned char *data, size_t firstIndex, size_t secondIndex) |
| |
| static ulong | hexToUlong (string hexString) |
| |
| static void | sendGetResponse (struct ClientSessionData *clientSessData, const unsigned char *data, string path) |
| |
| static string | resolvePath (struct ClientSessionData *clientSessData, string path) |
| |
| static void | getResponse200 (struct ClientSessionData *clientSessData, const unsigned char *data, string filepath) |
| |
| static void | getResponse404 (struct ClientSessionData *clientSessData, const unsigned char *data) |
| |
| static void | deleteClientSessionData (struct ClientSessionData *clientSessData) |
| |
◆ bytesToString()
| string h2_utils::bytesToString |
( |
const unsigned char * |
data, |
|
|
size_t |
firstIndex, |
|
|
size_t |
secondIndex |
|
) |
| |
|
static |
Converts bytes from unsigned char* to string
- Parameters
-
| data | - bytes to be converted |
| firstIndex | - Index to start reading from |
| secondIndex | - Index after the last to byte to be read |
- Returns
- string - from bytes
◆ createClientSessionData()
Creates a clientSessionData object which keeps all to be used for one single connection.
- Parameters
-
| appCtx | - Application-wide application_ctx object. |
| sock | - file descriptor for the connection |
| clientAddress | - socket address of the client. |
| addressLength | - length of socket address. |
- Returns
- clientSessData - the newly created
◆ deleteClientSessionData()
◆ getResponse200()
| void h2_utils::getResponse200 |
( |
struct ClientSessionData * |
clientSessData, |
|
|
const unsigned char * |
data, |
|
|
string |
filepath |
|
) |
| |
|
static |
Responds to get request with html, js or css file, and status: 200.
- Parameters
-
| clientSessData | - ClientSessionData, used to respond to correct client |
| data | - pointer to array containing request |
| filepath | - where the requested file is located |
◆ getResponse404()
| void h2_utils::getResponse404 |
( |
struct ClientSessionData * |
clientSessData, |
|
|
const unsigned char * |
data |
|
) |
| |
|
static |
Sends a status: 404 Not Found response
- Parameters
-
| clientSessData | - ClientSessionData, used to respond to correct client |
| data | - pointer to array containing request |
◆ hexToUlong()
| ulong h2_utils::hexToUlong |
( |
string |
hexString | ) |
|
|
static |
Convert hexString to ulong
- Parameters
-
| hexString | - hexString to be converted |
- Returns
- ulong
◆ resolvePath()
| string h2_utils::resolvePath |
( |
struct ClientSessionData * |
clientSessData, |
|
|
string |
path |
|
) |
| |
|
static |
Resolves user-defined routes, and returns the filepath in publicDir
- Parameters
-
- Returns
- string - filepath in publicDir
◆ sendConnectionHeader()
Sends server connection header with 'MAXIMUM_CONCURRENT_STREAMS' set to 100.
- Parameters
-
- Returns
- returnValue - 0 if successful, non-zero if failure.
◆ sendGetResponse()
| void h2_utils::sendGetResponse |
( |
struct ClientSessionData * |
clientSessData, |
|
|
const unsigned char * |
data, |
|
|
string |
path |
|
) |
| |
|
static |
Send a get response when recieving a request
- Parameters
-
| ClientSessData | - ClientSessionData |
| data | - pointer to array with the request |
| path | - where to find requested resource |
◆ sessionOnReceived()
Gets called every time a frame is recieved from a client
- Parameters
-
- Returns
- 0 if successful, non-zero if failure
The documentation for this class was generated from the following files: