new tecs version M.Z.08.2001

This commit is contained in:
cvs
2001-08-16 10:17:09 +00:00
parent b56745eb46
commit 0cda158849
35 changed files with 5289 additions and 2065 deletions

View File

@@ -1,17 +1,28 @@
#ifndef _COC_CLIENT_H_
#define _COC_CLIENT_H_
#include "myc_buf.h"
#include "coc_util.h"
typedef struct {
void *adr;
int type;
char *cmd;
} CocArg;
typedef struct {
/* private */
int fd, port;
CocVar *varList;
Str_Buf *cmdbuf; /* for sending command */
Str_Buf *resbuf; /* for response */
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);
@@ -22,33 +33,47 @@ int CocSendMagic(CocConn *conn, char *magic);
/* send magic word to the server for changing access rights
*/
int CocCmd(CocConn *conn, const char *rwList);
/* rwList consists of a list of variables to be read or written.
Variables must be separated with commas, variables to be written
must be enclosed in square brackets.
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 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 CocDoIt(CocConn *conn, char *error, int error_len);
Example (read p1 and p4, write p2 and p3):
CocCmd(&conn, "p1,[p2,p3],p4")
see COC_UTIL.H for the definiton of variables
*/
int CocCheck(CocConn *conn);
/*
returns 1, if not yet open
returns 0, if connection o.k.
retruns -1 (error message), if connection died
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_ */