// snf_xci.hpp
// Copyright (C) 2006 - 2009 ARM Research Labs, LLC
// See www.armresearch.com for the copyright terms.
//
// SNF XML Command Interface
//
// SNF clients communicate with the SNF server using one-line xml statements.
// The server responds in kind. This module uses the configuration module to
// interpret those communications. In practice, a line will be read from a
// connected socket and then passed to an snf_xci object for interpretation.
// The snf_xci object parses the xml and presents the results on it's surface
// in easily used variables.

#ifndef snf_xci_included
#define snf_xci_included

#include "configuration.hpp"

class snf_xci {                                                                 // SNF XCI message interpreter.
  private:
    ConfigurationElement Reader;                                                // Our reader.
    void SetupReader();                                                         // Configure the reader.
    ConfiguratorSetTrueOnComplete SNFWasParsed;                                 // Configurator sets the ReadWasGood
    bool ReadWasGood;                                                           // flag at the end of the snf element.
    void reset();                                                               // Reset/initialize for the next read.

  public:
    snf_xci();
    snf_xci(const char* bfr, int len);
    snf_xci(string& input);
    bool read(const char* bfr, int len);
    bool read(string& input);

    //// And now the interpreted results ////
    bool good();
    bool bad();

    string scanner_scan_file;
    bool scanner_scan_xhdr;
    bool scanner_scan_log;
    string scanner_scan_ip;
    int scanner_result_code;
    string scanner_result_xhdr;
    string scanner_result_log;

    string gbudb_set_ip;
    string gbudb_set_type;
    int gbudb_set_bad_count;
    int gbudb_set_good_count;

    string gbudb_good_ip;
    string gbudb_bad_ip;
    string gbudb_test_ip;
    string gbudb_drop_ip;

    string gbudb_result_ip;
    string gbudb_result_type;
    double gbudb_result_probability;
    double gbudb_result_confidence;
    int gbudb_result_bad_count;
    int gbudb_result_good_count;
    string gbudb_result_range;
    int gbudb_result_code;

    string report_request_status_class;
    string report_response;

    string xci_server_command;
    string xci_server_command_content;
    string xci_server_response;
    int xci_server_response_code;

    string xci_error_message;

};

#endif

