nsc: move nsc glue code from nsc-tcp-l4-protocol to node/nsc-glue.cc.
known problems:
- sim_interface.h is duplicated
- nsc-glue.cc adds hooks in node.cc, "hijacks" incoming packets
- nsc-glue exports NSCs INetStack (instead of wrapping it completely)
- nsc-tcp-l4-protocol and nsc-tcp-socket-impl make calls into nsc-glue
- nsc-tcp-socket-impl should really be "nsc-socket-core" (or something
like that)
needs fixing on nsc side:
- no support for multiple interfaces yet (also not yet supported
on nsc side)
- nsc initialisation still tied to IP (Adding an Interface and assigning the
IP address is a single step; it should be separate)
maybe there is more.
There is a NSC_NEXT define in nsc-glue.h, its main purpose is to flag
the places where the NSC API needs to be adapted to support multiple
interfaces in nsc.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 as
5 * published by the Free Software Foundation;
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 #ifndef NSC_TCP_L4_PROTOCOL_H
18 #define NSC_TCP_L4_PROTOCOL_H
22 #include "ns3/packet.h"
23 #include "ns3/ipv4-address.h"
25 #include "ns3/object-factory.h"
26 #include "ipv4-end-point-demux.h"
27 #include "ipv4-l4-protocol.h"
28 #include "ipv4-interface.h"
30 #include "tcp-header.h"
32 #include "nsc-tcp-socket-impl.h"
33 #include "sim_interface.h"
42 * \brief Nsc wrapper glue, to interface with the Ipv4 protocol underneath.
44 class NscTcpL4Protocol : public Ipv4L4Protocol {
46 static const uint8_t PROT_NUMBER;
47 static TypeId GetTypeId (void);
53 void SetNode (Ptr<Node> node);
55 // legacy, moved to node/node.cc
56 void SetNscLibrary (const std::string &lib);
57 std::string GetNscLibrary (void) const;
59 virtual int GetProtocolNumber (void) const;
60 virtual int GetVersion (void) const;
63 * \return A smart Socket pointer to a NscTcpSocketImpl, allocated by this instance
66 Ptr<Socket> CreateSocket (void);
68 Ipv4EndPoint *Allocate (void);
69 Ipv4EndPoint *Allocate (Ipv4Address address);
70 Ipv4EndPoint *Allocate (uint16_t port);
71 Ipv4EndPoint *Allocate (Ipv4Address address, uint16_t port);
72 Ipv4EndPoint *Allocate (Ipv4Address localAddress, uint16_t localPort,
73 Ipv4Address peerAddress, uint16_t peerPort);
75 void DeAllocate (Ipv4EndPoint *endPoint);
78 * \brief Recieve a packet up the protocol stack
79 * \param p The Packet to dump the contents into
80 * \param source The source's Ipv4Address
81 * \param destination The destinations Ipv4Address
82 * \param incomingInterface The Ipv4Interface it was received on
85 // Stub function, not used in nsc
86 virtual Ipv4L4Protocol::RxStatus Receive (Ptr<Packet> p,
87 Ipv4Address const &source,
88 Ipv4Address const &destination,
89 Ptr<Ipv4Interface> incomingInterface);
92 virtual void DoDispose (void);
93 virtual void NotifyNewAggregate ();
96 Ipv4EndPointDemux *m_endPoints;
97 ObjectFactory m_rttFactory;
99 static ObjectFactory GetDefaultRttEstimatorFactory (void);
100 friend class NscTcpSocketImpl;
101 INetStack* m_nscStack;
103 std::string m_nscLibrary;
104 std::vector<Ptr<NscTcpSocketImpl> > m_sockets;
109 #endif /* NSC_TCP_L4_PROTOCOL_H */