struct_def.h

来自「信使小精灵,是一个简易的聊天工具。主要是演示了网络编程的主要步骤。本程序使用封装」· C头文件 代码 · 共 100 行

H
100
字号
//struct_def.h
///////////////////////////////////////////////////////////////////////////////
#ifndef _STRUCT_DEF_H_
#define _STRUCT_DEF_H_

/*/////////////////////////////////////////////////////////////////////////*/
#if defined(__cplusplus)
extern "C" {
#endif
/*/////////////////////////////////////////////////////////////////////////*/
#include <windef.h>

#include "msgId_def.h"
/*/////////////////////////////////////////////////////////////////////////*/
#define MAX_NAME_LEN	(30)
/*/////////////////////////////////////////////////////////////////////////*/
typedef struct _tagUSER_INFO_STRU
{
	DWORD	dwUserID;
	BYTE	byStatus;
	char	szUserName[MAX_NAME_LEN+1];
	char	szPassword[MAX_NAME_LEN+2];

} TUSER_INFO_STRU;

typedef struct _tagGAMEPOSITION_STRU
{
	DWORD	dwRoomID;
	WORD	wTableID;
	BYTE	byPositionIndex;
	BYTE	byColor;
	char	szUserName[MAX_NAME_LEN];

} TGAMEPOSITION_STRU;

typedef struct _tagUSER_GAME_INFO_STRU
{
	DWORD	dwConnectionID;
	TUSER_INFO_STRU tUserInfo;

} TUSER_GAME_INFO_STRU;

typedef struct _tagUSERLIST_INFO_STRU
{
	DWORD	dwConnectionID;
	BYTE	byStatus;
	char	szUserName[MAX_NAME_LEN+1];

} TUSERLIST_INFO_STRU;


/*/////////////////////////////////////////////////////////////////////////*/
typedef struct _tagCOMMON_MSG_STRU
{
	DWORD	dwConnectionID;
	WORD	wMessageId;
	WORD	wSubMessageId;

} TCOMMON_MSG_STRU;

typedef struct _tagLOGIN_STRU
{
	TCOMMON_MSG_STRU	tCommonMsg;

	TUSER_INFO_STRU		tUserInfo;
	TGAMEPOSITION_STRU	tPosition;

} TLOGIN_STRU;

typedef struct _tagLOGIN_RESULT_STRU
{
	TCOMMON_MSG_STRU	tCommonMsg;

	DWORD	dwUserID;
	BYTE	byResult;
	BYTE	byStatus;
	WORD	wUserCount;

} LOGIN_RESULT_STRU;

typedef struct _tagCHAT_MESSAGE_STRU
{
	TCOMMON_MSG_STRU	tCommonMsg;

	DWORD dwFromUserID;
	DWORD dwToUserID;

	char szFromUserName[MAX_NAME_LEN];

	WORD wMessageLen;
	BYTE byFileContent[2];

} TCHAT_MESSAGE_STRU;

/*/////////////////////////////////////////////////////////////////////////*/
#if defined(__cplusplus)
}
#endif
/*/////////////////////////////////////////////////////////////////////////*/
#endif	/*_STRUCT_DEF_H_*/

⌨️ 快捷键说明

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