312 lines
7.3 KiB
Text
312 lines
7.3 KiB
Text
MQServer Client Protocol:
|
|
|
|
Packet:
|
|
MID|MSGTYPE|VERSION|LEN|FLAGS|CRC|DATA\0\0
|
|
|
|
SID: Message ID, unique, generated by initiator
|
|
|
|
MSGTYPE: The type of message, see below
|
|
|
|
VERSION: The protocol version. Currently, V1.
|
|
|
|
LEN: The length of the message.
|
|
|
|
FLAGS: Flags Specific to this message. See below.
|
|
|
|
CRC: CRC Checksum for entire message.
|
|
|
|
DATA: Encoded Binary Data. See http://www.sqlite.org/faq.html#q12 for possible encoders.
|
|
|
|
\0 Message Terminated by Null Char.
|
|
|
|
MessageType: (Initiator)
|
|
ACK (C/S)- Ack a previous message that requires it.
|
|
ERROR (C/S)- Indicate a error.
|
|
SRVCAP (S)- Server Capabilities
|
|
AUTH (C)- Authentication
|
|
CLNTCAP (C)- Client Capabilities
|
|
APPID (C)- Application ID's that has signed on. Can be resent as required.
|
|
NOTIFY (C)- Request for notification if a client signs on
|
|
FINDQUEUE (C)- Information about a queue.
|
|
PRESENCE (S)- Notify client about a signon or queue existance
|
|
JOINQUEUE (C)- Join a Queue
|
|
PARTQUEUE (C)- part a Queue
|
|
CREATEQUEUE (C)- Create a new Queue, Not active till you joinqueue.
|
|
QUEUEINFO (S)- return Info About Queue. after findqueue, or joinqueue
|
|
ALTERQUEUE (C/S)- Alter informationa about a queue and propogate to clients
|
|
SENDTOQUEUE (C)- Send a message to a queue.
|
|
GETFROMQUEUE (C)- Get a message from a queue.
|
|
MSGFROMQUEUE (S)- send either a broadcast message or reply to a GETFROMQUEUE request
|
|
SENDTOCLNT (C)- Send a message to a client
|
|
MSGFROMCLNT (S)- Recieve a message from a client.
|
|
|
|
Flags:
|
|
REQUIREACK - This message requires a ack to acknowledge its recieved.
|
|
REQUIREACKPROCESS - This messages requires a ack to acknowledge it has been processed.
|
|
|
|
|
|
Connection Sequence:
|
|
Client State <Client> <Server> Server State
|
|
Client Connects SRVCAP
|
|
CLNTCAP
|
|
ACK Server Initiates caps
|
|
AUTH
|
|
ACK
|
|
Client Logged In.
|
|
APPID
|
|
MSGFRCLNT Send Stored Message.
|
|
ACK
|
|
MSGFRCLNT Continue to send.
|
|
ACK
|
|
PRESENCE send client presence
|
|
Client Synced. Now can proceed with normal functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Message Type Details:
|
|
-----------------------------------------------------------------------------------------------
|
|
ACK
|
|
A ack message is sent to acknowledge a previous message. Depending upon the previous message flags,
|
|
or previous message type, acks will be sent so the client knows it has been processed. In some cases
|
|
ACK may also be used to indicate we recieved your message, but there was a error.
|
|
|
|
Packet:
|
|
<MID>|ACK|1|<LEN>|0|<CRC>|<ACKMESS>\0
|
|
|
|
MID: Message No we are ACK'ing.
|
|
LEN: Length of message
|
|
CRC: CRC of Message
|
|
ACKMESS: Dependant on what we are ACK'ing. See Other MessageTypes.
|
|
|
|
From:
|
|
Client or Server
|
|
|
|
ACK:
|
|
Never
|
|
|
|
ERROR:
|
|
None.
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
ERROR
|
|
A error message indicates a critical error of some sort. In most cases, the connection will be shutdown
|
|
after the error message has been sent.
|
|
ERROR's Can not request ACK's
|
|
|
|
Packet:
|
|
<MID>|ERROR|1|<LEN>|0|<CRC>|<<ERRID> <ERRMSG>>\0
|
|
|
|
MID: Message from other side that generated error.
|
|
LEN: Length of message
|
|
CRC: CRC of Message
|
|
ERRID: Unique Error Code
|
|
ERRMSG: Additional Information about Error
|
|
|
|
From:
|
|
Client or Server
|
|
|
|
ACK:
|
|
Never
|
|
|
|
ERROR:
|
|
None.
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
AUTH
|
|
A Auth message is to authenticate the client to the server. Requires a ACK to Acknowledge success/failure of the auth process.
|
|
Auth Messages are only sent after recieving a SRVCAP.
|
|
|
|
Packet:
|
|
<MID>|AUTH|1|<LEN>|0|<CRC>|<<UNAME> <PASS>>\0
|
|
|
|
MID: Message ID
|
|
LEN: Length of Message
|
|
CRC: CRC of Message
|
|
UNAME: Username of client
|
|
PASS: Password hashed using salt sent in SRVCAP message.
|
|
|
|
From:
|
|
Client
|
|
|
|
ACK:
|
|
Yes
|
|
Successfull Login:
|
|
<ACKMSG> = 1
|
|
Un-Successfull Login:
|
|
<ACKMSG> = 0
|
|
Account ERROR:
|
|
<ACKMSG> = -1|<MESSAGE>
|
|
|
|
Where Message is the error message.
|
|
|
|
ERROR:
|
|
Never.
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
SRVCAP
|
|
Server Capabilities. Sent during initial client connection (Banner) to indicate what the server is capable of in terms of protocol or application.
|
|
|
|
Packet:
|
|
0|SRVCAP|1|<LEN>|0|<CRC>|<<PWHASH> <CAPFLAGS> <CAPDETAILS>>\0
|
|
|
|
LEN: Length of Message
|
|
CRC: CRC of Message
|
|
PWHASH: Salt to use to encrypt password.
|
|
CAPFLAGS: Flags indicating what capabilities server has.
|
|
CAPDETAILS: Strings indicating any additional variables for server Capabilities.
|
|
|
|
From:
|
|
Server
|
|
|
|
ACK:
|
|
Via CLNTCAP message only.
|
|
|
|
ERROR:
|
|
Never.
|
|
|
|
Notes:
|
|
If a client can't support the server caps, it should disconnect.
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
APPID
|
|
Application ID's of available applications active on client. Must be sent after CLNTCAP Acknowledgement, to indicate what application topics are available on client for P2P messages.
|
|
|
|
Packet:
|
|
<MID>|APPID|1|<LEN>|0|<CRC>|<<APPID> <APPID> <APPID>>\0
|
|
|
|
MID: Message ID.
|
|
LEN: Length of message
|
|
CRC: CRC of message
|
|
APPID: Numeric Application ID's available. Can specify Multiple Times.
|
|
|
|
From:
|
|
Client
|
|
|
|
ACK:
|
|
No.
|
|
|
|
ERROR:
|
|
No.
|
|
|
|
Notes: Can send any time during connection as well to indicate the availability of new applications.
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
NOTIFY
|
|
Client Requests to be notified of any signons of other users listed. Can be used to adjust notificaiton lists.
|
|
|
|
Packet:
|
|
<MID>|NOTIFY|1|<LEN>|0|<CRC>|<+/-<USER> +/-<USER>>\0
|
|
|
|
MID: Message ID.
|
|
LEN: Length of message
|
|
CRC: CRC of message
|
|
+/-USER: Users to add or remove from notify list. If not Users are specified, send list.
|
|
If removing a user that is not on the list, silently ignore.
|
|
|
|
From:
|
|
Client
|
|
|
|
ACK:
|
|
YES
|
|
If Adding/Removing Users ACKMSG is blank.
|
|
|
|
|
|
If Requesting List:
|
|
List of users:
|
|
ACKMSG = <user> <user> <user>
|
|
|
|
ERROR:
|
|
Yes
|
|
User does not exist.
|
|
ERRID: ENOUSER
|
|
ERRMSG: <LIST OF USERS NOT EXISTING>
|
|
|
|
NOTIFY List full:
|
|
ERRID: NOTLISTFULL
|
|
ERRMSG: empty.
|
|
|
|
|
|
Notes: Can send any time during connection as well to modify the notification list.
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
FINDQUEUE
|
|
Client requests information about a queue. Data is returned as a QUEUEINFO message.
|
|
|
|
Packet:
|
|
<MID>|FINDQUEUE|1|<LEN>|0|<CRC>|<QUEUE> <QUEUE>>\0
|
|
|
|
MID: Message ID.
|
|
LEN: Length of message
|
|
CRC: CRC of message
|
|
QUEUE: Queue Names to find and return info on.
|
|
|
|
|
|
From:
|
|
Client
|
|
|
|
ACK:
|
|
Via QUEUEINFO message for queues found. Otherwise ERROR.
|
|
|
|
ERROR:
|
|
Yes
|
|
QUEUE does not exist.
|
|
ERRID: ENOQUEUE
|
|
ERRMSG: <LIST OF QUEUE NOT EXISTING>
|
|
|
|
|
|
Notes:
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
PRESENCE
|
|
Notify Client about another clients signon, or APPID changes.
|
|
|
|
Packet:
|
|
<MID>|PRESENCE|1|<LEN>|0|<CRC>|<+<USER> <APPID> <APPID> +<USER> <APPID>>\0
|
|
|
|
MID: Message ID.
|
|
LEN: Length of message
|
|
CRC: CRC of message
|
|
+USER: User that just signed on, or when appid's changed.
|
|
APPID: List of applications ID's for this user.
|
|
|
|
|
|
From:
|
|
Client
|
|
|
|
ACK:
|
|
No.
|
|
|
|
ERROR:
|
|
No.
|
|
|
|
Notes:
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
JOINQUEUE
|
|
Join A Queue. Queue Security will determine if you can join or not, and if you can send recieve.
|
|
|
|
Packet:
|
|
<MID>|JOINQUEUE|1|<LEN>|0|<CRC>|<<QUEUE> <FLAGS>>\0
|
|
|
|
MID: Message ID.
|
|
LEN: Length of message
|
|
CRC: CRC of message
|
|
QUEUE: Queue you are requesting to Join.
|
|
Flags:
|
|
DEAF - Recieve no messages from this queue.
|
|
|
|
|
|
|
|
From:
|
|
Client
|
|
|
|
ACK:
|
|
No.
|
|
|
|
ERROR:
|
|
No.
|
|
|
|
Notes:
|