Skip to content
Snippets Groups Projects
Commit a1ecefaf authored by dw6's avatar dw6
Browse files

added documentation. hopefully enough and correct.

parent e621b08f
No related branches found
No related tags found
No related merge requests found
...@@ -32,17 +32,27 @@ ...@@ -32,17 +32,27 @@
//#include "UNAddress.mpp" //#include "UNAddress.mpp"
///////////////////////////////hh.p//////////////////////////////////////// ///////////////////////////////hh.p////////////////////////////////////////
namespace senf { namespace senf {
/** \brief Unix domain address
UNAddress represents a simple unix domain address which is given by a path to a socket.
It is modelled as a boost::filesystem::path.
\ingroup addr_group
*/
class UNAddress class UNAddress
: public boost::filesystem::path, : public boost::filesystem::path,
public ComparableSafeBool<UNAddress> public ComparableSafeBool<UNAddress>
{ {
public: public:
UNAddress(); UNAddress(); ///< Construct an empty address
explicit UNAddress(boost::filesystem::path); explicit UNAddress(boost::filesystem::path);///< Construct an address constant from given path
static UNAddress fromString(std::string & s); static UNAddress fromString(std::string & s); ///< Convert string to address by interpreting the string as path
static UNAddress fromPath(boost::filesystem::path & p); static UNAddress fromPath(boost::filesystem::path & p);///< Convert path to address
static std::string pathString(); static std::string pathString(); ///< Return the path of the address as string
struct AddressException : public std::exception {};
/** \brief Base-class for UNAddress exceptions */
struct AddressException : public std::exception {};
private: private:
static boost::filesystem::path path; static boost::filesystem::path path;
}; };
......
...@@ -40,26 +40,56 @@ ...@@ -40,26 +40,56 @@
//#include "UNAddressing.mpp" //#include "UNAddressing.mpp"
///////////////////////////////hh.p//////////////////////////////////////// ///////////////////////////////hh.p////////////////////////////////////////
namespace senf { namespace senf {
/** \brief Unix domain socket address
UNSocketAddress wraps the standard sockaddr_in datatype. It provides simple accessor methods
to access the path.
\implementation This implementation is based on sockaddr_un.
\ingroup addr_group
*/
class UNSocketAddress class UNSocketAddress
: public ComparableSafeBool<UNSocketAddress> : public ComparableSafeBool<UNSocketAddress>
{ {
public: public:
//UNSocketAddress(); //UNSocketAddress();
explicit UNSocketAddress(boost::filesystem::path p); explicit UNSocketAddress(boost::filesystem::path p);
///< Construct an address constant ///< Construct an address constant from given path
static UNSocketAddress from_string(std::string const s); static UNSocketAddress from_string(std::string const s); ///< Create UNSocketAddress from string
static UNSocketAddress from_path(boost::filesystem::path const p); static UNSocketAddress from_path(boost::filesystem::path const p); ///< Create UNSocketAddress from path
static std::string path(); static std::string path(); ///< Return path as string
static sockaddr_un sockaddr(); static sockaddr_un sockaddr();
struct sockaddr * sockaddr_p(); struct sockaddr * sockaddr_p();
struct sockaddr const * sockaddr_p() const; struct sockaddr const * sockaddr_p() const;
unsigned sockaddr_len() const; unsigned sockaddr_len() const;
private: private:
static struct sockaddr_un sockAddr; static struct sockaddr_un sockAddr;
}; };
/** \brief Write path os
\related UNSocketAddress
*/
std::ostream & operator<<(std::ostream & os, UNSocketAddress const & addr); std::ostream & operator<<(std::ostream & os, UNSocketAddress const & addr);
/// \addtogroup policy_impl_group
/// @{
/** \brief Addressing policy supporting unix domain addressing
\par Address Type:
UNAddress
This addressing policy implements addressing using unix domain
addresses.
The various members are directly imported from
GenericAddressingPolicy which see for a detailed
documentation.
*/
struct UNAddressingPolicy struct UNAddressingPolicy
: public AddressingPolicyBase, : public AddressingPolicyBase,
......
...@@ -50,8 +50,27 @@ namespace senf { ...@@ -50,8 +50,27 @@ namespace senf {
ReadablePolicy, ReadablePolicy,
WriteablePolicy, WriteablePolicy,
SocketBufferingPolicy SocketBufferingPolicy
>::policy UNDatagramSocket_Policy; >::policy UNDatagramSocket_Policy; ///< Socket Policy of the Unix Domain Datagram Protocol
/** \brief Unix Domain Datagram Socket Protocol
\par Socket Handle typedefs:
\ref UNDatagramSocketHandle (ProtocolClientSocketHandle)
\par Policy Interface: (to be checked)
ClientSocketHandle::read(), ClientSocketHandle::readfrom(),
ClientSocketHandle::writeto(), ClientSocketHandle::bind(), ClientSocketHandle::local(),
ClientSocketHandle::rcvbuf(), ClientSocketHandle::sndbuf()
\par Address Type:
UNAddress
UNDatagramSocketProtocol provides an datagram protocol socket based on the unix domain addressing.
This class is utilized as the protocol class of the ProtocolClientSocketHandle
via the Socket Handle typedefs above.
*/
class UNDatagramSocketProtocol class UNDatagramSocketProtocol
: public ConcreteSocketProtocol<UNDatagramSocket_Policy>, : public ConcreteSocketProtocol<UNDatagramSocket_Policy>,
public UNProtocol, public UNProtocol,
......
...@@ -49,11 +49,11 @@ namespace senf { ...@@ -49,11 +49,11 @@ namespace senf {
: public virtual SocketProtocol : public virtual SocketProtocol
{ {
public: public:
void connect(UNSocketAddress const & address) const; ///< Connect to remote address void connect(UNSocketAddress const & address) const; ///< Connect to a unix domain socket
/**< \todo make this obsolete by allowing access to the /**< \todo make this obsolete by allowing access to the
ClientSocketHandle from ConcreateSocketProtocol ClientSocketHandle from ConcreateSocketProtocol
\param[in] address Address to connect to */ \param[in] address Address to connect to */
void bind(UNSocketAddress const & address) const; ///< Set local socket address void bind(UNSocketAddress const & address) const; ///< Set local socket address (path)
/**< \todo make this obsolete by allowing access to the /**< \todo make this obsolete by allowing access to the
ClientSocketHandle from ConcreateSocketProtocol ClientSocketHandle from ConcreateSocketProtocol
\param[in] address Address to set */ \param[in] address Address to set */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment