src/fd-net-device/model/fd-net-device.h
changeset 11045 6024c150e4c8
parent 10407 ea97f1c81af5
child 11407 c175567f535a
equal deleted inserted replaced
11044:6b153691af7c 11045:6024c150e4c8
   180   // private copy constructor as sugested in:
   180   // private copy constructor as sugested in:
   181   // http://www.nsnam.org/wiki/NS-3_Python_Bindings#.22invalid_use_of_incomplete_type.22
   181   // http://www.nsnam.org/wiki/NS-3_Python_Bindings#.22invalid_use_of_incomplete_type.22
   182   FdNetDevice (FdNetDevice const &);
   182   FdNetDevice (FdNetDevice const &);
   183 
   183 
   184   /**
   184   /**
   185    * \internal
       
   186    *
       
   187    * Spin up the device
   185    * Spin up the device
   188    */
   186    */
   189   void StartDevice (void);
   187   void StartDevice (void);
   190 
   188 
   191   /**
   189   /**
   192    * \internal
       
   193    *
       
   194    * Tear down the device
   190    * Tear down the device
   195    */
   191    */
   196   void StopDevice (void);
   192   void StopDevice (void);
   197 
   193 
   198   /**
   194   /**
   199    * \internal
       
   200    *
       
   201    * Callback to invoke when a new frame is received
   195    * Callback to invoke when a new frame is received
   202    */
   196    */
   203   void ReceiveCallback (uint8_t *buf, ssize_t len);
   197   void ReceiveCallback (uint8_t *buf, ssize_t len);
   204 
   198 
   205   /**
   199   /**
   206    * \internal
       
   207    *
       
   208    * Forward the frame to the appropriate callback for processing
   200    * Forward the frame to the appropriate callback for processing
   209    */
   201    */
   210   void ForwardUp (uint8_t *buf, ssize_t len);
   202   void ForwardUp (uint8_t *buf, ssize_t len);
   211 
   203 
   212   /**
   204   /**
   217   bool TransmitStart (Ptr<Packet> p);
   209   bool TransmitStart (Ptr<Packet> p);
   218 
   210 
   219   void NotifyLinkUp (void);
   211   void NotifyLinkUp (void);
   220 
   212 
   221   /**
   213   /**
   222    * \internal
       
   223    *
       
   224    * The ns-3 node associated to the net device.
   214    * The ns-3 node associated to the net device.
   225    */
   215    */
   226   Ptr<Node> m_node;
   216   Ptr<Node> m_node;
   227 
   217 
   228   /*
   218   /*
   229    * \internal
       
   230    *
       
   231    * a copy of the node id so the read thread doesn't have to GetNode() in
   219    * a copy of the node id so the read thread doesn't have to GetNode() in
   232    * in order to find the node ID.  Thread unsafe reference counting in
   220    * in order to find the node ID.  Thread unsafe reference counting in
   233    * multithreaded apps is not a good thing.
   221    * multithreaded apps is not a good thing.
   234    */
   222    */
   235   uint32_t m_nodeId;
   223   uint32_t m_nodeId;
   236 
   224 
   237   /**
   225   /**
   238    * \internal
       
   239    *
       
   240    * The ns-3 interface index (in the sense of net device index) that has been assigned to this network device.
   226    * The ns-3 interface index (in the sense of net device index) that has been assigned to this network device.
   241    */
   227    */
   242   uint32_t m_ifIndex;
   228   uint32_t m_ifIndex;
   243 
   229 
   244   /**
   230   /**
   245    * \internal
       
   246    *
       
   247    * The MTU associated to the file descriptor technology
   231    * The MTU associated to the file descriptor technology
   248    */
   232    */
   249   uint16_t m_mtu;
   233   uint16_t m_mtu;
   250 
   234 
   251   /**
   235   /**
   252    * \internal
       
   253    *
       
   254    * The file descriptor used for receive/send network traffic.
   236    * The file descriptor used for receive/send network traffic.
   255    */
   237    */
   256   int m_fd;
   238   int m_fd;
   257 
   239 
   258   /**
   240   /**
   259    * \internal
       
   260    *
       
   261    * Reader for the file descriptor.
   241    * Reader for the file descriptor.
   262    */
   242    */
   263   Ptr<FdNetDeviceFdReader> m_fdReader;
   243   Ptr<FdNetDeviceFdReader> m_fdReader;
   264 
   244 
   265   /**
   245   /**
   266    * \internal
       
   267    *
       
   268    * The net device mac address.
   246    * The net device mac address.
   269    */
   247    */
   270   Mac48Address m_address;
   248   Mac48Address m_address;
   271 
   249 
   272   /**
   250   /**
   273    * \internal
       
   274    *
       
   275    * The typ of encapsulation of the received/transmited frames.
   251    * The typ of encapsulation of the received/transmited frames.
   276    */
   252    */
   277   EncapsulationMode m_encapMode;
   253   EncapsulationMode m_encapMode;
   278 
   254 
   279   /**
   255   /**
   280    * \internal
       
   281    *
       
   282    * Flag indicating whether or not the link is up.  In this case,
   256    * Flag indicating whether or not the link is up.  In this case,
   283    * whether or not the device is connected to a channel.
   257    * whether or not the device is connected to a channel.
   284    */
   258    */
   285   bool m_linkUp;
   259   bool m_linkUp;
   286 
   260 
   287   /**
   261   /**
   288    * \internal
       
   289    *
       
   290    * Callbacks to fire if the link changes state (up or down).
   262    * Callbacks to fire if the link changes state (up or down).
   291    */
   263    */
   292   TracedCallback<> m_linkChangeCallbacks;
   264   TracedCallback<> m_linkChangeCallbacks;
   293 
   265 
   294   /**
   266   /**
   295    * \internal
       
   296    *
       
   297    * Flag indicating whether or not the underlying net device supports
   267    * Flag indicating whether or not the underlying net device supports
   298    * broadcast.
   268    * broadcast.
   299    */
   269    */
   300   bool m_isBroadcast;
   270   bool m_isBroadcast;
   301 
   271 
   302   /**
   272   /**
   303    * \internal
       
   304    *
       
   305    * Flag indicating whether or not the underlying net device supports
   273    * Flag indicating whether or not the underlying net device supports
   306    * multicast.
   274    * multicast.
   307    */
   275    */
   308   bool m_isMulticast;
   276   bool m_isMulticast;
   309 
   277 
   310   /**
   278   /**
   311    * \internal
       
   312    *
       
   313    * Number of packets that were received and scheduled for read but not yeat read.
   279    * Number of packets that were received and scheduled for read but not yeat read.
   314    */
   280    */
   315   uint32_t m_pendingReadCount;
   281   uint32_t m_pendingReadCount;
   316   
   282   
   317   /**
   283   /**
   318    * \internal
       
   319    *
       
   320    * Maximum number of packets that can be received and scheduled for read but not yeat read.
   284    * Maximum number of packets that can be received and scheduled for read but not yeat read.
   321    */
   285    */
   322   uint32_t m_maxPendingReads;
   286   uint32_t m_maxPendingReads;
   323   
   287   
   324    
   288    
   325   /**
   289   /**
   326    * \internal
       
   327    *
       
   328    * Mutex to increase pending read counter.
   290    * Mutex to increase pending read counter.
   329    */
   291    */
   330   SystemMutex m_pendingReadMutex;
   292   SystemMutex m_pendingReadMutex;
   331 
   293 
   332   /**
   294   /**
   333    * \internal
       
   334    *
       
   335    * Time to start spinning up the device
   295    * Time to start spinning up the device
   336    */
   296    */
   337   Time m_tStart;
   297   Time m_tStart;
   338 
   298 
   339   /**
   299   /**
   340    * \internal
       
   341    *
       
   342    * Time to start tearing down the device
   300    * Time to start tearing down the device
   343    */
   301    */
   344   Time m_tStop;
   302   Time m_tStop;
   345 
   303 
   346   EventId m_startEvent;
   304   EventId m_startEvent;