Began implementation of networking
[progcomp2012.git] / judge / manager / network_controller.h
1 #include <sys/types.h>
2 #include <sys/socket.h>
3 #include <netinet/in.h>
4 #include <arpa/inet.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <unistd.h>
9 #include <netdb.h>
10 #include <fcntl.h>
11
12
13
14 #include "controller.h"
15
16 #ifndef NETWORK_CONTROLLER_H
17 #define NETWORK_CONTROLLER_H
18
19
20 class NetworkController : public Controller
21 {
22         public:
23                 NetworkController(const Piece::Colour & newColour, const char * newName = "no-name");
24                 virtual ~NetworkController();
25
26                 virtual bool Valid() {return sfd != -1;}
27
28                 virtual void Message(const char * string) {fprintf(stderr, "NetworkController unimplemented!\n"); assert(false);}
29                 virtual MovementResult QuerySetup(const char * opponentName, std::string setup[]) {fprintf(stderr, "NetworkController unimplemented!\n"); assert(false);}
30                 virtual MovementResult QueryMove(std::string & buffer) {fprintf(stderr, "NetworkController unimplemented!\n"); assert(false);}
31
32         protected:
33                 int sfd; int cfd;
34                 static const int port = 666;    
35 };
36
37 class Server : public NetworkController
38 {
39         public:
40                 Server(const Piece::Colour & newColour, const char * newName = "no-name");
41                 virtual ~Server() {}
42 };
43
44 class Client : public NetworkController
45 {
46         public:
47                 Client(const Piece::Colour & newColour, const char * newName = "no-name", const char * server="127.0.0.1");
48                 virtual ~Client() {}
49 };
50
51 #endif //NETWORK_CONTROLLER_H
52
53 //EOF

UCC git Repository :: git.ucc.asn.au