Cisco Packet Tracer
Cisco Packet Tracer
1.2. Audience
The scope of this document is intended for Packet Tracer external application (ExApp)
developers. It is used to validate requirements and describes detail implementation
issues.
1.3. Abstract
This document describes the features of PTMP that support the IPC and Multi-user
features of Packet Tracer and details about its architectural design.
Packet Tracer has features that require network communication among different Packet
Tracer instances and/or other applications. This communication must be uniform and
transparent to the other components so that they can use this communication easily.
PTMP implements this communication with the following aspects: connection
negotiation, encoding, encryption, compression, and authentication.
2. Architecture
For optimal network utilization, PTMP is visualized as a protocol working over TCP/IP.
This is designed as a general messaging protocol. An application utilizing PTMP, such
as PT instances or other applications, will be referred to as a PTMP application. The
messages sent between PTMP applications are not governed by PTMP. It is the
responsibilities of the components utilizing PTMP to specify and follow their own
messaging formats and behaviors. These messages can be network packets in the case of
Multi-user or IPC calls in the case of IPC. In general, PTMP can be considered as a TCP
overlay that applications can use to communicate with PT instances.
When connections are made, a negotiation step is used to determine how the two PTMP
applications will communicate with each other. This includes negotiation on
authentication, encoding, encryption, and compression methods. Then an authentication
step is used to verify the client PTMP application.
Once a TCP connection is made between two PTMP applications and after the
negotiation and authentication steps, there is no concept of server and client. Both
applications have the same role and functionalities. Now, the two PTMP applications can
send messages to each other using PTMP.
There can be more than one connection to different PTMP applications. For each
connection, a dedicated TCP session is established.
Before going into details about the protocol, we must address the encodings available in
PTMP and the selected encoding during each connection. For backwards compatibility
with some development platforms that do not support binary, it is necessary to support
text encoding. However, binary encoding allows for efficient conversion and shorter
messages, thus it is also necessary to support binary encoding.
The encoding used for each connection is negotiated in the beginning of each connection.
The encoding formats to be followed for different basic types are as follows.
IPv6
address A 128-bit value An IPv6 address in the x:x:x:x:x:x:x:x format
MAC
address A 48-bit value A MAC address in the xxxx.xxxx.xxxx format
Maximum width is allocated for each data type to accommodate future requirements and
different programming languages. All the above data types may not be required. But for
completeness we can keep the encoding information. Unsigned types are not available
because languages such as Java do not have native support for unsigned types.
Binary encoding specifies the length or terminating character for each type of values.
Thus, it is straightforward to separate the values for reading. However, values in text
encoding do not specify a length per type. A terminating character (\0) is used to separate
the values for reading.
Messages are sent between PTMP applications once the TCP connection is established.
These messages need not be sent in one TCP segment. It can be of almost-infinite length
(2^31 – 1 = maximum number for int) and be sent over in multiple TCP segments.
However, they are processed only when the entire message is received. All these
messages must follow a common message format in order to differentiate the several
types of messages as well as determining the end of the message. The commonly used
Length-Type-Value (LTV) is used for all PTMP messages.
Value Message
0 Negotiation request
1 Negotiation response
2 Authentication request
3 Authentication challenge
4 Authentication response
5 Authentication status
6 Keep-alive
7 Disconnect
8 Communication
>= 100, < 200 IPC messages
>= 200, < 300 Multi-user messages
Once a TCP connection is made, the first step of the two PTMP applications is
connection negotiation. This is to decide on a set of common properties to be used on
both sides of the connection.
PTMP applications exchange information during negotiation using the following message
format:
• PTMP identifier (string): a constant identifier, “PTMP”
• PTMP version number (int): 1
• PTMP application ID (uuid): UUID of the application sending this negotiation
message
• Encoding (int): 1 = text, 2 = binary
• Encryption (int): 1 = none, 2 = XOR
• Compression (int): 1 = no, 2 = zlib default
• Authentication (int): 1 = clear text, 2 = simple, 4 = MD5
• Timestamp (string): local time when connection is initiated in the format
YYYYMMDDHHMMSS
• Keep-alive (int): keep-alive period in seconds
• Reserved (string): indicates the version of Packet Tracer running, in the format of
:PTVER<version> such as :PTVER8.1.0.0000
3.5. Authentication
The client first sends an authentication request message. The server challenges it by
sending an authentication challenge message. The challenge is a randomly generated
string consisting of 32 characters. Depending on the negotiated authentication method,
the client may need to calculate the “digest” by applying a hashing algorithm. If the
negotiated authentication method is clear text, the password is to be sent back in clear
text. If the negotiated authentication method is simple authentication, it uses the simple
authentication method described in Section 3.5.5 to encrypt the password. If the
negotiated authentication method is MD5, it uses MD5 along with the challenge text to
The simple authentication method uses a simple hashing function to generate a digest
from the given password.
3.6. Encryption
Confidentiality is the sole purpose of encryption in PTMP. Every message after the
negotiation process is to be encrypted if it is negotiated to do so. The encryption method
is simple XOR the data with a symmetric key (ie, both the server and client use the same
key to encrypt and decrypt).
The encryption key is derived from the UUIDs and the timestamps of the server and
client in this sequence:
This encryption key is to be used to XOR with the data messages in the following way:
3.7. Compression
1. Message with type and value fields are passed into PTMP for sending.
2. If state is authenticating or established:
a. Compress message if compression is negotiated
b. Encrypt message if encryption is negotiated
3. Prepend size of the message after compression and encryption.
Packet Tracer External Applications (ExApps) and Script Modules running in Packet
Tracer can send messages to other ExApps and Script Modules remotely connected via
Multi-user. This allows synchronization between the same ExApp or Script Module
running on multiple instances of Packet Tracer. The details of this mechanism is outside
of the scope of this document. PTMP only specifies the format of the Communication
Message while Packet Tracer Multi-user is responsible for delivering and processing the
message.
• Source ExApp Instance ID (UUID): the instance ID of the source ExApp or Script
Module
• Destination ExApp Instance ID (UUID): the instance ID of the destination ExApp
or Script Module, or null UUID if sending to destination ExApp ID without knowing
the ExApp instance ID
• Options (int): currently unused
• Source ExApp ID (string): the ID of the source ExApp or Script Module
• Destination ExApp ID (string): the ID of the destination ExApp or Script Module
• Visited PT instances count (int): the number of PT instances this message has
visited; for loop avoidance
• Visited PT instance IDs (list<UUID>): the list of PT instance IDs this message has
visited; for loop avoidance
• Message (string): the message to deliver to destination ExApp or Script Module