SOCK_Netlink.h

Go to the documentation of this file.
00001 // SOCK_Netlink.h,v 1.3 2006/06/08 10:06:35 jwillemsen Exp
00002 //=============================================================================
00003 /**
00004  *  @file    SOCK_Netlink.h
00005  *
00006  *  SOCK_Netlink.h,v 1.3 2006/06/08 10:06:35 jwillemsen Exp
00007  *
00008  *  @author Robert Iakobashvilli <coroberti@gmail.com>
00009  *  @author Raz Ben Yehuda <raziebe@013.net.il>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_SOCK_NETLINK_H
00014 #define ACE_SOCK_NETLINK_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/config-all.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021   #pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #ifdef ACE_HAS_NETLINK
00025 
00026 #include "ace/SOCK.h"
00027 #include "ace/Netlink_Addr.h"
00028 #include "ace/Addr.h"
00029 
00030 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00031 
00032 /**
00033  * @class ACE_SOCK_Netlink
00034  *
00035  * @brief Defines the member functions for the ACE_SOCK Netlink
00036  * abstraction.
00037 
00038  * Netlink sockets are used in Linux as a communication facilty of kernel to user
00039  * and user to kernel.
00040  * This code was created so one could use ACE reactor
00041  * as a gateway to a linux kernel.
00042  *
00043  */
00044 class ACE_Export ACE_SOCK_Netlink : public ACE_SOCK {
00045 public:
00046   // = Initialization and termination methods.
00047   /// Default constructor.
00048   ACE_SOCK_Netlink(void);
00049   ~ACE_SOCK_Netlink(void);
00050   ACE_SOCK_Netlink (ACE_Netlink_Addr &local,
00051                     int protocol_family,
00052                     int protocol);
00053   /**
00054    * opens a RAW socket over an ACE_SOCK and binds it
00055    *
00056    **/
00057   int open (ACE_Netlink_Addr &local,
00058             int protocol_family,
00059             int protocol);
00060 
00061   /**
00062    *  receives abuffer with the size n
00063    */
00064   ssize_t recv (void *buf,
00065                 size_t n,
00066                 int flags) const;
00067   /**
00068    * send a buffer of size n bytes
00069    *
00070    */
00071   ssize_t send (void *buf,
00072                 size_t n,
00073                 int flags) const;
00074 
00075   /**
00076    *  Recieves an iovec of size @a n to the netlink socket
00077   */
00078   ssize_t recv (iovec iov[],
00079                 int n,
00080                 ACE_Addr &addr,
00081                 int flags = 0) const;
00082 
00083   /**
00084    *  Sends an iovec of size @a n to the netlink socket
00085   */
00086   ssize_t send (const iovec iov[],
00087                 int n,
00088                 const ACE_Addr &addr,
00089                 int flags = 0) const;
00090 
00091   /// Declare the dynamic allocation hooks.
00092   ACE_ALLOC_HOOK_DECLARE;
00093 };
00094 
00095 ACE_END_VERSIONED_NAMESPACE_DECL
00096 
00097 #if defined (__ACE_INLINE__)
00098 #include "ace/SOCK_Netlink.inl"
00099 #endif /* __ACE_INLINE__ */
00100 
00101 #endif /* ACE_HAS_NETLINK */
00102 
00103 #include /**/ "ace/post.h"
00104 
00105 #endif /* ACE_SOCK_NETLINK_H */
00106 

Generated on Thu Nov 9 09:42:04 2006 for ACE by doxygen 1.3.6