version 1.79.2.1, 2006/07/27 23:11:51
|
version 1.89, 2007/06/06 05:24:49
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) |
|
// |
|
// Modified By: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com) |
|
// Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// Mike Day (mdday@us.ibm.com) |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// Arthur Pichlkostner (via Markus: sedgewick_de@yahoo.de) |
|
// Willis White (whiwill@us.ibm.com) PEP 127 and 128 |
|
// Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase1 |
|
// Amit K Arora, IBM (amita@in.ibm.com) for Bug#1090 |
|
// John Alex, IBM (johnalex@us.ibm.com) - Bug#2290 |
|
// |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#ifndef Pegasus_Message_h | #ifndef Pegasus_Message_h |
|
|
#include <iostream> | #include <iostream> |
#include <cstring> | #include <cstring> |
#include <Pegasus/Common/InternalException.h> | #include <Pegasus/Common/InternalException.h> |
#include <Pegasus/Common/StatisticalData.h> |
|
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
#include <Pegasus/Common/TimeValue.h> | #include <Pegasus/Common/TimeValue.h> |
#include <Pegasus/Common/CIMOperationType.h> | #include <Pegasus/Common/CIMOperationType.h> |
|
#include <Pegasus/Common/Threads.h> |
#include <Pegasus/Common/Linkable.h> | #include <Pegasus/Common/Linkable.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
// REVIEW: could class be renamed to MessageMask (coding standard) |
class PEGASUS_COMMON_LINKAGE MessageMask |
|
|
class PEGASUS_COMMON_LINKAGE message_mask |
|
{ | { |
public: | public: |
|
// Message handling is indicated by the high order 12 bits. For example: |
static Uint32 type_legacy; |
// Uint32 messageHandling = flags & 0xfff00000; |
static Uint32 type_CIMOperation; |
|
static Uint32 type_CIMAsyncOperation; |
|
static Uint32 type_export; |
|
static Uint32 type_lifetime; |
|
static Uint32 type_socket; |
|
static Uint32 type_connection; |
|
static Uint32 type_http; |
|
static Uint32 type_http_error; |
|
static Uint32 type_cimom; |
|
static Uint32 type_control; |
|
static Uint32 type_service; |
|
static Uint32 type_broadcast; |
|
static Uint32 type_client_exception; |
|
|
|
static Uint32 ha_no_delete; |
|
static Uint32 ha_request; | static Uint32 ha_request; |
static Uint32 ha_reply; | static Uint32 ha_reply; |
static Uint32 ha_synchronous; |
|
static Uint32 ha_async; | static Uint32 ha_async; |
static Uint32 ha_wait; |
|
|
|
|
|
// more for documentation than for use |
|
|
|
inline Uint32 get_type(Uint32 flags) |
|
{ |
|
return (flags & 0x000fffff); |
|
} |
|
|
|
inline Uint32 get_handling(Uint32 flags) |
|
{ |
|
return( flags & 0xfff00000); |
|
} |
|
}; | }; |
| |
class cimom; |
|
class MessageQueue; |
|
class MessageQueueService; |
|
class AsyncLegacyOperationStart; |
|
class AsyncLegacyOperationResult; |
|
|
|
enum HttpMethod | enum HttpMethod |
{ | { |
HTTP_METHOD__POST, | HTTP_METHOD__POST, |
|
|
(see MessageQueue class). Derived classes may add their own fields. | (see MessageQueue class). Derived classes may add their own fields. |
This base class defines a common type field, which is the type of | This base class defines a common type field, which is the type of |
the message. | the message. |
|
|
The Message class also provides previous and next pointers which are |
|
used to place the messages on a queue by the MessageQueue class. |
|
*/ | */ |
class PEGASUS_COMMON_LINKAGE Message : public Linkable | class PEGASUS_COMMON_LINKAGE Message : public Linkable |
{ | { |
|
|
Message( | Message( |
Uint32 type, | Uint32 type, |
Uint32 destination = 0, | Uint32 destination = 0, |
Uint32 mask = message_mask::type_legacy) |
Uint32 mask = 0) |
: | : |
_type(type), | _type(type), |
_mask(mask), | _mask(mask), |
_httpMethod (HTTP_METHOD__POST), | _httpMethod (HTTP_METHOD__POST), |
|
#ifndef PEGASUS_DISABLE_PERFINST |
|
_serverStartTimeMicroseconds(0), |
|
_providerTimeMicroseconds(0), |
|
_totalServerTimeMicroseconds(0), |
|
#endif |
_close_connect(false), | _close_connect(false), |
_last_thread_id(Threads::self()), | _last_thread_id(Threads::self()), |
_next(0), |
|
_prev(0), |
|
_async(0), | _async(0), |
dest(destination), | dest(destination), |
_isComplete(true), | _isComplete(true), |
_index(0) | _index(0) |
{ | { |
|
|
} | } |
| |
Message & operator = ( const Message & msg) |
virtual ~Message(); |
{ |
|
if (this != &msg) |
|
{ |
|
_type = msg._type; |
|
_mask = msg._mask; |
|
_last_thread_id = msg._last_thread_id; |
|
_next = _prev = _async = 0; |
|
dest = msg.dest; |
|
_httpMethod = msg._httpMethod; |
|
_index = msg._index; |
|
_isComplete = msg._isComplete; |
|
|
|
} |
|
return *this; |
|
} |
|
| |
|
// NOTE: The compiler default implementation of the copy constructor |
|
// is used for this class. |
| |
virtual ~Message(); |
|
Boolean getCloseConnect() const { return _close_connect; } | Boolean getCloseConnect() const { return _close_connect; } |
void setCloseConnect(Boolean close_connect) | void setCloseConnect(Boolean close_connect) |
{ | { |
|
|
| |
void setHttpMethod(HttpMethod httpMethod) {_httpMethod = httpMethod;} | void setHttpMethod(HttpMethod httpMethod) {_httpMethod = httpMethod;} |
| |
|
|
#ifndef PEGASUS_DISABLE_PERFINST | #ifndef PEGASUS_DISABLE_PERFINST |
// | // |
// Needed for performance measurement | // Needed for performance measurement |
// | // |
| |
void startServer(); |
Uint64 getServerStartTime() const |
|
{ |
void endServer(); |
return _serverStartTimeMicroseconds; |
|
} |
void startProvider(); |
|
|
|
void endProvider(); |
|
|
|
TimeValue getStartServerTime() const { return _timeServerStart; } |
|
| |
void setStartServerTime(TimeValue timeServerStart) |
void setServerStartTime(Uint64 serverStartTimeMicroseconds) |
{ | { |
_timeServerStart = timeServerStart; |
_serverStartTimeMicroseconds = serverStartTimeMicroseconds; |
} | } |
| |
TimeValue getStartProviderTime() const { return _timeProviderStart; } |
void endServer(); |
| |
void setStartProviderTime(TimeValue timeProviderStart) |
Uint64 getProviderTime() const |
{ | { |
_timeProviderStart = timeProviderStart; |
return _providerTimeMicroseconds; |
} | } |
| |
TimeValue getEndServerTime() const { return _timeServerEnd; } |
void setProviderTime(Uint64 providerTimeMicroseconds) |
|
|
void setEndServerTime (TimeValue timeServerEnd) |
|
{ | { |
_timeServerEnd = timeServerEnd; |
_providerTimeMicroseconds = providerTimeMicroseconds; |
} | } |
| |
TimeValue getEndProviderTime() const { return _timeProviderEnd; } |
Uint64 getTotalServerTime() const |
|
{ |
|
return _totalServerTimeMicroseconds; |
|
} |
| |
void setEndProviderTime(TimeValue timeProviderEnd) |
void setTotalServerTime(Uint64 totalServerTimeMicroseconds) |
{ | { |
_timeProviderEnd = timeProviderEnd; |
_totalServerTimeMicroseconds = totalServerTimeMicroseconds; |
} | } |
| |
TimeValue getServerTime() { return _serverTime; } |
|
// |
|
#endif | #endif |
| |
Message* getNext() { return _next; } |
|
|
|
const Message* getNext() const { return _next; } |
|
|
|
Message* getPrevious() { return _prev; } |
|
|
|
const Message* getPrevious() const { return _prev; } |
|
|
|
static CIMOperationType convertMessageTypetoCIMOpType(Uint32 type); | static CIMOperationType convertMessageTypetoCIMOpType(Uint32 type); |
| |
#ifdef PEGASUS_DEBUG | #ifdef PEGASUS_DEBUG |
|
|
Boolean printHeader = true) const; | Boolean printHeader = true) const; |
#endif | #endif |
| |
Message *get_async(void) |
Message* get_async() |
{ | { |
Message *ret = _async; | Message *ret = _async; |
_async = 0; | _async = 0; |
return ret; | return ret; |
|
|
} | } |
| |
void put_async(Message * msg) | void put_async(Message * msg) |
|
|
} | } |
| |
// << Tue Jul 1 11:02:49 2003 mdd >> pep_88 and helper for i18n and l10n | // << Tue Jul 1 11:02:49 2003 mdd >> pep_88 and helper for i18n and l10n |
Boolean thread_changed(void) |
Boolean thread_changed() |
{ | { |
if(_last_thread_id != Threads::self()) |
if (!Threads::equal(_last_thread_id, Threads::self())) |
{ | { |
_last_thread_id = Threads::self(); | _last_thread_id = Threads::self(); |
return true; | return true; |
|
|
// set the complete flag indicating if this message piece is the | // set the complete flag indicating if this message piece is the |
// last or not | // last or not |
void setComplete(Boolean isComplete) | void setComplete(Boolean isComplete) |
{ _isComplete = isComplete ? true:false; } |
{ |
|
_isComplete = isComplete ? true:false; |
|
} |
| |
// get the message index (or sequence number) | // get the message index (or sequence number) |
Uint32 getIndex() const { return _index; } | Uint32 getIndex() const { return _index; } |
|
|
Uint32 _type; | Uint32 _type; |
Uint32 _mask; | Uint32 _mask; |
HttpMethod _httpMethod; | HttpMethod _httpMethod; |
|
|
|
#ifndef PEGASUS_DISABLE_PERFINST |
// Needed for performance measurement | // Needed for performance measurement |
TimeValue _timeServerStart; |
Uint64 _serverStartTimeMicroseconds; |
TimeValue _timeServerEnd; |
Uint64 _providerTimeMicroseconds; |
TimeValue _timeProviderStart; |
Uint64 _totalServerTimeMicroseconds; |
TimeValue _timeProviderEnd; |
#endif |
TimeValue _serverTime; |
|
Boolean _close_connect; | Boolean _close_connect; |
| |
// |
|
|
|
// << Tue Jul 1 11:02:35 2003 mdd >> pep_88 and helper for i18n and l10n | // << Tue Jul 1 11:02:35 2003 mdd >> pep_88 and helper for i18n and l10n |
ThreadType _last_thread_id; | ThreadType _last_thread_id; |
| |
Message* _next; |
|
Message* _prev; |
|
|
|
protected: |
|
|
|
public: | public: |
Message *_async; | Message *_async; |
Uint32 dest; | Uint32 dest; |
//needed for PEP 128 - transmitting Server Response Time to Client |
|
Uint64 totServerTime; |
|
| |
private: | private: |
MessageQueue* _owner; |
Message& operator=(const Message& msg); |
|
|
Boolean _isComplete; | Boolean _isComplete; |
Uint32 _index; | Uint32 _index; |
|
|
friend class cimom; |
|
friend class MessageQueue; |
|
friend class MessageQueueService; |
|
friend class AsyncLegacyOperationStart; |
|
friend class AsyncLegacyOperationResult; |
|
|
|
}; | }; |
| |
| |
|
|
| |
QueueIdStack(const QueueIdStack& x); | QueueIdStack(const QueueIdStack& x); |
| |
PEGASUS_EXPLICIT QueueIdStack(Uint32 x); |
explicit QueueIdStack(Uint32 x); |
| |
PEGASUS_EXPLICIT QueueIdStack(Uint32 x1, Uint32 x2); |
explicit QueueIdStack(Uint32 x1, Uint32 x2); |
| |
~QueueIdStack() | ~QueueIdStack() |
{ | { |