summaryrefslogtreecommitdiff
path: root/ACE/ace/Log_Msg_IPC.h
blob: 1dad164bdc7d87d447566012e24fdfefeabffbbc (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
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Log_Msg_IPC.h
 *
 *  @author Carlos O'Ryan <coryan@uci.edu>
 */
//=============================================================================

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

#include "ace/Log_Msg_Backend.h"

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

#include "ace/Default_Constants.h"

// IPC conduit between sender and client daemon.  This should be
// included in the ACE_Log_Msg class, but due to "order of include"
// problems it can't be...
#if (ACE_HAS_STREAM_LOG_MSG_IPC == 1)
# include "ace/SPIPE_Connector.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef ACE_SPIPE_Stream ACE_LOG_MSG_IPC_STREAM;
typedef ACE_SPIPE_Connector ACE_LOG_MSG_IPC_CONNECTOR;
typedef ACE_SPIPE_Addr ACE_LOG_MSG_IPC_ADDR;
ACE_END_VERSIONED_NAMESPACE_DECL
#else
# include "ace/SOCK_Connector.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef ACE_SOCK_Stream ACE_LOG_MSG_IPC_STREAM;
typedef ACE_SOCK_Connector ACE_LOG_MSG_IPC_CONNECTOR;
typedef ACE_INET_Addr ACE_LOG_MSG_IPC_ADDR;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_STREAM_PIPES */

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

/// Defines the interfaces for ACE_Log_Msg backend.
/**
 * Implement an ACE_Log_Msg_Backend that logs to a remote logging
 * process.
 */
class ACE_Export ACE_Log_Msg_IPC : public ACE_Log_Msg_Backend
{
public:
  /// Constructor
  ACE_Log_Msg_IPC (void);

  /// Destructor
  virtual ~ACE_Log_Msg_IPC (void);

  /// Open a new connection
  virtual int open (const ACE_TCHAR *logger_key);

  /**
   * Reset the backend.  When changing the logging destination the
   * backend may need to properly disconnect from the remote logging
   * daemon and reclaim some local resources.  But we try to reduce
   * the number of local allocations/deallocations.
   */
  virtual int reset (void);

  virtual int close (void);
  virtual ssize_t log (ACE_Log_Record &log_record);

  ACE_ALLOC_HOOK_DECLARE;

private:
  ACE_LOG_MSG_IPC_STREAM message_queue_;
};

ACE_END_VERSIONED_NAMESPACE_DECL

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