OpenMAMA C++ API
MamaConnection.h
Go to the documentation of this file.
1 /* $Id$
2  *
3  * OpenMAMA: The open middleware agnostic messaging API
4  * Copyright (C) 2011 NYSE Technologies, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  */
21 
22 #ifndef MAMA_CONNECTION_CPP_H__
23 #define MAMA_CONNECTION_CPP_H__
24 
25 #include "mama/mamacpp.h"
26 #include "mama/MamaTransport.h"
27 #include "mama/conflation/connection.h"
28 
29 namespace Wombat
30 {
31 
32 class MAMACPPExpDLL MamaConnection
33 {
34 public:
35  MamaConnection (MamaTransport* tport, mamaConnection cnxn)
36  : mConnnection (cnxn)
37  , mTransport (tport) {}
38 
39  virtual ~MamaConnection (void);
40 
41  /* Convenience method to get the transport to which this connection belongs. */
42  MamaTransport* getTransport (void) const;
43 
44  /* Return the remote IP address.
45  */
46  const char* getIpAddress (void) const;
47 
48  /* return the remote port. Note for outbound connections this will be the
49  * "ephemeral" port assigned by connect() while the IP address will be the
50  * local address. For inbound connection it will be the "ephemeral" port
51  * on the remote client and the IP address of the remote client.
52  *
53  * The combination of IP address and port uniquely identifies the
54  * connection/client.
55  */
56  uint16_t getPort (void) const;
57 
58  /* Return the username related to this event. */
59  const char* getUserName (void) const;
60 
61  /* Return the application name related to this event. */
62  const char* getAppName (void) const;
63 
64  /* Return the current queue size which triggered the event. */
65  uint32_t getQueueSize (void) const;
66 
67  /* Return the maximum queue size. */
68  uint32_t getMaxQueueSize (void) const;
69 
70  /* Return the number of messages sent on the connection. */
71  uint32_t getMsgCount (void) const;
72 
73  /* Return the number of bytes sent on the connection. */
74  uint32_t getBytesSent (void) const;
75 
76  /* Return the string version of the connection. */
77  const char* toString (void) const;
78 
79  /* Return true if this connection is intercepted. */
80  bool isIntercepted (void) const;
81 
82  // Access to C types for implementation of related classes.
83  mamaConnection getCValue ();
84  const mamaConnection getCValue () const;
85 private:
86  mamaConnection mConnnection;
87  MamaTransport* mTransport;
88 
89  MamaConnection (void) {}
90  MamaConnection (const MamaConnection&) {}
91 
92 };
93 
94 }
95 #endif
MamaConnection(MamaTransport *tport, mamaConnection cnxn)
Definition: MamaConnection.h:35
Definition: MamaConnection.h:32
Definition: MamaConnection.h:29
The MamaTransport class provides market data functionality.
Definition: MamaTransport.h:261