Restore build on FreeBSD.
[getmangos.git] / dep / ACE_wrappers / ace / Netlink_Addr.h
blobb596068c517564bfdc0729ce0ffba106efd43971
1 // $Id: Netlink_Addr.h 80826 2008-03-04 14:51:23Z wotte $
3 //=============================================================================
4 /**
5 * @file Netlink_Addr.h
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)
22 #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"
31 #include "ace/Addr.h"
32 #include "ace/os_include/sys/os_socket.h"
34 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
36 /**
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 {
42 public:
43 // = Initialization methods.
45 /// Default constructor.
46 ACE_Netlink_Addr (void);
48 /// Copy constructor.
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);
54 /// Dtor
55 ~ACE_Netlink_Addr (void);
57 /**
58 * @param naddr sets the nl_ member @see nl_
60 int set (const ACE_Netlink_Addr &naddr);
61 /**
62 * sets the pid and groups fields of member nl_ @see nl_
64 void set (int pid, int gid);
65 /**
66 * set nl_ to nl_ @see nl_
68 int set (const sockaddr_nl *, int len);
69 /**
70 * @return pid
72 int get_pid (void) const;
73 /**
74 * @return the group id @see nl_
76 int get_gid (void) const;
77 /**
78 * @return addr pointer @see nl_
80 virtual void *get_addr (void) const;
81 /**
82 * @return nl_ member @see nl_ size
84 int get_addr_size (void) const;
85 /**
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;
93 private:
94 /**
95 * @return family type AF_NETLINK
97 * */
98 int determine_type (void) const;
99 /**
100 * set nl_ @see nl_ to zero and sets address family to default value
102 void reset (void);
104 sockaddr_nl nl_;
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 */