/**
 * Copyright (C) 2013 Regents of the University of California.
 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
 * See COPYING for copyright and distribution information.
 */

#ifndef NDN_TCPTRANSPORT_HPP
#define NDN_TCPTRANSPORT_HPP

#include <string>
#include "../c/transport/tcp-transport.h"
#include "../c/encoding/binary-xml-element-reader.h"
#include "transport.hpp"

namespace ndn {
  
class TcpTransport : public Transport {
public:
  /**
   * A TcpTransport::ConnectionInfo extends Transport::ConnectionInfo to hold the host and port info for the TCP connection.
   */
  class ConnectionInfo : public Transport::ConnectionInfo {
  public:
    /**
     * Create a ConnectionInfo with the given host and port.
     * @param host The host for the connection.
     * @param port The port number for the connection. If omitted, use 9695.
     */
    ConnectionInfo(const char *host, unsigned short port = 9695)
    : host_(host), port_(port)
    {
    }

    /**
     * Get the host given to the constructor.
     * @return A string reference for the host.
     */
    const std::string& 
    getHost() const { return host_; }
    
    /**
     * Get the port given to the constructor.
     * @return The port number.
     */
    unsigned short 
    getPort() const { return port_; }
    
    virtual 
    ~ConnectionInfo();
    
  private:
    std::string host_;
    unsigned short port_;
  };

  TcpTransport() 
  : elementListener_(0), isConnected_(false)
  {
    ndn_TcpTransport_initialize(&transport_);
    elementReader_.partialData.array = 0;
  }
  
  /**
   * Connect according to the info in ConnectionInfo, and processEvents() will use elementListener.
   * @param connectionInfo A reference to a TcpTransport::ConnectionInfo.
   * @param elementListener Not a shared_ptr because we assume that it will remain valid during the life of this object.
   */
  virtual void connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener);
  
  /**
   * Set data to the host
   * @param data A pointer to the buffer of data to send.
   * @param dataLength The number of bytes in data.
   */
  virtual void send(const unsigned char *data, unsigned int dataLength);

  /**
   * Process any data to receive.  For each element received, call elementListener.onReceivedElement.
   * This is non-blocking and will return immediately if there is no data to receive.
   * You should normally not call this directly since it is called by Face.processEvents.
   * @throw This may throw an exception for reading data or in the callback for processing the data.  If you
   * call this from an main event loop, you may want to catch and log/disregard all exceptions.
   */
  virtual void processEvents();

  virtual bool getIsConnected();

  /**
   * Close the connection to the host.
   */
  virtual void close();
  
  ~TcpTransport();
  
private:
  struct ndn_TcpTransport transport_;
  bool isConnected_;
  ElementListener *elementListener_;
  // TODO: This belongs in the socket listener.
  ndn_BinaryXmlElementReader elementReader_;
};

}

#endif
