summaryrefslogtreecommitdiff
path: root/ace/SOCK_Netlink.h
blob: 54b0cc12b4f1059a2fd0741b890b84a2241af655 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// $Id$
//=============================================================================
/**
 *  @file    SOCK_Netlink.h
 *
 *  SOCK_Netlink.cpp,v 5.4.2 2004/10/10  Exp
 * 
 *  @author Raz Ben Yehuda <raziebe@013.net.il>
 */
//=============================================================================

#ifndef ACE_SOCK_Netlink_H
#define ACE_SOCK_Netlink_H
#include /* */ "ace/pre.h"

#include /* */ "ace/SOCK.h"
#include /* */ "ace/Netlink_Addr.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/Addr.h"

/**
 * @class ACE_SOCK_Netlink
 *
 * @brief Defines the member functions for the ACE_SOCK Netlink 
 * abstraction.
 
 * Netlink sockets are used in Linux to communicate kernel to user 
 * and user to kernel It was created so one could use ACE reactor 
 * as a gateway to a linux driver.
 *
 */
class ACE_Export ACE_SOCK_Netlink : public ACE_SOCK
{
public:
  // = Initialization and termination methods.
  /// Default constructor.
  ACE_SOCK_Netlink(void);
  ~ACE_SOCK_Netlink(void);
  ACE_SOCK_Netlink (ACE_Netlink_Addr &local,
                  int protocol_family,
                  int protocol);
                  
  int open (ACE_Netlink_Addr &local,
           int protocol_family,
           int protocol);

  ssize_t recv (void *buf,
               size_t n,
               int flags) const;

  ssize_t send (void *buf,
                size_t n,
                int flags) const;

  /// Recv an <iovec> of size <n> to the datagram socket (uses
  /// <recvmsg(3)>).
  ssize_t recv (iovec iov[],
                int n,
                ACE_Addr &addr,
                int flags = 0) const;

  /// Send an <iovec> of size <n> to the datagram socket (uses
  /// <sendmsg(3)>).
  ssize_t send (const iovec iov[],
                int n,
                const ACE_Addr &addr,
                int flags = 0) const;

  /// Declare the dynamic allocation hooks.
  ACE_ALLOC_HOOK_DECLARE;
};

#if defined (__ACE_INLINE__)
#include "ace/SOCK_Netlink.inl"
#endif /* __ACE_INLINE__ */

#include /**/ "ace/post.h"
#endif /* ACE_SOCK_Netlink_H */