+// Copyright Leandro Lucarella 2008 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file COPYING or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
#ifndef POSIXX_LINUX_TIPC_HPP_
#define POSIXX_LINUX_TIPC_HPP_
};
+/// Type of TIPC address
+enum type_t
+{
+ ID = TIPC_ADDR_ID, ///< Port ID
+ NAME = TIPC_ADDR_NAME, ///< Port name
+ NAMESEQ = TIPC_ADDR_NAMESEQ ///< Name sequence or multicast
+};
+
+/**
+ * Bind scope.
+ *
+ * @see TIPC documentation: 2.1.2 bind
+ */
+enum scope_t
+{
+ ZONE = TIPC_ZONE_SCOPE, ///< Zone scope.
+ CLUSTER = TIPC_CLUSTER_SCOPE, ///< Cluster scope.
+ NODE = TIPC_NODE_SCOPE ///< Node scope.
+};
+
/**
* TIPC socket address (name).
*
struct sockaddr: sockaddr_tipc
{
- /// Type of TIPC address
- enum type_t
- {
- ID = TIPC_ADDR_ID, ///< Port ID
- NAME = TIPC_ADDR_NAME, ///< Port name
- NAMESEQ = TIPC_ADDR_NAMESEQ ///< Name sequence or multicast
- };
-
- /**
- * Bind scope.
- *
- * @see TIPC documentation: 2.1.2 bind
- */
- enum scope_t
- {
- ZONE = TIPC_ZONE_SCOPE, ///< Zone scope.
- CLUSTER = TIPC_CLUSTER_SCOPE, ///< Cluster scope.
- NODE = TIPC_NODE_SCOPE ///< Node scope.
- };
-
/// Constructor.
sockaddr() throw ();
inline
posixx::linux::tipc::sockaddr::sockaddr() throw ()
{
+ memset(this, 0, sizeof(*this));
+ family = AF_TIPC;
}
inline
posixx::linux::tipc::sockaddr::sockaddr(portid port, scope_t s) throw ()
{
family = AF_TIPC;
- addrtype = TIPC_ADDR_ID;
+ addrtype = ID;
scope = s;
addr.id = port;
}
throw ()
{
family = AF_TIPC;
- addrtype = TIPC_ADDR_NAME;
+ addrtype = NAME;
scope = s;
addr.name.name = name;
addr.name.domain = d;
posixx::linux::tipc::sockaddr::sockaddr(nameseq nameseq, scope_t s) throw ()
{
family = AF_TIPC;
- addrtype = TIPC_ADDR_NAMESEQ;
+ addrtype = NAMESEQ;
scope = s;
addr.nameseq = nameseq;
}
inline
-posixx::linux::tipc::sockaddr::type_t posixx::linux::tipc::sockaddr::type()
+posixx::linux::tipc::type_t posixx::linux::tipc::sockaddr::type()
const throw ()
{
return static_cast< type_t >(addrtype);