53 ; |
53 ; |
54 |
54 |
55 /* see http://www.iana.org/assignments/protocol-numbers */ |
55 /* see http://www.iana.org/assignments/protocol-numbers */ |
56 const uint8_t NscTcpL4Protocol::PROT_NUMBER = 6; |
56 const uint8_t NscTcpL4Protocol::PROT_NUMBER = 6; |
57 |
57 |
|
58 /** |
|
59 * \ingroup nsctcp |
|
60 * \brief Nsc interface implementation class. |
|
61 */ |
58 class NscInterfaceImpl : public ISendCallback, public IInterruptCallback |
62 class NscInterfaceImpl : public ISendCallback, public IInterruptCallback |
59 { |
63 { |
60 public: |
64 public: |
|
65 /** |
|
66 * Constructor |
|
67 * \param prot the NSC TCP protocol |
|
68 */ |
61 NscInterfaceImpl (Ptr<NscTcpL4Protocol> prot); |
69 NscInterfaceImpl (Ptr<NscTcpL4Protocol> prot); |
62 private: |
70 private: |
|
71 /** |
|
72 * \brief Invoked by NSCs 'ethernet driver' to re-inject a packet into ns-3. |
|
73 * |
|
74 * A packet is an octet soup consisting of an IP Header, TCP Header |
|
75 * and user payload, if any |
|
76 * |
|
77 * \param data the data |
|
78 * \param datalen the data length |
|
79 */ |
63 virtual void send_callback (const void *data, int datalen); |
80 virtual void send_callback (const void *data, int datalen); |
|
81 /** |
|
82 * \brief Called by the NSC stack whenever something of interest has happened |
|
83 * |
|
84 * Examples: when data arrives on a socket, a listen socket |
|
85 * has a new connection pending, etc. |
|
86 */ |
64 virtual void wakeup (); |
87 virtual void wakeup (); |
|
88 /** |
|
89 * \brief Called by the Linux stack RNG initialization |
|
90 * |
|
91 * Its also used by the cradle code to add a timestamp to |
|
92 * printk/printf/debug output. |
|
93 */ |
65 virtual void gettime (unsigned int *, unsigned int *); |
94 virtual void gettime (unsigned int *, unsigned int *); |
66 private: |
95 private: |
67 Ptr<NscTcpL4Protocol> m_prot; |
96 Ptr<NscTcpL4Protocol> m_prot; //!< the NSC TCP protocol |
68 }; |
97 }; |
69 |
98 |
70 NscInterfaceImpl::NscInterfaceImpl (Ptr<NscTcpL4Protocol> prot) |
99 NscInterfaceImpl::NscInterfaceImpl (Ptr<NscTcpL4Protocol> prot) |
71 : m_prot (prot) |
100 : m_prot (prot) |
72 { |
101 { |
383 m_nscStack->if_send_finish (0); |
419 m_nscStack->if_send_finish (0); |
384 } |
420 } |
385 |
421 |
386 void NscTcpL4Protocol::wakeup () |
422 void NscTcpL4Protocol::wakeup () |
387 { |
423 { |
388 /// \todo |
424 // \todo |
389 // this should schedule a timer to read from all tcp sockets now... this is |
425 // this should schedule a timer to read from all tcp sockets now... this is |
390 // an indication that data might be waiting on the socket |
426 // an indication that data might be waiting on the socket |
391 |
427 |
392 Ipv4EndPointDemux::EndPoints endPoints = m_endPoints->GetAllEndPoints (); |
428 Ipv4EndPointDemux::EndPoints endPoints = m_endPoints->GetAllEndPoints (); |
393 for (Ipv4EndPointDemux::EndPointsI endPoint = endPoints.begin (); |
429 for (Ipv4EndPointDemux::EndPointsI endPoint = endPoints.begin (); |
449 // |
485 // |
450 // Previous versions of this code tried to assign the "next" |
486 // Previous versions of this code tried to assign the "next" |
451 // IP address of the subnet but this was found to fail for |
487 // IP address of the subnet but this was found to fail for |
452 // some use cases in /30 subnets. |
488 // some use cases in /30 subnets. |
453 |
489 |
454 /// \todo \bugid{1398} NSC's limitation to single-interface nodes |
490 // \todo \bugid{1398} NSC's limitation to single-interface nodes |
455 m_nscStack->add_default_gateway (addrOss.str ().c_str ()); |
491 m_nscStack->add_default_gateway (addrOss.str ().c_str ()); |
456 } |
492 } |
457 } |
493 } |
458 } |
494 } |
459 |
495 |