imfreedom/knowledgebase

Add msn

2022-04-09, Gary Kramlich
6f68cee9441e
Add msn
# GoogleTalk
## Introduction
Google Talk is an instant messaging service that provides both text and voice
communication. The instant messaging service is colloquially known as "gtalk"
or "gchat" to its users. Because the Google Talk servers communicate with
clients using an open protocol, Extensible Messaging and Presence Protocol
XMPP, the service can also be accessed using any other client that supports
XMPP. Such clients are available for a number of operating systems not
supported by the Google Talk client.
Google Talk makes use of libjingle, which is Google's implementation of Jingle.
Clients which implement support for Jingle are incompatible with libjingle as
they are different enough.
## Features
Google Talk supports the following features :
* File transfer
* Instant messaging
* Voice chat
* Webcam support
## File Transfer
The scenario is as follows :
<romeo@montague.lit> (sender) wants to send a file somefile.tar.gz of size (in
bytes) 24410321 to <juliet@capulet.lit> (receiver).
The procedure is as follows:
**1. Sender sends an "initiate" message to the receiver for initiating a
session.**
```xml
<iq from="romeo@montague.lit" to="juliet@capulet.lit" type="set" id="purple937c6e2e">
<session xmlns="http://www.google.com/session"
type="initiate"
id="purple937c6e2d"
initiator="romeo@montague.lit">
<description xmlns="http://www.google.com/session/share">
<manifest>
<file size="24410321">
<name>somefile.tar.gz</name>
</file>
</manifest>
<protocol>
<http>
<url name="source-path">/temporary/x9w0a15d8gll334681a9tps7j838f104/</url>
<url name="preview-path">/temporary/p4e2a64s2ugd204688x7prk8s601m238/</url>
</http>
</protocol>
</description>
<transport xmlns="http://www.google.com/transport/p2p" />
</session>
</iq>
```
The receipt of the "initiate" message is acknowledged by the sender by a result
IQ.
```xml
<iq to="romeo@montague.lit" id="purple937c6e2e" type="result" from="juliet@capulet.lit"/>
```
**2. The receiver replies with a "transport-accept" message if the "initiate"
message contains the required(and correct!) transport.**
```xml
<iq to="romeo@montague.lit" type="set" id="58" from="juliet@capulet.lit">
<session xmlns="http://www.google.com/session"
type="transport-accept"
id="purple937c6e2d"
initiator="romeo@montague.lit">
<transport xmlns="http://www.google.com/transport/p2p" />
</session>
</iq>
```
The receipt of the "initiate" message is acknowledged by a result IQ.
```xml
<iq type='result' to='juliet@capulet.lit' id='58' from="romeo@montague.lit"/>
```
**3. When the receiver accepts the file transfer, an "accept" message is sent
to the sender.**
```xml
<iq to="romeo@montague.lit" type="set" id="59" from="juliet@capulet.lit">
<session xmlns="http://www.google.com/session"
type="accept"
id="purple937c6e2d"
initiator="romeo@montague.lit">
<description xmlns="http://www.google.com/session/share">
<manifest />
<protocol>
<http />
</protocol>
</description>
</session>
</iq>
```
The sender acknowledges the "accept" message with:
```xml
<iq type='result' to='juliet@capulet.lit' id='59' from="romeo@montague.lit"/>
```
**4. The receiver now sends an "info" message containing information about the
channel which will consequently allow the file bytes to flow.**
```xml
<iq to="romeo@montague.lit" type="set" id="60" from="juliet@capulet.lit">
<session xmlns="http://www.google.com/session"
type="info"
id="purple937c6e2d"
initiator="romeo@montague.lit">
<channel xmlns="http://www.google.com/session/share" name="private-1" />
</session>
</iq>
```
Sender sends an IQ of type "result" for acknowledgement:
```xml
<iq type='result' to='juliet@capulet.lit' id='60' from"romeo@montague.lit"/>
```
**5. Now, candidates are exchanged, which will serve as the candidates for the
actual file transfer.**
Each "transport-info" message contains the information about a single
candidate.
**5a. The sender sends it's candidates:**
```xml
<iq type="set" id="purple937c6e2f" to="juliet@capulet.lit" from="romeo@montague.lit">
<session xmlns="http://www.google.com/session"
id="purple937c6e2d"
initiator="romeo@montague.lit"
type="transport-info">
<transport xmlns="http://www.google.com/transport/p2p">
<candidate address="192.168.160.101"
port="55433"
name="private-1"
username="ccgg8psCDi8ALHPN"
password=""
preference="1"
protocol="udp"
type="host"
generation="0"
network="0" />
</transport>
</session>
</iq>
```
The receiver acknowledges this with an IQ:
```xml
<iq type='result' from='juliet@capulet.lit' id='purple937c6e2f' to="romeo@montague.lit"/>
```
**5b. The receiver sends it's candidates:**
```xml
<iq to="romeo@montague.lit" type="set" id="61" from="juliet@capulet.lit">
<session xmlns="http://www.google.com/session"
type="transport-info"
id="purple937c6e2d"
initiator="romeo@montague.lit">
<transport xmlns="http://www.google.com/transport/p2p">
<candidate name="private-1"
address="192.168.160.50"
port="55455"
preference="1"
username="sVfmPJvuPBdh+ail"
protocol="udp"
generation="0"
password="+9SLmzhJo6nqxYgE"
type="local"
network="0" />
</transport>
</session>
</iq>
```
The sender acknowledges the "transport-info" with an IQ:
```xml
<iq type='result' to='juliet@capulet.lit' id='61' from="romeo@montague.lit"/>
```
**6. Finalizing a candidate pair for the file transfer, the receiver sends an
HTTP GET request in the following format:**
```http
GET /temporary/x9w0a15d8gll334681a9tps7j838f104/somefile.tar.gz HTTP/1.1
Connection: Keep-Alive
Content-Length: 0
Host: romeo@montaglue.lit:0
User-Agent: Google Talk
```
The URL following "GET" in the above request is the same as the "source-path"
URL that was sent as a part of the "initiate" message (Step #1).
**7. The sender replies with an HTTP response, in this format :**
```http
HTTP/1.1 200
Connection: Keep-Alive
Content-Length: 24410321
Content-Type: application/octet-stream
```
The Content-Length field is changed from 0 to the size of the file under
question.
**8. The actual transfer of file bytes is underway.**
The sender is writing bytes to the open stream while the receiver reads all the
bytes. As soon as the receiver has received the number of bytes mentioned in
the HTTP response, it considers the file transfer to be complete and sends an
"info" message containing "complete".
```xml
<iq to="romeo@montague.lit" type="set" id="68" from="juliet@capulet.lit">
<session xmlns="http://www.google.com/session"
type="info"
id="purple937c6e2d"
initiator="romeo@montague.lit">
<complete xmlns="http://www.google.com/session/share" />
</session>
</iq>
```
Sender acknowledges "info" message with IQ :
```xml
<iq type='result' to='juliet@capulet.lit' id='68' from="romeo@montague.lit"/>
```
**9. The file transfer is complete.**
The receiver now sends a "terminate" message to the sender, showing it's
intention of tearing down the session.
```xml
<iq to="romeo@montague.lit" type="set" id="69" from="juliet@capulet.lit">
<session xmlns="http://www.google.com/session"
type="terminate"
id="purple937c6e2d"
initiator="romeo@montague.lit" />
</iq>
```
The sender acknowledges this with an IQ:
```xml
<iq type='result' to='juliet@capulet.lit' id='69' from="romeo@montague.lit"/>
```
**This completes the whole process of file transfer.**