[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Creating my own TCP (fwd)
---------- Forwarded message ----------
Date: Wed, 1 Sep 1999 09:28:04 +0200 (MET DST)
From: Fernando Cela Diaz <[email protected]>
To: [email protected]
Subject: RE: Creating my own TCP
You can do it in the C++ side; I enclose templates for that purpose.
Remember to modifiy the Makefile and include mytcp.o somewhere, as it is
done in Marc Greiss' tutorial in the Ping example.
Good luck.
tcp-mytcp.h----------------------------------------
#ifndef ns_mytcp_h
#define ns_mytcp_h
#include "tcp.h"
class MyTcpAgent : public virtual TcpAgent {
public:
virtual void recv(Packet*, Handler*);
protected:
};
#endif
tcp-mytcp.cc----------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <math.h>
#include "ip.h"
#include "tcp-mytcp.h"
#include "flags.h"
static class MyTcpTcpClass : public TclClass {
public:
MyTcpClass() : TclClass("Agent/TCP/MyTcp") {}
TclObject* create(int, const char*const*) {
return (new MyTcpTcpAgent());
}
} class_mytcp;
void MyTcpTcpAgent::recv(Packet *pkt, Handler*)
{
// Copy here the code from recv in tcp.cc and modify it
}
----------------------------------------------------------------------
Fernando Cela
email: [email protected] phone: +46 31 772 1709