3.2 The Packet Header

There are two different PPTP packet types:

Control Packets: Carries signaling and status information.

Management Packets: Carries device management and configuration information.

The PPTP packet header contains information describing the packet type (control or management), the packet length, and a Magic Cookie.

The PPTP packet format is as follows:


    /*
     * PPTP Packet Types.
     *
     * PPTP_CONTROL_PACKET:     This packet contains signaling
     *                          information.
     *
     * PPTP_MGMT_PACKET:        This packet contain remote
     *                          management data.
     */

typedef enum {
    PPTP_CONTROL_PACKET = 1,
    PPTP_MGMT_PACKET
} PptpPacketType;

#define PPTP_MAGIC_COOKIE       0x1a2b3c4d

    /*
     * The PPTP Header.
     *
     * This is the command header for all PPTP packets.
     *
     * packetLength:           Total length of packet including
     *                         the PptpPacketHeader.
     *
     * packetType:             One of PptpPacketType.
     *
     * magicCookie:            Must be 0x1a2b3c4d.
     */

typedef struct {
    Word      packetLength;
    Word      packetType;
    LongWord  magicCookie;
} PptpPacketHeader;
    /*
     * Number of seconds of inactivity to wait before sending a
     * PPTP_ECHO_REQUEST message.
     */

#define PPTP_ECHO_ACTIVITY_SECONDS    (60)

    /*
     * Number of bytes reserved for the "hostname" field used in PPTP
     * messages
     */

#define MAX_HOSTNAME_LENGTH (64)

    /*
     * Number of bytes reserved for the "vendorString" field used in
     * PPTP messages
     */

#define MAX_VENDOR_STRING_LENGTH (64)

    /*
     * Number of bytes reserved for all variants of call addresses
     * used in PPTP messages
     */

#define MAX_PHONE_NUMBER_LENGTH (64)

    /*
     * Number of bytes reserved for the "callStatistics" field used in
     * PPTP messages
     */

#define MAX_CALL_STATS_LENGTH (128)

    /*
     * Number of seconds to wait for a PPTP_ECHO_REPLY response to a
     * PPTP_ECHO_REQUEST before timing out the control connection
     */

#define PPTP_ECHO_REPLY_TIMEOUT_SECONDS (60)

    /*
     * Number of seconds to wait before a new PPTP_WAN_ERROR_NOTIFY
     * message can be sent to a server for a particular call
     */

#define PPTP_WAN_ERROR_NOTIFY_RETRANSMIT_SECONDS (60)