src/node/node.h
changeset 1194 b8e957eb0a94
parent 1186 909e9eb2124e
child 1195 53f1175dbe94
equal deleted inserted replaced
1193:ea2185e4e097 1194:b8e957eb0a94
    32 class TraceResolver;
    32 class TraceResolver;
    33 class NetDevice;
    33 class NetDevice;
    34 class Application;
    34 class Application;
    35 class Packet;
    35 class Packet;
    36 class Address;
    36 class Address;
       
    37 class CompositeTraceResolver;
    37 
    38 
    38 /**
    39 /**
    39  * \brief A network Node.
    40  * \brief A network Node.
    40  *
    41  *
    41  * This class holds together:
    42  * This class holds together:
   173    * The dispose method. Subclasses must override this method
   174    * The dispose method. Subclasses must override this method
   174    * and must chain up to it by calling Node::DoDispose at the
   175    * and must chain up to it by calling Node::DoDispose at the
   175    * end of their own DoDispose method.
   176    * end of their own DoDispose method.
   176    */
   177    */
   177   virtual void DoDispose (void);
   178   virtual void DoDispose (void);
       
   179   /**
       
   180    * \param resolver the resolver to store trace sources in.
       
   181    *
       
   182    * If a subclass wants to add new traces to a Node, it needs
       
   183    * to override this method and record the new trace sources
       
   184    * in the input resolver. Subclasses also _must_ chain up to
       
   185    * their parent's DoFillTraceResolver method prior
       
   186    * to recording they own trace sources.
       
   187    */
       
   188   virtual void DoFillTraceResolver (CompositeTraceResolver &resolver);
   178 private:
   189 private:
   179   /**
       
   180    * \param context the trace context
       
   181    * \returns a trace resolver to the user. The user must delete it.
       
   182    *
       
   183    * Subclasses must implement this method.
       
   184    */
       
   185   virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context);
       
   186   /**
   190   /**
   187    * \param device the device added to this Node.
   191    * \param device the device added to this Node.
   188    *
   192    *
   189    * This method is invoked whenever a user calls Node::AddDevice.
   193    * This method is invoked whenever a user calls Node::AddDevice.
   190    * Subclasses are expected to call NetDevice::SetReceiveCallback
   194    * Subclasses are expected to call NetDevice::SetReceiveCallback
   194   virtual void NotifyDeviceAdded (Ptr<NetDevice> device);
   198   virtual void NotifyDeviceAdded (Ptr<NetDevice> device);
   195 
   199 
   196   bool ReceiveFromDevice (Ptr<NetDevice> device, const Packet &packet, 
   200   bool ReceiveFromDevice (Ptr<NetDevice> device, const Packet &packet, 
   197                           uint16_t protocol, const Address &from);
   201                           uint16_t protocol, const Address &from);
   198   void Construct (void);
   202   void Construct (void);
   199 
   203   TraceResolver *CreateDevicesTraceResolver (const TraceContext &context);
       
   204 
       
   205   enum TraceSource {
       
   206     DEVICES
       
   207   };
   200   struct ProtocolHandlerEntry {
   208   struct ProtocolHandlerEntry {
   201     ProtocolHandler handler;
   209     ProtocolHandler handler;
   202     uint16_t protocol;
   210     uint16_t protocol;
   203     Ptr<NetDevice> device;
   211     Ptr<NetDevice> device;
   204   };
   212   };