/* -*- c++ -*- rcp-tap.h Received-Based TCP (Sender Side) Two agents: RcpAgent (receiver side) and RcpTap (sender side) */ #ifndef __rcptap_h__ #define __rcptap_h__ #include "tcp.h" /* * The following definitions can be put in tcp.h */ #define REPN (NSA*2) // 3 blocks #define TCP_REASON_REQOVER 0x04 // output() #ifdef NDEBUG #undef NDEBUG #endif class RcpTap : public Agent { public: RcpTap(); virtual int command(int argc, const char*const* argv); virtual void recv(Packet *pkt, Handler *); virtual void sendmsg(int nbytes, const char *flags = 0); virtual void advanceby(int delta); protected: virtual void reset(); virtual void delay_bind_init_all(); virtual int delay_bind_dispatch(const char *, const char *, TclObject *); int headersize(); void output(int seqno, int reason=0); TracedInt curseq_; /* highest seqno produced by app */ TracedInt maxseq_; /* highest seqno sent so far */ TracedInt o_seqno_; /* output seqno of the packet */ TracedInt r_seqno_; /* received seqno of the packet */ TracedInt nreqpack_; /* number of req packets received */ TracedInt ndatapack_; /* number of data packets sent */ TracedInt ndatabytes_; /* number of data bytes sent */ TracedInt nrexmitpack_; /* number of retransmited packets */ TracedInt nrexmitbytes_; /* number of retransmited bytes */ int syn_; /* 1 for modeling SYN/ACK exchange */ int useHeaders_; /* boolean: add TCP/IP header size */ int tcpip_base_hdr_size_; /* size of base TCP/IP header */ int ts_option_size_; /* header bytes in a ts option */ int ts_option_; /* use RFC1323-like timestamps? */ int closed_; /* whether the connection has closed */ double ts_peer_; /* the most recent timestamp the peer sent */ int rpq_[REPN],repnxt_; /* for repetitive request (redundancy) */ #define rep_(i) rpq_[(i) % REPN] Agent *peer_; /* XXX: ask peer to start pulling */ }; #endif/*__rcptap_h__*/