/* 
 * File: FEPSim.h
 * 
 * The FEPSim is an RPC Client which transfers network data to the
 * ATMS Server.
 *
 * An FEPSim is created every 30 seconds, and an fep_reply structure
 * for every FEP_LINE_LDS is transferred to the ATMS through an RPC Call.
 * After the FEPSim has transferred all fep_replys, it is destroyed.
 *
 * An FEPSim is script-like in nature. There are no public methods other than
 * the constructor. To construct an FEPSim, an input file (containing network 
 * data in xml form) and a host server_ip (for the ATMS) are necessary. The 
 * format of the xml input file can be fount in "networkReader.cpp" source file.
 *
 * @author John A. Torres
 * @version 9/8/2017
 */

// Include guard
#ifndef __FEPSIM_H_INCLUDED__
#define __FEPSIM_H_INCLUDED__

// Forward declared dependencies
class NetworkReader;

// Included dependencies
#include "fep.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "NetworkReader.h"
#include <netdb.h>
#include <sys/types.h> 
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>

const int BUFF_SIZE = 1000000;

class FEPSim {
public:
    /* members */
    CLIENT *clnt; // RPC Client

    /* methods */
    FEPSim(char * ATMSHost); // Constructor
    
    void updateATMS(char * xml); // updates ATMS

    ~FEPSim(); // Destructor

private:
    /* members */
    char * ATMSHost;

    /* methods */
    void handleCallResponse(void *response); //
    bool createClient(char *host);
    void sendReplys(char * xml);

};

#endif // __FEPSIM_H_INCLUDED__
