GizmoDistribution

gzDistRemoteMessage.h

Go to the documentation of this file.
00001 //*****************************************************************************
00002 // File         : gzDistRemoteMessage.h
00003 // Module       : gzDistribution
00004 // Description  : Definition of gzDistRemoteMessage
00005 // Author       : Anders Sandblad
00006 // Product      : GizmoDistribution 2.1.1
00007 //
00008 // Copyright © 2004 - Saab Training Systems AB, Sweden
00009 //
00010 // NOTE:    GizmoDistribution is a toolkit used for implementing distributed 
00011 //          objects and events in C++
00012 //
00013 //
00014 // Revision History...
00015 //
00016 // Who  Date    Description
00017 //
00018 // XAA  031113  Created file
00019 //
00020 //*****************************************************************************
00021 #ifndef __GZ_DIST_REMOTE_MESSAGE_H__
00022 #define __GZ_DIST_REMOTE_MESSAGE_H__
00023 
00028 // Includes
00029 #include "gzDistBase.h"
00030 #include "gzDistSerializeMemory.h"
00031 
00033 enum gzDistRemoteMessageClass
00034 {
00035     GZ_DIST_REMOTE_MESSAGE_CLASS_UNKNOWN = 0,
00036     GZ_DIST_REMOTE_MESSAGE_CLASS_SERVER,                // 
00037     GZ_DIST_REMOTE_MESSAGE_CLASS_SESSION,               // 
00038     GZ_DIST_REMOTE_MESSAGE_REQUEST_RESEND,              // Used in reliable mode to request missed messages.
00039     GZ_DIST_REMOTE_MESSAGE_INDEX_DISTRIBUTION,          // Used in reliable mode to distribute current message index.
00040     GZ_DIST_REMOTE_MESSAGE_BUFFER_INDEX_LIMIT,          // Used in reliable mode to distribute the start index of its resend buffer.
00041     GZ_DIST_REMOTE_MESSAGE_INDEX_ACK_REQUEST,           // Used in reliable mode to request acknowledge on index.
00042     GZ_DIST_REMOTE_MESSAGE_INDEX_ACK,                   // Used in reliable mode to acknowledge received index.
00043     GZ_DIST_REMOTE_MESSAGE_SHUTDOWN,                    // Used in reliable mode to tell other processes about shutdown.
00044     GZ_DIST_REMOTE_MESSAGE_SPECIAL_COMMANDS,            // Here begins all special debug messages etc. This number is never used!
00045     GZ_DIST_REMOTE_MESSAGE_HOST_INFO_REQUEST,
00046     GZ_DIST_REMOTE_MESSAGE_HOST_INFO_REPLY,
00047     GZ_DIST_REMOTE_MESSAGE_CLASS_MAX_CLASS              // The last item
00048 };
00049 
00050 
00052 enum gzDistRemoteMessageType
00053 {
00054     GZ_DIST_REMOTE_MESSAGE_TYPE_UNKNOWN = 0,
00055 
00056     // Server class messages
00057     GZ_DIST_REMOTE_MESSAGE_SERVER_PING,
00058     GZ_DIST_REMOTE_MESSAGE_SERVER_REQUEST_SYNCHRONIZE,  // Request a total synchronization from the active server. (Sent from non-server).
00059     GZ_DIST_REMOTE_MESSAGE_SERVER_END_SYNCHRONIZE,      // Tells that the synchronization is finished. (Sent from server).
00060     GZ_DIST_REMOTE_MESSAGE_SERVER_REQUEST_UPDATE,       // Request all data from a none-server. (Sent from server).
00061     GZ_DIST_REMOTE_MESSAGE_SERVER_END_UPDATE,           // Tells that the data transmission is finished. (Sent from non-server).
00062 
00063     // Session class messages
00064     GZ_DIST_REMOTE_MESSAGE_SESSION_EVENT,
00065     GZ_DIST_REMOTE_MESSAGE_SESSION_NEW_OBJECT,
00066     GZ_DIST_REMOTE_MESSAGE_SESSION_NEW_OBJECT_REQUEST,
00067     GZ_DIST_REMOTE_MESSAGE_SESSION_UPDATE_OBJECT,
00068     GZ_DIST_REMOTE_MESSAGE_SESSION_UPDATE_OBJECT_REQUEST,
00069     GZ_DIST_REMOTE_MESSAGE_SESSION_REMOVE_OBJECT,
00070     GZ_DIST_REMOTE_MESSAGE_SESSION_REMOVE_OBJECT_REQUEST,
00071     GZ_DIST_REMOTE_MESSAGE_SESSION_REMOVE_ATTRIBUTES,
00072     GZ_DIST_REMOTE_MESSAGE_SESSION_REMOVE_ATTRIBUTES_REQUEST,
00073     GZ_DIST_REMOTE_MESSAGE_SESSION_REQUEST_OWNERSHIP,
00074     GZ_DIST_REMOTE_MESSAGE_SESSION_DROP_OWNERSHIP,              // Used for drop request and drop request remove.
00075     GZ_DIST_REMOTE_MESSAGE_SESSION_SET_OWNERSHIP,
00076     GZ_DIST_REMOTE_MESSAGE_SESSION_PULL_OWNERSHIP,
00077     GZ_DIST_REMOTE_MESSAGE_SESSION_SYNCHRONIZE_OBJECT,
00078     GZ_DIST_REMOTE_MESSAGE_SESSION_MAX_TYPE                     // The last item
00079 };
00080 
00081 
00082 //--------------------------- gzDistRemoteMessage -----------------------------
00083 
00085 class gzDistRemoteMessage : public gzReference
00086 {
00087     public:
00088 
00090         GZ_DIST_EXPORT gzDistRemoteMessage();
00091 
00093         GZ_DIST_EXPORT gzDistRemoteMessage(gzUByte msgClass, gzUByte msgType);
00094 
00096         GZ_DIST_EXPORT virtual ~gzDistRemoteMessage();
00097         
00099         virtual gzReference* clone() const { return (gzReference *) new gzDistRemoteMessage(*this); }
00100 
00102         gzBool useDeepCopy() { return FALSE; }
00103 
00104 
00105         //---------- header data ----------
00106 
00108         gzDistInstanceID senderID;
00109         
00111         gzDistInstanceID destinationID;
00112 
00114         gzRefList<gzDistSerializeMemoryData> data;
00115 
00117         gzUByte messageClass;
00118 
00120         gzUByte messageType;
00121 
00122         gzUInt highPrio;
00123 };
00124 
00125 // Auto reference pointer and list
00126 GZ_DIST_PTR(gzDistRemoteMessage);
00127 GZ_DIST_LIST(gzDistRemoteMessage);
00128 
00129 
00130 //------------------------ gzDistRemoteMessageServer --------------------------
00131 
00132 // Remote server message
00133 class gzDistRemoteMessageServer : public gzDistRemoteMessage
00134 {
00135     public:
00136 
00137         gzDistRemoteMessageServer(gzUByte msgType)
00138         : gzDistRemoteMessage(GZ_DIST_REMOTE_MESSAGE_CLASS_SERVER, msgType)
00139         { }
00140     
00141         virtual ~gzDistRemoteMessageServer() { }
00142 
00143         virtual gzReference* clone() const { return (gzReference*) new gzDistRemoteMessageServer(*this); }
00144 
00145 
00146         //---------- body data ----------
00147         
00148         // Server status (gzDistServerStatus)
00149         gzUByte status;
00150         
00151         // Server base priority (gzDistServerPriority)
00152         gzUByte priority;
00153 
00154         // Source server instance ID
00155         gzDistInstanceID sourceID;
00156         
00157         // Server function ID
00158         gzString functionID;
00159 
00160 };
00161 
00162 // Auto reference pointer and list
00163 GZ_DIST_PTR(gzDistRemoteMessageServer);
00164 GZ_DIST_LIST(gzDistRemoteMessageServer);
00165 
00166 
00167 //------------------------ gzDistRemoteMessageSession -------------------------
00168 
00169 GZ_DIST_DECLARE_MEMBASE_EXPORT(gzDistRemoteMessageSession, GZ_DIST_EXPORT);
00170 
00171 // Remote session message
00172 class gzDistRemoteMessageSession : public gzDistRemoteMessage
00173 {
00174     public:
00175 
00176         GZ_DIST_EXPORT gzDistRemoteMessageSession(gzUByte messageType);
00177 
00178         gzDistRemoteMessageSession(const gzString& sessionName, gzUByte msgClass, gzUByte msgType);
00179             
00180         GZ_DIST_EXPORT virtual ~gzDistRemoteMessageSession();
00181         
00182         virtual gzReference* clone() const { return (gzReference*) new gzDistRemoteMessageSession(*this); }
00183 
00184 
00185         //---------- body data ----------
00186 
00187         // The name of the session
00188         gzString sessionName;
00189 
00190         // Class type of the data (TypeName) declared in gzTypeInterface.
00191         gzString dataType;
00192 
00193         // The identification of the sendign client.
00194         gzDistClientID clientID;
00195 
00196         // The position in data array where the serialized data begins. (Only used in incoming messages)
00197         gzUInt dataPosition;
00198 };
00199 
00200 // Auto reference pointer and list
00201 GZ_DIST_PTR(gzDistRemoteMessageSession);
00202 GZ_DIST_LIST(gzDistRemoteMessageSession);
00203 
00204 #endif

Documentation for GizmoDistribution generated at Wed Feb 20 11:59:21 2008 by   Saab Training Systems AB, ¸ (c) 2003-and beyond