00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef NSC_TCP_L4_PROTOCOL_H
00018 #define NSC_TCP_L4_PROTOCOL_H
00019
00020 #include <stdint.h>
00021
00022 #include "ns3/packet.h"
00023 #include "ns3/ipv4-address.h"
00024 #include "ns3/ptr.h"
00025 #include "ns3/object-factory.h"
00026 #include "ipv4-end-point-demux.h"
00027 #include "ipv4-l4-protocol.h"
00028 #include "ipv4-interface.h"
00029
00030 #include "tcp-header.h"
00031
00032 #include "ns3/timer.h"
00033 #include "sim_interface.h"
00034
00035 namespace ns3 {
00036
00037 class Node;
00038 class Socket;
00039 class TcpHeader;
00040
00041
00042
00043
00044
00045 class NscTcpL4Protocol : public Ipv4L4Protocol, ISendCallback, IInterruptCallback {
00046 public:
00047 static const uint8_t PROT_NUMBER;
00048 static TypeId GetTypeId (void);
00049
00050
00051
00052 NscTcpL4Protocol ();
00053 virtual ~NscTcpL4Protocol ();
00054
00055 void SetNode (Ptr<Node> node);
00056 void SetNscLibrary(const std::string &lib);
00057
00058 virtual int GetProtocolNumber (void) const;
00059 virtual int GetVersion (void) const;
00060
00061
00062
00063
00064
00065 Ptr<Socket> CreateSocket (void);
00066
00067 Ipv4EndPoint *Allocate (void);
00068 Ipv4EndPoint *Allocate (Ipv4Address address);
00069 Ipv4EndPoint *Allocate (uint16_t port);
00070 Ipv4EndPoint *Allocate (Ipv4Address address, uint16_t port);
00071 Ipv4EndPoint *Allocate (Ipv4Address localAddress, uint16_t localPort,
00072 Ipv4Address peerAddress, uint16_t peerPort);
00073
00074 void DeAllocate (Ipv4EndPoint *endPoint);
00075
00076
00077
00078
00079
00080
00081
00082
00083 virtual Ipv4L4Protocol::RxStatus Receive (Ptr<Packet> p,
00084 Ipv4Address const &source,
00085 Ipv4Address const &destination,
00086 Ptr<Ipv4Interface> incomingInterface);
00087
00088
00089
00090
00091
00092
00093
00094
00095 virtual void send_callback(const void *data, int datalen);
00096
00097
00098
00099 virtual void wakeup();
00100
00101
00102
00103 virtual void gettime(unsigned int *, unsigned int *);
00104
00105 protected:
00106 virtual void DoDispose (void);
00107 private:
00108 Ptr<Node> m_node;
00109 Ipv4EndPointDemux *m_endPoints;
00110 ObjectFactory m_rttFactory;
00111 private:
00112 void AddInterface (void);
00113 void SoftInterrupt (void);
00114 static ObjectFactory GetDefaultRttEstimatorFactory (void);
00115 friend class NscTcpSocketImpl;
00116 INetStack* m_nscStack;
00117 void *m_dlopenHandle;
00118 Timer m_softTimer;
00119 };
00120
00121 };
00122
00123 #endif