Back to index

radiance  4R0+20100331
netproc.h
Go to the documentation of this file.
00001 /* RCSid $Id: netproc.h,v 2.8 2004/03/26 21:36:19 schorsch Exp $ */
00002 /*
00003  * Header file for network processing routines
00004  */
00005 #ifndef _RAD_NETPROC_H_
00006 #define _RAD_NETPROC_H_
00007 #ifdef __cplusplus
00008 extern "C" {
00009 #endif
00010 
00011 
00012 typedef struct {
00013        char   *com;         /* command (stored on client side) */
00014        int    pid;          /* process ID */
00015        int    efd;          /* standard error file descriptor */
00016        char   *errs;        /* error output */
00017        int    elen;         /* error output length */
00018        int    (*cf)();      /* completion callback function */
00019 } NETPROC;                  /* process slot (name PROC conflicts with Windows) */
00020 
00021 /* Callback function cf above passed process server, slot number and status */
00022 
00023 typedef struct pserver {
00024        struct pserver       *next; /* next process server in main list */
00025        char   hostname[64]; /* remote host ID */
00026        char   directory[128];      /* remote execution directory */
00027        char   username[32]; /* remote user ID */
00028        short  nprocs;              /* number of allocated process slots */
00029        NETPROC       proc[1];      /* process slot(s) (must be last in struct) */
00030 } PSERVER;           /* process server */
00031 
00032 extern PSERVER       *pslist;      /* global process server list */
00033 
00034 extern PSERVER       *addpserver(char *host, char *dir, char *usr, int np);
00035 extern void delpserver(PSERVER     *ps);
00036 extern PSERVER  *findjob(int *pnp);
00037 typedef int pscompfunc(PSERVER *ps, int pn, int status);
00038 extern int startjob(PSERVER *ps, char     *command, pscompfunc *compf);
00039 extern int wait4job(PSERVER *ps, int      pid);
00040 
00041 
00042 #define LHOSTNAME    "localhost"   /* accepted name for local host */
00043 
00044 #define pserverOK(ps)       (wait4job(ps, startjob(ps, "true", NULL)) == 0)
00045 
00046 
00047 #ifdef __cplusplus
00048 }
00049 #endif
00050 #endif /* _RAD_NETPROC_H_ */
00051