44 lines
1.3 KiB
C
44 lines
1.3 KiB
C
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <sys/time.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
#include <netdb.h>
|
|
#include <signal.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <strings.h>
|
|
#include <unistd.h>
|
|
#include <stdarg.h>
|
|
#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)
|