Netlink_Addr.h

Go to the documentation of this file.
00001 // Netlink_Addr.h,v 1.5 2006/06/08 11:28:15 jwillemsen Exp
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Netlink_Addr.h
00006  *
00007  *  Netlink_Addr.h,v 1.5 2006/06/08 11:28:15 jwillemsen Exp
00008  *
00009  * @author Robert Iakobashvilli <coroberti@gmail.com>
00010  * @author Raz Ben Yehuda <raziebe@gmail.com>
00011  */
00012 //=============================================================================
00013 
00014 #ifndef ACE_NETLINK_ADDR_H
00015 #define ACE_NETLINK_ADDR_H
00016 
00017 #include /**/ "ace/pre.h"
00018 
00019 #include "ace/config-all.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022   #pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #ifdef  ACE_HAS_NETLINK
00026 
00027 #include "ace/OS_NS_string.h"
00028 #include "ace/Global_Macros.h"
00029 #include "ace/OS_NS_unistd.h"
00030 #include "ace/OS_NS_unistd.h"
00031 #include "ace/Addr.h"
00032 #include "ace/os_include/sys/os_socket.h"
00033 
00034 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00035 
00036 /**
00037  * @class ACE_Netlink_Addr
00038  *
00039  * @brief Defines a C++ wrapper facade for the netlink sockets
00040  */
00041 class ACE_Export ACE_Netlink_Addr : public ACE_Addr {
00042 public:
00043   // = Initialization methods.
00044 
00045   /// Default constructor.
00046   ACE_Netlink_Addr (void);
00047 
00048   /// Copy constructor.
00049   ACE_Netlink_Addr (const ACE_Netlink_Addr &);
00050 
00051   /// Creates an ACE_INET_Addr from a sockaddr_in structure.
00052   ACE_Netlink_Addr (const sockaddr_nl *, int len);
00053 
00054   /// Dtor
00055   ~ACE_Netlink_Addr (void);
00056 
00057   /**
00058   *     @param naddr sets the nl_ member @see nl_
00059    */
00060   int set (const ACE_Netlink_Addr &naddr);
00061   /**
00062   *     sets the pid and groups fields of member nl_  @see nl_
00063   */
00064   void set (int pid, int gid);
00065   /**
00066    *    set nl_ to nl_  @see nl_
00067   */
00068   int set (const sockaddr_nl *, int len);
00069   /**
00070    * @return pid
00071   */
00072   int get_pid (void) const;
00073   /**
00074    *    @return the group id @see nl_
00075   */
00076   int get_gid (void) const;
00077   /**
00078    *    @return addr pointer @see nl_
00079   */
00080   virtual void *get_addr (void) const;
00081   /**
00082    *    @return nl_ member  @see nl_  size
00083   */
00084   int get_addr_size (void) const;
00085   /**
00086    *     Set a pointer to the address
00087   */
00088   virtual void set_addr (void *, int len= sizeof(sockaddr_nl) );
00089 
00090   /// Declare the dynamic allocation hooks.
00091   ACE_ALLOC_HOOK_DECLARE;
00092 
00093 private:
00094   /**
00095    * @return family type  AF_NETLINK
00096    *
00097    * */
00098   int determine_type (void) const;
00099   /**
00100   *     set nl_  @see nl_ to zero and sets address family to default value
00101   */
00102   void reset (void);
00103 
00104   sockaddr_nl  nl_;
00105 };
00106 
00107 ACE_END_VERSIONED_NAMESPACE_DECL
00108 
00109 #if defined (__ACE_INLINE__)
00110 #include "ace/Netlink_Addr.inl"
00111 #endif /* __ACE_INLINE__ */
00112 
00113 #endif /* ACE_HAS_NETLINK */
00114 
00115 #include /**/ "ace/post.h"
00116 
00117 #endif /* ACE_NETLINK_ADDR_H */
00118 
00119 
00120 

Generated on Thu Nov 9 09:41:57 2006 for ACE by doxygen 1.3.6