(file) Return to Message.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/Message.h between version 1.2 and 1.5.2.10

version 1.2, 2001/07/08 23:39:09 version 1.5.2.10, 2001/12/06 16:38:20
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%///-*-c++-*-/////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM  // Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM,
   // The Open Group, Tivoli Systems
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 22 
Line 23 
 // //
 // Author: Mike Brasher (mbrasher@bmc.com) // Author: Mike Brasher (mbrasher@bmc.com)
 // //
 // Modified By:  // Modified By: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
   // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
   //              (carolann_graves@hp.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 30 
Line 33 
 #define Pegasus_Message_h #define Pegasus_Message_h
  
 #include <iostream> #include <iostream>
   #include <cstring>
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
   #include <Pegasus/Common/Exception.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   class PEGASUS_EXPORT message_mask
   {
      public:
         static Uint32 type_legacy;
         static Uint32 type_CIMClass;
         static Uint32 type_CIMInstance;
         static Uint32 type_CIMIndication;
         static Uint32 type_CIMQualifier;
         static Uint32 type_CIMSubscription;
         static Uint32 type_socket;
         static Uint32 type_connection;
         static Uint32 type_http;
         static Uint32 type_cimom;
   
         static Uint32 type_request;
         static Uint32 type_resply;
         static Uint32 type_control;
   };
   
 class MessageQueue; class MessageQueue;
  
 /** The Message class and derived classes are used to pass messages between /** The Message class and derived classes are used to pass messages between
Line 47 
Line 71 
     The Message class also provides previous and next pointers which are     The Message class also provides previous and next pointers which are
     used to place the messages on a queue by the MessageQueue class.     used to place the messages on a queue by the MessageQueue class.
 */ */
 class Message  class PEGASUS_COMMON_LINKAGE Message
 { {
 public: public:
  
     Message(Uint32 type, Uint32 key = getNextKey())      Message(Uint32 type, Uint32 key = getNextKey(), Uint32 mask = message_mask::type_legacy)
         : _type(type), _key(key), _next(0), _prev(0) { }          : _type(type), _key(key), _mask(mask), _next(0), _prev(0) { }
   
  
     virtual ~Message();     virtual ~Message();
  
Line 74 
Line 99 
  
     static Uint32 getNextKey() { return ++_nextKey; }     static Uint32 getNextKey() { return ++_nextKey; }
  
     virtual void print(      virtual void print(PEGASUS_STD(ostream)& os) const;
         PEGASUS_STD(ostream)& os,  
         Boolean printHeader = true) const;  
  
 private: private:
     Uint32 _type;     Uint32 _type;
     Uint32 _key;     Uint32 _key;
         Uint32 _mask;
     Message* _next;     Message* _next;
     Message* _prev;     Message* _prev;
     MessageQueue* _owner;     MessageQueue* _owner;
Line 88 
Line 112 
     friend class MessageQueue;     friend class MessageQueue;
 }; };
  
   
   // each component needs to support a set of these messgaes and pass that array
   // to the dispatcher so the dispatcher can route messages at the first level
   // i.e., client will not accept request messages.
   // every message should have a response
   
   // dispatcher supports full cim api set (as below)
   // repository needs to be a peer to the provider manager
   //
   
   // mkdir _dispatcher
   // mkdir _providermanager
   // mkdir _server (http incoming, front end)
   // mkdir _repositorymanager
   //       _subscriptionprocessor
   //       _indicationprocessor
   //       _configurationmanager
   //       _cimom (loads and links everyone, hooks up queues)
   
   // fundamental messages:
   
   // start, stop, pause, resume
   // handshaking: interrogate (as in windows service api)
   //              message class support
   //              message namespace support ???
   
   enum MessageType
   {
       DUMMY_MESSAGE,
   
       // CIM Message types:
   
       CIM_GET_CLASS_REQUEST_MESSAGE,
       CIM_GET_INSTANCE_REQUEST_MESSAGE,
       CIM_EXPORT_INDICATION_REQUEST_MESSAGE,
       CIM_DELETE_CLASS_REQUEST_MESSAGE,
       CIM_DELETE_INSTANCE_REQUEST_MESSAGE,
       CIM_CREATE_CLASS_REQUEST_MESSAGE,
       CIM_CREATE_INSTANCE_REQUEST_MESSAGE,
       CIM_MODIFY_CLASS_REQUEST_MESSAGE,
       CIM_MODIFY_INSTANCE_REQUEST_MESSAGE,
       CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE,
       CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE,
       CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE,
       CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE,
       CIM_EXEC_QUERY_REQUEST_MESSAGE,
       CIM_ASSOCIATORS_REQUEST_MESSAGE,
       CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE,
       CIM_REFERENCES_REQUEST_MESSAGE,
       CIM_REFERENCE_NAMES_REQUEST_MESSAGE,
       CIM_GET_PROPERTY_REQUEST_MESSAGE,
       CIM_SET_PROPERTY_REQUEST_MESSAGE,
       CIM_GET_QUALIFIER_REQUEST_MESSAGE,
       CIM_SET_QUALIFIER_REQUEST_MESSAGE,
       CIM_DELETE_QUALIFIER_REQUEST_MESSAGE,
       CIM_ENUMERATE_QUALIFIERS_REQUEST_MESSAGE,
       CIM_INVOKE_METHOD_REQUEST_MESSAGE,
       CIM_ENABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE,
       CIM_MODIFY_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE,
       CIM_DISABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE,
       CIM_GET_CLASS_RESPONSE_MESSAGE,
       CIM_GET_INSTANCE_RESPONSE_MESSAGE,
       CIM_EXPORT_INDICATION_RESPONSE_MESSAGE,
       CIM_DELETE_CLASS_RESPONSE_MESSAGE,
       CIM_DELETE_INSTANCE_RESPONSE_MESSAGE,
       CIM_CREATE_CLASS_RESPONSE_MESSAGE,
       CIM_CREATE_INSTANCE_RESPONSE_MESSAGE,
       CIM_MODIFY_CLASS_RESPONSE_MESSAGE,
       CIM_MODIFY_INSTANCE_RESPONSE_MESSAGE,
       CIM_ENUMERATE_CLASSES_RESPONSE_MESSAGE,
       CIM_ENUMERATE_CLASS_NAMES_RESPONSE_MESSAGE,
       CIM_ENUMERATE_INSTANCES_RESPONSE_MESSAGE,
       CIM_ENUMERATE_INSTANCE_NAMES_RESPONSE_MESSAGE,
       CIM_EXEC_QUERY_RESPONSE_MESSAGE,
       CIM_ASSOCIATORS_RESPONSE_MESSAGE,
       CIM_ASSOCIATOR_NAMES_RESPONSE_MESSAGE,
       CIM_REFERENCES_RESPONSE_MESSAGE,
       CIM_REFERENCE_NAMES_RESPONSE_MESSAGE,
       CIM_GET_PROPERTY_RESPONSE_MESSAGE,
       CIM_SET_PROPERTY_RESPONSE_MESSAGE,
       CIM_GET_QUALIFIER_RESPONSE_MESSAGE,
       CIM_SET_QUALIFIER_RESPONSE_MESSAGE,
       CIM_DELETE_QUALIFIER_RESPONSE_MESSAGE,
       CIM_ENUMERATE_QUALIFIERS_RESPONSE_MESSAGE,
       CIM_INVOKE_METHOD_RESPONSE_MESSAGE,
       CIM_ENABLE_INDICATION_SUBSCRIPTION_RESPONSE_MESSAGE,
       CIM_MODIFY_INDICATION_SUBSCRIPTION_RESPONSE_MESSAGE,
       CIM_DISABLE_INDICATION_SUBSCRIPTION_RESPONSE_MESSAGE,
   
       // Monitor-related messages:
   
       SOCKET_MESSAGE,
   
       // Connection-oriented messages:
   
       CLOSE_CONNECTION_MESSAGE,
   
       // HTTP messages:
   
       HTTP_MESSAGE,
   
       NUMBER_OF_MESSAGES
   };
   
   PEGASUS_COMMON_LINKAGE const char* MessageTypeToString(Uint32 messageType);
   
   /** This class implements a stack of queue-ids. Many messages must keep a
       stack of queue-ids of queues which they must be returned to. This provides
       a light efficient stack for this purpose.
   */
   class QueueIdStack
   {
   public:
   
       QueueIdStack() : _size(0)
       {
       }
   
       QueueIdStack(const QueueIdStack& x) : _size(x._size)
       {
           memcpy(_items, x._items, sizeof(_items));
       }
   
       PEGASUS_EXPLICIT QueueIdStack(Uint32 x) : _size(0)
       {
           push(x);
       }
   
       PEGASUS_EXPLICIT QueueIdStack(Uint32 x1, Uint32 x2) : _size(0)
       {
           push(x1);
           push(x2);
       }
   
       ~QueueIdStack()
       {
       }
   
       QueueIdStack& operator=(const QueueIdStack& x)
       {
           if (this != &x)
           {
               memcpy(_items, x._items, sizeof(_items));
               _size = x._size;
           }
           return *this;
       }
   
       Uint32 size() const
       {
           return _size;
       }
   
       Boolean isEmpty() const
       {
           return _size == 0;
       }
   
       void push(Uint32 x)
       {
           if (_size == MAX_SIZE)
               throw StackOverflow();
   
           _items[_size++] = x;
       }
   
       Uint32& top()
       {
           if (_size == 0)
               throw StackUnderflow();
   
           return _items[_size-1];
       }
   
       Uint32 top() const
       {
           return ((QueueIdStack*)this)->top();
       }
   
       void pop()
       {
           if (_size == 0)
               throw StackUnderflow();
   
           _size--;
       }
   
       /** Make a copy of this stack and then pop the top element. */
       QueueIdStack copyAndPop() const
       {
           return QueueIdStack(*this, 0);
       }
   
   private:
   
       // Copy the given stack but then pop the top element:
       QueueIdStack(const QueueIdStack& x, int) : _size(x._size)
       {
           memcpy(_items, x._items, sizeof(_items));
           pop();
       }
   
       enum { MAX_SIZE = 5 };
       Uint32 _items[MAX_SIZE];
       Uint32 _size;
   };
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  
 #endif /* Pegasus_Message_h */ #endif /* Pegasus_Message_h */


Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5.2.10

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2