/*
 * Copyright (C) 2008 The Trustees of Columbia University in the City of New York. 
 * All rights reserved.
 *
 * See the file LICENSE included in this distribution for details.
 */

#ifndef _CMDCLIENT_H
#define _CMDCLIENT_H

#ifndef _WENGO
#include "types.h"
#include "node.h"
#include "peer.h"
#include "msgheader.h"
#endif

#ifdef _WENGO
#include "p2pp/common/types.h"
#include "p2pp/msg/msgheader.h"
#include "p2pp/bigint/bigint.h"
#include "p2pp/msg/node.h"
#include "p2pp/msg/peer.h"
#endif


class CmdClient : public Peer {

 private:
  uint32 m_uiTransId;

 private:
  void OnTransactionTimeout(Transaction* pobjTrans);

  int32 OnRequest(char* pchIP, int32 port, transtype tt);
  int32 OnResponse(char* pchIP, int32 port, transtype tt);
  int32 OnIndication(char* pchIP, int32 port, transtype tt);
  int32 OnACK(char* pchIP, int32 port, transtype tt);

 public:
  CmdClient();
  virtual ~CmdClient();
  
  virtual void Initialize();
  virtual void OnTimer();
  virtual int32 OnReceive(uchar* buf, int len, char* pchIP, int32 port, transtype tt);

  virtual uint32 getNextHop(uchar* peerid, uint32 len, struct peerinfo& stP);


  virtual void ShowRT() ;
  virtual void ShowNT() ;
  virtual void ShowRO() ;
 
};

#endif
