Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / utils / logWalker / Invocation.h
blob6c296d9c468ccf4c932d69d2df573170bca2243c
1 // -*- C++ -*-
3 //
5 #ifndef LOG_WALKER_INVOCATION_H
6 #define LOG_WALKER_INVOCATION_H
8 #include "ace/SString.h"
9 #include "ace/CDR_Stream.h"
10 #include "ace/Unbounded_Queue.h"
12 class PeerProcess;
13 class PeerObject;
14 class Thread;
15 class GIOP_Buffer;
17 typedef ACE_Unbounded_Queue<ACE_CString> NotifyIncidents;
19 // Invocation holds the buffer contents for a request/response pair.
20 // This could be originating in this process, or in the peer process.
22 // The trigger for finding a new outgoing invocation is "Muxed_TMS[%d]"
23 // following that the process/thread will perform a dump_msg.
25 // The trigger for finding a new incoming invocation is
26 // "Transport[%d]::process_parsed_messages, entering (missing data == 0)"
27 // which could indicate a new request or reply, depending on the context
28 // in which the peer connection is made.
30 // It is possible that two or more threads may call dump_msg
31 // concurrently and thus have the preamble and body printed out of
32 // order. The HEXDUMP always reports a buffer size including the 12
33 // byte GIOP header. Also, the first line of the text contains header
34 // data which can be compared to the expected request ID.
36 class Invocation
38 public:
39 enum Dump_Mode {
40 Dump_Proc,
41 Dump_Thread,
42 Dump_Both
45 // initialize a new instance, with the initial request text line and offeset
46 Invocation (PeerProcess *peer, Thread *thr, size_t req_id = 0);
47 bool init ( const char * text, size_t offset, Thread *thr);
48 ~Invocation (void);
50 // return true if the invocation was a oneway
51 bool is_oneway(void) const;
53 // return true if the request is a oneway and has all its octets, or
54 // if it also has all its reply octets. The side-effect of this call
55 // is to obtain the target reference from the request buffer and associate
56 // it with the peer process.
57 bool message_complete (void);
59 size_t request_id (void) const;
61 // returns true if this request was sent by the host process.
62 bool sent_request (void) const;
64 // returns the size parsed from either the request or reply preamble
65 // which can be used to match a HEXDUMP b
66 size_t expected_size (void) const;
68 size_t request_bytes (void) const;
70 void set_target (const char *oid, size_t oid_len);
72 void set_octets (bool request, GIOP_Buffer *octets);
73 GIOP_Buffer *octets (bool request);
74 GIOP_Buffer *give_octets (bool request);
76 bool contains (size_t line);
77 size_t req_line (void);
78 size_t repl_line (void);
80 void add_notify_incident (const ACE_CString &text, size_t offset);
81 Thread *waiter (void) const;
82 long handle (void) const;
84 void new_line (ostream &strm, size_t indent, int offset, bool add_nl, bool show_indent);
85 void dump_detail (ostream &strm, size_t indent, Dump_Mode mode, bool show_handle);
86 void dump_rel_time (ostream &strm, const ACE_Time_Value& tv, const ACE_Time_Value& start);
87 void dump_start_line (ostream &strm, size_t indent, const ACE_Time_Value& start);
88 void dump_finish_line (ostream &strm, size_t indent, const ACE_Time_Value& start);
89 void dump_special_details (ostream &strm, size_t indent, const char *opname);
91 private:
92 GIOP_Buffer *req_octets_;
93 GIOP_Buffer *repl_octets_;
95 Thread *waiter_;
96 NotifyIncidents notify_incidents_;
97 PeerProcess *peer_;
98 size_t req_id_;
99 PeerObject *target_;
100 long handle_;
101 bool finish_reported_;
102 size_t req_level_;
103 size_t repl_level_;
106 #endif // LOG_WALKER_INVOCATION_H