-// Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum NETwork research (NET)
-// David Wagner <david.wagner@fokus.fraunhofer.de>
+// $Id$
+//
+// 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 "../../../Socket/SocketPolicy.hh"
-#include "../../../Socket/ClientSocketHandle.hh"
-#include "../../../Socket/CommunicationPolicy.hh"
-#include "../../../Socket/Protocols/GenericAddressingPolicy.hh"
-#include "../../../Utils/safe_bool.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
\ingroup addr_group
*/
class UNSocketAddress
- : public comparable_safe_bool<UNSocketAddress>
+ : public BSDSocketAddress
{
public:
+ static short const addressFamily = AF_UNIX;
+
+ UNSocketAddress();
- //UNSocketAddress();
- explicit UNSocketAddress(std::string p);
+ explicit UNSocketAddress(std::string const & path);
///< Construct an address constant from given path
- static UNSocketAddress from_string(std::string const s); ///< Create UNSocketAddress from string
- std::string path() const ; ///< Return path as string
- struct sockaddr_un sockaddr();
- struct sockaddr * sockaddr_p() ;
- struct sockaddr const * sockaddr_p() const;
- unsigned sockaddr_len() const;
+
+ 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;
+
private:
- struct sockaddr_un sockAddr;
+ struct sockaddr_un addr_;
};
- /** \brief Write path os
+ /** \brief Write path to os
\related UNSocketAddress
*/
/** \brief Addressing policy supporting unix domain addressing
\par Address Type:
- UNAddress
+ UNSocketAddress
This addressing policy implements addressing using unix domain
addresses.
The various members are directly imported from
- GenericAddressingPolicy which see for a detailed
+ 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