testQQCommon.pas
上传用户:xgd119
上传日期:2007-05-02
资源大小:514k
文件大小:3k
- unit testQQCommon;
- interface
- //-------------------常量定义---------------------
- Const SERVER_PORT=9001;
- CLIENT_PORT=5001;
- IsFalse='0';
- IsTrue='1';
- LogonSign=1; //注册信号
- HandSign=2; //握手数据,用于保持会话连接,如网关的NAT端口
- FriendDataSign=3; //好友资料
- LogoutSign=4; //注销信号
- ChatMsgSign=5; //聊天信息
- ChatMsgRecvedSign=6; //收到聊天信息
- //-------------------数据头定义---------------------
- type TTQQUDPHead=record
- MsgType:String[2]; {数据类型}
- DataSize:LONGWORD;
- end;
- //-------------------数据体定义---------------------
- {4.0 登录上线数据格式}
- type TLogonData=packed record
- Account:array [0..20] of Char; {账号}
- MyPublicIP:array [0..20] of Char; {IP}
- MyPublicPORT:array[0..5] of Char; {PORT}
- lResult:array[0..1] of Char; {验证结果: 1,成功;0,失败}
- end;
- {4.1 登录下线数据格式}
- type TLogoutData=packed record
- Account:array [0..20] of Char; {账号}
- lResult:array[0..1] of Char; {验证结果: 1,成功;0,失败}
- end;
- type THandData=packed record
- Account:array [0..20] of Char; {账号}
- Mark:array[0..1] of Char; {是否是上线信号}
- DesIP:array [0..20] of Char; {IP}
- DesPORT:array[0..5] of Char; {PORT}
- NeedReBack:Array[0..2] of Char; {是否需要反馈}
- IsDirected:array[0..1] of Char; {是否是直接发送}
- end;
- {聊天消息数据格式}
- type TChatData=packed record
- fromAccount:array [0..20] of Char; {账号}
- toAccount:array [0..20] of Char; {}
- Msg:array[0..499] of Char; {消息内容}
- IsNeedReBack:array[0..1] of Char; {是否需要接收成功反馈}
- IsReBackSigh:array[0..1] of Char; {是否为反馈信息}
- end;
- //-------------------用户基本信息定义---------------------
- type TUserData=packed record
- Account:array [0..20] of Char; {用户ID}
- IP:array[0..15] of Char; {IP地址}
- PORT:array[0..6] of Char;
- IsFirstOne:array[0..2] of Char; {是否为第一个,特殊处理}
- end;
- //-------------------整体结构定义格式包---------------------
- {(Package) 登录上线验证数据格式}
- type TLogonDataPackage=packed record
- Head:TTQQUDPHead;
- Body:TLogonData;
- end;
- type TLogoutDataPackage=packed record
- Head:TTQQUDPHead;
- Body:TLogoutData;
- end;
- {握手[打洞]数据格式}
- type THandDataPackage=packed record
- Head:TTQQUDPHead;
- Body:THandData;
- end;
- {好友信息数据}
- type TFriendDataPackage=packed record
- Head:TTQQUDPHead;
- Body:TUserData;
- end;
- {聊天消息数据格式}
- type TChatDataPackage=packed record
- Head:TTQQUDPHead;
- Body:TChatData;
- end;
- //-------------------在线信息---------------------
- type PServerUserBasicInfo=^TServerUserBasicInfo;
- TServerUserBasicInfo=class //在线用户数据表
- UserData:TUserData;
- IsActive:Boolean;
- end;
- implementation
- end.