HTTP-2-lib
h2_utils.hpp
Go to the documentation of this file.
1 // h2_utils.hpp
2 
3 #pragma once
4 #include <stddef.h>
5 #include <string>
6 #include "h2_structs.hpp"
7 
8 using namespace std;
9 
10 class h2_utils {
11 public:
12  static int sendConnectionHeader(struct ClientSessionData *clientSessData);
13  static int sessionOnReceived(struct ClientSessionData *clientSessData);
14  static struct ClientSessionData *createClientSessionData(struct ApplicationContext *appCtx, int sock, struct sockaddr *clientAddress, int addressLength);
15  static string bytesToString(const unsigned char *data, size_t firstIndex, size_t secondIndex);
16  static ulong hexToUlong(string hexString);
17  static void sendGetResponse(struct ClientSessionData *clientSessData, const unsigned char *data, string path);
18  static string resolvePath(struct ClientSessionData *clientSessData, string path);
19  static void getResponse200(struct ClientSessionData *clientSessData, const unsigned char *data, string filepath);
20  static void getResponse404(struct ClientSessionData *clientSessData, const unsigned char *data);
21  static void deleteClientSessionData(struct ClientSessionData *clientSessData);
22 };
Struct for holding all data for each individual connection and client session.
Definition: h2_structs.hpp:21
char * clientAddress
Definition: h2_structs.hpp:26
Struct for holding the application wide context.
Definition: h2_structs.hpp:13
Definition: h2_utils.hpp:10
struct ApplicationContext appCtx
Definition: h2_server.cpp:16