// $Id$
//
-// Copyright (C) 2007
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// David Wagner <dw6@berlios.de>
//
// 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
/** \file
\brief UNAddressing public header */
-#ifndef HH_UNAddressing_
-#define HH_UNAddressing_ 1
+#ifndef HH_SENF_Socket_Protocols_UN_UNAddressing_
+#define HH_SENF_Socket_Protocols_UN_UNAddressing_ 1
// Custom includes
#include <iostream>
#include <string>
#include <sys/socket.h>
#include <sys/un.h>
-#include <boost/cstdint.hpp>
-#include <boost/operators.hpp>
-#include "boost/filesystem/path.hpp"
-#include "../../../Socket/SocketPolicy.hh"
-#include "../../../Socket/ClientSocketHandle.hh"
-#include "../../../Socket/CommunicationPolicy.hh"
-#include "../../../Socket/Protocols/GenericAddressingPolicy.hh"
-#include "UNAddress.hh"
+#include "../BSDAddressingPolicy.hh"
+#include "../BSDSocketAddress.hh"
//#include "UNAddressing.mpp"
///////////////////////////////hh.p////////////////////////////////////////
+
namespace senf {
+
+ /** \brief Unix domain socket address
+
+ UNSocketAddress wraps the standard sockaddr_un datatype. It provides simple accessor methods
+ to access the path.
+
+ \implementation This implementation is based on sockaddr_un.
+
+ \ingroup addr_group
+ */
class UNSocketAddress
- : public ComparableSafeBool<UNSocketAddress>
+ : public BSDSocketAddress
{
public:
+ static short const addressFamily = AF_UNIX;
+
+ UNSocketAddress();
+
+ explicit UNSocketAddress(std::string const & path);
+ ///< Construct an address constant from given path
+
+ UNSocketAddress(const UNSocketAddress& other);
+ UNSocketAddress& operator=(const UNSocketAddress& other);
+
+ std::string path() const ; ///< Return path as string
+ void path(std::string const & path);
+
+ using BSDSocketAddress::sockaddr_p;
+ using BSDSocketAddress::socklen_p;
- //UNSocketAddress();
- explicit UNSocketAddress(boost::filesystem::path p);
- ///< Construct an address constant
- static UNSocketAddress from_string(std::string const s);
- static UNSocketAddress from_path(boost::filesystem::path const p);
- static std::string path();
- static sockaddr_un sockaddr();
- struct sockaddr * sockaddr_p();
- struct sockaddr const * sockaddr_p() const;
- unsigned sockaddr_len() const;
private:
- static struct sockaddr_un sockAddr;
+ struct sockaddr_un addr_;
};
+
+ /** \brief Write path to os
+
+ \related UNSocketAddress
+ */
std::ostream & operator<<(std::ostream & os, UNSocketAddress const & addr);
+ /// \addtogroup policy_impl_group
+ /// @{
+
+ /** \brief Addressing policy supporting unix domain addressing
+
+ \par Address Type:
+ UNSocketAddress
+ This addressing policy implements addressing using unix domain
+ addresses.
+
+ The various members are directly imported from
+ BSDAddressingPolicyMixin which see for a detailed
+ documentation.
+ */
struct UNAddressingPolicy
- : public AddressingPolicyBase,
- private GenericAddressingPolicy<UNSocketAddress>
+ : public BSDAddressingPolicy,
+ private BSDAddressingPolicyMixin<UNSocketAddress>
{
typedef UNSocketAddress Address;
- using GenericAddressingPolicy<UNSocketAddress>::peer;
- using GenericAddressingPolicy<UNSocketAddress>::local;
- using GenericAddressingPolicy<UNSocketAddress>::connect;
- using GenericAddressingPolicy<UNSocketAddress>::bind;
+ using BSDAddressingPolicyMixin<UNSocketAddress>::peer;
+ using BSDAddressingPolicyMixin<UNSocketAddress>::local;
+ using BSDAddressingPolicyMixin<UNSocketAddress>::connect;
+ using BSDAddressingPolicyMixin<UNSocketAddress>::bind;
};
+
+ ///@}
}
+
///////////////////////////////hh.e////////////////////////////////////////
-//#include "UNAddressing.cci"
+#include "UNAddressing.cci"
//#include "UNAddressing.ct"
//#include "UNAddressing.cti"
#endif