Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / utils / logWalker / PeerProcess.h
blobc37995dbe85258212ba3ab91bdf4e49cd0252359
1 // -*- C++ -*-
3 //
5 #ifndef LOG_WALKER_PEER_PROCESS_H
6 #define LOG_WALKER_PEER_PROCESS_H
8 #include "ace/SString.h"
9 #include "ace/Synch.h"
10 #include "ace/RB_Tree.h"
11 #include "ace/Functor.h"
12 #include "ace/Containers.h"
13 #include "ace/streams.h"
15 class PeerObject;
16 class HostProcess;
17 class Invocation;
18 class Session;
19 class Thread;
22 enum EndpointRole {
23 ER_UNKNOWN,
24 ER_CLIENT,
25 ER_SERVER
28 class Endpoint
30 public:
31 Endpoint ();
32 Endpoint (const Endpoint &other);
33 Endpoint (const char *addr, EndpointRole role = ER_UNKNOWN);
34 void assign (const char *addr, EndpointRole role = ER_UNKNOWN);
35 Endpoint & operator = (const Endpoint &other);
36 bool operator == (const Endpoint &other) const;
37 bool operator < (const Endpoint &other) const;
38 bool is_client () const;
40 ACE_CString addr_;
41 ACE_CString host_;
42 ACE_CString port_;
43 bool is_localhost_;
44 EndpointRole role_;
47 class Transport
49 public:
50 Transport (const char *addr, bool is_client, size_t offset, const ACE_CString &time);
51 void close (size_t offset, const ACE_CString &time);
53 long handle_;
54 Endpoint client_endpoint_;
55 size_t open_offset_;
56 ACE_CString open_time_;
57 size_t close_offset_;
58 ACE_CString close_time_;
62 typedef ACE_RB_Tree<u_long, PeerObject*, ACE_Less_Than<u_long>, ACE_Null_Mutex> PeerObjectTable;
63 typedef ACE_RB_Tree<long, PeerObject*, ACE_Less_Than<long>, ACE_Null_Mutex> ObjectByIndex;
64 typedef ACE_DLList<Invocation> InvocationList;
65 typedef ACE_DLList<Transport> TransportList;
67 class PeerProcess
69 public:
70 static char *nextIdent(bool is_server);
71 PeerProcess (size_t offset, const ACE_CString &time, bool is_server);
73 virtual ~PeerProcess ();
75 const char * id () const;
76 void split_filename (char *buffer, size_t len) const;
78 void set_owner (HostProcess *host);
79 HostProcess *owner ();
81 void match_hosts (Session *session);
82 void set_server_addr (const ACE_CString &addr);
83 const Endpoint &server_addr () const;
84 const Endpoint &last_client_addr () const;
86 bool is_server () const;
87 size_t offset () const;
88 void ssl (bool is_ssl);
89 void add_transport (Transport *t);
90 Transport *last_transport ();
91 Transport *find_transport (long handle);
93 bool match_local (const char *addr) const;
94 bool match_server_addr (const Endpoint &addr) const;
96 Invocation *new_invocation (size_t req_id, Thread *thr);
97 Invocation *find_invocation (size_t req_id, long handle);
98 Invocation *find_invocation_size (size_t len);
100 PeerObject *object_for(const char *oid, size_t len);
102 virtual void dump_summary (ostream &strm);
103 virtual void dump_object_detail (ostream &strm);
104 virtual void dump_invocation_detail (ostream &strm);
106 private:
107 char *ident_;
108 char *origin_;
109 HostProcess *owner_;
110 HostProcess *remote_;
111 Endpoint server_ep_;
112 TransportList transports_;
113 Transport *last_transport_;
114 bool is_server_role_;
115 bool ssl_;
116 size_t origin_offset_;
117 PeerObjectTable objects_;
118 InvocationList invocations_;
119 ObjectByIndex object_by_index_;
120 ACE_CString first_time_;
124 #endif // LOG_WALKER_PEER_PROCESS_H