maxnet_file.h

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 // ------------------------
00003 // File ....: maxnet_file.h
00004 // ------------------------
00005 // Author...: Gus J Grubba
00006 // Date ....: March 2000
00007 // O.S. ....: Windows 2000
00008 //
00009 // *** Obsolete ***
00010 // 
00011 //-----------------------------------------------------------------------------
00012 
00013 #pragma once
00014 #include <WTypes.h>
00015 #include "strbasic.h"
00016 #include "maxheap.h"
00017 #include "network\MaxNetExport.h"
00018 // forward declarations
00019 struct AlertData;
00020 class CJobText;
00021 struct SceneInfo;
00022 struct Job;
00023 struct NetworkStatus;
00024 struct ConfigurationBlock;
00025 struct WeekSchedule;
00026 struct JobServer;
00027 struct JOBFRAMES;
00028 
00029 #define SRVTOMAX                _M("ToMax.txt")
00030 #define APPTOSRV                _M("ToServer.txt")
00031 #define JOBDESCRP               _M("Job.txt")
00032 
00033 //---------------------------------------------------------
00034 //-- Messages from MAX to Server
00035 
00036 #define FROMMAX_READY           _M("ready")
00037 #define FROMMAX_FRAME_COMPLETE  _M("complete")
00038 #define FROMMAX_FRAME_ERROR     _M("error")
00039 #define FROMMAX_BUSY            _M("busy")
00040 #define FROMMAX_GOING_DOWN      _M("end")
00041 
00042 //---------------------------------------------------------
00043 //-- Messages from Server to Max
00044 
00045 #define FROMSRV_NEWFRAME        _M("frame")
00046 #define FROMSRV_CANCEL          _M("cancel")
00047 
00048 //-----------------------------------------------------------------------------
00049 //-- Sections
00050 //
00051 
00052 #ifdef  _MXNTF_DEFINE_
00053 
00054 #define MXNTF_SERVERINFO            _M("ServerInfo")
00055 #define MXNTF_VERSION               _M("Version")
00056 #define MXNTF_SRV_PID               _M("ServerPID")
00057 #define MXNTF_SRV_TOTAL_FRAMES      _M("TotalFrames")
00058 #define MXNTF_SRV_TOTAL_TIME        _M("TotalTime")
00059 #define MXNTF_SRV_INDEX             _M("Index")
00060 #define MXNTF_CONFIG_BLOCK          _M("Configuration")
00061 #define MXNTF_TOTAL_MEMORY          _M("TotalMemory")
00062 #define MXNTF_TOTAL_CPU             _M("NumberCpus")
00063 #define MXNTF_OS_MAJOR              _M("OSMajor")
00064 #define MXNTF_OS_MINOR              _M("OSMinor")
00065 #define MXNTF_OS_BUILD              _M("OSBuild")
00066 #define MXNTF_OS_PLATFORM_ID        _M("OSPlatformID")
00067 #define MXNTF_OS_CSDV               _M("OSCSDV")
00068 #define MXNTF_TEMP_DIR              _M("TempDir")
00069 #define MXNTF_WORK_DISK             _M("WorkDisk")
00070 #define MXNTF_AVAILABLE_DISKS       _M("AvailableDisks")
00071 #define MXNTF_DISK_SPACE            _M("DiskSpace")
00072 #define MXNTF_MAC                   _M("MAC")
00073 #define MXNTF_NETSTATUS             _M("NetworkStatus")
00074 #define MXNTF_DROPPED_PACKETS       _M("DroppedPackets")
00075 #define MXNTF_BAD_PACKETS           _M("BadPackets")
00076 #define MXNTF_TCP_REQUESTS          _M("TCPRequests")
00077 #define MXNTF_UDP_REQUESTS          _M("UDPRequests")
00078 #define MXNTF_BOOT_TIME             _M("BootTime")
00079 #define MXNTF_JOB                   _M("Job")
00080 #define MXNTF_FLAGS                 _M("Flags")
00081 #define MXNTF_HJOB                  _M("HJOB")
00082 #define MXNTF_JOB_NAME              _M("JobName")
00083 #define MXNTF_JOB_FIRST_FRAME       _M("FirstFrame")
00084 #define MXNTF_JOB_LAST_FRAME        _M("LastFrame")
00085 #define MXNTF_STEP                  _M("Step")
00086 #define MXNTF_JOB_SUBMISSION        _M("Submission")
00087 #define MXNTF_JOB_START             _M("Start")
00088 #define MXNTF_JOB_END               _M("End")
00089 #define MXNTF_JOB_FRAMES_COMPLETE   _M("FramesComplete")
00090 #define MXNTF_JOB_SERVER_COUNT      _M("ServerCount")
00091 #define MXNTF_JOB_PRIORITY          _M("JobPriority")
00092 #define MXNTF_JOB_ARCHSIZE          _M("ArchivedSize")
00093 #define MXNTF_JOB_UNARCHSIZE        _M("UnarchivedSize")
00094 #define MXNTF_ALERTS                _M("Alerts")
00095 #define MXNTF_NOTIFICATIONS         _M("Notifications")
00096 #define MXNTF_ENABLED               _M("Enabled")
00097 #define MXNTF_USER_NAME             _M("UserName")
00098 #define MXNTF_COMPUTER_NAME         _M("ComputerName")
00099 #define MXNTF_JOB_TEXT              _M("JobText")
00100 #define MXNTF_COUNT                 _M("Count")
00101 #define MXNTF_JOB_TEXTITEM          _M("JobTextItem")
00102 #define MXNTF_JOB_TEXT_TEXT         _M("JobTextText")
00103 #define MXNTF_JOB_TEXT_OUTPUT       _M("JobTextOutput")
00104 #define MXNTF_JOB_TEXT_OUTPUT_FILE  _M("JobTextOutputData")
00105 #define MXNTF_R_ELEMENT             _M("RenderElement")
00106 #define MXNTF_RE_ENABLED            _M("RenderElementEnabled")
00107 #define MXNTF_RE_ACTIVE             _M("RenderElementsActive")
00108 #define MXNTF_RE_FLT_ENABLED        _M("RenderElementFilterEnabled")
00109 #define MXNTF_RE_ATM_ENABLED        _M("RenderElementAtmEnabled")
00110 #define MXNTF_RE_SHD_ENABLED        _M("RenderElementShadowEnabled")
00111 #define MXNTF_RE_NAME               _M("RenderElementName")
00112 #define MXNTF_RE_OUTPUT             _M("RenderElementOutput")
00113 #define MXNTF_JOB_FRAMES            _M("JobFrames")
00114 #define MXNTF_JOB_FRAME_NO          _M("Frame")
00115 #define MXNTF_JOB_SERVERS           _M("JobServers")
00116 #define MXNTF_JOB_SERVER_NO         _M("Server")
00117 #define MXNTF_WIDTH                 _M("Width")
00118 #define MXNTF_HEIGHT                _M("Height")
00119 #define MXNTF_PIXELASPECT           _M("PixelAspect")
00120 #define MXNTF_INIT                  _M("Init")
00121 #define MXNTF_GAMMACORRECTION       _M("UseGammaCorrection")
00122 #define MXNTF_INPUTGAMMA            _M("InputGamma")
00123 #define MXNTF_OUTPUTGAMMA           _M("OutputGamma")
00124 #define MXNTF_CAMERA                _M("Camera")
00125 #define MXNTF_SCENE_INFO            _M("SceneInfo")
00126 #define MXNTF_NO_OBJECTS            _M("NumberOfObjects")
00127 #define MXNTF_NO_FACES              _M("NumberOfFaces")
00128 #define MXNTF_NO_LIGHTS             _M("NumberOfLights")
00129 #define MXNTF_SCENE_FLAGS           _M("SceneFlags")
00130 #define MXNTF_SCENE_START           _M("SceneStart")
00131 #define MXNTF_SCENE_END             _M("SceneEnd")
00132 #define MXNTF_JOB_STATE             _M("JobState")
00133 #define MXNTF_NO_JOBS               _M("NumberOfJobs")
00134 #define MXNTF_JOB_STATE_N           _M("Job")
00135 #define MXNTF_INI_GENERAL           _M("General")
00136 #define MXNTF_INI_MGRPORT           _M("ManagerPort")
00137 #define MXNTF_INI_SRVPORT           _M("ServerPort")
00138 #define MXNTF_INI_MAXBLOCK          _M("MaxBlockSize")
00139 #define MXNTF_INI_NETMASK           _M("NetworkMask")
00140 #define MXNTF_INI_MANAGER           _M("Manager")
00141 #define MXNTF_INI_QM                _M("QueueManager")
00142 #define MXNTF_INI_MGRAPP            _M("ManagerApp")
00143 #define MXNTF_INI_SRVAPP            _M("ServerApp")
00144 #define MXNTF_INI_INIT              _M("Init")
00145 #define MXNTF_INI_WX                _M("WindowX")
00146 #define MXNTF_INI_WY                _M("WindowY")
00147 #define MXNTF_INI_WW                _M("WindowW")
00148 #define MXNTF_INI_WH                _M("WindowH")
00149 #define MXNTF_INI_SR                _M("SplitterRoll")
00150 #define MXNTF_INI_SC                _M("SplitterColumn")
00151 #define MXNTF_INI_CLI_VFB           _M("UseVFB")
00152 #define MXNTF_INI_SRV_TABS          _M("ServerTabs")
00153 #define MXNTF_INI_AUTO_CONN         _M("AutoConnect")
00154 #define MXNTF_INI_AUTO_REFRESH      _M("AutoRefresh")
00155 #define MXNTF_INI_RETRYFSERVERS     _M("RetryFailedServers")
00156 #define MXNTF_INI_SRVCOOLOFF        _M("ServerCoolOffTime")
00157 #define MXNTF_INI_CLIENTNOTIFYDELAY _M("ClientNotificationDelay")
00158 #define MXNTF_INI_RETRYCOUNT        _M("RetryCount")
00159 #define MXNTF_INI_TIMEBRETRY        _M("TimeBetweenRetries")
00160 #define MXNTF_INI_MAXLOADTIME       _M("MAXLoadTimeout")
00161 #define MXNTF_INI_MAXRENDERTIME     _M("MAXRenderTimeout")
00162 #define MXNTF_INI_MAXUNLOADTIME     _M("MAXUnloadTimeout")
00163 #define MXNTF_INI_MAXCONCASSIGN     _M("MaxConcurrentAssignments")
00164 #define MXNTF_INI_TIME              _M("Timers")
00165 #define MXNTF_INI_ACKTIMEOUT        _M("AckTimeout")
00166 #define MXNTF_INI_ACKRETRY          _M("AckRetries")
00167 #define MXNTF_INI_FASTACKTIMEOUT    _M("FastAckTimeout")
00168 #define MXNTF_INI_LOG               _M("Log")
00169 #define MXNTF_INI_MAXSCRRENLN       _M("MaxLogScreenLines")
00170 #define MXNTF_INI_ERRORSCREEN       _M("LogErrorsToScreen")
00171 #define MXNTF_INI_WARNSCREEN        _M("LogWarningsToScreen")
00172 #define MXNTF_INI_INFOSCREEN        _M("LogInfoToScreen")
00173 #define MXNTF_INI_DEBUGSCREEN       _M("LogDebugToScreen")
00174 #define MXNTF_INI_DEBUGEXSCREEN     _M("LogDebugExToScreen")
00175 #define MXNTF_INI_ERRORFILE         _M("LogErrorsToFile")
00176 #define MXNTF_INI_WARNFILE          _M("LogWarningsToFile")
00177 #define MXNTF_INI_INFOFILE          _M("LogInfoToFile")
00178 #define MXNTF_INI_DEBUGFILE         _M("LogDebugToFile")
00179 #define MXNTF_INI_DEBUGEXFILE       _M("LogDebugExToFile")
00180 #define MXNTF_INI_SERVER            _M("Server")
00181 #define MXNTF_INI_AUTOSEARCH        _M("AutoSearchManager")
00182 #define MXNTF_INI_MGRNAME           _M("ManagerName")
00183 #define MXNTF_WEEK_SCHEDULE         _M("WeekSchedule")
00184 #define MXNTF_ATT_PRIORITY          _M("AttendedPriority")
00185 #define MXNTF_UTT_PRIORITY          _M("UnattendedPriority")
00186 #define MXNTF_WEEK_DAY              _M("Day")
00187 #define MXNTF_INI_CLIENT            _M("ClientSettings")
00188 #define MXNTF_INI_ALERT_COMPLETION  _M("AlertCompletion")
00189 #define MXNTF_INI_ALERT_FAILURE     _M("AlertFailure")
00190 #define MXNTF_INI_ALERT_NTH         _M("AlertEveryNth")
00191 #define MXNTF_INI_ALERT_PROGRESS    _M("AlertProgress")
00192 #define MXNTF_INI_ALERTS            _M("Alerts")
00193 #define MXNTF_INI_AUTOCONNECT       _M("AutoConnect")
00194 #define MXNTF_INI_IGNORESCENE       _M("IgnoreScenePath")
00195 #define MXNTF_INI_INCLUDEMAPS       _M("IncludeMaps")
00196 #define MXNTF_INI_SKIPOUTPUT        _M("SkipOutputTest")
00197 #define MXNTF_INI_USEALLSERVERS     _M("UseAllServers")
00198 
00199 #endif
00200 
00201 //-----------------------------------------------------------------------------
00202 //-- File Class
00203 //
00204 
00205 class MAXNETEXPORT MaxNetFile : public MaxHeapOperators {
00206 
00207 protected:
00208 
00209     MCHAR   line[1024];
00210     FILE*   f;
00211     bool    read;
00212 
00213 public:
00214 
00215     MaxNetFile      ( );
00216     virtual ~MaxNetFile     ( );
00217 
00218     virtual bool    OpenRead    (const MCHAR* name);
00219     virtual bool    OpenWrite   (const MCHAR* name);
00220     virtual void    Close       ( );                    //-- Optional (Destructor calls it)
00221     void            Reset       ( );                    //-- fseek 0 seek_set
00222 
00223     MCHAR*  FirstBlank      (MCHAR* line);
00224     MCHAR*  FirstNonblank   (MCHAR* line);
00225     MCHAR*  NextValue       (MCHAR* ln);
00226     bool    LocateSection   (MCHAR* section);
00227     MCHAR*  LocateValue     (MCHAR* section, MCHAR* var, bool rescan = true);
00228     MCHAR*  GetLine         (MCHAR* destination = 0 );
00229 
00230     bool    ReadFilename    (MCHAR* ptr, MCHAR* filename);
00231 
00232     bool    Write           (MCHAR* line);
00233     bool    WriteHeader     (MCHAR* hdr);
00234     bool    WritePair       (MCHAR* var, float value);
00235     bool    WritePair       (MCHAR* var, int value);
00236     bool    WritePair       (MCHAR* var, bool value);
00237     bool    WritePair       (MCHAR* var, short value);
00238     bool    WritePair       (MCHAR* var, DWORD value);
00239     bool    WritePair       (MCHAR* var, size_t value);
00240     bool    WritePair       (MCHAR* var, MCHAR* value);
00241     bool    WritePair       (MCHAR* var, SYSTEMTIME* value);
00242     bool    WritePairHex    (MCHAR* var, DWORD value);
00243 
00244     bool    ReadPair        (MCHAR* section, MCHAR* var, float* value);
00245     bool    ReadPair        (MCHAR* section, MCHAR* var, int* value);
00246     bool    ReadPair        (MCHAR* section, MCHAR* var, bool* value);
00247     bool    ReadPair        (MCHAR* section, MCHAR* var, short* value);
00248     bool    ReadPair        (MCHAR* section, MCHAR* var, DWORD* value);
00249     bool    ReadPair        (MCHAR* section, MCHAR* var, size_t* value);
00250     bool    ReadPair        (MCHAR* section, MCHAR* var, MCHAR* value);
00251     bool    ReadPair        (MCHAR* section, MCHAR* var, SYSTEMTIME* value);
00252     bool    ReadPairHex     (MCHAR* section, MCHAR* var, DWORD* value);
00253 };
00254 
00255 //-----------------------------------------------------------------------------
00256 //-- Network Engine Config
00257 //
00258 class MAXNETEXPORT MaxNetEngine : public MaxNetFile {
00259 
00260     public:
00261 
00262         bool    WriteNetStatus      (NetworkStatus* status);
00263         bool    WriteCfg            (ConfigurationBlock *cfg);
00264         bool    WriteAlertData      (AlertData *alerts);
00265         bool    WriteJobText        (CJobText& jobText);
00266         bool    WriteSceneInfo      (SceneInfo* info);
00267         bool    WriteWeekSchedule   (WeekSchedule* ws);
00268 
00269         bool    ReadNetStatus       (NetworkStatus* status);
00270         bool    ReadCfg             (ConfigurationBlock *cfg);
00271         bool    ReadAlertData       (AlertData *alerts);
00272         int     ReadJobTextCount    ( );
00273         bool    ReadJobText         (CJobText& jobText);
00274         bool    ReadSceneInfo       (SceneInfo* info);
00275         bool    ReadWeekSchedule    (WeekSchedule* ws);
00276 
00277 };
00278 
00280 class MAXNETEXPORT MaxNetJob : public MaxNetEngine {
00281     public:
00282         bool    WriteJob        (Job* job, CJobText& jobText);
00283         bool    ReadJob         (Job* job, CJobText& jobText);
00284         bool    WriteServers    (int count, const JobServer* servers);
00285         bool    ReadServers     (int count, JobServer* servers);
00286         bool    WriteFrames     (int count, const JOBFRAMES* frames);
00287         bool    ReadFrames      (int count, JOBFRAMES* frames);
00288 };
00289 
00291 enum max_msg
00292 {
00293     MAX_MESSAGE_NOTHING=0,
00294     MAX_MESSAGE_READY,
00295     MAX_MESSAGE_BUSY,
00296     MAX_MESSAGE_FRAME_COMPLETE,
00297     MAX_MESSAGE_FRAME_ERROR,
00298     MAX_MESSAGE_GOING_DOWN
00299 };
00300 
00301 class MAXNETEXPORT MsgFromMax : public MaxNetFile {
00302     public:
00303         //-- Server uses this to peek/read messages
00304         max_msg Message         (MCHAR* file, MCHAR* err = 0);
00305         //-- MAX uses this to write out messages
00306         void    WriteMessage    (max_msg message, MCHAR* err = 0);
00307 };
00308 
00310 enum srv_msg
00311 {
00312     SRV_MESSAGE_NOTHING=0,
00313     SRV_MESSAGE_NEWFRAME,
00314     SRV_MESSAGE_CANCEL
00315 };
00316 
00317 class MAXNETEXPORT MsgFromSrv : public MaxNetFile {
00318     public:
00319         //-- MAX uses this to peek/read messages
00320         srv_msg Message         (MCHAR* file, int* arg);
00321         //-- Server uses this to write out messages
00322         void    WriteMessage    (srv_msg message, int arg = 0);
00323 };