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