maxnet_manager.h

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 // ---------------------------
00003 // File ....: maxnet_manager.h
00004 // ---------------------------
00005 // Author...: Gus J Grubba
00006 // Date ....: February 2000
00007 // O.S. ....: Windows 2000
00008 //
00009 // History .: Feb, 15 2000 - Created
00010 //
00011 // 3D Studio Max Network Rendering Classes
00012 // 
00013 //-----------------------------------------------------------------------------
00014 
00015 #pragma once
00016 #include "network\MaxNetExport.h"
00017 #include "network\MaxNet.h"
00018 #include "strbasic.h"
00019 #include "maxheap.h"
00020 #include "maxnet_job.h"
00021 // forward declarations
00022 struct ManagerInfo;
00023 struct ClientInfo;
00024 struct JobServer;
00025 struct JOBFRAMES;
00026 struct ServerList;
00027 struct NetworkStatus;
00028 
00029 //-------------------------------------------------------------------
00030 //-- Global Server State
00031 //
00032 
00033 #define JOB_STATE_COMPLETE  0
00034 #define JOB_STATE_WAITING   1
00035 #define JOB_STATE_BUSY      2
00036 #define JOB_STATE_ERROR     3
00037 #define JOB_STATE_SUSPENDED 4
00038 
00043 struct JobList: public MaxHeapOperators {
00045     Job     job;
00047     HJOB        hJob;
00060     WORD        state;
00061 };
00062 
00063 //-----------------------------------------------------------------------------
00064 //-- MaxNetCallBack
00065 //
00066 //  Note: Return as soon as possible from these calls. They block the API thread
00067 //  and nothing will happen until you return. If you have to do some processing,
00068 //  post a message to your own code and return immediately. Also note that these
00069 //  calls may come from a separate thread than your main process thread. 
00070 //
00071 
00079 #pragma warning(push)
00080 #pragma warning(disable:4100)
00081 class MAXNETEXPORT MaxNetCallBack: public MaxHeapOperators {
00082     public:
00084         virtual ~MaxNetCallBack() {;}
00085         //-- Return "true" to cancel, "false" to continue
00094         virtual bool Progress       (int total, int current){return false;}
00101         virtual void ProgressMsg    (const MCHAR *message){;}
00102         //-- Notifies the Manager Went Down
00106         virtual void ManagerDown    ( ){;}
00107         //-- Notifies something has changed (new job, new server, new frame, etc.)
00115         virtual void Update         ( ){;}
00116         //-- Notifies someone wants control of the queue; Send grant control msg to manager;
00129         virtual void QueryControl   ( MCHAR* station ){;}
00130         //-- Notifies someone has taken control of the queue (Another QueueManager for instance)
00133         virtual void QueueControl   ( ){;}
00134 };
00135 #pragma warning(pop)
00136 //-----------------------------------------------------------------------------
00137 //-- Manager Session Class
00138 //
00139 
00164 class MAXNETEXPORT MaxNetManager : public MaxNet {
00165 
00166     public:
00168         virtual ~MaxNetManager() {;}
00169 
00170         //-- Optional Call Back
00171         
00178         virtual void    SetCallBack             ( MaxNetCallBack* cb )=0;
00179 
00180         //-- Session
00197         virtual bool    FindManager             ( short port, char* manager, char* netmask = "255.255.255.0" )=0;
00219         virtual void    Connect                 ( short port, char* manager = NULL, bool enable_callback = false )=0;
00222         virtual void    Disconnect              ( )=0;
00228         virtual void    GetManagerInfo          ( ManagerInfo* info )=0;
00235         virtual bool    KillManager             ( )=0;
00247         virtual void    EnableUpdate            ( bool enable = true )=0;
00248         
00264         virtual bool    QueryManagerControl     ( bool wait )=0;
00268         virtual bool    TakeManagerControl      ( )=0;
00280         virtual void    GrantManagerControl     ( bool grant )=0;
00293         virtual bool    LockControl             ( bool lock  )=0;
00296         virtual int     GetClientCount          ( )=0;
00312         virtual int     ListClients             ( int start, int end, ClientInfo* clientList )=0;
00313 
00314         //-- Jobs
00315         
00317         virtual int     GetJobCount             ( )=0;
00331         virtual int     ListJobs                ( int start, int end, JobList* jobList )=0;
00339         virtual void    GetJob                  ( HJOB hJob, JobList* jobList )=0;
00347         virtual void    GetJob                  ( HJOB hJob, Job* job )=0;
00362         virtual void    GetJobText              ( HJOB hJob, CJobText& jobText, int count )=0;
00383         virtual void    SetJob                  ( HJOB hJob, Job* job, CJobText& jobText, bool reset )=0;
00389         virtual int     GetJobPriority          ( HJOB hJob )=0;
00398         virtual bool    SetJobPriority          ( HJOB hJob, int priority )=0;
00406         virtual void    SetJobOrder             ( HJOB* hJob, DWORD count )=0;
00412         virtual void    DeleteJob               ( HJOB hJob )=0;
00418         virtual void    SuspendJob              ( HJOB hJob )=0;
00424         virtual void    ActivateJob             ( HJOB hJob )=0;
00430         virtual int     GetJobServersCount      ( HJOB hJob )=0;
00447         virtual int     GetJobServers           ( int start, int end, HJOB hJob, JobServer* servers )=0;
00462         virtual void    GetJobServerStatus      ( HJOB hJob, HSERVER hServer, MCHAR* status_text )=0;
00472         virtual void    SuspendJobServer        ( HJOB hJob, HSERVER hServer )=0;
00480         virtual void    AssignJobServer         ( HJOB hJob, HSERVER hServer )=0;
00486         virtual int     GetJobFramesCount       ( HJOB hJob )=0;
00503         virtual int     GetJobFrames            ( int start, int end, HJOB hJob, JOBFRAMES* frames )=0;
00523         virtual int     GetJobLog               ( int start, int count, HJOB hJob, MCHAR** buffer )=0;
00524         
00543         virtual bool    CheckOutputVisibility   ( MCHAR* output, MCHAR* err )=0;
00570         virtual void    AssignJob               ( Job* job, MCHAR* archive, HSERVER* servers, CJobText& jobtext, DWORD blocksize = 0 )=0;
00571         
00572 
00573         //-- Servers (Global)
00574 
00577         virtual int     GetServerCount          ( )=0;
00591         virtual int     ListServers             ( int start, int end, ServerList* serverList )=0;
00600         virtual void    GetServer               ( HSERVER hServer, ServerList* serverList )=0;
00609         virtual bool    DeleteServer            ( HSERVER hServer )=0;
00622         virtual bool    ResetServerIndex        ( HSERVER hServer )=0;
00630         virtual void    GetWeekSchedule         ( HSERVER hServer, WeekSchedule* schedule )=0;
00638         virtual void    SetWeekSchedule         ( HSERVER hServer, WeekSchedule* schedule )=0;
00647         virtual void    GetServerNetStat        ( HSERVER hServer, NetworkStatus* net_stat )=0;
00648         
00650         virtual int     GetServerGroupCount     ( )=0;
00656         virtual int     GetServerGroupXCount    ( int group )=0;
00671         virtual int     GetServerGroup          ( int group, int count, HSERVER* grplist, MCHAR* name )=0;
00681         virtual void    NewServerGroup          ( int count, HSERVER* grplist, MCHAR* name )=0;
00686         virtual void    DeleteServerGroup       ( int group )=0;
00687         
00688 
00689 };
00690 
00691 //-----------------------------------------------------------------------------
00692 //-- Interface Class
00693 
00694 class MaxNetworkInterface: public MaxHeapOperators {
00695     public:
00696         virtual ~MaxNetworkInterface() {;}
00697         virtual bool    GetCurrentRenderer      ( MCHAR* name, DWORD* id1, DWORD* id2)=0;
00698 };
00699 
00700 //This class will have more methods with each version.
00701 //Version number indicates which methods are supported by a given implementation
00702 class MaxNetworkInterface2 : public MaxNetworkInterface {
00703     protected:
00704         int version;
00705     public:
00706         MaxNetworkInterface2() { version = 6010; }  //version 6.0.1.0
00707         int     GetMAXVersion()                     {return version;}
00708         void    SetMAXVersion(int version)          {this->version = version;}
00709 
00710         //-- version 6.0.1.0 - begin
00711         virtual BOOL    GetRendMultiThread()        {return FALSE;}
00712         virtual BOOL    GetRendSimplifyAreaLights() {return FALSE;}
00713         virtual BOOL    GetUseAdvLight()            {return FALSE;}
00714         virtual BOOL    GetCalcAdvLight()           {return FALSE;}
00715         //-- version 6.0.1.0 - end
00716 
00717         //-- version 7.0.0.0 - begin
00718         //-- ADD VERSION 7 METHODS HERE
00719         //-- version 7.0.0.0 - end
00720 };
00721 
00722 //Uses interface version 1
00723 MAXNETEXPORT void AssignJobEx(
00724     MaxNetManager* mgr, 
00725     MaxNetworkInterface* maxIface,
00726     Job* job,
00727     MCHAR* archive,
00728     HSERVER* servers,
00729     CJobText& jobtext,
00730     DWORD blocksize = 0 );
00731 
00732 //Uses interface version 2
00733 MAXNETEXPORT void AssignJobEx(
00734     MaxNetManager* mgr, 
00735     MaxNetworkInterface2* maxIface,
00736     Job* job,
00737     MCHAR* archive,
00738     HSERVER* servers,
00739     CJobText& jobtext,
00740     DWORD blocksize = 0 );
00741 
00742 
00743 //-- EOF: maxnet_manager.h ----------------------------------------------------