-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSS_API.h
More file actions
67 lines (49 loc) · 1.47 KB
/
Copy pathSS_API.h
File metadata and controls
67 lines (49 loc) · 1.47 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
58
59
60
61
62
63
64
65
66
67
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <libgen.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <vector>
#include <dirent.h>
#include <assert.h>
using namespace std;
#define MAX_LINE 8192
#define BUFFSIZE 8192
//#define SERVERPORT 30300
#define SERVERPORT 32000
//#define SERVERPORT 32004
//#define SIM_SERVICE_IP "10.101.0.1"
#define SIM_SERVICE_IP "172.30.100.2"
//#define SIM_SERVICE_IP "172.18.90.181"
//#define SIM_SERVICE_IP "172.18.90.180"
//#define SIM_SERVICE_IP "10.96.100.1"
//#define SIM_SERVICE_IP "10.100.52.5"
typedef struct SIMULATION_OPTION {
int simulation_count_total;
int simulation_count_per_pod;
int is_source_included;
}SIM_OPT;
class SS_API
{
public:
SS_API() {};
~SS_API() {};
static void SetConnectionInfo(char *IP, uint16_t port);
static FILE* SimulationRequest(char *fileName, SIM_OPT simOpt, char *resPath = NULL);
static FILE* SimulationRequest(char *fileName, char *dirPath, SIM_OPT simOpt, char *resPath = NULL);
private:
static string m_IP;
static uint16_t m_port;
static int SocketConnection();
static void SendSimulationModel(int sockfd, char* fileName, SIM_OPT simOpt, int source);
static void SendSimulationFiles(int sockfd, char* dirPath);
static FILE* ResultReceive(int sockfd, char *resPath);
static int sendfile(FILE *fp, int sockfd);
static char** str_split(char* a_str, const char a_delim);
};