作者:white
日期:99-6-3 下午 10:58:14
COMMUNICATION BETWEEN SERVER AND CLIENT USING UDP
=================================================
The UDP packet sent from the client to the server has the following general
layout:
Length Content (if fixed) Name Description
------ ------------------ ---- -----------
2 bytes 02 00 VERSION Identifies the packet as an IC
Q packet
2 bytes xx xx COMMAND Code for service the server sh
ould provide
2 bytes xx xx SEQ_NUM Sequence number
4 bytes xx xx xx xx UIN The senders UIN
variable PARAMETERS 0 or more parameters (dependin
g on COMMAND)
The UDP packet sent from the server to the client has the following general
layout:
Length Content (if fixed) Name Description
------ ------------------ ---- -----------
2 bytes 02 00 VERSION Identifies the packet as an IC
Q packet
2 bytes xx xx COMMAND Code for service the server sh
ould provide
2 bytes xx xx SEQ_NUM Sequence number
variable PARAMETERS 0 or more parameters (dependin
g on COMMAND)
The VERSION field is present on all ICQ packets, and identifies the packet
as a ICQ message. The SEQ_NUM contains a sequence number for the packet. All
packets must have a unique sequence number (unless it is a retransmission).
This is used to avoid confusion if a UDP packet is lost or duplicated (as
may happen). Normally, the SEQ_NUM of the current packet is the previous packet> + 1. Note that the server and the client has separate
numbering, so that SEQ_NUM = 3 of a packet sent from the server is different
from SEQ_NUM = 3 of a packet sent from the client. Note also that the server
start counting on 00 00, and the client start counting on 01 00.
The following commands are available for the client to send to the server:
Code Name Description
---- ---- -----------
0A 00 ACK Acknowledgement
0E 01 SEND_MESSAGE Send message through server (to offline user)
E8 03 LOGIN Login on server
06 04 CONTACT_LIST Inform the server of my contact list
1A 04 SEARCH_UIN Search for user using his/her UIN
24 04 SEARCH_USER Search for user using his/her name or e-mail
2E 04 KEEP_ALIVE Sent to indicate connection is still up
38 04 SEND_TEXT_CODE Send special message to server as text
4C 04 LOGIN_1 Sent during login
60 04 INFO_REQ Request basic information about a user
6A 04 EXT_INFO_REQ Request extended information about a user离心机转子 9C 04 CHANGE_PASSWORD Change the user's password
D8 04 STATUS_CHANGE User has changed online status (Away etc)
28 05 LOGIN_2 Sent during login
Not yet described in detail (v0.1 of this document)
0A 05 UPDATE_INFO Update my basic information
B0 04 UPDATE_EXT_INFO Update my extended information
3C 05 ADD_TO_LIST Add user to my contact list
56 04 REQ_ADD_TO_LIST Request authorization to add to contact list
BA 04 QUERY_SERVERS Query the server about address to other servers
C4 04 QUERY_ADDONS Query the server about globally defined add-ons
EC 04 NEW_USER_1 Ask for permission to add a new user
FC 03 NEW
_USER_REG Register a new user
A6 04 NEW_USER_INFO Send basic information about a new user
42 04 CMD_X1 *Unknown
56 04 MSG_TO_NEW_USER Send a message to a user not on my contact list
(this one is also used to request permission to add someone with 'authorize'
status to your contact list)
The following commands can be sent from the server to the client, either as
a response to a client command, or to notify the client of some event.
Code Name Description
杜仲
橡胶种植
---- ---- -----------
0A 00 ACK Acknowledgement
5A 00 LOGIN_REPLY Login reply
6E 00 USER_ONLINE User on contact list is online/has changed online
status
78 00 USER_OFFLINE User on contact list has gone offline
8C 00 USER_FOUND User record found matching search criteria
DC 00 RECEIVE_MESSAGE Message sent while offline/through server
A0 00 END_OF_SEARCH No more USER_FOUND will be sent
18 01 INFO_REPLY Return basic information about a user
22 01 EXT_INFO_REPLY Return extended information about a user
A4 01 STATUS_UPDATE User on contact list has changed online status (A
way etc)
Not yet described in detail (v0.1 of this document)
1C 02 REPLY_X1 *Unknown (returned during login)
E6 00 REPLY_X2 *Unknown (confirm my UIN?)
E0 01 UPDATE_REPLY Confirmation of basic information update
C8 00 UPDATE_EXT_REPLY Confirmation of extended information update
46 00 NEW_USER_UIN Confirmation of creation of new user and newly as
signed UIN
B4 00 NEW_USER_REPLY Confirmation of new user basic information
82 00 QUERY_REPLY Response to QUERY_SEVERS or QUERY_ADDONS
C2 01 SYSTEM_MESSAGE System message with URL'ed button
The UDP messages will now be examined in closer detail.
MESSAGES SENT BY THE CLIENT
===========================
ACK (0A 00) Acknowledgement
---
Parameters: None
NOTE! Unlike all other commands, in ACK the field SEQ_NUM contains the
sequence number of the *server's* packet the client wishes to acknowledge.
Note further that an ACK should *not* be acknowledged!
SEND_MESSAGE (0E 01) Send message through server (to offline user)
------------
Parameters:
Length Content (if fixed) Name Description
------ ------------------ ---- -----------
4 bytes xx xx xx xx RECEIVER_UIN UIN of the user the message is
sent to
2 bytes (see below) MESSAGE_TYPE Type of message being sent
2 bytes xx xx LENGTH Length of MESSAGE including NU
LL
variable MESSAGE The message, ended by a NULL (
00)
MESSAGE_TYPE can be one of the following:
01 00 - the message is a normal message
04 00 - the message is an URL, and actually consists of two parts,
separated by the code FE.
The first part is the description of the URL, and the second part is the
actual URL.
LOGIN (E8 03) Login on server
-
----
Parameters:
Length Content (if fixed) Name Description
------ ------------------ ---- -----------
4 bytes xx xx xx xx PORT The TCP port to use for incomi
ng connections
2 bytes xx xx LENGTH Length of PASSWORD including N
ULL
variable PASSWORD The user's pas
sword + NULL (ma
x 8 chars)
4 bytes 78 00 00 00 X1 *Unknown
切割环
4 bytes xx xx xx xx USER_IP The user's IP address
cd45431 byte 04 X2 *Unknown橡胶闸阀
4 bytes xx xx xx xx STATUS Users online status (normally
00 00 00 00)
4 bytes 02 00 00 00 X3 *Unknown
2 bytes xx xx LOGIN_SEQ_NUM Login sequence number
4 bytes 00 00 00 00 X4 *Unknown
4 bytes 08 00 78 00 X5 *Unknown
监控界面CONTACT_LIST (06 04) Inform the server of my contact list
------------
Parameters:
Length Content (if fixed) Name Description
------ ------------------ ---- -----------
2 bytes xx xx NUM_CONTACTS Number of contacts following
{4 bytes xx xx xx xx UIN UIN of user on contact list }
The last field is repeated for as many users as NUM_CONTACTS indicate.
The server will send online/offline notification to client only of users
registered using CONTACT_LIST.
SEARCH_UIN (1A 04) Search for user using his/her UIN
----------
Parameters:
Length Content (if fixed) Name Description
------ ------------------ ---- -----------
2 bytes xx xx SEARCH_SEQ_NUM Search sequence number
4 bytes xx xx xx xx SEARCHED_UIN The UIN to search for
The SEARCH_SEQ_NUM should be a unique number, to distinguish from other
searches. The reply from the server will contain the SEARCH_SEQ_NUM of the
search, to facitilate matching query and answer.