PCP::response

Description

This command provides access to the data in a PCP (Port Control Protocol) response packet. Access to this data is read-only, and the data in the PCP response cannot be modified via the PCP::response command.

Syntax

PCP::response version
PCP::response opcode
PCP::response lifetime
PCP::response protocol
PCP::response internal-port
PCP::response client-addr
PCP::response result
PCP::response assigned-ext-port
PCP::response assigned-ext-addr

PCP::response version

  • Returns the PCP version of the response.

PCP::response opcode

  • Returns the opcode of the PCP response as a string, either “announce”, “peer” or “map”. If the opcode is invalid, the field is returned as an integer.

PCP::response lifetime

  • Returns the lifetime field from the PCP response.

PCP::response protocol

  • Returns the protocol of the matching PCP request as a string, either “tcp” or “udp”. If the protocol is invalid, the field is returned as an integer. This subcommand is only valid for a PCP map response. “NA” is returned if called on a peer or announce response.

PCP::response internal-port

  • Returns the internal port of the matching PCP request. This subcommand is only valid for a PCP map response. “NA” is returned if called on a peer or announce response.

PCP::response client-addr

  • Returns the client address of the matching PCP request.

PCP::response result

  • Returns the result field of the PCP response. This is an integer between 0 and 255. 0 denotes success. All others denote failure of the PCP request.

PCP::response assigned-ext-port

  • Returns the assigned external port in the PCP response. This subcommand is only valid for a PCP map response. “NA” is returned if called on a peer or announce response.

PCP::response assigned-ext-addr

  • Returns the assigned external address in the PCP response. This subcommand is only valid for a PCP map response. “NA” is returned if called on a peer or announce response.

Examples

when PCP_RESPONSE {
    if {[PCP::response opcode] == "map" && [PCP::response result] != 0] } {
        log "PCP map request from\
              [PCP::response client-addr]:[PCP::response internal-port]\
              failed with a result of [PCP::response result]"
    }
}