Hi,

Does anyone know how to make :

1) sendpacket() function that in FULLTCP.cc agent send only SYN packet.

2) recv() function only detect and drop incoming ACK packet


I have tried but I couldn't !!!!!! any suggestion

here is the sendpacket in fulltcp.cc
================================

void
FullTcpAgent::sendpacket(int seqno, int ackno, int pflags, int datalen, int
reason)
{
        Packet* p = allocpkt();
        hdr_tcp *tcph = hdr_tcp::access(p);
hdr_flags *fh = hdr_flags::access(p);

/* build basic header w/options */

        tcph->seqno() = seqno;
        tcph->ackno() = ackno;
        tcph->flags() = pflags;
        tcph->reason() |= reason; // make tcph->reason look like ns1
pkt->flags?
tcph->sa_length() = 0;    // may be increased by build_options()
        tcph->hlen() = tcpip_base_hdr_size_;
tcph->hlen() += build_options(tcph);

/*
 * Explicit Congestion Notification (ECN) related:
 * Bits in header:
 * ECT (EC Capable Transport),
 * ECNECHO (ECHO of ECN Notification generated at router),
 * CWR (Congestion Window Reduced from RFC 2481)
 * States in TCP:
 * ecn_: I am supposed to do ECN if my peer does
 * ect_: I am doing ECN (ecn_ should be T and peer does ECN)
 */

// set ect on data packets (not syn or ack packets)
if ( datalen > 0 && ecn_ ){
fh->ect() = ect_; // on after mutual agreement on ECT
}
else {
/* Set ect() to 0.  -M. Weigle 1/19/05 */
fh->ect() = 0;
}

        // fill in CWR and ECE bits which don't actually sit in
        // the tcp_flags but in hdr_flags
        if ( pflags & TH_ECE) {
                fh->ecnecho() = 1;
        } else {
                fh->ecnecho() = 0;
        }
        if ( pflags & TH_CWR ) {
                fh->cong_action() = 1;
        }
else {
/* Set cong_action() to 0  -M. Weigle 1/19/05 */
fh->cong_action() = 0;
}

/* actual size is data length plus header length */

        hdr_cmn *ch = hdr_cmn::access(p);
        ch->size() = datalen + tcph->hlen();

        if (datalen <= 0)
                ++nackpack_;
        else {
                ++ndatapack_;
                ndatabytes_ += datalen;
last_send_time_ = now(); // time of last data
        }
        if (reason == REASON_TIMEOUT || reason == REASON_DUPACK || reason
== REASON_SACK) {
                ++nrexmitpack_;
                nrexmitbytes_ += datalen;
        }

last_ack_sent_ = ackno;

//if (state_ != TCPS_ESTABLISHED) {
//printf("%f(%s)[state:%s]: sending pkt ", now(), name(), statestr(state_));
//prpkt(p);
//}

send(p, 0);

return;
}

================================
-- 
Regards,
Mohd.

Reply via email to