# SINetworkMessages.h

    00001 //***************************************************************************************
    00002 //
    00003 // File supervisor: Crosswalk team
    00004 //
    00005 // Copyright 2008 Autodesk, Inc.  All rights reserved.
    00006 // Use of this software is subject to the terms of the Autodesk license agreement
    00007 // provided at the time of installation or download, or which otherwise accompanies
    00008 // this software in either electronic or hard copy form.
    00009 //
    00010 //***************************************************************************************
    00011
    00012 #ifndef _SINETWORKMESSAGES_H_
    00013 #define _SINETWORKMESSAGES_H_
    00014
    00015 #include <SIBCUtil.h>
    00016
    00017 #define SI_NETMSG_FREAD_PACKET_SIZE     256
    00018 #define SI_NET_FILE_TRANSFER_ATTEMPTS   5
    00019
    00020 //
    00021 // Messages
    00022 //
    00023
    00024 enum
    00025 {
    00026     SI_NETMSG_LOADFILE,
    00027     SI_NETMSG_MERGEFILE,
    00028     SI_NETMSG_SETHOSTNAME,
    00029
    00030     SI_NETMSG_FILEOPEN,
    00031     SI_NETMSG_FILEOPEN_ANSWER,
    00032
    00033     SI_NETMSG_EOF,
    00034     SI_NETMSG_EOF_ANSWER,
    00035
    00036     SI_NETMSG_FGETC,
    00037     SI_NETMSG_FGETC_ANSWER,
    00038
    00039     SI_NETMSG_FILECLOSE,
    00040     SI_NETMSG_FILECLOSE_ANSWER,
    00041
    00042     SI_NETMSG_FTELL,
    00043     SI_NETMSG_FTELL_ANSWER,
    00044
    00045     SI_NETMSG_FSEEK,
    00046     SI_NETMSG_FSEEK_ANSWER,
    00047
    00048     SI_NETMSG_FREAD,
    00049     SI_NETMSG_FREAD_PACKET,
    00050     SI_NETMSG_FREAD_END,
    00051
    00052     SI_NETMSG_FREAD_CONFIRM,
    00053
    00054     SI_NETMSG_SETPARAMVALUE,
    00055     SI_NETMSG_GETPARAMHANDLE,
    00056     SI_NETMSG_PARAMHANDLE,
    00057
    00058     SI_NETMSG_CMDEND
    00059
    00060 };
    00061
    00062 #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_XBOX)
    00063 #pragma pack( push )
    00064 #pragma pack( 1 )
    00065 #elif defined(CODEWARRIOR)
    00066 #pragma options align= native
    00067 #endif
    00068
    00069 struct SINetMsgLoadFile
    00070 {
    00071     SI_Char     l_szFilename[128];
    00072 };
    00073
    00074 struct SINetMsgSetParamValue
    00075 {
    00076     SI_Long     m_lHandle;
    00077     SI_Float    m_fValue;
    00078 };
    00079
    00080 struct SINetMsgSetHostName
    00081 {
    00082     SI_Char     m_szHostName[128];
    00083 };
    00084
    00085 struct SINetMsgFileOpen
    00086 {
    00087     SI_Char     m_szFilename[256];
    00088     SI_Char     m_szMode[4];
    00089 };
    00090
    00091 struct SINetMsgFileOpenAnswer
    00092 {
    00093     SI_Long     m_lHandle;
    00094 };
    00095
    00096 struct SINetMsgFileEOF
    00097 {
    00098     SI_Long     m_lHandle;
    00099 };
    00100
    00101 struct SINetMsgFileEOFAnswer
    00102 {
    00103     SI_Int      m_iResult;
    00104 };
    00105
    00106 struct SINetMsgFGETC
    00107 {
    00108     SI_Long     m_lHandle;
    00109 };
    00110
    00111 struct SINetMsgFGETCAnswer
    00112 {
    00113     SI_Int      m_iChar;
    00114 };
    00115
    00116
    00117 struct SINetMsgFileClose
    00118 {
    00119     SI_Long     m_lHandle;
    00120 };
    00121
    00122 struct SINetMsgFileCloseAnswer
    00123 {
    00124     SI_Int      m_iChar;
    00125 };
    00126
    00127 struct SINetMsgFileTell
    00128 {
    00129     SI_Long     m_lHandle;
    00130
    00131 };
    00132
    00133 struct SINetMsgFileEnd
    00134 {
    00135     SI_Long     m_lTotalBytes;
    00136
    00137 };
    00138
    00139
    00140 struct SINetMsgFileTellAnswer
    00141 {
    00142     SI_Long     m_lOffset;
    00143 };
    00144
    00145 struct SINetMsgFileSeek
    00146 {
    00147     SI_Long     m_lHandle;
    00148     SI_Long     m_lOffset;
    00149     SI_Int      m_iMode;
    00150
    00151 };
    00152
    00153 struct SINetMsgFileSeekAnswer
    00154 {
    00155     SI_Int      m_iAnswer;
    00156
    00157 };
    00158
    00159 struct SINetMsgFileRead
    00160 {
    00161     SI_Long     m_lHandle;
    00162     SI_Long     m_lSize;
    00163
    00164 };
    00165
    00166 struct SINetMsgFileReadPacket
    00167 {
    00168     SI_Long     m_lOffset;
    00169     SI_Long     m_lSize;
    00170     SI_Char     m_pData[SI_NETMSG_FREAD_PACKET_SIZE];
    00171
    00172 };
    00173
    00174 struct SINetMsgFileReadConfirm
    00175 {
    00176     SI_Long     m_lOffset;
    00177     SI_Long     m_lSize;
    00178 };
    00179
    00180 struct SINetMsgParamName
    00181 {
    00182     SI_Char     m_szName[256];
    00183 };
    00184
    00185 struct SINetMsgParamHandle
    00186 {
    00187     SI_Long     m_lHandle;
    00188 };
    00189
    00190 #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_XBOX)
    00191 #pragma pack( pop )
    00192 #elif defined(CODEWARRIOR)
    00193 #pragma options align= reset
    00194 #endif
    00195
    00196 struct XSICOREEXPORT SINetMsg
    00197 {
    00198     SI_Char m_bID;
    00199
    00200     union
    00201     {
    00202
    00203         SINetMsgLoadFile        m_LoadFile;
    00204         SINetMsgSetParamValue   m_ParamValue;
    00205         SINetMsgSetHostName     m_HostName;
    00206
    00207         SINetMsgFileOpen        m_FileOpen;
    00208         SINetMsgFileOpenAnswer  m_FileOpenAnswer;
    00209
    00210
    00211         SINetMsgFileEOF         m_FileEOF;
    00212         SINetMsgFileEOFAnswer   m_FileEOFAnswer;
    00213
    00214         SINetMsgFGETC           m_FGETC;
    00215         SINetMsgFGETCAnswer     m_FGETCAnswer;
    00216
    00217         SINetMsgFileClose       m_FileClose;
    00218         SINetMsgFileCloseAnswer m_FileCloseAnswer;
    00219
    00220         SINetMsgFileTell        m_FileTell;
    00221         SINetMsgFileTellAnswer  m_FileTellAnswer;
    00222
    00223         SINetMsgFileSeek        m_FileSeek;
    00224         SINetMsgFileSeekAnswer  m_FileSeekAnswer;
    00225
    00226         SINetMsgFileRead        m_FileRead;
    00227         SINetMsgFileReadPacket  m_FileReadPacket;
    00228
    00229         SINetMsgFileReadConfirm m_FileReadConfirm;
    00230
    00231         SINetMsgFileEnd         m_FileReadEnd;
    00232
    00233         SINetMsgParamName       m_ParamName;
    00234         SINetMsgParamHandle     m_ParamHandle;
    00235
    00236     };
    00237
    00238 public:
    00239
    00240     explicit SINetMsg( SI_Char in_bID = 0 );
    00241
    00242     //
    00243     // Accessors
    00244     //
    00245
    00246     SINetMsgLoadFile&           GetLoadFile()       { return m_LoadFile;}
    00247     SINetMsgSetParamValue&      GetSetParamValue()  { return m_ParamValue;}
    00248     SINetMsgSetHostName&        GetHostName()       { return m_HostName;}
    00249
    00250     SINetMsgFileOpen&           GetFileOpen()           { return m_FileOpen;}
    00251     SINetMsgFileOpenAnswer&     GetFileOpenAnswer()     { return m_FileOpenAnswer;}
    00252
    00253     SINetMsgFileEOF&            GetFileEOF()        { return m_FileEOF;};
    00254     SINetMsgFileEOFAnswer&      GetFileEOFAnswer()      { return m_FileEOFAnswer;};
    00255
    00256     SINetMsgFGETC&              GetFGETC()          { return m_FGETC;};
    00257     SINetMsgFGETCAnswer&        GetFGETCAnswer()    { return m_FGETCAnswer;};
    00258
    00259     SINetMsgFileClose&          GetFileClose()      { return m_FileClose;};
    00260     SINetMsgFileCloseAnswer&    GetFileCloseAnswer(){ return m_FileCloseAnswer;};
    00261
    00262     SINetMsgFileTell&           GetFileTell()       { return m_FileTell;};
    00263     SINetMsgFileTellAnswer&     GetFileTellAnswer()     { return m_FileTellAnswer;};
    00264
    00265     SINetMsgFileSeek&           GetFileSeek()       { return m_FileSeek;};
    00266     SINetMsgFileSeekAnswer&     GetFileSeekAnswer()     { return m_FileSeekAnswer;};
    00267
    00268     SINetMsgFileRead&           GetFileRead()       { return m_FileRead; };
    00269     SINetMsgFileReadPacket&     GetFileReadPacket() { return m_FileReadPacket; };
    00270
    00271     SINetMsgFileReadConfirm&    GetFileReadConfirm() { return m_FileReadConfirm; };
    00272
    00273     SINetMsgFileEnd&            GetFileReadEnd()    { return m_FileReadEnd; };
    00274
    00275     SINetMsgParamName&          GetParamName()      { return m_ParamName; };
    00276     SINetMsgParamHandle&        GetParamHandle()        { return m_ParamHandle; };
    00277
    00278
    00279
    00280     SI_Char GetId()         const   { return m_bID; }
    00281     SI_Int  GetMaxSize()    const   { return sizeof(*this); }
    00282     SI_Int  GetSize()       const;
    00283 };
    00284
    00285
    00286 #endif