src/internet/model/ipv4-end-point.h
changeset 10440 1e48ff9185f1
parent 7386 2310ed220a61
child 11470 0b3d6135a28b
--- a/src/internet/model/ipv4-end-point.h	Sun Nov 24 23:48:49 2013 +0100
+++ b/src/internet/model/ipv4-end-point.h	Wed Nov 20 20:15:02 2013 +0100
@@ -46,48 +46,188 @@
 
 class Ipv4EndPoint {
 public:
+  /**
+   * \brief Constructor.
+   * \param address the IPv4 address
+   * \param port the port
+   */
   Ipv4EndPoint (Ipv4Address address, uint16_t port);
   ~Ipv4EndPoint ();
 
+  /**
+   * \brief Get the local address.
+   * \return the local address
+   */
   Ipv4Address GetLocalAddress (void);
+
+  /**
+   * \brief Set the local address.
+   * \param address the address to set
+   */
   void SetLocalAddress (Ipv4Address address);
+
+  /**
+   * \brief Get the local port.
+   * \return the local port
+   */
   uint16_t GetLocalPort (void);
+
+  /**
+   * \brief Get the peer address.
+   * \return the peer address
+   */
   Ipv4Address GetPeerAddress (void);
+
+  /**
+   * \brief Get the peer port.
+   * \return the peer port
+   */
   uint16_t GetPeerPort (void);
 
+  /**
+   * \brief Set the peer informations (address and port).
+   * \param address peer address
+   * \param port peer port
+   */
   void SetPeer (Ipv4Address address, uint16_t port);
 
+  /**
+   * \brief Bind a socket to specific device.
+   *
+   * This method corresponds to using setsockopt() SO_BINDTODEVICE
+   * of real network or BSD sockets.   If set on a socket, this option will
+   * force packets to leave the bound device regardless of the device that
+   * IP routing would naturally choose.  In the receive direction, only
+   * packets received from the bound interface will be delivered.
+   *
+   * This option has no particular relationship to binding sockets to
+   * an address via Socket::Bind ().  It is possible to bind sockets to a
+   * specific IP address on the bound interface by calling both
+   * Socket::Bind (address) and Socket::BindToNetDevice (device), but it
+   * is also possible to bind to mismatching device and address, even if
+   * the socket can not receive any packets as a result.
+   *
+   * \param netdevice Pointer to Netdevice of desired interface
+   */
   void BindToNetDevice (Ptr<NetDevice> netdevice);
+
+  /**
+   * \brief Returns socket's bound netdevice, if any.
+   *
+   * This method corresponds to using getsockopt() SO_BINDTODEVICE
+   * of real network or BSD sockets.
+   *
+   *
+   * \returns Pointer to interface.
+   */
   Ptr<NetDevice> GetBoundNetDevice (void);
 
   // Called from socket implementations to get notified about important events.
+  /**
+   * \brief Set the reception callback.
+   * \param callback callback function
+   */
   void SetRxCallback (Callback<void,Ptr<Packet>, Ipv4Header, uint16_t, Ptr<Ipv4Interface> > callback);
+  /**
+   * \brief Set the ICMP callback.
+   * \param callback callback function
+   */
   void SetIcmpCallback (Callback<void,Ipv4Address,uint8_t,uint8_t,uint8_t,uint32_t> callback);
+  /**
+   * \brief Set the default destroy callback.
+   * \param callback callback function
+   */
   void SetDestroyCallback (Callback<void> callback);
 
-  // Called from an L4Protocol implementation to notify an endpoint of a
-  // packet reception.
+  /**
+   * \brief Forward the packet to the upper level.
+   *
+   * Called from an L4Protocol implementation to notify an endpoint of a
+   * packet reception.
+   * \param p the packet
+   * \param header the packet header
+   * \param sport source port
+   * \param incomingInterface incoming interface
+   */
   void ForwardUp (Ptr<Packet> p, const Ipv4Header& header, uint16_t sport, 
                   Ptr<Ipv4Interface> incomingInterface);
-  // Called from an L4Protocol implementation to notify an endpoint of
-  // an icmp message reception.
+
+  /**
+   * \brief Forward the ICMP packet to the upper level.
+   *
+   * Called from an L4Protocol implementation to notify an endpoint of
+   * an icmp message reception.
+   *
+   * \param icmpSource source IP address
+   * \param icmpTtl time-to-live
+   * \param icmpType ICMP type
+   * \param icmpCode ICMP code
+   * \param icmpInfo ICMP info
+   */
   void ForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, 
                     uint8_t icmpType, uint8_t icmpCode,
                     uint32_t icmpInfo);
 
 private:
+  /**
+   * \brief ForwardUp wrapper.
+   * \param p packet
+   * \param header the packet header
+   * \param sport source port
+   * \param incomingInterface incoming interface
+   */
   void DoForwardUp (Ptr<Packet> p, const Ipv4Header& header, uint16_t sport,
                     Ptr<Ipv4Interface> incomingInterface);
-  void DoForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, 
+  /**
+   * \brief ForwardIcmp wrapper.
+   * \param icmpSource source IP address
+   * \param icmpTtl time-to-live
+   * \param icmpType ICMP type
+   * \param icmpCode ICMP code
+   * \param icmpInfo ICMP info
+   */
+  void DoForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl,
                       uint8_t icmpType, uint8_t icmpCode,
                       uint32_t icmpInfo);
+
+  /**
+   * \brief The local address.
+   */
   Ipv4Address m_localAddr;
+
+  /**
+   * \brief The local port.
+   */
   uint16_t m_localPort;
+
+  /**
+   * \brief The peer address.
+   */
   Ipv4Address m_peerAddr;
+
+  /**
+   * \brief The peer port.
+   */
   uint16_t m_peerPort;
+
+  /**
+   * \brief The NetDevice the EndPoint is bound to (if any).
+   */
   Ptr<NetDevice> m_boundnetdevice;
+
+  /**
+   * \brief The RX callback.
+   */
   Callback<void,Ptr<Packet>, Ipv4Header, uint16_t, Ptr<Ipv4Interface> > m_rxCallback;
+
+  /**
+   * \brief The ICMPv6 callback.
+   */
   Callback<void,Ipv4Address,uint8_t,uint8_t,uint8_t,uint32_t> m_icmpCallback;
+
+  /**
+   * \brief The destroy callback.
+   */
   Callback<void> m_destroyCallback;
 };