-
Notifications
You must be signed in to change notification settings - Fork 0
/
RPCImpl.h
50 lines (40 loc) · 1.33 KB
/
RPCImpl.h
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
/* RPCServer.cpp : This file contains the 'main' function.Program execution begins and ends there.
This is a very very simple example of a CPSC5042 Server that will listen to
a CPSC5042 Client
Version 1 will have the server handle one client at a time. The server will:
- Wait for connection from client
- Process the Connect API once connect
- Process all RPC requests until the client does a Disconnect RPC
- This intial server will handle 3 RPC's:
- Connect
- HowManyChars (will return HowManyChars are in the input message)
- Disconnnect
server, then run the various RPC's that might happen between the server and
client
*/
#pragma once
#include <unistd.h>
#include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <string.h>
#include <vector>
#include <iterator>
class RPCImpl
{
public:
RPCImpl(int socket);
~RPCImpl();
bool ProcessRPC();
private:
int m_rpcCount;
int m_socket;
// First one in this function should be a connect, and it
// will continue try to process RPC's until a Disconnect happens
void readFile(struct _question questionArray[]);
bool ProcessConnectRPC(std::vector<std::string>& arrayTokens);
bool ProcessStatusRPC();
bool ProcessDisconnectRPC();
void ParseTokens(char* buffer, std::vector<std::string>& a);
};