dnxProtocol.h

Go to the documentation of this file.
00001 /*--------------------------------------------------------------------------
00002 
00003    Copyright (c) 2006-2007, Intellectual Reserve, Inc. All rights reserved.
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License version 2 as
00007    published by the Free Software Foundation.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program; if not, write to the Free Software
00016    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018   --------------------------------------------------------------------------*/
00019 
00140 #ifndef _DNXPROTOCOL_H_
00141 #define _DNXPROTOCOL_H_
00142 
00143 #include <time.h>
00144 
00145 #include "dnxTransport.h"
00146 
00148 typedef enum DnxObjType
00149 {
00150    DNX_OBJ_SCHEDULER = 0,
00151    DNX_OBJ_DISPATCHER,
00152    DNX_OBJ_WORKER,
00153    DNX_OBJ_COLLECTOR,
00154    DNX_OBJ_REAPER,
00155    DNX_OBJ_JOB,
00156    DNX_OBJ_MANAGER,
00157    DNX_OBJ_MAX
00158 } DnxObjType;
00159 
00161 typedef enum DnxReqType
00162 {
00163    DNX_REQ_REGISTER = 0,
00164    DNX_REQ_DEREGISTER,
00165    DNX_REQ_ACK,
00166    DNX_REQ_NAK
00167 } DnxReqType;
00168 
00170 typedef enum DnxJobState
00171 {
00172    DNX_JOB_NULL = 0,
00173    DNX_JOB_PENDING,
00174    DNX_JOB_INPROGRESS,
00175    DNX_JOB_COMPLETE,
00176    DNX_JOB_EXPIRED
00177 } DnxJobState;
00178 
00180 typedef struct DnxXID
00181 {
00182    DnxObjType objType;              
00183    unsigned long objSerial;         
00184    unsigned long objSlot;           
00185 } DnxXID;
00186 
00188 typedef struct DnxNodeRequest
00189 {
00190    DnxXID xid;                      
00191    DnxReqType reqType;              
00192    unsigned int jobCap;             
00193    unsigned int ttl;                
00194    time_t expires;                  
00195    char address[DNX_MAX_ADDRESS];   
00196    char addrstr[DNX_MAX_ADDRSTR];   
00197 } DnxNodeRequest;
00198 
00200 typedef struct DnxJob
00201 {
00202    DnxXID xid;                      
00203    DnxJobState state;               
00204    int priority;                    
00205    int timeout;                     
00206    char * cmd;                      
00207    char address[DNX_MAX_ADDRESS];   
00208 } DnxJob;
00209 
00211 typedef struct DnxResult
00212 {
00213    DnxXID xid;                      
00214    DnxJobState state;               
00215    unsigned int delta;              
00216    int resCode;                     
00217    char * resData;                  
00218    char address[DNX_MAX_ADDRESS];   
00219 } DnxResult;
00220 
00222 typedef struct DnxMgmtRequest
00223 {
00224    DnxXID xid;                      
00225    char * action;                   
00226    char address[DNX_MAX_ADDRESS];   
00227 } DnxMgmtRequest;
00228 
00230 typedef struct DnxMgmtReply
00231 {
00232    DnxXID xid;                      
00233    DnxReqType status;               
00234    char * reply;                    
00235    char address[DNX_MAX_ADDRESS];   
00236 } DnxMgmtReply;
00237 
00238 int dnxSendMgmtRequest(DnxChannel * channel, DnxMgmtRequest * pRequest);
00239 
00240 int dnxSendMgmtReply(DnxChannel * channel, DnxMgmtReply * pReply, 
00241       char * address);
00242 
00243 int dnxWaitForMgmtReply(DnxChannel * channel, DnxMgmtReply * pReply, 
00244       int timeout);
00245 
00246 int dnxWaitForMgmtRequest(DnxChannel * channel, DnxMgmtRequest * pRequest,
00247       char * address, int timeout);
00248 
00249 int dnxMakeXID(DnxXID * pxid, DnxObjType xType, unsigned long xSerial, 
00250       unsigned long xSlot);
00251 
00252 int dnxEqualXIDs(DnxXID * pxa, DnxXID * pxb);
00253 
00254 #endif   /* _DNXPROTOCOL_H_ */
00255 

Generated on Tue Apr 13 15:48:07 2010 for DNX by  doxygen 1.5.6