[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/libqt-addon
From:       Thiago Macieira <thiagom () mail ! com>
Date:       2003-12-12 15:57:36
[Download RAW message or body]

CVS commit by thiago: 

Added a method of retrieving the externally visible local address.
Also changed documentation stating that QSocketImpl::peerAddress is
to return the actual peer, not the proxy's address if one is being
used.


  M +1 -3      TODO   1.2
  M +8 -1      libqt-addon/qsocketimpl.cpp   1.11
  M +20 -3     libqt-addon/qsocketimpl.h   1.10


--- kdenonbeta/libqt-addon/TODO  #1.1:1.2
@@ -3,6 +3,4 @@
 Sockets:
 ========
-- Add a method to differentiate the real local IP from the external IP a 
-proxy may have bound to (SOCKS, UPnP)
 - Enhance QSocketImpl creation through requested capabilities
   (multicast, datagram, local-binding)

--- kdenonbeta/libqt-addon/libqt-addon/qsocketimpl.h  #1.9:1.10
@@ -247,9 +247,26 @@ public:
 
   /**
-   * Returns this socket's peer address.
+   * Returns this socket's peer address. If this implementation does proxying
+   * of some sort, this is the real external address, not the proxy's address.
    */
   virtual QSocketAddress peerAddress() const;
 
   /**
+   * Returns this socket's externally visible local address.
+   *
+   * If this socket has a local address visible externally different
+   * from the normal local address (as returned by @ref localAddress), then
+   * return it.
+   *
+   * Certain implementations will use proxies and thus have externally visible
+   * addresses different from the local socket values. The default implementation
+   * returns the same value as @ref localAddress.
+   *
+   * @note This function may return an empty QSocketAddress. In that case, the
+   *       externally visible address could/can not be determined.
+   */
+  virtual QSocketAddress externalAddress() const;
+
+  /**
    * Returns a socket notifier for input on this socket.
    * The notifier is created only when requested. Whether

--- kdenonbeta/libqt-addon/libqt-addon/qsocketimpl.cpp  #1.10:1.11
@@ -607,4 +607,11 @@ QSocketAddress QSocketImpl::peerAddress(
 }
 
+QSocketAddress QSocketImpl::externalAddress() const
+{
+  // for normal sockets, the externally visible address is the same
+  // as the local address
+  return localAddress();
+}
+
 QSocketNotifier* QSocketImpl::readNotifier() const
 {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic