1 // $Id: Netlink_Addr.h 80826 2008-03-04 14:51:23Z wotte $
3 //=============================================================================
7 * $Id: Netlink_Addr.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Robert Iakobashvilli <coroberti@gmail.com>
10 * @author Raz Ben Yehuda <raziebe@gmail.com>
12 //=============================================================================
14 #ifndef ACE_NETLINK_ADDR_H
15 #define ACE_NETLINK_ADDR_H
17 #include /**/ "ace/pre.h"
19 #include /**/ "ace/config-all.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #ifdef ACE_HAS_NETLINK
27 #include "ace/OS_NS_string.h"
28 #include "ace/Global_Macros.h"
29 #include "ace/OS_NS_unistd.h"
30 #include "ace/OS_NS_unistd.h"
32 #include "ace/os_include/sys/os_socket.h"
34 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
37 * @class ACE_Netlink_Addr
39 * @brief Defines a C++ wrapper facade for the netlink sockets
41 class ACE_Export ACE_Netlink_Addr
: public ACE_Addr
{
43 // = Initialization methods.
45 /// Default constructor.
46 ACE_Netlink_Addr (void);
49 ACE_Netlink_Addr (const ACE_Netlink_Addr
&);
51 /// Creates an ACE_INET_Addr from a sockaddr_in structure.
52 ACE_Netlink_Addr (const sockaddr_nl
*, int len
);
55 ~ACE_Netlink_Addr (void);
58 * @param naddr sets the nl_ member @see nl_
60 int set (const ACE_Netlink_Addr
&naddr
);
62 * sets the pid and groups fields of member nl_ @see nl_
64 void set (int pid
, int gid
);
66 * set nl_ to nl_ @see nl_
68 int set (const sockaddr_nl
*, int len
);
72 int get_pid (void) const;
74 * @return the group id @see nl_
76 int get_gid (void) const;
78 * @return addr pointer @see nl_
80 virtual void *get_addr (void) const;
82 * @return nl_ member @see nl_ size
84 int get_addr_size (void) const;
86 * Set a pointer to the address
88 virtual void set_addr (void *, int len
= sizeof(sockaddr_nl
) );
90 /// Declare the dynamic allocation hooks.
91 ACE_ALLOC_HOOK_DECLARE
;
95 * @return family type AF_NETLINK
98 int determine_type (void) const;
100 * set nl_ @see nl_ to zero and sets address family to default value
107 ACE_END_VERSIONED_NAMESPACE_DECL
109 #if defined (__ACE_INLINE__)
110 #include "ace/Netlink_Addr.inl"
111 #endif /* __ACE_INLINE__ */
113 #endif /* ACE_HAS_NETLINK */
115 #include /**/ "ace/post.h"
117 #endif /* ACE_NETLINK_ADDR_H */