Changeset 21003

Show
Ignore:
Timestamp:
01/13/08 08:13:47 (8 months ago)
Author:
patrick
Message:

While pondering the mysteries of life, it occurred to me that the code in the
class vpr::SocketBasicOpt?, vpr::SocketIpOpt?, vpr::SocketStreamOpt?, and
vpr::SocketDatagramOpt? really did not need to be in base classes. I think that
doing things in that manner dates back to the very early days of VPR (circa
October 2000), and things have changed quite a lot in the I/O architecture
since then. This changes things around so that the methods of
vpr::SocketBasicOpt? and vpr::SocketIpOpt? are now directly part of
vpr::Socket_t<T> instead of being inherited. Similarly, the methods of
vpr::SocketDatagramOpt? are now part of vpr::SocketDatagram_t<T> and those
of vpr::SocketStreamOpt? are now part of vpr::SocketStream_t<T>. The class
vpr::SocketOptionWrapper? has been removed altogether as it really served no
purpose at all. Fundamentally, the way that socket options were being
handled violated the rule that public inheritance dictates an is-a
relationship (is a socket a socket option? No.), but in a borader sense, it
just made things more complicated than necessary.

This change should not have any impact on user-level code as I doubt that
anyone would have been handling socket objects as instances of
vpr::SocketOptionWrapper? or a subclass thereof.

Bumped the version to 2.1.10.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/vapor/ChangeLog

    r20997 r21003  
    11DATE       AUTHOR   CHANGE 
    22---------- -------- ----------------------------------------------------------- 
     32008-01-13 patrick  Folded vpr::SocketBasicOpt and vpr::SocketIpOpt into 
     4                    vpr::Socket_t<T>. Folded vpr::SocketStreamOpt into 
     5                    vpr::SocketStream_t<T>. Folded vpr::SocketDatagramOpt into 
     6                    vpr::SocketDatagram_t<T>. Removed vpr::SocketOptionWrapper. 
     7                    NEW VERSION: 2.1.10 
    382008-01-12 patrick  Extended vpr::SocketStream to support "corked" or no-push 
    49                    writing. 
  • juggler/trunk/modules/vapor/VERSION

    r20997 r21003  
     12.1.10-0 @01/13/2008 14:15:00 UTC@ 
    122.1.9-0 @01/12/2008 15:20:00 UTC@ 
    232.1.8-0 @10/30/2007 20:15:00 UTC@ 
  • juggler/trunk/modules/vapor/vpr/IO/Socket/Makefile.in

    r21001 r21003  
    5959                SocketAcceptor.cpp              \ 
    6060                SocketConnector.cpp             \ 
    61                 SocketDatagramOpt.cpp           \ 
    6261                SocketException.cpp             \ 
    63                 SocketStreamOpt.cpp             \ 
    6462                UnknownHostException.cpp 
    6563 
  • juggler/trunk/modules/vapor/vpr/IO/Socket/SocketDatagram_t.h

    r20993 r21003  
    4141 
    4242#include <vpr/IO/Socket/Socket_t.h> 
    43 #include <vpr/IO/Socket/SocketDatagramOpt.h> 
    4443 
    4544#include <boost/smart_ptr.hpp> 
     
    5857 * 
    5958 * @see vpr::SocketDatagramImplNSPR, vpr::SocketDatagramImplBSD 
     59 * 
     60 * @note vpr::SocketDatagramOpt was folded into this class in version 2.1.10. 
     61 *       User-level code will most likely not be affected by this difference. 
    6062 */ 
    6163template<class SocketConfig_> 
    6264class SocketDatagram_t 
    6365   : public Socket_t<SocketConfig_> 
    64    , public SocketDatagramOpt 
    6566{ 
    6667public: 
     
    7374   SocketDatagram_t() 
    7475      : Socket_t<Config>() 
    75       , SocketDatagramOpt() 
    7676      , mSocketDgramImpl() 
    7777   { 
     
    9696                    const vpr::InetAddr& remoteAddr) 
    9797      : Socket_t<Config>() 
    98       , SocketDatagramOpt() 
    9998   { 
    10099      mSocketDgramImpl = 
     
    111110   SocketDatagram_t(const SocketDatagram_t& sock) 
    112111      : Socket_t<Config>() 
    113       , SocketDatagramOpt() 
    114112      , mSocketDgramImpl(sock.mSocketDgramImpl) 
    115113   { 
     
    214212   } 
    215213 
    216 protected: 
    217    /** 
    218     * @throw vpr::SocketException 
    219     *           Thrown if querying the indiccated option on this socket fails. 
    220     */ 
    221    virtual void getOption(const vpr::SocketOptions::Types option, 
    222                           struct vpr::SocketOptions::Data& data) 
    223       const 
    224    { 
    225       return mSocketDgramImpl->getOption(option, data); 
    226    } 
    227  
    228    /** 
    229     * @throw vpr::SocketException 
    230     *           Thrown if setting the indicated option on this socket fails. 
    231     */ 
    232    virtual void setOption(const vpr::SocketOptions::Types option, 
    233                           const struct vpr::SocketOptions::Data& data) 
    234    { 
    235       mSocketDgramImpl->setOption(option, data); 
    236    } 
     214   /** @name Socket Options */ 
     215   //@{ 
     216   /** 
     217    * Gets the multicast interface for this datagram socket. 
     218    * 
     219    * @throw vpr::SocketException Thrown if the operation failed. 
     220    */ 
     221   const vpr::InetAddr getMcastInterface() const 
     222   { 
     223      vpr::SocketOptions::Data option; 
     224 
     225      this->getOption(SocketOptions::McastInterface, option); 
     226      return option.mcast_if; 
     227   } 
     228 
     229   /** 
     230    * Sets the multicast interface for this datagram socket. 
     231    * 
     232    * @throw vpr::SocketException Thrown if the operation failed. 
     233    */ 
     234   void setMcastInterface(const vpr::InetAddr& mcastIf) 
     235   { 
     236      vpr::SocketOptions::Data option; 
     237      option.mcast_if = mcastIf; 
     238      this->setOption(SocketOptions::McastInterface, option); 
     239   } 
     240 
     241   /** 
     242    * Gets the multicast time-to-live parameter for packets sent on this 
     243    * socket. 
     244    * 
     245    * @throw vpr::SocketException Thrown if the operation failed. 
     246    */ 
     247   vpr::Uint8 getMcastTimeToLive() const 
     248   { 
     249      vpr::SocketOptions::Data option; 
     250 
     251      this->getOption(SocketOptions::McastTimeToLive, option); 
     252      return option.mcast_ttl; 
     253   } 
     254 
     255   /** 
     256    * Sets the multicast time-to-live parameter for packets sent on this 
     257    * socket. 
     258    * 
     259    * @throw vpr::SocketException Thrown if the operation failed. 
     260    */ 
     261   void setMcastTimeToLive(const vpr::Uint8 ttl) 
     262   { 
     263      vpr::SocketOptions::Data option; 
     264      option.mcast_ttl = ttl; 
     265      this->setOption(SocketOptions::McastTimeToLive, option); 
     266   } 
     267 
     268   /** 
     269    * @throw vpr::SocketException Thrown if the operation failed. 
     270    */ 
     271   vpr::Uint8 getMcastLoopback() const 
     272   { 
     273      vpr::SocketOptions::Data option; 
     274 
     275      this->getOption(SocketOptions::McastLoopback, option); 
     276      return option.mcast_loopback; 
     277   } 
     278 
     279   /** 
     280    * @throw vpr::SocketException Thrown if the operation failed. 
     281    */ 
     282   void setMcastLoopback(const vpr::Uint8 loop) 
     283   { 
     284      vpr::SocketOptions::Data option; 
     285      option.mcast_loopback = loop; 
     286      this->setOption(SocketOptions::McastLoopback, option); 
     287   } 
     288 
     289   /** 
     290    * @throw vpr::IOException Thrown if the operation failed. 
     291    */ 
     292   void addMcastMember(const vpr::McastReq& request) 
     293   { 
     294      vpr::SocketOptions::Data option; 
     295      option.mcast_add_member = request; 
     296      this->setOption(SocketOptions::AddMember, option); 
     297   } 
     298 
     299   /** 
     300    * @throw vpr::IOException Thrown if the operation failed. 
     301    */ 
     302   void dropMcastMember(const vpr::McastReq& request) 
     303   { 
     304      vpr::SocketOptions::Data option; 
     305      option.mcast_drop_member = request; 
     306      this->setOption(SocketOptions::DropMember, option); 
     307   } 
     308 
     309   /** 
     310    * @throw vpr::IOException Thrown if the operation failed. 
     311    * @since 1.1.17 
     312    */ 
     313   void setBroadcast(const bool val) 
     314   { 
     315      vpr::SocketOptions::Data option; 
     316      option.broadcast = val; 
     317      this->setOption(SocketOptions::Broadcast, option); 
     318   } 
     319   //@} 
    237320 
    238321// Put in back door for simulator 
  • juggler/trunk/modules/vapor/vpr/IO/Socket/SocketOptions.h

    r20997 r21003  
    125125} 
    126126 
    127 /** \class SocketOptionWrapper SocketOptions.h vpr/IO/Socket/SocketOptions.h 
    128  * 
    129  * Simple interface for setting and querying socket options. 
    130  */ 
    131 class VPR_CLASS_API SocketOptionWrapper 
    132 { 
    133 public: 
    134    virtual ~SocketOptionWrapper() 
    135    { 
    136       /* Do nothing. */ ; 
    137    } 
    138  
    139 protected: 
    140    /** 
    141     * Retrieves the value for the given option as set on the socket. 
    142     * 
    143     * @param option The option to be queried. 
    144     * @param data   A data buffer that will be used to store the value of the 
    145     *               given option. 
    146     * 
    147     * @throws vpr::SocketException if the value for the given option 
    148     *         could not be retrieved. 
    149     */ 
    150    virtual void getOption(const vpr::SocketOptions::Types option, 
    151                           struct vpr::SocketOptions::Data& data) const = 0; 
    152  
    153    /** 
    154     * Sets a value for the given option on the socket using the given data 
    155     * block. 
    156     * 
    157     * @param option The option whose value will be set. 
    158     * @param data   A data buffer containing the value to be used in setting 
    159     *               the socket option. 
    160     * 
    161     * @throws vpr::SocketException if the value for the given option 
    162     *         could not be set. 
    163     */ 
    164    virtual void setOption(const vpr::SocketOptions::Types option, 
    165                           const struct vpr::SocketOptions::Data& data) = 0; 
    166 }; 
    167  
    168127} // End of vpr namespace 
    169128 
  • juggler/trunk/modules/vapor/vpr/IO/Socket/SocketStream_t.h

    r21002 r21003  
    4040#include <vpr/vprConfig.h> 
    4141 
    42 #include <vpr/IO/Socket/SocketStreamOpt.h> 
    4342#include <vpr/IO/Socket/Socket_t.h> /* base bridge class.. */ 
    4443 
     
    5857 * 
    5958 * @see vpr::SocketStreamImplNSPR, vpr::SocketStreamImplBSD 
     59 * 
     60 * @note vpr::SocketStreamOpt was folded into this class in version 2.1.10. 
     61 *       User-level code will most likely not be affected by this difference. 
    6062 */ 
    6163//template<class RealSocketStreamImpl, class RealSocketStreamImplParent, class IO_STATS_STRATEGY = NullIOStatsStrategy> 
    6264//class SocketStream_t : public Socket_t<RealSocketStreamImplParent, IO_STATS_STRATEGY>, 
    6365template<class SocketConfig_> 
    64 class SocketStream_t : public Socket_t<SocketConfig_>, public SocketStreamOpt 
     66class SocketStream_t : public Socket_t<SocketConfig_> 
    6567{ 
    6668public: 
     
    108110   SocketStream_t(const SocketStream_t& sock) 
    109111      : Socket_t<SocketConfig_>() 
    110       , SocketStreamOpt() 
    111112      , mSocketStreamImpl(sock.mSocketStreamImpl) 
    112113   { 
     
    207208   } 
    208209 
     210   /** @name Socket Options */ 
     211   //@{ 
     212   /** 
     213    * 
     214    */ 
     215   size_t getMaxSegmentSize() const 
     216   { 
     217      vpr::SocketOptions::Data option; 
     218 
     219      this->getOption(vpr::SocketOptions::MaxSegment, option); 
     220      return option.max_segment; 
     221   } 
     222 
     223   /** 
     224    * 
     225    */ 
     226   void setMaxSegmentSize(const vpr::Int32 size) 
     227   { 
     228      vpr::SocketOptions::Data option; 
     229      option.max_segment = size; 
     230      this->setOption(vpr::SocketOptions::MaxSegment, option); 
     231   } 
     232 
     233   /** @name Nagle Algorithm Control */ 
     234   //@{ 
     235   /** 
     236    * Gets the current no-delay status for this socket.  If no-delay is true, 
     237    * then the Nagle algorithm has been disabled. 
     238    * 
     239    * @return \c true is returned if the Nabel algorithm is \em not being used 
     240    *         to delay the transmission of TCP segments. Otherwise, the Nagle 
     241    *         algorithm is delaying the transmission. 
     242    */ 
     243   bool getNoDelay() const 
     244   { 
     245      vpr::SocketOptions::Data option; 
     246 
     247      this->getOption(vpr::SocketOptions::NoDelay, option); 
     248      return option.no_delay; 
     249   } 
     250 
     251   /** 
     252    * Sets the current no-delay status for this socket.  If no-delay is true, 
     253    * then the Nagle algorithm will be disabled. 
     254    * 
     255    * @param enableVal The Boolean enable/disable state for no-delay on this 
     256    *                  socket. 
     257    */ 
     258   void setNoDelay(const bool enableVal) 
     259   { 
     260      vpr::SocketOptions::Data option; 
     261      option.no_delay = enableVal; 
     262      this->setOption(vpr::SocketOptions::NoDelay, option); 
     263   } 
     264   //@} 
     265 
     266   /** @name TCP Corking Interface */ 
     267   //@{ 
     268   /** 
     269    * Gets the state of the "no push" or "corking" for this socket. While a 
     270    * TCP socket is in the corked state, write operations are queued for 
     271    * later transmission when the socket is uncorked (that is, when the 
     272    * no-push state is disabled). 
     273    * 
     274    * @return true is returned if this socket is currently in the no-push 
     275    *         (corked) state. false is returned otherwise. 
     276    * 
     277    * @since 2.1.9 
     278    */ 
     279   bool getNoPush() const 
     280   { 
     281#if defined(HAVE_CORKABLE_TCP) 
     282      vpr::SocketOptions::Data option; 
     283 
     284      this->getOption(vpr::SocketOptions::NoPush, option); 
     285      return option.no_push; 
     286#else 
     287      return mCorked; 
     288#endif 
     289   } 
     290 
     291   /** 
     292    * Enables or disables the no-push (or "corked") state. 
     293    * 
     294    * @post If this socket was previously in the corked state and the value of 
     295    *       \p enableVal is false, then all queued buffer writes will be 
     296    *       performed. 
     297    * 
     298    * @param enableVal A boolean value indicating whether this socket should 
     299    *                  be in the no-push (corked) state. 
     300    * 
     301    * @since 2.1.9 
     302    */ 
     303   void setNoPush(const bool enableVal) 
     304   { 
     305// NSPR sockets are not corkable, but the OS may still support TCP corking. 
     306#if defined(HAVE_CORKABLE_TCP) && VPR_IO_DOMAIN_INCLUDE != VPR_DOMAIN_NSPR 
     307      vpr::SocketOptions::Data option; 
     308      option.no_push = enableVal; 
     309      this->setOption(vpr::SocketOptions::NoPush, option); 
     310#else 
     311      if ( enableVal != mCorked ) 
     312      { 
     313         // Changing from the uncorked state to the corked state. 
     314         if ( enableVal ) 
     315         { 
     316            mSocketStreamImpl->cork(); 
     317         } 
     318         // Changing from the corked state to the uncorked state. 
     319         else 
     320         { 
     321            mSocketStreamImpl->uncork(); 
     322         } 
     323      } 
     324#endif 
     325 
     326      mCorked = enableVal; 
     327   } 
     328 
    209329   /** 
    210330    * Changes the strategy used for determining hwo much memory to allocate 
     
    223343      mSocketStreamImpl->setCorkAllocStrategy(s); 
    224344   } 
     345   //@} 
     346 
     347   //@} 
    225348 
    226349protected: 
     
    242365 
    243366   /** 
    244     * @throw vpr::SocketException 
    245     *           Thrown if querying the indiccated option on this socket fails. 
    246     */ 
    247    virtual void getOption(const vpr::SocketOptions::Types option, 
    248                           struct vpr::SocketOptions::Data& data) 
    249       const 
    250    { 
    251       mSocketStreamImpl->getOption(option, data); 
    252    } 
    253  
    254    /** 
    255     * @throw vpr::SocketException 
    256     *           Thrown if setting the indicated option on this socket fails. 
    257     */ 
    258    virtual void setOption(const vpr::SocketOptions::Types option, 
    259                           const struct vpr::SocketOptions::Data& data) 
    260    { 
    261       mSocketStreamImpl->setOption(option, data); 
    262    } 
    263  
    264    /** 
    265367    * @name TCP Corking Interface Implementation 
    266368    * 
     
    268370    */ 
    269371   //@{ 
    270    /** 
    271     * Calls through to the cork() method of the internal stream socket 
    272     * implementation. 
    273     * 
    274     * @since 2.1.9 
    275     * 
    276     * @see vpr::SocketStreamImplBSD::cork() 
    277     * @see vpr::SocketStreamImplNSPR::cork() 
    278     */ 
    279    virtual void cork() 
    280    { 
    281       mSocketStreamImpl->cork(); 
    282    } 
    283  
    284    /** 
    285     * Calls through to the uncork() method of the internal stream socket 
    286     * implementation. 
    287     * 
    288     * @since 2.1.9 
    289     * 
    290     * @see vpr::SocketStreamImplBSD::uncork() 
    291     * @see vpr::SocketStreamImplNSPR::uncork() 
    292     */ 
    293    virtual void uncork() 
    294    { 
    295       mSocketStreamImpl->uncork(); 
    296    } 
    297    //@} 
    298  
    299372// Put in back door for simulator 
    300373#if VPR_IO_DOMAIN_INCLUDE == VPR_DOMAIN_SIMULATOR 
     
    303376   /// Platform-specific stream socket implementation 
    304377   boost::shared_ptr<SocketStreamImpl> mSocketStreamImpl; 
     378 
     379private: 
     380   bool mCorked; 
    305381}; 
    306382 
  • juggler/trunk/modules/vapor/vpr/IO/Socket/Socket_t.h

    r20974 r21003  
    4646#include <vpr/IO/IOSys.h> 
    4747#include <vpr/IO/Socket/SocketOptions.h> 
    48 #include <vpr/IO/Socket/SocketIpOpt.h> 
    4948 
    5049#include <vpr/Util/Interval.h> 
     
    7372 * @see vpr::SocketStream_t, vpr::SocketDatagram_t, vpr::SocketImplNSPR, 
    7473 *      vpr::SocketImplBSD 
     74 * 
     75 * @note vpr::SocketBasicOpt and vpr::SocketIpOpt were folded into this class 
     76 *       in version 2.1.10. User-level code will most likely not be affected 
     77 *       by this difference. 
    7578 */ 
    7679//template<class RealSocketImpl, class IO_STATS_STRATEGY = NullIOStatsStrategy> 
    7780template<class SockConfig_> 
    78 class Socket_t : public vpr::BlockIO, public vpr::SocketIpOpt 
     81class Socket_t : public vpr::BlockIO 
    7982{ 
    8083public: 
     
    596599      mSocketImpl->setRemoteAddr(addr); 
    597600   } 
     601 
     602   /** @name Socket Options */ 
     603   //@{ 
     604   /** 
     605    * @throw vpr::SocketException Thrown if the operation failed. 
     606    */ 
     607   bool getKeepAlive() const 
     608   { 
     609      vpr::SocketOptions::Data option; 
     610 
     611      getOption(vpr::SocketOptions::KeepAlive, option); 
     612 
     613      return option.keep_alive; 
     614   } 
     615 
     616   /** 
     617    * @throw vpr::SocketException Thrown if the operation failed. 
     618    */ 
     619   void setKeepAlive(const bool enableVal) 
     620   { 
     621      vpr::SocketOptions::Data option; 
     622      option.keep_alive = enableVal; 
     623      setOption(vpr::SocketOptions::KeepAlive, option); 
     624   } 
     625 
     626   /** 
     627    * @throw vpr::SocketException Thrown if the operation failed. 
     628    */ 
     629   void getLingerOnClose(bool& enabled, int& lingerSec) const 
     630   { 
     631      vpr::SocketOptions::Data opt; 
     632 
     633      getOption(vpr::SocketOptions::Linger, opt); 
     634 
     635      enabled   = opt.linger.enabled; 
     636      lingerSec = opt.linger.seconds; 
     637   } 
     638 
     639   /** 
     640    * @throw vpr::SocketException Thrown if the operation failed. 
     641    */ 
     642   void setLingerOnClose(const bool enableVal, 
     643                         const int lingerSec) 
     644   { 
     645      vpr::SocketOptions::Data opt; 
     646 
     647      opt.linger.enabled = enableVal; 
     648      opt.linger.seconds = lingerSec; 
     649 
     650      setOption(vpr::SocketOptions::Linger, opt); 
     651   } 
     652 
     653   /** 
     654    * @throw vpr::SocketException Thrown if the operation failed. 
     655    */ 
     656   size_t getRecvBufferSize() const 
     657   { 
     658      vpr::SocketOptions::Data opt; 
     659 
     660      getOption(vpr::SocketOptions::RecvBufferSize, opt); 
     661 
     662      return opt.recv_buffer_size; 
     663   } 
     664 
     665   /** 
     666    * @throw vpr::SocketException Thrown if the operation failed. 
     667    */ 
     668   void setRecvBufferSize(const Int32 size) 
     669   { 
     670      vpr::SocketOptions::Data opt; 
     671 
     672      opt.recv_buffer_size = size; 
     673 
     674      setOption(vpr::SocketOptions::RecvBufferSize, opt); 
     675   } 
     676 
     677   /** 
     678    * @throw vpr::SocketException Thrown if the operation failed. 
     679    */ 
     680   size_t getSendBufferSize() const 
     681   { 
     682      vpr::SocketOptions::Data opt; 
     683 
     684      getOption(vpr::SocketOptions::SendBufferSize, opt); 
     685 
     686      return opt.send_buffer_size; 
     687   } 
     688 
     689   /** 
     690    * @throw vpr::SocketException Thrown if the operation failed. 
     691    */ 
     692   void setSendBufferSize(const Int32 size) 
     693   { 
     694      vpr::SocketOptions::Data opt; 
     695 
     696      opt.send_buffer_size = size; 
     697 
     698      setOption(vpr::SocketOptions::SendBufferSize, opt); 
     699   } 
     700 
     701   /** 
     702    * @throw vpr::SocketException Thrown if the operation failed. 
     703    */ 
     704   bool getReuseAddr() const 
     705   { 
     706      vpr::SocketOptions::Data option; 
     707 
     708      getOption(vpr::SocketOptions::ReuseAddr, option); 
     709 
     710      return option.reuse_addr; 
     711   } 
     712 
     713   /** 
     714    * Enables reuse of the address that will be bound by the socket. 
     715    * 
     716    * @pre The socket has been opened, but bind() has not been called. 
     717    * 
     718    * @throw vpr::SocketException Thrown if the operation failed. 
     719    */ 
     720   void setReuseAddr(const bool enableVal) 
     721   { 
     722      vpr::SocketOptions::Data option; 
     723      option.reuse_addr = enableVal; 
     724      setOption(vpr::SocketOptions::ReuseAddr, option); 
     725   } 
     726 
     727   /** 
     728    * @throw vpr::SocketException Thrown if the operation failed. 
     729    */ 
     730   vpr::SocketOptions::TypeOfService getTypeOfService() const 
     731   { 
     732      vpr::SocketOptions::Data option; 
     733 
     734      getOption(vpr::SocketOptions::IpTypeOfService, option); 
     735      return option.type_of_service; 
     736   } 
     737 
     738   /** 
     739    * @throw vpr::SocketException Thrown if the operation failed. 
     740    */ 
     741   void setTypeOfService(const vpr::SocketOptions::TypeOfService& tos) 
     742   { 
     743      vpr::SocketOptions::Data option; 
     744      option.type_of_service = tos; 
     745      setOption(vpr::SocketOptions::IpTypeOfService, option); 
     746   } 
     747 
     748   /** 
     749    * @throw vpr::SocketException Thrown if the operation failed. 
     750    */ 
     751   vpr::Int32 getTimeToLive() const 
     752   { 
     753      vpr::SocketOptions::Data option; 
     754 
     755      getOption(vpr::SocketOptions::IpTimeToLive, option); 
     756      return option.ip_ttl; 
     757   } 
     758 
     759   /** 
     760    * @throw vpr::SocketException Thrown if the operation failed. 
     761    */ 
     762   void setTimeToLive(const vpr::Int32 ttl) 
     763   { 
     764      vpr::SocketOptions::Data option; 
     765      option.ip_ttl = ttl; 
     766      setOption(vpr::SocketOptions::IpTimeToLive, option); 
     767   } 
     768   //@} 
    598769 
    599770protected: 
     
    756927   } 
    757928 
    758    virtual void getOption(const vpr::SocketOptions::Types option, 
    759                           struct vpr::SocketOptions::Data& data) const 
     929   /** 
     930    * Retrieves the value for the given option as set on the socket. 
     931    * 
     932    * @param option The option to be queried. 
     933    * @param data   A data buffer that will be used to store the value of the 
     934    *               given option. 
     935    * 
     936    * @throw vpr::SocketException 
     937    *           Thrown if the value for the given option could not be 
     938    *           retrieved. 
     939    */ 
     940   void getOption(const vpr::SocketOptions::Types option, 
     941                  struct vpr::SocketOptions::Data& data) const 
    760942   { 
    761943      mSocketImpl->getOption(option, data); 
    762944   } 
    763945 
    764    virtual void setOption(const vpr::SocketOptions::Types option, 
    765                           const struct vpr::SocketOptions::Data& data) 
     946   /** 
     947    * Sets a value for the given option on the socket using the given data 
     948    * block. 
     949    * 
     950    * @param option The option whose value will be set. 
     951    * @param data   A data buffer containing the value to be used in setting 
     952    *               the socket option. 
     953    * 
     954    * @throw vpr::SocketException 
     955    *           Thrown if the value for the given option could not be set. 
     956    */ 
     957   void setOption(const vpr::SocketOptions::Types option, 
     958                  const struct vpr::SocketOptions::Data& data) 
    766959   { 
    767960      mSocketImpl->setOption(option, data);