X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FClientSocketHandle.hh;h=92635f956927c221c820ce60de7bc32402d7d64d;hb=532240d72e09e19e57fac9bb55c2560b9c9e5b97;hp=2e2372a1b5bff5fd7c6e75be7f60dc9ab65a7675;hpb=96d591f9024bc536e0a643b40c2bf243241d342d;p=senf.git diff --git a/Socket/ClientSocketHandle.hh b/Socket/ClientSocketHandle.hh index 2e2372a..92635f9 100644 --- a/Socket/ClientSocketHandle.hh +++ b/Socket/ClientSocketHandle.hh @@ -1,9 +1,9 @@ // $Id$ // // Copyright (C) 2006 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Stefan Bund +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Stefan Bund // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -24,8 +24,8 @@ \brief ClientSocketHandle public header */ -#ifndef HH_ClientSocketHandle_ -#define HH_ClientSocketHandle_ 1 +#ifndef HH_SENF_Socket_ClientSocketHandle_ +#define HH_SENF_Socket_ClientSocketHandle_ 1 // Custom includes #include @@ -42,7 +42,7 @@ namespace senf { /// \addtogroup handle_group /// @{ - template class ServerSocketHandle; + template class ServerSocketHandle; /** \brief Generic SocketHandle with client interface @@ -63,8 +63,6 @@ namespace senf { bind() AddressingPolicy::bind (\ref senf::AddressingPolicyBase) peer() AddressingPolicy::peer (\ref senf::AddressingPolicyBase) local() AddressingPolicy::local (\ref senf::AddressingPolicyBase) - rcvbuf() BufferingPolicy::sndbuf (\ref senf::BufferingPolicyBase) - sndbuf() BufferingPolicy::rcvbuf (\ref senf::BufferingPolicyBase) It is important to note, that not all members are always accessible. Which are depends on @@ -87,16 +85,16 @@ namespace senf { \see \ref policy_group \n \ref protocol_group */ - template + template class ClientSocketHandle - : public SocketHandle + : public SocketHandle { public: /////////////////////////////////////////////////////////////////////////// // Types /// Address type from the addressing policy - typedef typename Policy::AddressingPolicy::Address Address; + typedef typename SPolicy::AddressingPolicy::Address Address; /// 'Best' type for passing address as parameter /** Depending on the type of \c Address, this will be either Address or Address const &. See ServerSocketHandle; + typedef ServerSocketHandle ServerHandle; /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members @@ -123,13 +121,22 @@ namespace senf { ClientSocketHandle(); // conversion constructors +# ifndef DOXYGEN template ClientSocketHandle(ClientSocketHandle other, - typename SocketHandle::template IsCompatible::type * = 0); + typename SocketHandle::template IsCompatible::type * = 0); +# else + ClientSocketHandle(ClientSocketHandle other); +# endif +# ifndef DOXYGEN template - typename SocketHandle::template IsCompatible::type const & + typename SocketHandle::template IsCompatible::type const & operator=(ClientSocketHandle other); +# else + template + ClientSocketHandle const & operator=(ClientSocketHandle other); +# endif ///@} /////////////////////////////////////////////////////////////////////////// @@ -190,14 +197,20 @@ namespace senf { \see \ref read() \n Boost.Range */ # endif +# ifndef DOXYGEN template typename boost::range_iterator::type read (ForwardWritableRange & range, typename boost::disable_if< boost::is_convertible >::type * = 0); +# else + template + typename boost::range_iterator::type + read (ForwardWritableRange & range); ///< Read data into range /**< \see read(ForwardWritableRange const &) \n read() \n Boost.Range */ +# endif template void read (Sequence & container, unsigned limit); ///< Read data into container @@ -361,18 +374,18 @@ namespace senf { \throws senf::SystemException */ - void connect (AddressParam addr); + void connect (AddressParam addr) const; /** \brief Set local address For addressable protocols (AddressingPolicy is not NoAddressingPolicy), bind() will set the local address of the socket. - \param[in] addr Local socket address to asign + \param[in] addr Local socket address to assign \throws senf::SystemException */ - void bind (AddressParam addr); + void bind (AddressParam addr) const; /** \brief Query remote address @@ -385,8 +398,8 @@ namespace senf { \throws senf::SystemException */ - Address peer (); - void peer (Address & addr); + Address peer () const; + void peer (Address & addr) const; ///< Query remote address /**< \see \ref peer() */ @@ -400,31 +413,13 @@ namespace senf { \throws senf::SystemException */ - Address local (); - void local (Address & addr); + Address local () const; + void local (Address & addr) const; ///< Query local address /**< \see \ref local() */ ///@} - /////////////////////////////////////////////////////////////////////////// - ///\name Buffering - ///@{ - - unsigned rcvbuf (); ///< Check size of receive buffer - /**< \returns size of receive buffer in bytes */ - void rcvbuf (unsigned size); - ///< Set size of receive buffer - /**< \param[in] size size of receive buffer in bytes */ - - unsigned sndbuf (); ///< Check size of send buffer - /**< \returns size of send buffer in bytes */ - void sndbuf (unsigned size); - ///< Set size of send buffer - /**< \param[in] size size of send buffer in bytes */ - - ///@} - static ClientSocketHandle cast_static(FileHandle handle); static ClientSocketHandle cast_dynamic(FileHandle handle); @@ -432,15 +427,14 @@ namespace senf { void state(SocketStateMap & map, unsigned lod=0); std::string dumpState(unsigned lod=0); + unsigned available(); + protected: ClientSocketHandle(FileHandle other, bool isChecked); - explicit ClientSocketHandle(std::auto_ptr protocol, - int fd = -1); + explicit ClientSocketHandle(std::auto_ptr body); private: - unsigned available(); - - friend class senf::ServerSocketHandle; + friend class senf::ServerSocketHandle; }; /// @}