#include #include #include #include #include #include #include #include #include #include #include #include #include "errhdl.h" #include "buf.h" #include "util.h" #define CocPORT 9751 #define CocPORTS 3 int CocCreateSockAdr( struct sockaddr_in *sockaddrPtr, /* Socket address */ const char *host, /* Host. NULL implies INADDR_ANY */ int port); /* Port number */ int CocRecv(int fd, buf_type *buf); typedef struct { void *next; char name[32]; void *var; int *flag; int type; } CocVar; extern int CocRD; extern int CocWR; CocVar *serverVarList; void CocDefVar(const char *name, void *var, int type, int *flag); void CocVarList(CocVar **varlist); void CocFreeVarList(CocVar **varList); CocVar *CocFindVar(CocVar *varList, const char *name); int CocPutVar(CocVar *varList, buf_type *buf, const char *name); int CocGetVar(CocVar *varList, buf_type *buf, const char *name); void CocDefFlag(int *flag); #define CocDefInt(V,F) CocDefVar(#V,&V,-1,&F) #define CocDefFlt(V,F) CocDefVar(#V,&V,-2,&F) #define CocDefStr(V,F) CocDefVar(#V,V,sizeof(V),&F) #define CocDefStrPtr(V,S,F) CocDefVar(#V,V,S,&F)