1 /***********************************************************************/
2 /* Open Visualization Data Explorer                                    */
3 /* (C) Copyright IBM Corp. 1989,1999                                   */
4 /* ALL RIGHTS RESERVED                                                 */
5 /* This code licensed under the                                        */
6 /*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
7 /***********************************************************************/
8 /*
9  * $Header: /src/master/dx/src/exec/dpexec/distp.h,v 1.8 2005/12/30 19:38:43 davidt Exp $
10  */
11 
12 #if defined(__cplusplus) || defined(c_plusplus)
13 extern "C" {
14 #endif
15 
16 #ifndef _DISTP_H
17 #define _DISTP_H
18 
19 #include <dxconfig.h>
20 
21 #include "exobject.h"
22 #include "graph.h"
23 #include "d.h"
24 
25 #define DPMSG_VERSION    0x0d
26 #define DPMSG_SIGNATURE  0x100b0d13
27 #define DPMSG_SIGNATUREI 0x130d0b10
28 
29 typedef enum
30 {
31     DM_NULL,		/*  0 */
32     DM_PARSETREE,	/*  1 */
33     DM_EVICTCACHE,	/*  2 */
34     DM_EXECGRAPH,	/*  3 */
35     DM_INSERTGDICT,	/*  4 */
36     DM_INSERTGDICTNB,	/*  5 */
37     DM_INSERTMDICT,	/*  6 */
38     DM_SLISTEN,		/*  7 */
39     DM_SCONNECT,	/*  8 */
40     DM_SCONNECTPORT,	/*  9 */
41     DM_SACCEPT,		/* 10 */
42     DM_SLAVEID,         /* 11 */
43     DM_GRAPHDONE, 	/* 12 */
44     DM_GRAPHDELETE,     /* 13 */
45     DM_INSERTCACHE,	/* 14 */
46     DM_UIMSG,		/* 15 */
47     DM_UIPCK,		/* 16 */
48     DM_DPSEND,          /* 17 */
49     DM_KILLEXECGRAPH,   /* 18 */
50     DM_FLUSHGLOBAL,     /* 19 */
51     DM_PVREQUIRED,      /* 20 */
52     DM_CONNECTERROR,    /* 21 */
53     DM_EVICTCACHELIST,  /* 22 */
54     DM_FLUSHDICT,       /* 23 */
55     DM_FLUSHCACHE,      /* 24 */
56     DM_FLUSHMACRO,      /* 25 */
57     DM_DPSENDREQ,       /* 26 */
58     DM_DPSENDACK,       /* 27 */
59     DM_PERSISTDELETE,   /* 28 */
60     DM_LOADMDF,         /* 29 */
61     DM_VERSION,         /* 30 */
62     DM_BADFUNC,         /* 31 */
63     DM_VCRREDO,         /* 32 */
64     DM_LOOPDONE,        /* 33 */
65     DM_DELETEPEER,      /* 34 */
66     DM_EXIT,		/* 35 */
67     DM_GRAPHDELETECONF  /* 36 */
68 } DistMsg;
69 
70 typedef enum
71 {
72     DICT_NONE,		/*  0 */
73     DICT_GLOBAL,	/*  1 */
74     DICT_MACRO,		/*  2 */
75     DICT_GRAPH		/*  3 */
76 } DictType;
77 
78 #define TOMASTER 0
79 #define TOSLAVES 1
80 #define TOPEERS  2
81 #define TOPEER0  3
82 
83 typedef struct dphosts
84 {
85     char 	*name;
86     int         islocal;
87 } dphosts;
88 
89 typedef struct dpslave_id
90 {
91     int 	id;
92     int         namelen;
93     char 	*name;
94 
95 } dpslave_id;
96 
97 typedef struct dpversion
98 {
99     int 	signature;
100     int         version;
101 } dpversion;
102 
103 typedef struct dpgraphstat
104 {
105     char        *prochostname;
106     char	*procusername;
107     char        *options;
108     int		procfd;      /* for os2 this must always be a *socket* */
109     int         SlaveId;
110     int         SwapMsg;
111     int         numpgrps;
112     int         error;
113 } dpgraphstat;
114 
115 /* this is similar to gvar in graph.h. Any changes made to gvar may need
116  * to be added here too.
117  */
118 typedef struct gvarpkg
119 {
120     _gvtype             type;
121     uint32              reccrc;         /* cache tag            */
122     double              cost;
123     int                 skip;           /* error or route shutoff */
124     int                 disable_cache;  /* disable output cacheing */
125     int                 procId;
126     int			hasobj;
127 } gvarpkg;
128 
129 typedef struct DPSendPkg
130 {
131     int                 index;
132     int			excache;
133     gvarpkg		gvp;
134     Object		obj;
135 } DPSendPkg;
136 
137 typedef struct dps_elem
138 {
139     struct dps_elem     *next;          /* linked list of elements */
140     DPSendPkg           *pkg;           /* request package for send object */
141 } dps_elem;
142 
143 
144 typedef struct DPSendQ
145 {
146     dps_elem *head;
147     dps_elem *tail;
148 } DPSendQ;
149 
150 typedef struct SlavePeers
151 {
152     char 	*peername;
153     int         sfd;
154     int         SlaveId;
155     int         SwapMsg;
156     DPSendQ     sendq;
157     int         wait_on_ack;
158     int         pending_req;
159 } SlavePeers;
160 
161 typedef struct PGassign
162 {
163     char 	*pgname;
164     int	        hostindex;
165 } PGassign;
166 
167 typedef struct GDictSend
168 {
169     char		*varname;
170     exo_class   	exclass;
171     gvarpkg   	 	gvp;
172     Object		obj;
173 } GDictSend;
174 
175 /* for deleting a persistent outboard from a remote exec */
176 typedef struct DelRemote {
177     int 		del_namelen;
178     char 		*del_name;
179     int 		del_instance;
180 } DelRemote;
181 
182 #define MAX_UI_PACKET  4096
183 
184 /* This number has to be smaller than MAX_UI_PACKET, there needs to be extra */
185 /* space in the UI packet for adding a header to the message for the UI      */
186 /* This value should be the same as MAX_MSGLEN in  dxmods/interact.h         */
187 
188 #define MSG_BUFLEN 4000
189 
190 /* these are for DXMessage, DXSetError, DXWarning */
191 typedef struct UIMsgPackage
192 {
193     int 		ptype;
194     int 		graphId;
195     int			len;
196     char 		data[MSG_BUFLEN];
197 } UIMsgPackage;
198 
199 /* these are for direct calls to _dxf_ExSPack */
200 typedef struct UIPackage
201 {
202     int			len;
203     char		data[MAX_UI_PACKET];
204 } UIPackage;
205 
206 #define N_CACHETAGLIST_ITEMS 10
207 typedef struct CacheTagList
208 {
209     int numtags;
210     uint32 ct[N_CACHETAGLIST_ITEMS];
211 } CacheTagList;
212 
213 /* from distpacket.c */
214 int   _dxf_ExValidGroupAttach(char *groupname);
215 
216 /* from distconnect.c */
217 void  _dxf_ExUpdateDPTable();
218 Error _dxf_ExSlaveListen();
219 Error _dxf_ExSlaveConnect();
220 void  _dxf_ResetSlavesDone();
221 
222 /* from distp.c */
223 int   _dxf_SuspendPeers();
224 int   _dxf_ResumePeers();
225 void  _dxf_ExDistributeMsg(DistMsg type, Pointer data, int size, int to);
226 void  _dxf_ExDistMsgfd(DistMsg type, Pointer data, int tofd);
227 Error _dxf_ExWaitOnSlaves();
228 void  _dxf_ExWaitForPeers();
229 void  _dxf_ExSendDict(int fd, EXDictionary dict);
230 void  _dxf_ExRecvGDictPkg(int fd, int swap, int nobkgrnd);
231 void  _dxf_ExReqDPSend(ProgramVariable *pv, int varindex, SlavePeers *sp);
232 Error _dxf_ExReceivePeerPacket(SlavePeers *sp);
233 void  _dxf_ExSendPVRequired(int gid, int sgid, int funcId, int varId, int requiredFlag);
234 int   _dxf_ExReceiveBuffer(int fd, Pointer buffer, int n, Type t,int swap);
235 void  _dxf_ExSendParseTree(node *n);
236 Error _dxf_ExSendQInit(DPSendQ *sendq);
237 Error _dxf_ExCreateGDictPkg(GDictSend *pkg, char *name, EXObj ex_obj);
238 int   _dxf_ExWriteSock(int fd, Pointer buffer, int size);
239 int   _dxf_ExGetSocketId(char *procname);
240 void  _dxf_SlaveDone();
241 
242 /* from distqueue.c */
243 void _dxf_ExSendQEnqueue (DPSendQ *sendq, DPSendPkg *pkg);
244 DPSendPkg *_dxf_ExSendQDequeue (DPSendQ *sendq);
245 int _dxf_ExSendQEmpty(DPSendQ *sendq);
246 
247 #endif /* _DISTP_H */
248 #if defined(__cplusplus) || defined(c_plusplus)
249 }
250 #endif
251