PCP::request

Description

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

Syntax

PCP::request version
PCP::request opcode
PCP::request lifetime
PCP::request protocol
PCP::request internal-port
PCP::request prefer-failure
PCP::request client-addr
PCP::request third-party
PCP::request third-party-int-addr
PCP::request suggested-ext-port
PCP::request suggested-ext-addr

PCP::request version

  • Returns the PCP version of the request

PCP::request opcode

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

PCP::request lifetime

  • Returns the lifetime specified in the PCP request.

PCP::request protocol

  • Returns the protocol specified in the PCP request as a string, either “tcp” or “udp”. If the protocol is invalid the field is returned as an integer. This sub-command is only valid for a PCP map request. “NA” is returned if called on a peer or announce request.

PCP::request internal-port

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

PCP::request prefer-failure

  • Returns 2 if prefer-failure is set in the PCP request, returns 0 if it is not. This subcommand is only valid for a PCP map request. “NA” is returned if called on a peer or announce request.

PCP::request client-addr

  • Returns the client address of the PCP request.

PCP::request third-party

  • Returns 1 if third-party is set in the PCP request, returns 0 if it is not. This subcommand is only valid for a PCP map request. “NA” is returned if called on a peer or announce request.

PCP::request third-party-int-addr

  • Returns the third-party IP address specified in the PCP request. If a third-party address is not specified in the PCP request, “NA” is returned. This subcommand is only valid for a PCP map request. “NA” is returned if called on a peer or announce request.

PCP::request suggested-ext-port

  • Returns the suggested external port specified in the PCP request. If a suggested external port was not specified, 0 is returned. This subcommand is only valid for a PCP map request. “NA” is returned if called on a peer or announce request.

PCP::request suggested-ext-addr

  • Returns the suggested external address specified in the PCP request. If a suggested external address was not specified, an address string containing all zero’s is returned. This subcommand is only valid for a PCP map request. “NA” is returned if called on a peer or announce request.

Examples

Logs a message each time a PCP map request is received from client 192.168.1.1:
when PCP_REQUEST {
     if {[PCP::request opcode] == "map" && [PCP::request client-addr] == "192.168.1.1" } {
         log "Received PCP map request for port [PCP::request internal-port] from 192.168.1.1"
     }
}