tcsbase.h

来自「并行TIN生成算法, 基于DeWall算法理论实现」· C头文件 代码 · 共 122 行

H
122
字号
/* -*- C++ -*- */

//=============================================================================
/**
 *  @文件    TcsBase.h
 *
 *  TcsBase.h, 版本 0.10 2008/09/23
 *
 *  @作者 邓雪清 <xueqingdeng@sohu.com>
 */
//=============================================================================

#ifndef _TCS_BASE_H_
#define _TCS_BASE_H_

#if !defined (_WIN32)
	#define DLLEXPORT
#elif !defined (DLLEXPORT)
	#if defined (_LIB)
		#define DLLEXPORT
	#elif defined (_USRDLL)
		#define DLLEXPORT __declspec(dllexport)
	#else
		#define DLLEXPORT __declspec(dllimport)
	#endif
#endif

#ifdef __cplusplus
extern "C" {
#endif

#include <windows.h>
#include <sys/timeb.h>

// 基本数据类型
typedef    char				TCS_S08;
typedef   short				TCS_S16;
typedef    long				TCS_S32;
typedef __int64				TCS_S64;
typedef   float				TCS_F32;
typedef  double				TCS_F64;
typedef    void				TCS_V00;
typedef unsigned  char		TCS_U08;
typedef unsigned short		TCS_U16;
typedef unsigned  long		TCS_U32;
typedef __int64				TCS_U64;

typedef unsigned int		TCS_USO;
typedef unsigned int		TCS_UIN;
typedef int					TCS_SIN;

typedef struct _timeb		TCS_TMB;

// 服务请求结构
typedef struct tagSVC_CODE {
	TCS_S32	svc_code;	// 服务码
	TCS_S32	chk_code;	// 校验码
} SVC_CODE;

// 服务请求码定义
#define SVC_UND_CODE		0	// 未定义请求码

#define SVC_CHK_CODE		101	// 校验连接有效
#define SVC_CON_TYPE		102	// 服务连接类型

#define SVC_REQ_CONN		201	// 请求服务连接
#define SVC_REQ_NOSN		202 // 请求节点数目
#define SVC_REQ_NODE		203 // 请求节点信息
#define SVC_REQ_NUSN		204	// 请求用户数目
#define SVC_REQ_NUDE		205	// 请求用户信息
#define SVC_REQ_NASN		206	// 请求任务数目
#define SVC_REQ_NADE		207	// 请求任务信息

#define SVC_REG_NODE		301	// 登记节点连接
#define SVC_REG_NUDE		302	// 登记用户连接
#define SVC_REG_NADE		303	// 登记计算任务

// 服务连接类型
#define SVC_CON_NONE		0
#define SVC_CON_NODE		1	// 节点连接
#define SVC_CON_NUDE		2	// 用户连接

// 节点连接结构
typedef struct tagTCS_NODE {
	TCS_S32	 noid;		// 节点编号
	TCS_S32	 nbnd;		// 网络带宽
	TCS_S32	 cpus;		// 处理器数
	TCS_USO	 sock;
	TCS_U32	 addr;		// 节点地址
	TCS_U32	 port;		// 节点端口
	TCS_V00	*nock;		// 访问互斥
	TCS_S32	 asoc;		// 活动状态
	TCS_S32	 comc;		// 任务计数
	TCS_TMB	 entm;		// 登录时间
	TCS_TMB	 actm;		// 活动时间
} TCS_NODE;

// 用户连接结构
typedef struct tagTCS_NUDE {
	TCS_S32	 nuid;		// 用户编号
	TCS_USO	 sock;
	TCS_U32	 addr;		// 用户地址
	TCS_U32	 port;		// 用户端口
	TCS_V00	*nuck;		// 访问互斥
	TCS_S32	 asoc;		// 活动状态
	TCS_TMB	 entm;		// 登录时间
	TCS_TMB	 actm;		// 活动时间
	TCS_S32	 naid[8];	// 任务编号
} TCS_NUDE;

// 计算任务结构
typedef struct tagTCS_NADE {
	TCS_S32	 naid;		// 任务编号
	TCS_S08	 pswd[128];	// 任务密码
} TCS_NADE;

#ifdef __cplusplus
}
#endif

#endif	// _TCS_BASE_H_

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?