1 |
schorsch |
2.8 |
/* RCSid $Id: netproc.h,v 2.7 2003/10/27 10:32:06 schorsch Exp $ */ |
2 |
greg |
2.1 |
/* |
3 |
|
|
* Header file for network processing routines |
4 |
greg |
2.3 |
*/ |
5 |
schorsch |
2.6 |
#ifndef _RAD_NETPROC_H_ |
6 |
|
|
#define _RAD_NETPROC_H_ |
7 |
|
|
#ifdef __cplusplus |
8 |
|
|
extern "C" { |
9 |
|
|
#endif |
10 |
|
|
|
11 |
greg |
2.1 |
|
12 |
|
|
typedef struct { |
13 |
|
|
char *com; /* command (stored on client side) */ |
14 |
|
|
int pid; /* process ID */ |
15 |
|
|
int efd; /* standard error file descriptor */ |
16 |
|
|
char *errs; /* error output */ |
17 |
|
|
int elen; /* error output length */ |
18 |
|
|
int (*cf)(); /* completion callback function */ |
19 |
schorsch |
2.7 |
} NETPROC; /* process slot (name PROC conflicts with Windows) */ |
20 |
greg |
2.1 |
|
21 |
|
|
/* Callback function cf above passed process server, slot number and status */ |
22 |
|
|
|
23 |
|
|
typedef struct pserver { |
24 |
|
|
struct pserver *next; /* next process server in main list */ |
25 |
|
|
char hostname[64]; /* remote host ID */ |
26 |
|
|
char directory[128]; /* remote execution directory */ |
27 |
|
|
char username[32]; /* remote user ID */ |
28 |
|
|
short nprocs; /* number of allocated process slots */ |
29 |
schorsch |
2.7 |
NETPROC proc[1]; /* process slot(s) (must be last in struct) */ |
30 |
greg |
2.1 |
} PSERVER; /* process server */ |
31 |
|
|
|
32 |
|
|
extern PSERVER *pslist; /* global process server list */ |
33 |
|
|
|
34 |
schorsch |
2.6 |
extern PSERVER *addpserver(char *host, char *dir, char *usr, int np); |
35 |
schorsch |
2.8 |
extern void delpserver(PSERVER *ps); |
36 |
schorsch |
2.6 |
extern PSERVER *findjob(int *pnp); |
37 |
schorsch |
2.8 |
typedef int pscompfunc(PSERVER *ps, int pn, int status); |
38 |
|
|
extern int startjob(PSERVER *ps, char *command, pscompfunc *compf); |
39 |
|
|
extern int wait4job(PSERVER *ps, int pid); |
40 |
greg |
2.1 |
|
41 |
greg |
2.2 |
|
42 |
greg |
2.1 |
#define LHOSTNAME "localhost" /* accepted name for local host */ |
43 |
|
|
|
44 |
|
|
#define pserverOK(ps) (wait4job(ps, startjob(ps, "true", NULL)) == 0) |
45 |
schorsch |
2.6 |
|
46 |
|
|
|
47 |
|
|
#ifdef __cplusplus |
48 |
|
|
} |
49 |
|
|
#endif |
50 |
|
|
#endif /* _RAD_NETPROC_H_ */ |
51 |
|
|
|