Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / ACE / ace / Netlink_Addr.cpp
blobdbd44a0e0a06463006f9851bf73d27a766df1309
1 //=============================================================================
2 /**
3 * @file Netlink_Addr.cpp
5 * @author Robert Iakobashvilli <coroberti@gmail.com>
6 * @author Raz Ben Yehuda <raziebe@gmail.com>
7 */
8 //=============================================================================
10 #include "ace/Netlink_Addr.h"
12 #ifdef ACE_HAS_NETLINK
14 #if defined (ACE_HAS_ALLOC_HOOKS)
15 # include "ace/Malloc_Base.h"
16 #endif /* ACE_HAS_ALLOC_HOOKS */
18 #if !defined (__ACE_INLINE__)
19 #include "ace/Netlink_Addr.inl"
20 #endif /* __ACE_INLINE__ */
22 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
24 ACE_ALLOC_HOOK_DEFINE(ACE_Netlink_Addr)
26 int ACE_Netlink_Addr::set (const ACE_Netlink_Addr &sa)
28 ACE_OS::memset ((void *) &this->nl_,0,sizeof this->nl_);
29 this->nl_.nl_family = AF_NETLINK;
30 this->base_set (sa.get_type (), sa.get_size ());
31 return 0;
34 // Copy constructor.
36 ACE_Netlink_Addr::ACE_Netlink_Addr (const ACE_Netlink_Addr &sa)
37 : ACE_Addr (AF_NETLINK, sa.get_size ())
39 this->set (sa);
42 int ACE_Netlink_Addr::set (const sockaddr_nl *un, int len)
44 (void) ACE_OS::memcpy ((void *) &this->nl_,un,len);
45 return 0;
48 ACE_Netlink_Addr::ACE_Netlink_Addr (const sockaddr_nl *un, int len)
50 this->set (un, len);
53 int
54 ACE_Netlink_Addr::get_pid () const
56 return this->nl_.nl_pid;
59 int
60 ACE_Netlink_Addr::get_gid () const
62 return this->nl_.nl_groups;
65 ACE_END_VERSIONED_NAMESPACE_DECL
67 #endif