00001 /* 00002 * Name: filter.m4 00003 * 00004 * Description: 00005 * DOXYGEN Input file filter for DRAMA source files. 00006 * 00007 * This file must be complatible with both Solaris and GNU m4. All 00008 * unused macros are deleted and this comment must end up as a C/C++ 00009 * compatible comment which is not picked up by DOXYGEN. 00010 * 00011 * Synopsis: 00012 * DCF(func) => Produces a link to a DRAMA C source file func.html 00013 * in ../routines. 00014 * DDL(link,text) => Produce a link to ../link.html, specified link text. 00015 * 00016 * Language: m4 macro. 00017 * 00018 * Author: Tony Farrell, AAO. 00019 * 00020 * "@(#) $Id: ACMM:DramaHtml/filter.m4,v 3.24 03-Nov-2009 09:07:29+11 tjf $" 00021 * 00022 * History: 00023 * 10-Nov-2004 - TJF - Original Version. 00024 */ 00025 00026 00027 00028 #ifndef dcpptask_h 00029 #define dcpptask_h 00030 /* d c p p t a s k 00031 00032 * Module name: 00033 dcpptask.h 00034 00035 * Function: 00036 A C++ class that provides access to the DRAMA messaging facilities, 00037 00038 * Description: 00039 An object of this class provides an interface allowing you to send 00040 messages to other DRAMA tasks. 00041 00042 This file now uses DOXYGEN comments to generate the C++ web pages. 00043 m4 macros of the form @htmlonly <a href="../routines/function.html">function()</a>@endhtmlonly are used in the comments 00044 to refer to DRAMA C function documention (see DramaHtml/Makefile, 00045 DramaHtml/doxygen.config and DramaHtml/filter.m4 for detials) 00046 00047 * Language: 00048 C++ 00049 00050 * Support: Tony Farrell, AAO 00051 00052 * Copyright (c) Anglo-Australian Telescope Board, 1995. 00053 Not to be used for commercial purposes without AATB permission. 00054 00055 * @(#) $Id: ACMM:DramaDul/dcpptask.h,v 3.43 17-Sep-2009 14:07:37+10 tjf $ 00056 00057 * History: 00058 12-Oct-1995 - TJF - Original version. Extracted from dcpp.h 00059 09-Nov-1995 - TJF - Change Dits___MsgType to DitsMsgType 00060 25-Jun-1997 - TJF - Add the Died() function. 00061 26-Jun-1997 - TJF - Add constructore to buld SelfPath object. 00062 09-Dec-1997 - TJF - Declare class with DPUBLICCLASS to allow 00063 export from WIN32 DLL. 00064 02-Feb-1998 - TJF - Declare DiscardResponse static function using 00065 DSTATICMEM macro to support WIN32 DLL correctly. 00066 04-Jun-1998 - TJF - When getting task name for a path which is in 00067 SELFINIT state, we get the current task's name. 00068 23-Nov-1998 - TJF - Obey and Send have new transid argument, allowing 00069 us to Kick spawned actions. 00070 22-Dec-1998 - TJF - Add Bulk Data Send function. 00071 13-Jan-1998 - TJF - Make message operations Virtual. 00072 16-Nov-1999 - TJF - HandleBulkTrans now returns void. 00073 Add new versions of the Obey routines which 00074 have an SdsId * final argument, these wrap 00075 up the use of DitsSpawnKickArg. Also add 00076 versions with a "const SdsId *", which wrap up a 00077 a call to DitsSpawnKickArgUpdate. 00078 19-Nov-1999 - TJF - DitsSharedMemInfoType arguments replaced by 00079 DcppShared arguments. 00080 12-Sep-2003 - TJF - Add transaction id argument Forget versions of obey 00081 (need to create new versions). This allows us to 00082 Forget a spawned obey but then kick it later. 00083 17-Sep-2003 - TJF - Use Dits___Log for logging. 00084 22-Sep-2003 - TJF - Add IsDead(), Initial() and Busy() functions and 00085 provide initial support for NOTIFY state. 00086 16-Dec-2003 - TJF - Add Delete() function. 00087 06-Jan-2004 - TJF - DisconHandler destructor must be vitual. 00088 26-Jan-2004 - TJF - Add GetDitsPath() method. 00089 06-Jul-2004 - TJF - SetName() now looks for a node name and copies 00090 it to the right place rather then to the 00091 task name part. 00092 00093 00094 */ 00095 #include "DitsInteraction.h" 00096 #include "DitsFix.h" 00097 #include "DitsBulk.h" 00098 #include "dcpp.h" 00099 00130 DPUBLICCLASS DcppTask { 00131 00132 public: 00142 class DisconHandler { 00143 public: 00146 DisconHandler() {} 00161 virtual void Disconnected(DcppTask *) = 0; 00164 virtual ~DisconHandler() {} 00165 }; 00166 00167 private: 00168 00169 DisconHandler *disconnectHandler; 00170 00171 /* List element for list of objects of this type */ 00172 struct TaskListElem { 00173 TaskListElem *next; 00174 DcppTask *task; 00175 }; 00176 /* Pointer to global list of task objects */ 00177 static TaskListElem *ObjectList; 00178 00179 static bool disconnectEnabled; 00180 /* Pointer to this task's entry in list */ 00181 TaskListElem *MyListElem; 00182 00183 static bool Log; 00184 00185 00186 static DitsDisConnectRoutineType origDisconnect; 00187 static DVOIDP origDisconnectData; 00188 00189 00190 bool taskLog; 00191 00192 /* The path to the task, if state != INITIAL */ 00193 DitsPathType path; 00194 /* The state of this task object (NOTIFY not yet supported */ 00195 enum StateEnum { INITIAL, SELFINIT, PATHWAIT1, LOADING, 00196 PATHWAIT2, ACTIVE, DIED, NOTIFY } state; 00197 /* Buffer sizes */ 00198 DcppBuffers buffers; 00199 /* Flags to the PathGet operation */ 00200 int pathflags; 00201 /* Task priority */ 00202 int priority; 00203 /* Flags to the load command */ 00204 int loadflags; 00205 /* Set true to indicate the last GetPath loaded this task */ 00206 bool loaded; 00207 /* Do we log loads */ 00208 bool logLoad; 00209 /* The name of the task */ 00210 char taskname[DITS_C_NAMELEN]; 00211 /* The location of the task */ 00212 char tasklocation[DcppNodeNameLen]; 00213 /* The file to load the task from */ 00214 char taskfile[DcppNodeNameLen]; 00215 /* The requested process name */ 00216 char process[DITS_C_NAMELEN]; 00217 /* Argument to the load command */ 00218 char argument[DcppArgumentLen]; 00219 /* Decode string */ 00220 char decode[DcppNodeNameLen]; 00221 00222 unsigned stackSize; 00223 00224 /* 00225 * Various internal routines. 00226 */ 00227 void constructorHelper(); 00228 00229 void Disconnected(); 00230 00231 const char *StateString(StateEnum state) const; 00232 00233 void LogStartMsg(const char *name, DitsMsgType type, 00234 const SdsId & arg, bool forgotten, StatusType *status) const; 00235 static void LogArgument(void *client_data, const char *line, 00236 StatusType * status); 00237 DcppHandlerRet HandlePathWait1( 00238 DcppTransaction * const transaction, 00239 StatusType * const status); 00240 DcppHandlerRet HandleLoading( 00241 DcppTransaction * const transaction, 00242 StatusType * const status); 00243 DcppHandlerRet HandlePathWait2( 00244 DcppTransaction * const transaction, 00245 StatusType * const status); 00246 00247 DcppHandlerRet HandleRejected( 00248 DcppTransaction * const transaction, 00249 StatusType * const status); 00250 DcppHandlerRet HandleCompleted( 00251 DcppTransaction * const transaction, 00252 StatusType * const status); 00253 DcppHandlerRet HandleTrigger( 00254 DcppTransaction * const transaction, 00255 StatusType * const status); 00256 DcppHandlerRet HandleErs( 00257 DcppTransaction * const transaction, 00258 StatusType * const status); 00259 DcppHandlerRet HandleMsg( 00260 DcppTransaction * const transaction, 00261 StatusType * const status); 00262 void HandleBulkTrans( 00263 DcppTransaction * const transaction, 00264 StatusType * const status); 00265 DcppHandlerRet HandleBulkDone( 00266 DcppTransaction * const transaction, 00267 StatusType * const status); 00268 00269 DcppHandlerRet Send( 00270 const char * const name, 00271 const DitsMsgType Type, 00272 const int flags, 00273 const SdsId & arg, 00274 const DcppHandlerRoutine SuccessHandler, 00275 const DcppHandlerRoutine ErrorHandler, 00276 const DcppHandlerRoutine TriggerHandler, 00277 const DcppHandlerRoutine ErsHandler, 00278 const DcppHandlerRoutine MsgHandler, 00279 const DcppVoidPnt ClientData, 00280 DitsTransIdType * const transid, 00281 StatusType * const status); 00282 00283 DcppHandlerRet Send( 00284 const char * const name, 00285 const DitsMsgType Type, 00286 const int flags, 00287 const DcppShared & SharedMem, 00288 const bool sds, 00289 const int NotifyBytes, 00290 const DcppHandlerRoutine SuccessHandler, 00291 const DcppHandlerRoutine ErrorHandler, 00292 const DcppHandlerRoutine TriggerHandler, 00293 const DcppHandlerRoutine ErsHandler, 00294 const DcppHandlerRoutine MsgHandler, 00295 const DcppBulkTransRoutine BulkTransHandler, 00296 const DcppHandlerRoutine BulkDoneHandler, 00297 const DcppVoidPnt ClientData, 00298 DitsTransIdType * const transid, 00299 StatusType * const status); 00300 00301 void SendForget( 00302 const char * const name, 00303 const DitsMsgType Type, 00304 const int flags, 00305 const SdsId & arg, 00306 const DcppHandlerRoutine SuccessHandler, 00307 const DcppHandlerRoutine ErrorHandler, 00308 const DcppHandlerRoutine TriggerHandler, 00309 const DcppHandlerRoutine ErsHandler, 00310 const DcppHandlerRoutine MsgHandler, 00311 const DcppVoidPnt ClientData, 00312 DitsTransIdType * const transid, 00313 StatusType * const status); 00314 00315 00316 00317 00318 /* 00319 * Prevent Assignment and copying of this type by redefining the 00320 * assignment and copy operators to be private. 00321 * This ensures we can't get multiple threads controlling the one 00322 * task unless done intentionally by the caller. 00323 * 00324 * Also disallow the default constructor. 00325 */ 00326 DcppTask& operator=(const DcppTask&); 00327 DcppTask(const DcppTask&); 00328 DcppTask(); 00329 00330 00331 public: 00346 DcppTask(const char * const name, 00347 const char * const location = 0, 00348 const char * const file = 0); 00349 00358 DcppTask(bool self); 00359 00362 virtual ~DcppTask(); 00363 /* 00364 * Static logging enabling routine. Effects all objects of this type 00365 */ 00371 static void LoggingOn() { Log = true;} 00377 static void LoggingOff() { Log = false;} 00382 void TaskLoggingOn() { taskLog = true;} 00389 void TaskLoggingOff() { taskLog = false;} 00395 void Report(StatusType *status) const; 00396 /* 00397 * Inquiries 00398 */ 00403 bool GetPathLoaded() const { return (loaded); }; 00412 const char * TaskName() const { 00413 /* If self path and we have not initilaised yet, have to 00414 return the current task's name */ 00415 if (state == SELFINIT) 00416 return DitsGetTaskName(); 00417 return (taskname); 00418 }; 00428 const char * Location() const { return (tasklocation); }; 00433 const char * GetArgument() const { return (argument); }; 00434 00435 /* 00436 * Routines to set various load and get path options. 00437 */ 00451 virtual void SetName(const char * const TaskName) { 00452 unsigned i; 00453 /* 00454 * Copy the task name one character at a time - so that 00455 * we can look for a node name. 00456 */ 00457 for (i = 0; (TaskName[i] != 0 && TaskName[i] != '@') ; ++i) 00458 { 00459 /* 00460 * Bail out if too long, ensuring we null terminate the 00461 * name (but don't complain - through we probably should) 00462 */ 00463 if (i >= sizeof(taskname)-1) 00464 { 00465 taskname[sizeof(taskname)-1] = 0; 00466 return; 00467 } 00468 taskname[i] = TaskName[i]; 00469 } 00470 taskname[i] = 0; /* Null terminate the stored name */ 00471 /* 00472 * If we found the node name. 00473 */ 00474 if (TaskName[i] == '@') 00475 { 00476 unsigned j; 00477 ++i; /* Point to first character in node name */ 00478 /* 00479 * Now copy the node name in. 00480 */ 00481 for (j = 0; TaskName[i] != 0 ; ++i, ++j) 00482 { 00483 if (j >= sizeof(tasklocation)-1) 00484 { 00485 tasklocation[sizeof(tasklocation)-1] = 0; 00486 return; 00487 } 00488 tasklocation[j] = TaskName[i]; 00489 } 00490 /* 00491 * Null terminate. 00492 */ 00493 tasklocation[j] = 0; 00494 } 00495 }; 00503 virtual void SetLocation(const char * const Location) { 00504 strncpy(tasklocation,Location,sizeof(tasklocation)); 00505 tasklocation[sizeof(tasklocation)-1] = 0; 00506 }; 00511 virtual void SetFile(const char * const File) { 00512 strncpy(taskfile,File,sizeof(taskfile)); 00513 taskfile[sizeof(taskfile)-1] = 0; 00514 }; 00522 virtual void SetBuffers(const DcppBuffers & Buffers) { 00523 this->buffers = Buffers; 00524 }; 00530 virtual void SetFlowControl() { 00531 pathflags |= DITS_M_FLOW_CONTROL; 00532 } 00542 virtual void SetProcess(const char * const ProcessName) { 00543 if ((ProcessName) && (strlen(ProcessName) > 0)) 00544 { 00545 strncpy(process,ProcessName,sizeof(process)) ; 00546 process[sizeof(process)-1] = 0; /* Null terminate */ 00547 loadflags |= DITS_M_PROC_NAME; 00548 } 00549 else 00550 loadflags &= ~DITS_M_PROC_NAME; 00551 }; 00552 00561 virtual void SetStackSize(unsigned bytes) { 00562 stackSize = bytes; 00563 if (bytes > 0) 00564 loadflags |= DITS_M_SET_BYTES; 00565 else 00566 loadflags &= ~DITS_M_SET_BYTES; 00567 }; 00568 00569 00580 virtual void SetArgument(const char * const LoadArg, 00581 bool const Append=false) 00582 { 00583 if (Append) 00584 { 00585 int len = sizeof(argument) - strlen(argument) - 1; 00586 strncat(argument," ",len); 00587 --len; 00588 strncat(argument,LoadArg,len); 00589 } 00590 else 00591 strncpy(argument,LoadArg,sizeof(argument)) ; 00592 00593 argument[sizeof(argument)-1] = 0; 00594 }; 00595 00607 virtual void SetPriority(const int Priority, 00608 const bool Absolute = false) { 00609 priority = Priority; 00610 if (Absolute) 00611 { 00612 loadflags &= ~DITS_M_REL_PRIO; 00613 loadflags |= DITS_M_ABS_PRIO; 00614 } 00615 else if (Priority == 0) 00616 { 00617 loadflags &= ~(DITS_M_REL_PRIO|DITS_M_ABS_PRIO); 00618 } 00619 else 00620 { 00621 loadflags &= ~DITS_M_ABS_PRIO; 00622 loadflags |= DITS_M_REL_PRIO; 00623 } 00624 }; 00625 /* 00626 IMP_ARG_SPLIT not yet supported 00627 00628 virtual void SetDecode(const char * const Decode) { 00629 if (strlen(Decode) > 0) 00630 { 00631 strncpy(decode,Decode,sizeof(decode)) ; 00632 loadflags |= DITS_M_ARG_SPLIT; 00633 } 00634 else 00635 loadflags &= ~DITS_M_ARG_SPLIT; 00636 }; 00637 */ 00651 virtual void SetNames(const bool Flag = true) { 00652 if (Flag) 00653 loadflags |= DITS_M_NAMES; 00654 else 00655 loadflags &= ~DITS_M_NAMES; 00656 }; 00669 virtual void SetSymbols(const bool Flag = true) { 00670 if (Flag) 00671 loadflags |= DITS_M_SYMBOL; 00672 else 00673 loadflags &= ~DITS_M_SYMBOL; 00674 }; 00691 virtual void SetProg(const bool Flag = true) { 00692 if (Flag) 00693 loadflags |= DITS_M_PROG; 00694 else 00695 loadflags &= ~DITS_M_PROG; 00696 }; 00704 virtual void LogLoad(const bool Flag = true) { 00705 logLoad = Flag; 00706 }; 00707 00713 virtual void ClearState() { 00714 state = INITIAL; 00715 }; 00722 virtual bool Active() { 00723 return ((state == ACTIVE)||(state == SELFINIT)); 00724 } 00729 virtual bool IsDead() { 00730 return (state == DIED); 00731 } 00736 virtual bool Initial() { 00737 return ((state == INITIAL)||(state == DIED)); 00738 } 00746 virtual bool Busy() { 00747 return ((state == PATHWAIT1) || 00748 (state == PATHWAIT2) || 00749 (state == LOADING) || 00750 (state == NOTIFY)); 00751 } 00752 00785 virtual DcppHandlerRet GetPath( 00786 StatusType * const status, 00787 const DcppHandlerRoutine SuccessHandler=0, 00788 const DcppHandlerRoutine ErrorHandler=0, 00789 const DcppVoidPnt ClientData=0); 00790 00793 virtual void Died() { 00794 path = 0; 00795 state = DIED; 00796 } 00805 virtual void LosePath(StatusType * const status) { 00806 if ((state != INITIAL)&&(state != SELFINIT)&& 00807 ( path != 0 )&&(path != DitsGetSelfPath())) 00808 DitsLosePath(path,status); 00809 Died(); 00810 } 00819 virtual void Delete(int force, StatusType * status) { 00820 int known; 00821 /* Delete the task, note, we cast away the const as the 00822 underlying imp routine is not prototyped correctly */ 00823 DitsDeleteTask((char *)TaskName(), force, &known, status); 00824 Died(); 00825 } 00826 /* 00827 * Various messages 00828 * 00829 * Standard Obey function - optionally return transaction id. 00830 */ 00897 virtual DcppHandlerRet Obey(const char * const name, 00898 StatusType * const status, 00899 const SdsId & arg=SdsNull, 00900 const DcppHandlerRoutine SuccessHandler=0, 00901 const DcppHandlerRoutine ErrorHandler=0, 00902 const DcppHandlerRoutine TriggerHandler=0, 00903 const DcppVoidPnt ClientData=0, 00904 const DcppHandlerRoutine ErsHandler=0, 00905 const DcppHandlerRoutine MsgHandler=0, 00906 DitsTransIdType * const transid=0) { 00907 return(Send(name,DITS_MSG_OBEY,0,arg,SuccessHandler, 00908 ErrorHandler,TriggerHandler,ErsHandler,MsgHandler, 00909 ClientData,transid,status)); 00910 }; 00911 /* 00912 * Version of obey where transaction id Sds id is returned instead of 00913 * DitsTransIdType 00914 */ 00915 00986 virtual DcppHandlerRet Obey(const char * const name, 00987 StatusType * const status, 00988 const SdsId & arg, 00989 const DcppHandlerRoutine SuccessHandler, 00990 const DcppHandlerRoutine ErrorHandler, 00991 const DcppHandlerRoutine TriggerHandler, 00992 const DcppVoidPnt ClientData, 00993 const DcppHandlerRoutine ErsHandler, 00994 const DcppHandlerRoutine MsgHandler, 00995 SdsId * const tidArg) { 00996 DitsTransIdType tid = 0; 00997 DcppHandlerRet result = Send( 00998 name,DITS_MSG_OBEY,0,arg, 00999 SuccessHandler, 01000 ErrorHandler,TriggerHandler,ErsHandler,MsgHandler, 01001 ClientData,&tid,status); 01002 DcppSpawnKickArg(tid, tidArg, status); 01003 return result; 01004 }; 01005 /* Version where transaction id Sds id is returned instead of 01006 DitsTransIdType. Since the SdsID argument is const, we can 01007 distinish one where we want to update an existing item rather 01008 then create a new item 01009 */ 01010 01082 virtual DcppHandlerRet Obey(const char * const name, 01083 StatusType * const status, 01084 const SdsId & arg, 01085 const DcppHandlerRoutine SuccessHandler, 01086 const DcppHandlerRoutine ErrorHandler, 01087 const DcppHandlerRoutine TriggerHandler, 01088 const DcppVoidPnt ClientData, 01089 const DcppHandlerRoutine ErsHandler, 01090 const DcppHandlerRoutine MsgHandler, 01091 const SdsId * const tidArg) { 01092 DitsTransIdType tid = 0; 01093 DcppHandlerRet result = Send( 01094 name,DITS_MSG_OBEY,0,arg, 01095 SuccessHandler, 01096 ErrorHandler,TriggerHandler,ErsHandler,MsgHandler, 01097 ClientData,&tid,status); 01098 DcppSpawnKickArgUpdate(tid, tidArg, status); 01099 return result; 01100 }; 01158 virtual DcppHandlerRet Kick(const char * const name, 01159 StatusType * const status, 01160 const SdsId & arg=SdsNull, 01161 const DcppHandlerRoutine SuccessHandler=0, 01162 const DcppHandlerRoutine ErrorHandler=0, 01163 const DcppVoidPnt ClientData=0, 01164 const DcppHandlerRoutine ErsHandler=0, 01165 const DcppHandlerRoutine MsgHandler=0) { 01166 return(Send(name,DITS_MSG_KICK,0,arg,SuccessHandler, 01167 ErrorHandler,0,ErsHandler,MsgHandler, 01168 ClientData,0,status)); 01169 }; 01170 /* Bulk data versions of the above */ 01253 virtual DcppHandlerRet Obey(const char * const name, 01254 const DcppShared & SharedMem, 01255 const bool sds, 01256 const int NotifyBytes, 01257 StatusType * const status, 01258 const DcppHandlerRoutine SuccessHandler=0, 01259 const DcppHandlerRoutine ErrorHandler=0, 01260 const DcppBulkTransRoutine BulkTransHandler=0, 01261 const DcppHandlerRoutine BulkDoneHandler=0, 01262 const DcppHandlerRoutine TriggerHandler=0, 01263 const DcppVoidPnt ClientData=0, 01264 const DcppHandlerRoutine ErsHandler=0, 01265 const DcppHandlerRoutine MsgHandler=0, 01266 DitsTransIdType * const transid=0) { 01267 return(Send(name,DITS_MSG_OBEY,0, 01268 SharedMem,sds,NotifyBytes, 01269 SuccessHandler, ErrorHandler,TriggerHandler, 01270 ErsHandler,MsgHandler, 01271 BulkTransHandler, BulkDoneHandler, 01272 ClientData,transid,status)); 01273 }; 01360 virtual DcppHandlerRet Obey(const char * const name, 01361 const DcppShared & SharedMem, 01362 const bool sds, 01363 const int NotifyBytes, 01364 StatusType * const status, 01365 const DcppHandlerRoutine SuccessHandler, 01366 const DcppHandlerRoutine ErrorHandler, 01367 const DcppBulkTransRoutine BulkTransHandler, 01368 const DcppHandlerRoutine BulkDoneHandler, 01369 const DcppHandlerRoutine TriggerHandler, 01370 const DcppVoidPnt ClientData, 01371 const DcppHandlerRoutine ErsHandler, 01372 const DcppHandlerRoutine MsgHandler, 01373 SdsId * const tidArg) { 01374 01375 DitsTransIdType tid = 0; 01376 DcppHandlerRet result = Send( 01377 name,DITS_MSG_OBEY,0, 01378 SharedMem,sds,NotifyBytes, 01379 SuccessHandler, ErrorHandler,TriggerHandler, 01380 ErsHandler,MsgHandler, 01381 BulkTransHandler, BulkDoneHandler, 01382 ClientData,&tid,status); 01383 DcppSpawnKickArg(tid, tidArg, status); 01384 return result; 01385 01386 }; 01474 virtual DcppHandlerRet Obey(const char * const name, 01475 const DcppShared & SharedMem, 01476 const bool sds, 01477 const int NotifyBytes, 01478 StatusType * const status, 01479 const DcppHandlerRoutine SuccessHandler, 01480 const DcppHandlerRoutine ErrorHandler, 01481 const DcppBulkTransRoutine BulkTransHandler, 01482 const DcppHandlerRoutine BulkDoneHandler, 01483 const DcppHandlerRoutine TriggerHandler, 01484 const DcppVoidPnt ClientData, 01485 const DcppHandlerRoutine ErsHandler, 01486 const DcppHandlerRoutine MsgHandler, 01487 const SdsId * const tidArg) { 01488 01489 DitsTransIdType tid = 0; 01490 DcppHandlerRet result = Send( 01491 name,DITS_MSG_OBEY,0, 01492 SharedMem,sds,NotifyBytes, 01493 SuccessHandler, ErrorHandler,TriggerHandler, 01494 ErsHandler,MsgHandler, 01495 BulkTransHandler, BulkDoneHandler, 01496 ClientData,&tid,status); 01497 DcppSpawnKickArgUpdate(tid, tidArg, status); 01498 return result; 01499 01500 }; 01574 virtual DcppHandlerRet Kick(const char * const name, 01575 const DcppShared & SharedMem, 01576 const bool sds, 01577 const int NotifyBytes, 01578 StatusType * const status, 01579 const DcppHandlerRoutine SuccessHandler=0, 01580 const DcppHandlerRoutine ErrorHandler=0, 01581 const DcppBulkTransRoutine BulkTransHandler=0, 01582 const DcppHandlerRoutine BulkDoneHandler=0, 01583 const DcppVoidPnt ClientData=0, 01584 const DcppHandlerRoutine ErsHandler=0, 01585 const DcppHandlerRoutine MsgHandler=0) { 01586 return(Send(name,DITS_MSG_KICK,0, 01587 SharedMem,sds,NotifyBytes, 01588 SuccessHandler, ErrorHandler,0, 01589 ErsHandler,MsgHandler, 01590 BulkTransHandler, BulkDoneHandler, 01591 ClientData,0,status)); 01592 }; 01643 virtual DcppHandlerRet Get(const char * const name, 01644 StatusType * const status, 01645 const DcppHandlerRoutine SuccessHandler=0, 01646 const DcppHandlerRoutine ErrorHandler=0, 01647 const DcppVoidPnt ClientData=0, 01648 const DcppHandlerRoutine ErsHandler=0) { 01649 return(Send(name,DITS_MSG_GETPARAM,0,SdsNull,SuccessHandler, 01650 ErrorHandler,0,ErsHandler,0, 01651 ClientData,0,status)); 01652 }; 01695 virtual DcppHandlerRet MGet( 01696 const DcppHandlerRoutine SuccessHandler, 01697 const DcppHandlerRoutine ErrorHandler, 01698 const DcppVoidPnt ClientData, unsigned count, 01699 StatusType * status, ...); 01700 01751 virtual DcppHandlerRet MGet( 01752 const DcppHandlerRoutine SuccessHandler, 01753 const DcppHandlerRoutine ErrorHandler, 01754 const DcppHandlerRoutine ErsHandler, 01755 const DcppVoidPnt ClientData, unsigned count, 01756 StatusType * status, ...); 01757 01806 virtual DcppHandlerRet Set(const char * const name, 01807 StatusType * const status, 01808 const SdsId & arg = SdsNull, 01809 const DcppHandlerRoutine SuccessHandler=0, 01810 const DcppHandlerRoutine ErrorHandler=0, 01811 const DcppVoidPnt ClientData=0, 01812 const DcppHandlerRoutine ErsHandler=0) { 01813 return(Send(name,DITS_MSG_SETPARAM,0,arg,SuccessHandler, 01814 ErrorHandler,0,ErsHandler,0, 01815 ClientData,0,status)); 01816 }; 01871 virtual DcppHandlerRet Control(const char * const name, 01872 StatusType * const status, 01873 const SdsId & arg=SdsNull, 01874 const DcppHandlerRoutine SuccessHandler=0, 01875 const DcppHandlerRoutine ErrorHandler=0, 01876 const DcppHandlerRoutine TriggerHandler=0, 01877 const DcppVoidPnt ClientData=0, 01878 const DcppHandlerRoutine ErsHandler=0) { 01879 return(Send(name,DITS_MSG_CONTROL,0,arg,SuccessHandler, 01880 ErrorHandler,TriggerHandler,ErsHandler,0, 01881 ClientData,0,status)); 01882 }; 01945 virtual DcppHandlerRet Monitor(const char *name, 01946 StatusType * const status, 01947 const SdsId & arg=SdsNull, 01948 const DcppHandlerRoutine SuccessHandler=0, 01949 const DcppHandlerRoutine ErrorHandler=0, 01950 const DcppHandlerRoutine TriggerHandler=0, 01951 const DcppVoidPnt ClientData=0, 01952 const bool SendCurrent=false, 01953 const DcppHandlerRoutine ErsHandler=0) { 01954 int flags = SendCurrent ? DITS_M_SENDCUR : 0; 01955 return(Send(name,DITS_MSG_MONITOR,flags,arg,SuccessHandler, 01956 ErrorHandler,TriggerHandler,ErsHandler,0, 01957 ClientData,0,status)); 01958 }; 01959 /* 01960 * Forget Versions - Obey and Monitor only 01961 */ 02028 virtual void ObeyForget(const char * const name, 02029 StatusType * const status, 02030 const SdsId & arg=SdsNull, 02031 const DcppHandlerRoutine SuccessHandler=0, 02032 const DcppHandlerRoutine ErrorHandler=0, 02033 const DcppHandlerRoutine TriggerHandler=0, 02034 const DcppVoidPnt ClientData=0, 02035 const DcppHandlerRoutine ErsHandler=0, 02036 const DcppHandlerRoutine MsgHandler=0, 02037 DitsTransIdType * const transid=0) { 02038 SendForget(name,DITS_MSG_OBEY,0,arg,SuccessHandler, 02039 ErrorHandler,TriggerHandler,ErsHandler,MsgHandler, 02040 ClientData,transid,status); 02041 }; 02111 virtual void ObeyForget(const char * const name, 02112 StatusType * const status, 02113 const SdsId & arg, 02114 const DcppHandlerRoutine SuccessHandler, 02115 const DcppHandlerRoutine ErrorHandler, 02116 const DcppHandlerRoutine TriggerHandler, 02117 const DcppVoidPnt ClientData, 02118 const DcppHandlerRoutine ErsHandler, 02119 const DcppHandlerRoutine MsgHandler, 02120 SdsId * const tidArg) { 02121 DitsTransIdType tid = 0; 02122 SendForget(name,DITS_MSG_OBEY,0,arg,SuccessHandler, 02123 ErrorHandler,TriggerHandler,ErsHandler,MsgHandler, 02124 ClientData,&tid,status); 02125 DcppSpawnKickArg(tid, tidArg, status); 02126 }; 02197 virtual void ObeyForget(const char * const name, 02198 StatusType * const status, 02199 const SdsId & arg, 02200 const DcppHandlerRoutine SuccessHandler, 02201 const DcppHandlerRoutine ErrorHandler, 02202 const DcppHandlerRoutine TriggerHandler, 02203 const DcppVoidPnt ClientData, 02204 const DcppHandlerRoutine ErsHandler, 02205 const DcppHandlerRoutine MsgHandler, 02206 const SdsId * const tidArg) { 02207 DitsTransIdType tid = 0; 02208 SendForget(name,DITS_MSG_OBEY,0,arg,SuccessHandler, 02209 ErrorHandler,TriggerHandler,ErsHandler,MsgHandler, 02210 ClientData,&tid,status); 02211 DcppSpawnKickArgUpdate(tid, tidArg, status); 02212 }; 02269 virtual void KickForget(const char * const name, 02270 StatusType * const status, 02271 const SdsId & arg=SdsNull, 02272 const DcppHandlerRoutine SuccessHandler=0, 02273 const DcppHandlerRoutine ErrorHandler=0, 02274 const DcppVoidPnt ClientData=0, 02275 const DcppHandlerRoutine ErsHandler=0, 02276 const DcppHandlerRoutine MsgHandler=0) { 02277 SendForget(name,DITS_MSG_KICK,0,arg,SuccessHandler, 02278 ErrorHandler,0,ErsHandler,MsgHandler, 02279 ClientData,0,status); 02280 }; 02339 virtual void MonitorForget(const char *name, 02340 StatusType * const status, 02341 const SdsId & arg=SdsNull, 02342 const DcppHandlerRoutine SuccessHandler=0, 02343 const DcppHandlerRoutine ErrorHandler=0, 02344 const DcppHandlerRoutine TriggerHandler=0, 02345 const DcppVoidPnt ClientData=0, 02346 const bool SendCurrent=false, 02347 const DcppHandlerRoutine ErsHandler=0) { 02348 int flags = SendCurrent ? DITS_M_SENDCUR : 0; 02349 SendForget(name,DITS_MSG_MONITOR,flags,arg,SuccessHandler, 02350 ErrorHandler,TriggerHandler,ErsHandler,0, 02351 ClientData,0,status); 02352 }; 02353 02365 virtual DisconHandler *PutDisconnectHandler(DisconHandler *p) { 02366 DisconHandler *old = disconnectHandler; 02367 disconnectHandler = p; 02368 return old; 02369 } 02370 02377 DcppHandlerRet HandleMessage(DcppTransaction * transaction, 02378 StatusType * status); 02379 02391 DSTATICMEM DcppHandlerRet DiscardResponse(DcppVoidPnt ClientData, 02392 StatusType * status) ; 02393 02403 virtual void GetDitsPath(DitsPathType *path, StatusType *status); 02404 02409 static DVOID HandleDisconnected(const char *task, 02410 DitsPathType path, 02411 StatusType *status); 02412 }; 02413 02414 02415 #endif 02416
Click here for the DRAMA home page and here for the AAO home page.
For more information, contact tjf@aaoepp.aao.gov.au Generated on Tue Nov 3 09:09:56 2009 for AAO DRAMA C++ Interfaces by
1.2.18