- Rearranged directory structure for forking out ANSTO
- Refactored site specific stuff into a site module - PSI specific stuff is now in the PSI directory. - The old version has been tagged with pre-ansto
This commit is contained in:
82
tecs/coc_client.h
Normal file
82
tecs/coc_client.h
Normal file
@@ -0,0 +1,82 @@
|
||||
#ifndef _COC_CLIENT_H_
|
||||
#define _COC_CLIENT_H_
|
||||
|
||||
#include "myc_buf.h"
|
||||
#include "coc_util.h"
|
||||
|
||||
typedef struct {
|
||||
void *adr;
|
||||
int type, size;
|
||||
char *cmd;
|
||||
} CocArg;
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
/* private */
|
||||
int port;
|
||||
StrBuf cmdbuf; /* for sending command */
|
||||
StrBuf resbuf; /* for response */
|
||||
char cmdbuf_[COC_CMD_LEN];
|
||||
char resbuf_[COC_RES_LEN];
|
||||
CocArg args[16];
|
||||
int nargs;
|
||||
char host[64];
|
||||
char magic[32];
|
||||
char startcmd[512];
|
||||
char synch;
|
||||
} CocConn;
|
||||
|
||||
int CocInitClient(CocConn *conn, char *host, int port, char *magic, int bufsize, char *startcmd);
|
||||
/* initialize a connection to the server process
|
||||
*/
|
||||
|
||||
int CocSendMagic(CocConn *conn, char *magic);
|
||||
/* send magic word to the server for changing access rights
|
||||
*/
|
||||
|
||||
void CocReset(CocConn *conn);
|
||||
int CocPutStr(CocConn *conn, const char *name, const char *value);
|
||||
int CocPutFloat(CocConn *conn, const char *name, float value);
|
||||
int CocPutInt(CocConn *conn, const char *name, int value);
|
||||
int CocPutArray(CocConn *conn, const char *name, float *value, int value_size);
|
||||
int CocGetStr(CocConn *conn, const char *name, char *value, int value_len);
|
||||
int CocGetFloat(CocConn *conn, const char *name, float *value);
|
||||
int CocGetInt(CocConn *conn, const char *name, int *value);
|
||||
int CocGetArray(CocConn *conn, const char *name, float *value, int value_size);
|
||||
int CocDoIt(CocConn *conn, char *error, int error_len);
|
||||
|
||||
int CocCheck(CocConn *conn);
|
||||
/*
|
||||
returns 1, if not yet open
|
||||
returns 0, if connection o.k.
|
||||
returns -1 (error message), if connection died
|
||||
*/
|
||||
|
||||
int CocWatchLog(CocConn *conn, char *list);
|
||||
/*
|
||||
Watch indefinitely for log messages
|
||||
*/
|
||||
|
||||
int CocSet(CocConn *conn, const char *name, const char *value);
|
||||
/*
|
||||
set one variable
|
||||
*/
|
||||
|
||||
int CocGetN(CocConn *conn, const char *name, char *value, int reslen);
|
||||
#define CocGet(C,N,V) CocGetN(C,N,V,sizeof(V))
|
||||
/*
|
||||
read one variable. Use the macro if value is a fixed length array
|
||||
*/
|
||||
|
||||
int CocSetGetN(CocConn *conn, const char *name, const char *cmd, char *value, int reslen);
|
||||
#define CocSetGet(C,N,S,V) CocSetGetN(C,N,S,V,sizeof(V))
|
||||
/*
|
||||
set and get a variable. Use the macro if value is a fixed length array
|
||||
*/
|
||||
|
||||
void CocCloseClient(CocConn *conn);
|
||||
/*
|
||||
close the connection to the server
|
||||
*/
|
||||
|
||||
#endif /* _COC_CLIENT_H_ */
|
||||
Reference in New Issue
Block a user