00001 #ifndef TCONNECTION_AMCS_H
00002 #define TCONNECTION_AMCS_H
00003 #include "tvsp_amcs.hpp"
00004 #include "tclientamcs.hpp"
00005 #include <sys/socket.h>
00006 #include <arpa/inet.h>
00007 #include <stdlib.h>
00008 #include <unistd.h>
00009 #include <netinet/in.h>
00010 #include <string>
00011 #include <tmessages_amcs.hpp>
00012 #include <iostream>
00013 #include <fstream>
00014 #include <errno.h>
00015
00016 class TConnection_AMCS{
00017 public:
00018
00019
00020
00021 int sock;
00022 char* enabledIPs[4];
00023 int currentIP;
00024 struct sockaddr_in echoserver;
00025
00026 TConnection_AMCS();
00027
00028 ~TConnection_AMCS();
00029
00030
00031
00032 bool setUp(TVSP_AMCS activeVSP, TClientAMCS clientQueue);
00033
00034
00035
00036 bool ping(char* ipAddress);
00037
00038
00039
00040
00041 bool establish(char* portNumber, int index);
00042
00043
00044
00045 bool reconnectFail(TVSP_AMCS vsps);
00046
00047
00048 bool sendMessage(string messageToSend);
00049
00050
00051
00052 bool receiveMessage();
00053
00054
00055
00056 bool softwareComm(TVSP_AMCS vsps);
00057
00058
00059
00060 bool presenceOfAMCS(TVSP_AMCS vspSettings,int index);
00061
00062
00063
00064 bool establishSearch(const string& textFile);
00065
00066
00067
00068 void closeSocket();
00069 };
00070
00071 #endif