trastoamcs.kdevelop: trastoamcs/src/tconnection_amcs.hpp Source File

Main Page | Directories | File List

# tconnection_amcs.hpp

    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         //Attributes
    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         //Try Connect method
    00031         //Is used to launch the series of function to connect to AMCS
    00032         bool setUp(TVSP_AMCS activeVSP, TClientAMCS clientQueue);
    00033
    00034         //Ping method
    00035         //This method will output the ping results to a file, then reads it.
    00036         bool ping(char* ipAddress);
    00037
    00038
    00039         //Establish method
    00040         //This method try to establish a TCP connection to the AMCS
    00041         bool establish(char* portNumber, int index);
    00042
    00043         //reconnec t Fail method
    00044         //This method will loop until a connection has been established with AMCS
    00045         bool reconnectFail(TVSP_AMCS vsps);
    00046         //SendMessage method
    00047         //This method takes the message and send it to AMCS
    00048         bool sendMessage(string messageToSend);
    00049
    00050         //receive message method
    00051         //This method receives a message from the server
    00052         bool receiveMessage();
    00053
    00054         //softwareComm method
    00055         //This method start the message sending sequence
    00056         bool softwareComm(TVSP_AMCS vsps);
    00057
    00058         //presenceOfAMCS method
    00059         //This method verifies the presence of the server AMCS
    00060         bool presenceOfAMCS(TVSP_AMCS vspSettings,int index);
    00061
    00062         //establishSearch method
    00063         //This method is used to search for the word Established in the temp file
    00064         bool establishSearch(const string& textFile);
    00065
    00066         //closeSocket method
    00067         //This method closes the socket to the AMCS
    00068         void closeSocket();
    00069 };
    00070
    00071 #endif