diff options
| author | Christian Krinitsin <mail@krinitsin.com> | 2025-03-21 16:17:20 +0100 |
|---|---|---|
| committer | Christian Krinitsin <mail@krinitsin.com> | 2025-03-21 16:17:20 +0100 |
| commit | f1af8679481cfc4199b6423d723f67188145ea46 (patch) | |
| tree | 62d25d33bab6a2ba150659a35155977131e67237 /src/client/client.h | |
| parent | 2a22b4123dce661b0500dc07012d61215bdce161 (diff) | |
| download | BT-Programming-Assignment-f1af8679481cfc4199b6423d723f67188145ea46.tar.gz BT-Programming-Assignment-f1af8679481cfc4199b6423d723f67188145ea46.zip | |
client: add client class with input processing
Diffstat (limited to 'src/client/client.h')
| -rw-r--r-- | src/client/client.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/client/client.h b/src/client/client.h new file mode 100644 index 0000000..9ff5b47 --- /dev/null +++ b/src/client/client.h @@ -0,0 +1,32 @@ +#pragma once + +#include <cstring> +#include <fcntl.h> +#include <iostream> +#include <optional> +#include <pthread.h> +#include <string> +#include <sys/mman.h> +#include <unistd.h> +#include <utility> + +#include "shared_memory.h" +class Client { +public: + Client(); + ~Client(); + + void start_client(); + +private: + SharedMemory* shared_memory; + int shm_fd; + + int send_request( + SharedMemory* shared_memory, + Operations type, + std::optional<const std::string> k, + std::optional<const std::string> v); + bool request_processed(SharedMemory* shared_memory, int index); + std::string process_result(SharedMemory* shared_memory, int index); +}; |