Protocols/OSCAR/SNAC/ICBM CHANNEL MSG TO HOST

From NINA Wiki
Revision as of 11:46, 14 February 2021 by AD (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
OSCAR Protocol
IntroductionTermsClients
Basic
DatatypesFLAPSNACTLV
UUIDsErrorsTool IDs
Host Interaction
Rate LimitsMigrationMessages
Other Services
ADMINADVERTALERT
BARTBOSBUCPCHAT
CHAT_NAV
Tutorials
Sign OnBARTRendezvous
ICBMLocateBuddies
Foodgroups
OSERVICE (0x0001)
LOCATE (0x0002)
BUDDY (0x0003)
ICBM (0x0004)
ADVERT (0x0005)
INVITE (0x0006)
ADMIN (0x0007)
POPUP (0x0008)
PD (0x0009)
USER_LOOKUP (0x000A)
STATS (0x000B)
TRANSLATE (0x000C)
CHAT_NAV (0x000D)
CHAT (0x000E)
ODIR (0x000F)
BART (0x0010)
FEEDBAG (0x0013)
ICQ (0x0015)
BUCP (0x0017)
ALERT (0x0018)
PLUGIN (0x0022)
UNNAMED_FG_24 (0x0024)
MDIR (0x0025)
ARS (0x044A)
ID Origin Name Foodgroup Service Status Version
0x0004, 0x0006 Client ICBM__CHANNEL_MSG_TOHOST Unspecified BOS Active 1.25

This is the basic inter-client message after which the group was named (Inter-Client Basic Messages).

SNAC Header

Foodgroup uint16 (word) 00 04
Subgroup uint16 (word) 00 06
Flags uint16 (word) 00 00
Request ID uint32 (dword) 00 00 00 00

SNAC Data

Length Description
8 bytes Random message cookie
2 bytes

Channel ID. Can be one of the following:

  • 0x0001 - Basic instant messages
  • 0x0002 - Rendevous (chat inviation, file transfer negotation, send icon, etc.)
1 byte Length L of the following
L bytes The destination AIM screen name or ICQ number (in ASCII) of this ICBM
X bytes TLVs


Once at the server, the SNAC is reformatted into a ICBM__CHANNEL_MSG_TOCLIENT before it is sent to the destination user.

Name Type Notes
cookie ICBM Cookie Opaque data generated by conversation initiator and used to link up the conversation and errors
channel uint16 (word) [Class: ICBM__CHANNELS] Channel the message is on
dest username string08 Destination username, who should receive the message
icbmTlvs Rest of SNAC array of TLV [Class: ICBM__TAGS] Message data and parameters; it must contain either the IM or DATA tag

From Aleksandr Shutko: SNAC(04,06) ICBM__CHANNEL_MSG_TOHOST


Client use this snac to send message thru server. Within the ICBM (Inter-Client Basic Message) types (family 4), a channel is defined. Each channel represents a different kind of message.

Channel 1 is used for what would commonly be called an "instant message" (plain text messages). Channel 2 is used for complex messages (rtf, utf8) and negotiating "rendezvous". These transactions end in something more complex happening, such as a chat invitation, or a file transfer. Channel 3 is used for chat messages (not in the same family as these channels). Channel 4 is used for various ICQ messages. Examples are normal messages, URLs, and old-style authorization.

This snac contain one fixed part (target uin, channel, msg-id cookie) and channel-dependend tlv-chain.

First dword in msg-id cookies is actually the computer uptime in milliseconds (ie GetTickCount(), at least this is what the ICQ Lite and the other official clients I have tested uses).


 00 04   word   SNAC family
 00 06   word   SNAC subtype
 00 00   word   SNAC flags
 xx xx xx xx   dword   SNAC request-id
   xx xx xx xx
 xx xx xx xx
  qword   msg-id cookie
   xx xx   word   message channel (see table below)
   xx   byte   screenname string length
   xx ..   string   screenname string
 xx xx   word   TLV.Type(0xXX) - icbm info
 xx xx   word   TLV.Length
 ....   ....   ....
  ....  .... ....
 xx xx   word   TLV.Type(0xXX) - icbm info
 xx xx   word   TLV.Length
 ....   ....   ....


 Channel 1    Channel 1 message format (plain-text messages)
 Channel 2    Channel 2 message format (rtf messages, rendezvous)
 Channel 4    Channel 4 message format (typed old-style messages)



Examples

Channel 1 Example

From Aleksandr Shutko: SNAC(04,06)/CH1 ICBM__CHANNEL_MSG_TOHOST/CH1


Client use this snac to send message thru server on channel 1. All clients use this snac to send plain-text messages to an old clients and to clients that doesn't support channel 2 messages. TLV(0x03) and TLV(0x06) is optional.

 00 04   word   SNAC family
 00 06   word   SNAC subtype
 00 00   word   SNAC flags
 xx xx xx xx   dword   SNAC request-id
 xx xx xx xx
 xx xx xx xx
qword   msg-id cookie
 00 01 word   message channel
 xx byte   screenname string length
 xx .. string   screenname string
 00 02   word   TLV.Type(0x02) - message data
 xx xx   word   TLV.Length
 05   byte   fragment identifier (array of required capabilities)
 01   byte   fragment version
 xx xx   word   Length of rest data
 xx ...   array   byte array of required capabilities (1 - text)
 01   byte   fragment identifier (text message)
 01   byte   fragment version
 xx xx   word   Length of rest data
 00 00   word   Message charset number
 ff ff   word   Message language number
 xx ..   string (ascii)   Message text string
 00 03   word   TLV.Type(0x03) - request an ack from server
 00 00   word   TLV.Length
 empty
 00 06   word   TLV.Type(0x06) - store message if recipient offline
 00 00   word   TLV.Length
 empty



Example SNAC dumps with flap header:


  2a 02 23 6c 00 47 00 04  00 06 00 00 00 01 00 06  *.#l.G..........
  67 c3 15 01 3d 3a 00 00  00 01 07 31 30 30 30 30  g...=:.....10000
  30 30 00 02 00 23 05 01  00 01 01 01 01 00 1a 00  00...#..........
  00 ff ff 74 65 73 74 20  63 68 61 6e 6e 65 6c 20  ...test channel
  31 20 6d 65 73 73 61 67  65 00 06 00 00           1 message....


Channel 2 Example

From Aleksandr Shutko: SNAC(04,06)/CH2 ICBM__CHANNEL_MSG_TOHOST/CH2


Client use this snac to send message thru server on channel 2.

 00 04   word   SNAC family
 00 06   word   SNAC subtype
 00 00   word   SNAC flags
 xx xx xx xx   dword   SNAC request-id
 xx xx xx xx
 xx xx xx xx
qword   msg-id cookie
 00 02 word   message channel
 xx byte   screenname string length
 xx .. string   screenname string
 00 05   word   TLV.Type(0x05) - rendezvous message data
 xx xx   word   TLV.Length
 xx xx   word   message type (0 - request, 1 - cancel, 2 - accept)
 xx xx xx xx
 xx xx xx xx
  qword   msg-id cookie (same as above)
 xx .. xx   guid   capability (determines format of message data in "extention data" below)
 00 03   word   TLV.Type(0x03) - internal ip
 xx xx   word   TLV.Length
 xx xx xx xx   dword   internal ip
 00 05   word   TLV.Type(0x05) - listening port
 xx xx   word   TLV.Length
 xx xx   word   listening port
 00 0A   word   TLV.Type(0x0A) - unknown
 xx xx   word   TLV.Length
 xx xx   word   unknown (usually 1)
 00 0B   word   TLV.Type(0x0B) - unknown
 xx xx   word   TLV.Length
 xx xx   word   unknown
 00 0F   word   TLV.Type(0x0F) - unknown
 00 00   word   TLV.Length
 empty
 11 27   word   TLV.Type(0x2711) - extention data
 xx xx   word   TLV.Length
 Following contents is capability-specific.
 
       Data format description for capability 
        {09461349-4C7F-11D1-8222-444553540000}
 xx xx   word (LE)   length of following data
 xx xx   word (LE)   protocol version
 xx .. xx   guid (LE)   plugin or zero bytes
 xx xx   word   unknown
 xx xx xx xx   dword (LE)   client capabilities flags
 xx   byte   unknown
 xx xx   word (LE)   seems to be a downcounter
 xx xx   word (LE)   length of following data
 xx xx   word (LE)   seems to be a downcounter as in first chunk above
 xx ..     unknown, usually zeros
if plugin field in first chunk above is zero, here is
        message, overwise here is
        plugin-specific data.
 00 03   word   TLV.Type(0x03) - request an ack from server
 00 00   word   TLV.Length
 empty


Example SNAC dumps with flap header:


  2A 02 36 87 00 99 00 04 00 06 00 00 00 0F 00 06  *.6???.???..........
  CC EB 54 00 F7 07 00 00 00 02 09 31 32 33 34 35  ??????T.???......12345
  36 37 38 39 00 05 00 73 00 00 CC EB 54 00 F7 07  6789...s..??????T.???.
  00 00 09 46 13 49 4C 7F 11 D1 82 22 44 45 53 54  ...F.IL?.T???"DEST
  00 00 00 0A 00 02 00 01 00 0F 00 00 27 11 00 4B  ............'..K
  1B 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00 00 00 00 00 00 03 00 00 00 00 FB FF 0E 00 FB  ...........v???..v
  FF 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00  ???...............
  00 21 00 0E 00 54 65 73 74 20 6D 65 73 73 61 67  .!...Test messag
  65 2E 00 00 00 00 00 FF FF FF 00 00 03 00 00     e......?????????.....


Channel 4 Example

From Aleksandr Shutko: SNAC(04,06)/CH4 ICBM__CHANNEL_MSG_TOHOST/CH4


ICQ clients use this snac to send messages to an old/offline/invisible clients if message type != 1 or message flags != 0 (for example plain-text multi-recipient message to an offline client) but this doesn't mean that you can't send usual plain-text message on channel 4. TLV(0x03) and TLV(0x06) is optional.

 00 04   word   SNAC family
 00 06   word   SNAC subtype
 00 00   word   SNAC flags
 xx xx xx xx   dword   SNAC request-id
 xx xx xx xx
 xx xx xx xx
  qword   msg-id cookie
 00 04   word   message channel
 xx   byte   screenname string length
 xx ..   string   screenname string
 00 05   word   TLV.Type(0x05) - message data
 xx xx   word   TLV.Length
 xx xx xx xx   dword (LE)   Sender uin
 xx   byte   Message type
 xx   byte   Message flags
 xx xx   word (LE)   Message string length
 xx .. 00   string (asciiz)   Message string
 00 03   word   TLV.Type(0x03) - request an ack from server
 00 00   word   TLV.Length
 empty
 00 06   word   TLV.Type(0x06) - store message if recipient offline
 00 00   word   TLV.Length
 empty


Example SNAC dumps with flap header:


  2a 02 56 1e 00 6f 00 04-00 06 00 00 00 0b 00 06   *.V..o..........
  4e b5 6c 01 33 28 00 00-00 04 07 31 30 30 30 30   N.l.3(.....10000
  30 30 00 05 00 4b 8f e4-5e 00 04 00 43 00 54 68   00...K..^...C.Th
  69 73 20 69 73 20 74 68-65 20 74 65 73 74 20 75   is is the test u
  72 6c 20 6d 65 73 73 61-67 65 20 74 6f 20 61 6e   rl message to an
  20 6f 6c 64 20 63 6c 69-65 6e 74 fe 68 74 74 70    old client.http
  3a 2f 2f 68 74 74 70 2e-74 65 73 74 2e 75 72 6c   ://http.test.url
  00 00 06 00 00                                    .....


ICBM SNACs

SNAC List
Subgroup Origin Name
0x0001 Any ICBM__ERR
This is the error SNAC for the ICBM foodgroup.
0x0002 Client ICBM__ADD_PARAMETERS
This SNAC is typically sent prior to sending the OSERVICE__CLIENT_ONLINE so that the host is properly initialized with the clients' preferences.
0x0003 Client ICBM__DEL_PARAMETERS
These are the delete all parameters for a given channel.
0x0004 Client ICBM__PARAMETER_QUERY
This SNAC requests ICBM parameters from the host.
0x0005 Host ICBM__PARAMETER_REPLY
This SNAC is sent by the host in response to a ICBM__PARAMETER_QUERY.
0x0006 Client ICBM__CHANNEL_MSG_TOHOST
This is the basic inter-client message after which the group was named (Inter-Client Basic Messages).
0x0007 Host ICBM__CHANNEL_MSG_TOCLIENT
This is the ICBM__CHANNEL_MSG_TOHOST after it has been reformatted by the host and sent to the destination client.
0x0008 Client ICBM__EVIL_REQUEST
This requests that the specified user is sent an EVIL notification.
0x0009 Host ICBM__EVIL_REPLY
The reply tells the requester, the sender of an ICBM__EVIL_REQUEST SNAC, how much EVIL, if any, was applied to the recipient.
0x000A Host ICBM__MISSED_CALLS
When the host is unable to send one or more messages to the client, the host sends this SNAC to the client to let it know that it missed some messages ("calls").
0x000B Any ICBM__CLIENT_ERR
This error notice is one of the few SNACs that can be sent to the host and received by a client.
0x000C Host ICBM__HOST_ACK
This SNAC is sent by the host upon receipt of any ICBM__CHANNEL_MSG_TOHOST which includes the optional ICBM__TLV_TAGS_REQUEST_HOST_ACK TLV.
0x000D NCD ICBM__SIN_STORED
This is not currently documented. Want to contribute?
0x000E NCD ICBM__SIN_LIST_QUERY
This is not currently documented. Want to contribute?
0x000F NCD ICBM__SIN_LIST_REPLY
This is not currently documented. Want to contribute?
0x0010 Client ICBM__SIN_RETRIEVE
This requests ICBM__CHANNEL_MSG_TOCLIENT messages be generated for each of the stored ICBMs. Any message retrieved is deleted.
0x0011 NCD ICBM__SIN_DELETE
This is not currently documented. Want to contribute?
0x0012 NCD ICBM__NOTIFY_REQUEST
This is not currently documented. Want to contribute?
0x0013 NCD ICBM__NOTIFY_REPLY
This is not currently documented. Want to contribute?
0x0014 Any ICBM__CLIENT_EVENT
This SNAC is sent as a control message, sent by a client to inform the recipient of an event, or by the host informing of an event.
0x0017 Host ICBM__SIN_REPLY
The host successfully processed the request to retrieve all the offline messages.