66 * protocol which can be used on the Node on which this L3 Demux |
66 * protocol which can be used on the Node on which this L3 Demux |
67 * is running. The new L3Protocol is registered internally as |
67 * is running. The new L3Protocol is registered internally as |
68 * a working L3 Protocol and returned from this method. |
68 * a working L3 Protocol and returned from this method. |
69 * The caller does not get ownership of the returned pointer. |
69 * The caller does not get ownership of the returned pointer. |
70 */ |
70 */ |
71 void Insert(ns3::L3Protocol * protocol); |
71 void Insert(Ptr<L3Protocol> protocol); |
72 /** |
72 /** |
73 * \param protocolNumber number of protocol to lookup |
73 * \param protocolNumber number of protocol to lookup |
74 * in this L4 Demux |
74 * in this L4 Demux |
75 * \returns a matching L3 Protocol |
75 * \returns a matching L3 Protocol |
76 * |
76 * |
77 * This method is typically called by lower layers |
77 * This method is typically called by lower layers |
78 * to forward packets up the stack to the right protocol. |
78 * to forward packets up the stack to the right protocol. |
79 * It is also called from InternetNode::GetIpv4 for example. |
79 * It is also called from InternetNode::GetIpv4 for example. |
80 */ |
80 */ |
81 ns3::L3Protocol* PeekProtocol (int protocolNumber); |
81 Ptr<L3Protocol> GetProtocol (int protocolNumber); |
82 /** |
82 /** |
83 * \param protocol protocol to remove from this demux. |
83 * \param protocol protocol to remove from this demux. |
84 * |
84 * |
85 * The input value to this method should be the value |
85 * The input value to this method should be the value |
86 * returned from the L3Protocol::Insert method. |
86 * returned from the L3Protocol::Insert method. |
87 */ |
87 */ |
88 void Erase(ns3::L3Protocol*protocol); |
88 void Erase(Ptr<L3Protocol> protocol); |
89 protected: |
89 protected: |
90 virtual void DoDispose (void); |
90 virtual void DoDispose (void); |
91 private: |
91 private: |
92 typedef std::map<int, ns3::L3Protocol*> L3Map_t; |
92 typedef std::map<int, Ptr<ns3::L3Protocol> > L3Map_t; |
93 |
93 |
94 Ptr<Node> m_node; |
94 Ptr<Node> m_node; |
95 L3Map_t m_protocols; |
95 L3Map_t m_protocols; |
96 }; |
96 }; |
97 |
97 |