﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-DWZ</title><link>http://www.cppblog.com/dwz-1987/</link><description>MAKI</description><language>zh-cn</language><lastBuildDate>Tue, 07 Apr 2026 21:25:32 GMT</lastBuildDate><pubDate>Tue, 07 Apr 2026 21:25:32 GMT</pubDate><ttl>60</ttl><item><title>UML图中类图和对象图的 依赖关系，实现关系，泛化关系，关联关系（组合、聚合）</title><link>http://www.cppblog.com/dwz-1987/archive/2008/05/21/50630.html</link><dc:creator>刘冬清</dc:creator><author>刘冬清</author><pubDate>Wed, 21 May 2008 04:54:00 GMT</pubDate><guid>http://www.cppblog.com/dwz-1987/archive/2008/05/21/50630.html</guid><wfw:comment>http://www.cppblog.com/dwz-1987/comments/50630.html</wfw:comment><comments>http://www.cppblog.com/dwz-1987/archive/2008/05/21/50630.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/dwz-1987/comments/commentRss/50630.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/dwz-1987/services/trackbacks/50630.html</trackback:ping><description><![CDATA[类图和对象图（对象是类的实例，那么对象图就是类图的一个实例，类图类名下面无下划线，而对象图是有的）：<br>一、依赖关系（使用带实心箭头的虚线表示）：假设A类的变化引起了B类的变化，则说名B类依赖于A类。<br><br>依赖关系有如下三种情况：<br>1、A类是B类的一个成员变量；<br>2、A类是B类方法当中的一个参数；<br>3、A类向B类发送消息，从而影响B类发生变化；<br><br><br><br>二、泛化关系（使用带空心箭头的实线表示）：A是B和C的父类，B,C具有公共类（父类）A，说明A是B,C的一般化（概括，也称泛化）<br><br>在UML当中，对泛化关系有三个要求：<br>1、子类与父类应该完全一致，父类所具有的属性、操作，子类应该都有；<br>2、子类中除了与父类一致的信息以外，还包括额外的信息；<br>3、可以使用父类的实例的地方，也可以使用子类的实例；<br><br>三、关联关系（使用实线来表示）：两个类的实例之间存在着某种语义上的联系<br>关联关系是所有关系当中最最通用的关系；<br>某种联系不存在非常明确的定义<br>如：学校、教室和老师<br><br>关联关系分为两种：<br>1、聚合关系<br>表示的是整体和部分的关系，整体与部分可以分开<br>如：电话机包括一个话筒<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 电脑包括键盘、显示器，一台电脑可以和多个键盘、多个显示器搭配，确定键盘和显示器是可以和主机分开的，主机可以选择其他的键盘、显示器组成电脑；<br>使用带空心菱形的实线来表示<br>2、组合关系<br>也是整体与部分的关系，但是整体与部分不可以分开<br>如：公司和部门，部门是部分，公司是整体，公司A的财务部不可能和公司B的财务部对换，就是说，公司A不能和自己的财务部分开；<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 人与人的心脏<br><br>四、实现关系（使用带空心箭头的虚线表示）：是用来规定接口和实线接口的类或者构建结构的关系，接口是操作的集合，而这些操作就用于规定类或者构建的一种服务。<br><br><br>
<img src ="http://www.cppblog.com/dwz-1987/aggbug/50630.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/dwz-1987/" target="_blank">刘冬清</a> 2008-05-21 12:54 <a href="http://www.cppblog.com/dwz-1987/archive/2008/05/21/50630.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>批评</title><link>http://www.cppblog.com/dwz-1987/archive/2008/05/12/49635.html</link><dc:creator>刘冬清</dc:creator><author>刘冬清</author><pubDate>Mon, 12 May 2008 05:49:00 GMT</pubDate><guid>http://www.cppblog.com/dwz-1987/archive/2008/05/12/49635.html</guid><wfw:comment>http://www.cppblog.com/dwz-1987/comments/49635.html</wfw:comment><comments>http://www.cppblog.com/dwz-1987/archive/2008/05/12/49635.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/dwz-1987/comments/commentRss/49635.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/dwz-1987/services/trackbacks/49635.html</trackback:ping><description><![CDATA[不是为了批评而批评,而是为了能够让人们改掉坏毛病,做的比原来更好.<br>不是批评了就万事大吉,除了批评,还要关心到底!
<img src ="http://www.cppblog.com/dwz-1987/aggbug/49635.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/dwz-1987/" target="_blank">刘冬清</a> 2008-05-12 13:49 <a href="http://www.cppblog.com/dwz-1987/archive/2008/05/12/49635.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>QQ类接口</title><link>http://www.cppblog.com/dwz-1987/archive/2008/04/21/47769.html</link><dc:creator>刘冬清</dc:creator><author>刘冬清</author><pubDate>Mon, 21 Apr 2008 14:49:00 GMT</pubDate><guid>http://www.cppblog.com/dwz-1987/archive/2008/04/21/47769.html</guid><wfw:comment>http://www.cppblog.com/dwz-1987/comments/47769.html</wfw:comment><comments>http://www.cppblog.com/dwz-1987/archive/2008/04/21/47769.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/dwz-1987/comments/commentRss/47769.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/dwz-1987/services/trackbacks/47769.html</trackback:ping><description><![CDATA[<p>/**<br>&nbsp;* &lt;pre&gt;<br>&nbsp;* 定义一些QQ用到的常量，常量的命名方式经过调整，统一为<br>&nbsp;* QQ_[类别]_[名称]<br>&nbsp;* <br>&nbsp;* 比如表示长度的常量，为QQ_LENGTH_XXXXX<br>&nbsp;* 表示最大值的常量，为QQ_MAX_XXXX<br>&nbsp;* &lt;/pre&gt;<br>&nbsp;* <br>&nbsp;* @author luma<br>&nbsp;*/<br><br>QQ接口类中，包含的属性有：<br>1、public static final String EMPTY_STRING = ""; （）&nbsp; /** 空字符串 */<br>&nbsp;&nbsp;&nbsp;&nbsp; // 协议族标识<br>2、&nbsp;// QQ包类型定义<br>&nbsp;/** QQ基本协议族包头 */<br>&nbsp;public static final byte QQ_HEADER_BASIC_FAMILY = 0x02;<br>&nbsp;/** QQ P2P协议族 */<br>&nbsp;public static final byte QQ_HEADER_P2P_FAMILY = 0x00;<br>&nbsp;/** 03协议族包头 */<br>&nbsp;public static final byte QQ_HEADER_03_FAMILY = 0x03;<br>&nbsp;&nbsp;&nbsp; /** 04开头的协议族，未知含义，文件中转包有用到过 */<br>&nbsp;public static final byte QQ_HEADER_04_FAMILY = 0x04;<br>&nbsp;/** 05协议族包头 */<br>&nbsp;public static final byte QQ_HEADER_05_FAMILY = 0x05;<br>&nbsp;/** QQ基本协议族包尾 */<br>&nbsp;public static final byte QQ_TAIL_BASIC_FAMILY = 0x03;<br>&nbsp;/** 05系列协议族包尾 */<br>&nbsp;public static final byte QQ_TAIL_05_FAMILY = 0x03;<br>3、<br>&nbsp;/** 不需要确认的包的发送次数，这个值应该是随便的，由于QQ Logout包发了4次，所以我选4 */ <br>&nbsp;&nbsp;&nbsp; public static final int QQ_SEND_TIME_NOACK_PACKET = 4;</p>
<p>&nbsp;&nbsp;&nbsp; /** QQ登录包中16到51字节的固定内容 */<br>&nbsp;&nbsp;&nbsp; public static final byte[] QQ_LOGIN_16_51 = new byte[] {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00, 0x00, 0x00, (byte)0x86, (byte)0xCC, 0x4C, 0x35, 0x2C, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (byte)0xD3, 0x73, 0x6C, 0x14, (byte)0xF6, (byte)0xF6, (byte)0xAF, (byte)0xC3, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (byte)0xFA, 0x33, (byte)0xA4, 0x01<br>&nbsp;&nbsp;&nbsp; };<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; /** QQ登录包中53到68字节的固定内容 */<br>&nbsp;&nbsp;&nbsp; public static final byte[] QQ_LOGIN_53_68 = new byte[] {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (byte)0x8D, (byte)0x8B, (byte)0xFA, (byte)0xEC, (byte)0xD5, 0x52, 0x17, 0x4A, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (byte)0x86, (byte)0xF9, (byte)0xA7, 0x75, (byte)0xE6, 0x32, (byte)0xD1, 0x6D<br>&nbsp;&nbsp;&nbsp; };<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; /** QQ登录包中的未知固定内容 */<br>&nbsp;&nbsp;&nbsp; public static final byte[] QQ_LOGIN_SEGMENTS = new byte[] {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x0B, 0x04, 0x02, 0x00, 0x01, 0x00,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, (byte)0xE9, 0x03,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, (byte)0xF3,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (byte)0xED, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x01, (byte)0xEC, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00, 0x03, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x00, 0x00,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00, 0x00, 0x00, 0x01, (byte)0xEE, 0x03, 0x00, 0x00,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00, 0x00, 0x00, 0x00, 0x01, (byte)0xEF, 0x03, 0x00,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, (byte)0xEB, 0x03,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00<br>&nbsp;&nbsp;&nbsp; };</p>
<p>4、<br>&nbsp;/** 包最大大小 */<br>&nbsp;public static final int QQ_MAX_PACKET_SIZE = 65535;<br>&nbsp;/**<br>&nbsp; * 消息最大长度，QQ是最大700字节<br>&nbsp; */<br>&nbsp;public static final int QQ_MAX_SEND_IM = 700;<br>&nbsp;/** 密钥长度 */<br>&nbsp;public static final int QQ_LENGTH_KEY = 16;<br>&nbsp;/** 登陆信息长度 */<br>&nbsp;public static final int QQ_LENGTH_LOGIN_DATA = 416;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;/** QQ UDP缺省端口 */<br>&nbsp;public static final int QQ_PORT_UDP = 8000;<br>&nbsp;/** QQ TCP缺省端口 */<br>&nbsp;public static final int QQ_PORT_TCP = 80;<br>&nbsp;/** 使用HTTP代理时连接QQ服务器的端口 */<br>&nbsp;public static final int QQ_PORT_HTTP = 443;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; /** QQ缺省编码方式 */<br>&nbsp;public static final String QQ_CHARSET_DEFAULT = "GBK";<br>&nbsp;/** 消息编码，好像可以自己胡乱定义 */<br>&nbsp;public static final char QQ_CHARSET_GB = 0x8602;<br>&nbsp;public static final char QQ_CHARSET_EN = 0x0000;&nbsp;<br>&nbsp;public static final char QQ_CHARSET_BIG5 = 0x8603;<br>&nbsp;<br>&nbsp;/** 单位: ms */<br>&nbsp;public static final long QQ_TIMEOUT_SEND = 5000;<br>&nbsp;/** 最大重发次数 */<br>&nbsp;public static final int QQ_MAX_RESEND = 5;<br>&nbsp;/** Keep Alive包发送间隔，单位: ms */<br>&nbsp;public static final long QQ_INTERVAL_KEEP_ALIVE = 100000;<br>5、<br>&nbsp;// 和虚拟摄像头有关系<br>&nbsp;/** 显示虚拟摄像头 */<br>&nbsp;public static final int QQ_CAM_SHOW_FAKE = 1;<br>&nbsp;/** 隐藏虚拟摄像头 */<br>&nbsp;public static final int QQ_CAM_DONT_SHOW_FAKE = 0;</p>
<p>&nbsp;/** QQ分组的名称最大字节长度，注意一个汉字是两个字节 */<br>&nbsp;public static final int QQ_MAX_GROUP_NAME = 16;<br>&nbsp;/** QQ昵称的最长长度 */<br>&nbsp;public static final int QQ_MAX_NAME_LENGTH = 250;<br>&nbsp;/** QQ缺省表情个数 */<br>&nbsp;public static final int QQ_COUNT_DEFAULT_FACE = 96;<br>&nbsp;/** 得到用户信息的回复包字段个数 */<br>&nbsp;public static final int QQ_COUNT_GET_USER_INFO_FIELD = 37;<br>&nbsp;/** 修改用户信息的请求包字段个数，比实际的多1，最开始的QQ号不包括 */<br>&nbsp;public static final int QQ_COUNT_MODIFY_USER_INFO_FIELD = 35;<br>&nbsp;/** 用户备注信息的字段个数 */<br>&nbsp;public static final int QQ_COUNT_REMARK_FIELD = 7;</p>
<p>&nbsp;/** 客户端版本号标志 - QQ2005 */<br>&nbsp;public static final char QQ_CLIENT_VERSION_0E1B = 0x0E1B;<br>&nbsp;/**<br>&nbsp; * 服务器端版本号 (不一定)<br>&nbsp; * 不一定真的是表示服务器端版本号，似乎和发出的包不同，这个有其他的含义，<br>&nbsp; * 感觉像是包的类型标志<br>&nbsp; */<br>&nbsp;public static final char QQ_SERVER_VERSION_0100 = 0x0100;<br>6、<br>&nbsp;/** 中转服务器版本号 */<br>&nbsp;public static final char QQ_AGENT_SERVER_VERSION_04D1 = 0x04D1;<br>&nbsp;<br>&nbsp;/** 程序缺省使用的客户端版本号 */<br>&nbsp;public static final char QQ_CLIENT_VERSION = QQ_CLIENT_VERSION_0E1B;<br>&nbsp;&nbsp;<br>&nbsp;/** 正常登陆 */<br>&nbsp;public static final byte QQ_LOGIN_MODE_NORMAL = 0x0A;<br>&nbsp;/** 隐身登陆 */<br>&nbsp;public static final byte QQ_LOGIN_MODE_HIDDEN = 0x28;<br>&nbsp;/** 性别-男 */<br>&nbsp;public static final byte QQ_GENDER_GG = 0x0;<br>&nbsp;/** 性别-女 */<br>&nbsp;public static final byte QQ_GENDER_MM = 0x1;<br>&nbsp;/** 性别-未知 */<br>&nbsp;public static final byte QQ_GENDER_UNKNOWN = (byte)0xFF;<br>7、<br>&nbsp;/** 在线状态-在线 */<br>&nbsp;public static final byte QQ_STATUS_ONLINE = 0x0A;<br>&nbsp;/** 在线状态-离线 */<br>&nbsp;public static final byte QQ_STATUS_OFFLINE = 0x14;<br>&nbsp;/** 在线状态-离开 */<br>&nbsp;public static final byte QQ_STATUS_AWAY = 0x1E;<br>&nbsp;/** 在线状态-隐身 */<br>&nbsp;public static final byte QQ_STATUS_HIDDEN = 0x28;<br>8、<br>&nbsp;// 回复常量&nbsp;<br>&nbsp;/** 通用常量，操作成功 */<br>&nbsp;public static final byte QQ_REPLY_OK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= 0x00;<br>&nbsp;/** 对方已经是我的好友 */<br>&nbsp;public static final byte QQ_REPLY_ADD_FRIEND_ALREADY = (byte)0x99;<br>&nbsp;/** 请求登录令牌成功 */<br>&nbsp;public static final byte QQ_REPLY_REQUEST_LOGIN_TOKEN_OK = 0x00;<br>&nbsp;/** 登录信息-重定向 */<br>&nbsp;public static final byte QQ_REPLY_LOGIN_REDIRECT = 0x01;<br>&nbsp;/** 登录信息-登录失败 */<br>&nbsp;public static final byte QQ_REPLY_LOGIN_FAIL = 0x05;<br>&nbsp;/** 改变在线状态成功 */<br>&nbsp;public static final byte QQ_REPLY_CHANGE_STATUS_OK = 0x30;<br>&nbsp;/** 发送认证消息成功 */<br>&nbsp;public static final byte QQ_REPLY_ADD_FRIEND_AUTH_OK = 0x30;<br>&nbsp;/** 高级搜索结束，没有更多数据 */<br>&nbsp;public static final byte QQ_REPLY_ADVANCED_SEARCH_END = 1;<br>&nbsp;/** 申请中转服务器，重定向 */<br>&nbsp;public static final char QQ_REPLY_REQUEST_AGENT_REDIRECT = 0x0001;<br>&nbsp;/** 申请中转服务器成功 */<br>&nbsp;public static final char QQ_REPLY_REQUEST_AGENT_OK = 0x0000;<br>&nbsp;/** 要发送的图片太大 */<br>&nbsp;public static final char QQ_REPLY_REQUEST_AGENT_TOO_LONG = 0x0003;<br>9、<br>&nbsp;/** 命令常量 - 登出 */<br>&nbsp;public static final char QQ_CMD_LOGOUT = 0x0001;<br>&nbsp;/** 命令常量 - 保持在线状态 */<br>&nbsp;public static final char QQ_CMD_KEEP_ALIVE = 0x0002;<br>&nbsp;/** 命令常量 - 修改自己的信息 */<br>&nbsp;public static final char QQ_CMD_MODIFY_INFO = 0x0004;<br>&nbsp;/** 命令常量 - 查找用户 */<br>&nbsp;public static final char QQ_CMD_SEARCH_USER = 0x0005;<br>&nbsp;/** 命令常量 - 得到好友信息 */<br>&nbsp;public static final char QQ_CMD_GET_USER_INFO = 0x0006;<br>&nbsp;/** <br>&nbsp; * 命令常量 - 添加一个好友<br>&nbsp; * <br>&nbsp; * @deprecated 2005使用QQ_CMD_ADD_FRIEND_EX <br>&nbsp; */<br>&nbsp;public static final char QQ_CMD_ADD_FRIEND = 0x0009;<br>&nbsp;/** 命令常量 - 删除一个好友 */<br>&nbsp;public static final char QQ_CMD_DELETE_FRIEND = 0x000A;<br>&nbsp;/** 命令常量 - 发送验证信息 */<br>&nbsp;public static final char QQ_CMD_ADD_FRIEND_AUTH = 0x000B;<br>&nbsp;/** 命令常量 - 改变自己的在线状态 */<br>&nbsp;public static final char QQ_CMD_CHANGE_STATUS = 0x000D;<br>&nbsp;/** 命令常量 - 确认收到了系统消息 */<br>&nbsp;public static final char QQ_CMD_ACK_SYS_MSG = 0x0012;<br>&nbsp;/** 命令常量 - 发送消息 */<br>&nbsp;public static final char QQ_CMD_SEND_IM = 0x0016;<br>&nbsp;/** 命令常量 - 接收消息 */<br>&nbsp;public static final char QQ_CMD_RECV_IM = 0x0017;<br>&nbsp;/** 命令常量 - 把自己从对方好友名单中删除 */<br>&nbsp;public static final char QQ_CMD_REMOVE_SELF = 0x001C;<br>&nbsp;/** 请求一些操作需要的密钥，比如文件中转，视频也有可能 */<br>&nbsp;public static final char QQ_CMD_REQUEST_KEY = 0x001D;<br>&nbsp;/** 命令常量 - 登陆 */<br>&nbsp;public static final char QQ_CMD_LOGIN = 0x0022;<br>&nbsp;/** 命令常量 - 得到好友列表 */<br>&nbsp;public static final char QQ_CMD_GET_FRIEND_LIST = 0x0026;<br>&nbsp;/** 命令常量 - 得到在线好友列表 */<br>&nbsp;public static final char QQ_CMD_GET_ONLINE_OP = 0x0027;<br>&nbsp;/** 命令常量 - 发送短消息 */<br>&nbsp;public static final char QQ_CMD_SEND_SMS = 0x002D;<br>&nbsp;/** 命令常量 - 群相关命令 */<br>&nbsp;public static final char QQ_CMD_CLUSTER_CMD = 0x0030;<br>&nbsp;/** 命令常量 - 测试连接 */<br>&nbsp;public static final char QQ_CMD_TEST = 0x0031;<br>&nbsp;/** 命令常量 - 分组数组操作 */<br>&nbsp;public static final char QQ_CMD_GROUP_DATA_OP = 0x003C;<br>&nbsp;/** 命令常量 - 上传分组中的好友QQ号列表 */<br>&nbsp;public static final char QQ_CMD_UPLOAD_GROUP_FRIEND = 0x003D;<br>&nbsp;/** 命令常量 - 好友相关数据操作 */<br>&nbsp;public static final char QQ_CMD_FRIEND_DATA_OP = 0x003E;<br>&nbsp;/** 命令常量 - 下载分组中的好友QQ号列表 */<br>&nbsp;public static final char QQ_CMD_DOWNLOAD_GROUP_FRIEND = 0x0058;<br>&nbsp;&nbsp;&nbsp; /** 命令常量 - 好友等级信息相关操作 */<br>&nbsp;&nbsp;&nbsp; public static final char QQ_CMD_FRIEND_LEVEL_OP = 0x005C; <br>&nbsp;&nbsp;&nbsp; /** 命令常量 - 隐私数据操作 */<br>&nbsp;&nbsp;&nbsp; public static final char QQ_CMD_PRIVACY_DATA_OP = 0x005E;<br>&nbsp;/** 命令常量 - 群数据操作命令 */<br>&nbsp;public static final char QQ_CMD_CLUSTER_DATA_OP = 0x005F;<br>&nbsp;/** 命令常量 - 好友高级查找 */<br>&nbsp;public static final char QQ_CMD_ADVANCED_SEARCH = 0x0061;<br>&nbsp;/** 命令常量 - 请求登录令牌 */<br>&nbsp;public static final char QQ_CMD_REQUEST_LOGIN_TOKEN = 0x0062;<br>&nbsp;/** 命令常量 - 用户属性操作 */<br>&nbsp;public static final char QQ_CMD_USER_PROPERTY_OP = 0x0065;<br>&nbsp;/** 命令常量 - 临时会话操作 */<br>&nbsp;public static final char QQ_CMD_TEMP_SESSION_OP = 0x0066;<br>&nbsp;/** 命令常量 - 个性签名的操作 */<br>&nbsp;public static final char QQ_CMD_SIGNATURE_OP = 0x0067;<br>&nbsp;/** 命令常量 - 接收到系统消息 */<br>&nbsp;public static final char QQ_CMD_RECV_MSG_SYS = 0x0080;<br>&nbsp;/** 命令常量 - 好友改变状态 */<br>&nbsp;public static final char QQ_CMD_RECV_MSG_FRIEND_CHANGE_STATUS = 0x0081;<br>&nbsp;/** 命令常量 - 天气操作 */<br>&nbsp;public static final char QQ_CMD_WEATHER_OP = 0x00A6;<br>&nbsp;/** 命令常量 - QQ2005使用的添加好友命令 */<br>&nbsp;public static final char QQ_CMD_ADD_FRIEND_EX = 0x00A7;<br>&nbsp;/** 命令常量 - 发送验证消息 */<br>&nbsp;public static final char QQ_CMD_AUTHORIZE = 0X00A8;<br>&nbsp;/** 命令常量 - 未知命令，调试用途 */<br>&nbsp;public static final char QQ_CMD_UNKNOWN = 0xFFFF;<br>10、<br>&nbsp;/** 命令常量 - 登出 */<br>&nbsp;public static final char QQ_CMD_LOGOUT = 0x0001;<br>&nbsp;/** 命令常量 - 保持在线状态 */<br>&nbsp;public static final char QQ_CMD_KEEP_ALIVE = 0x0002;<br>&nbsp;/** 命令常量 - 修改自己的信息 */<br>&nbsp;public static final char QQ_CMD_MODIFY_INFO = 0x0004;<br>&nbsp;/** 命令常量 - 查找用户 */<br>&nbsp;public static final char QQ_CMD_SEARCH_USER = 0x0005;<br>&nbsp;/** 命令常量 - 得到好友信息 */<br>&nbsp;public static final char QQ_CMD_GET_USER_INFO = 0x0006;<br>&nbsp;/** <br>&nbsp; * 命令常量 - 添加一个好友<br>&nbsp; * <br>&nbsp; * @deprecated 2005使用QQ_CMD_ADD_FRIEND_EX <br>&nbsp; */<br>&nbsp;public static final char QQ_CMD_ADD_FRIEND = 0x0009;<br>&nbsp;/** 命令常量 - 删除一个好友 */<br>&nbsp;public static final char QQ_CMD_DELETE_FRIEND = 0x000A;<br>&nbsp;/** 命令常量 - 发送验证信息 */<br>&nbsp;public static final char QQ_CMD_ADD_FRIEND_AUTH = 0x000B;<br>&nbsp;/** 命令常量 - 改变自己的在线状态 */<br>&nbsp;public static final char QQ_CMD_CHANGE_STATUS = 0x000D;<br>&nbsp;/** 命令常量 - 确认收到了系统消息 */<br>&nbsp;public static final char QQ_CMD_ACK_SYS_MSG = 0x0012;<br>&nbsp;/** 命令常量 - 发送消息 */<br>&nbsp;public static final char QQ_CMD_SEND_IM = 0x0016;<br>&nbsp;/** 命令常量 - 接收消息 */<br>&nbsp;public static final char QQ_CMD_RECV_IM = 0x0017;<br>&nbsp;/** 命令常量 - 把自己从对方好友名单中删除 */<br>&nbsp;public static final char QQ_CMD_REMOVE_SELF = 0x001C;<br>&nbsp;/** 请求一些操作需要的密钥，比如文件中转，视频也有可能 */<br>&nbsp;public static final char QQ_CMD_REQUEST_KEY = 0x001D;<br>&nbsp;/** 命令常量 - 登陆 */<br>&nbsp;public static final char QQ_CMD_LOGIN = 0x0022;<br>&nbsp;/** 命令常量 - 得到好友列表 */<br>&nbsp;public static final char QQ_CMD_GET_FRIEND_LIST = 0x0026;<br>&nbsp;/** 命令常量 - 得到在线好友列表 */<br>&nbsp;public static final char QQ_CMD_GET_ONLINE_OP = 0x0027;<br>&nbsp;/** 命令常量 - 发送短消息 */<br>&nbsp;public static final char QQ_CMD_SEND_SMS = 0x002D;<br>&nbsp;/** 命令常量 - 群相关命令 */<br>&nbsp;public static final char QQ_CMD_CLUSTER_CMD = 0x0030;<br>&nbsp;/** 命令常量 - 测试连接 */<br>&nbsp;public static final char QQ_CMD_TEST = 0x0031;<br>&nbsp;/** 命令常量 - 分组数组操作 */<br>&nbsp;public static final char QQ_CMD_GROUP_DATA_OP = 0x003C;<br>&nbsp;/** 命令常量 - 上传分组中的好友QQ号列表 */<br>&nbsp;public static final char QQ_CMD_UPLOAD_GROUP_FRIEND = 0x003D;<br>&nbsp;/** 命令常量 - 好友相关数据操作 */<br>&nbsp;public static final char QQ_CMD_FRIEND_DATA_OP = 0x003E;<br>&nbsp;/** 命令常量 - 下载分组中的好友QQ号列表 */<br>&nbsp;public static final char QQ_CMD_DOWNLOAD_GROUP_FRIEND = 0x0058;<br>&nbsp;&nbsp;&nbsp; /** 命令常量 - 好友等级信息相关操作 */<br>&nbsp;&nbsp;&nbsp; public static final char QQ_CMD_FRIEND_LEVEL_OP = 0x005C; <br>&nbsp;&nbsp;&nbsp; /** 命令常量 - 隐私数据操作 */<br>&nbsp;&nbsp;&nbsp; public static final char QQ_CMD_PRIVACY_DATA_OP = 0x005E;<br>&nbsp;/** 命令常量 - 群数据操作命令 */<br>&nbsp;public static final char QQ_CMD_CLUSTER_DATA_OP = 0x005F;<br>&nbsp;/** 命令常量 - 好友高级查找 */<br>&nbsp;public static final char QQ_CMD_ADVANCED_SEARCH = 0x0061;<br>&nbsp;/** 命令常量 - 请求登录令牌 */<br>&nbsp;public static final char QQ_CMD_REQUEST_LOGIN_TOKEN = 0x0062;<br>&nbsp;/** 命令常量 - 用户属性操作 */<br>&nbsp;public static final char QQ_CMD_USER_PROPERTY_OP = 0x0065;<br>&nbsp;/** 命令常量 - 临时会话操作 */<br>&nbsp;public static final char QQ_CMD_TEMP_SESSION_OP = 0x0066;<br>&nbsp;/** 命令常量 - 个性签名的操作 */<br>&nbsp;public static final char QQ_CMD_SIGNATURE_OP = 0x0067;<br>&nbsp;/** 命令常量 - 接收到系统消息 */<br>&nbsp;public static final char QQ_CMD_RECV_MSG_SYS = 0x0080;<br>&nbsp;/** 命令常量 - 好友改变状态 */<br>&nbsp;public static final char QQ_CMD_RECV_MSG_FRIEND_CHANGE_STATUS = 0x0081;<br>&nbsp;/** 命令常量 - 天气操作 */<br>&nbsp;public static final char QQ_CMD_WEATHER_OP = 0x00A6;<br>&nbsp;/** 命令常量 - QQ2005使用的添加好友命令 */<br>&nbsp;public static final char QQ_CMD_ADD_FRIEND_EX = 0x00A7;<br>&nbsp;/** 命令常量 - 发送验证消息 */<br>&nbsp;public static final char QQ_CMD_AUTHORIZE = 0X00A8;<br>&nbsp;/** 命令常量 - 未知命令，调试用途 */<br>&nbsp;public static final char QQ_CMD_UNKNOWN = 0xFFFF;<br>11、<br>&nbsp;// 消息类型，这个类型比上面的类型又再低一级，他们基本从属于QQ_RECV_IM_FRIEND<br>&nbsp;// 所以他们是normalIMHeader中的类型<br>&nbsp;/** 普通文件消息 */<br>&nbsp;public static final char QQ_IM_TYPE_TEXT = 0x000B;<br>&nbsp;/** 一个TCP连接请求 */<br>&nbsp;public static final char QQ_IM_TYPE_TCP_REQUEST = 0x0001;<br>&nbsp;/** 接收TCP连接请求 */<br>&nbsp;public static final char QQ_IM_TYPE_ACCEPT_TCP_REQUEST = 0x0003;<br>&nbsp;/** 拒绝TCP连接请求 */<br>&nbsp;public static final char QQ_IM_TYPE_REJECT_TCP_REQUEST = 0x0005;<br>&nbsp;/** UDP连接请求 */<br>&nbsp;public static final char QQ_IM_TYPE_UDP_REQUEST = 0x0035;<br>&nbsp;/** 接受UDP连接请求 */<br>&nbsp;public static final char QQ_IM_TYPE_ACCEPT_UDP_REQUEST = 0x0037;<br>&nbsp;/** 拒绝UDP连接请求 */<br>&nbsp;public static final char QQ_IM_TYPE_REJECT_UDP_REQUEST = 0x0039;<br>&nbsp;/** 通知文件传输端口 */<br>&nbsp;public static final char QQ_IM_TYPE_NOTIFY_IP = 0x003B;<br>&nbsp;/** 请求对方主动连接 */<br>&nbsp;public static final char QQ_IM_TYPE_ARE_YOU_BEHIND_FIREWALL = 0x003F;<br>&nbsp;/** 未知含意 */<br>&nbsp;public static final char QQ_IM_TYPE_ARE_YOU_BEHIND_PROXY = 0x0041;<br>&nbsp;/** 未知含意，0x0041的回复 */<br>&nbsp;public static final char QQ_IM_TYPE_YES_I_AM_BEHIND_PROXY = 0x0042;<br>&nbsp;/** 通知文件中转服务器信息 */<br>&nbsp;public static final char QQ_IM_TYPE_NOTIFY_FILE_AGENT_INFO = 0x004B;<br>&nbsp;/** 取消TCP或者UDP连接请求 */<br>&nbsp;public static final char QQ_IM_TYPE_REQUEST_CANCELED = 0x0049;<br>12、</p>
<img src ="http://www.cppblog.com/dwz-1987/aggbug/47769.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/dwz-1987/" target="_blank">刘冬清</a> 2008-04-21 22:49 <a href="http://www.cppblog.com/dwz-1987/archive/2008/04/21/47769.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>QQ客户端对象类</title><link>http://www.cppblog.com/dwz-1987/archive/2008/04/21/47765.html</link><dc:creator>刘冬清</dc:creator><author>刘冬清</author><pubDate>Mon, 21 Apr 2008 13:38:00 GMT</pubDate><guid>http://www.cppblog.com/dwz-1987/archive/2008/04/21/47765.html</guid><wfw:comment>http://www.cppblog.com/dwz-1987/comments/47765.html</wfw:comment><comments>http://www.cppblog.com/dwz-1987/archive/2008/04/21/47765.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/dwz-1987/comments/commentRss/47765.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/dwz-1987/services/trackbacks/47765.html</trackback:ping><description><![CDATA[&nbsp; QQ的客户端类，这个类为用户提供一个方便的接口，比如发送消息之类的，只需要调用一个<br>&nbsp;方法便可以完成了。
<img src ="http://www.cppblog.com/dwz-1987/aggbug/47765.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/dwz-1987/" target="_blank">刘冬清</a> 2008-04-21 21:38 <a href="http://www.cppblog.com/dwz-1987/archive/2008/04/21/47765.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> QQ所有包对象的基类</title><link>http://www.cppblog.com/dwz-1987/archive/2008/04/16/47201.html</link><dc:creator>刘冬清</dc:creator><author>刘冬清</author><pubDate>Wed, 16 Apr 2008 03:02:00 GMT</pubDate><guid>http://www.cppblog.com/dwz-1987/archive/2008/04/16/47201.html</guid><wfw:comment>http://www.cppblog.com/dwz-1987/comments/47201.html</wfw:comment><comments>http://www.cppblog.com/dwz-1987/archive/2008/04/16/47201.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/dwz-1987/comments/commentRss/47201.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/dwz-1987/services/trackbacks/47201.html</trackback:ping><description><![CDATA[
		<p>一、包对象的基类中，包含的属性有：<br />1、log对象（import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;）<br />2、解密者 （Crypter）<br />3、包体缓冲区 （ByteBuffer 类型：ByteBuffer）<br />4、调试模式开关 （DebugSwitch 类型：Debug切换类，单一实例，控制debug状态的设置和管理Debug客户端，其负责向客户端转发 Debug事件。所以可以有多个调试客户端同时存在。）<br />5、包命令, 0x03~0x04  （command 类型：char）<br />6、源标志, 0x01~0x02  （source 类型：char）<br />7、包序号, 0x05~0x06   （sequence 类型：char）<br />8、包头字节 （header 类型：byte）<br />9、QQUser 对象 （封装QQ用户的信息类）<br />10、duplicated（由于LumaQQ较常发生 消息确认包丢失的问题，所以，这里加一个字段来表示到来的消息包是重复的。类型：boolean）<br />11、明文包体 bodyDecrypted (类型：byte[])<br /><br />二、构造函数的构造<br />1、<br />/**<br />  * 构造一个指定参数的包<br />  * <br />  * @param header<br />  *   包头<br />  * @param source<br />  *   包源<br />  * @param command<br />  *   包命令 <br />  * @param sequence<br />  *   包序号 <br />  * @param user <br />  *   QQ用户对象<br />  */<br /> public Packet(byte header, char source, char command, char sequence, QQUser user) {<br />     this.user = user;<br />  this.source = source;<br />  this.command = command;<br />  this.sequence = sequence;<br />  this.duplicated = false;<br />  this.header = header;<br /> }<br />2、<br /> /**<br />  * 从buf中构造一个OutPacket，用于调试。这个buf里面可能包含了抓包软件抓来的数据<br />  * <br />  * @param buf<br />  *    ByteBuffer<br />  * @throws PacketParseException<br />  *    解析出错<br />  */<br /> protected Packet(ByteBuffer buf, QQUser user) throws PacketParseException {<br />     this(buf, buf.limit() - buf.position(), user);<br /> }</p>
		<p> 3、<br />/**<br />  * 从buf中构造一个OutPacket，用于调试。这个buf里面可能包含了抓包软件抓来的数据<br />  * <br />  * @param buf<br />  *    ByteBuffer<br />  * @param length<br />  *    要解析的内容长度<br />  * @throws PacketParseException<br />  *    如果解析出错<br />  */<br /> protected Packet(ByteBuffer buf, int length, QQUser user) throws PacketParseException {<br />     this.user = user;<br />     // 解析头部<br />     parseHeader(buf);<br />     // 检查QQ号<br />     if(!validateHeader())<br />         throw new PacketParseException("包头有误，抛弃该包: " + toString());<br />     // 得到包体<br />     byte[] body = getBodyBytes(buf, length);<br />     bodyDecrypted = decryptBody(body, 0, body.length);<br />  if(bodyDecrypted == null)<br />         throw new PacketParseException("包内容解析出错，抛弃该包: " + toString());<br />     // 包装到ByteBuffer<br />     ByteBuffer tempBuf = ByteBuffer.wrap(bodyDecrypted);<br />     try {<br />      // 解析<br />      parseBody(tempBuf);         <br />     } catch (BufferUnderflowException e) {<br />         throw new PacketParseException(e.getMessage());<br />     }<br />     parseTail(buf);<br />     // 查看是否打开了调试模式，如果有，则触发调试事件<br />     if(ds.isDebug()) {         <br />         byte[] debugContent = dump();<br />         IDebugObject obj = new PacketDO(getPacketName(), debugContent, this instanceof InPacket, getHeadLength(), debugContent.length - getTailLength());<br />         ds.deliverDebugObject(obj);<br />     }<br /> }  <br />4、<br />/**<br />  * 构造一个包对象，什么字段也不填，仅限于子类使用<br />  */<br /> protected Packet() {     <br /> } </p>
<img src ="http://www.cppblog.com/dwz-1987/aggbug/47201.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/dwz-1987/" target="_blank">刘冬清</a> 2008-04-16 11:02 <a href="http://www.cppblog.com/dwz-1987/archive/2008/04/16/47201.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>