-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTServerT2V1.h
More file actions
executable file
·57 lines (48 loc) · 1.24 KB
/
TServerT2V1.h
File metadata and controls
executable file
·57 lines (48 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Created by george on 16/11/2017.
//
#ifndef TServer_TServer_H
#define TServer_TServer_H
#include "iostream"
#include <cstring>
#include <sys/socket.h>
#include <arpa/inet.h>
#include "old_techniques/tserverfhesiutils.h"
#include "FHE-SI.h"
#include "FHEContext.h"
#include "Serialization.h"
#include <map>
using namespace std;
class TServerT2V1 {
private:
unsigned k;
unsigned dim;
map<uint32_t,Ciphertext> point_distances;
bool active;
bool verbose;
string t_serverIP;
int t_serverPort;
int t_serverSocket;
FHEcontext* client_context;
FHESISecKey* t_server_seckey;
FHESIPubKey* client_pubkey;
KeySwitchSI* t_server_SM;
void socketCreate();
void socketBind();
void socketListen();
void socketAccept();
void handleRequest(int);
void receiveEncryptionParamFromClient(int);
void initializeKM(int);
void classifyToCluster(int);
unsigned extractClusterIndex();
ifstream indexToStream(const Ciphertext &);
public:
TServerT2V1(string,int, bool verbose=true);
bool sendStream(ifstream,int);
bool sendMessage(int,string);
string receiveMessage(int, int buffersize=64);
ifstream receiveStream(int,string filename="temp.dat");
void log(int,string);
};
#endif