<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="yes"?>
<rfc category="info" docName="draft-boucadair-pcp-flow-examples-04"
     ipr="trust200902">
  <front>
    <title abbrev="PCP Flow Examples">Port Control Protocol (PCP) Flow
    Examples</title>

    <author fullname="Mohamed Boucadair" initials="M." surname="Boucadair">
      <organization>France Telecom</organization>

      <address>
        <postal>
          <street></street>

          <city>Rennes</city>

          <region></region>

          <code>35000</code>

          <country>France</country>
        </postal>

        <email>mohamed.boucadair@orange.com</email>
      </address>
    </author>

    <date day="23" />

    <workgroup>PCP WG</workgroup>

    <abstract>
      <t>This document provides a set of examples to illustrate Port Control
      Protocol (PCP) operations. It is a companion document to the base PCP
      specification.<!--Add exampels for PREFIX64, DESCRIPTION, ETC.--></t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>As a companion document to <xref target="RFC6887"></xref>, this
      document provides examples to help understanding the PCP machinery and
      exchanged PCP messages in various usage contexts.</t>

      <t>For more details about PCP protocol specification, the reader is
      invited to refer to <xref target="RFC6887"></xref>.</t>

      <t>Examples included in this document make use of the IPv4 and IPv6
      address blocks for documentation purposes defined in <xref
      target="RFC5737"></xref> and <xref target="RFC3849"></xref>.</t>
    </section>

    <section title="Basic MAP Operations">
      <t>The following figure illustrates the messages which are exchanged to
      create a mapping in a PCP-controlled device with MAP opcode.</t>

      <t><figure align="center" anchor="create"
          title="Example of creating a mapping">
          <preamble></preamble>

          <artwork><![CDATA[+------+                           +------+
| PCP  |                           | PCP  |
|Client|                           |Server|
+------+                           +------+
    |      (1) PCP MAP Request         |
    |--------------------------------->|
    |      (2) PCP MAP Response        |
    |<---------------------------------|
    |                                  |

]]></artwork>

          <postamble></postamble>
        </figure>The following sub-sections provide several examples depending
      on the content of the MAP request and the decision of the PCP
      server.</t>

      <section title="Suggested External Port Honored by the PCP Server">
        <t>This example illustrates the content of exchanged PCP messages when
        the PCP client does not include any PCP Option in its request. In this
        example, the PCP server assigns the suggested port number. In
        reference to <xref target="create"></xref>, the content of exchanged
        PCP messages is as follows:</t>

        <t><figure anchor="ex1"
            title="MAP request (suggested External Port Honored by the PCP Server)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:0.0.0.0]]></artwork>
          </figure></t>

        <t><figure anchor="ex2"
            title="MAP response (suggested External Port Honored by the PCP Server)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Assigned External Port: 3938
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>
      </section>

      <section title="IPv6-enabled PCP Client">
        <t>This example illustrates the content of exchanged PCP messages when
        the PCP client is assigned with an IPv6 address but the remote server
        controls a NAT44 device. In reference to <xref
        target="create"></xref>, the content of exchanged PCP messages is as
        follows:</t>

        <t><figure anchor="ex3"
            title="MAP request (suggested External Port Honored by the PCP Server)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: 2001:db8:0:0:1::1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:0.0.0.0]]></artwork>
          </figure></t>

        <t><figure anchor="ex4"
            title="MAP response (suggested External Port Honored by the PCP Server)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Assigned External Port: 3938
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>
      </section>

      <section title="Remove an Existing Mapping">
        <t>This example illustrates the content of exchanged PCP messages when
        the PCP client request the removal of an existing mapping.</t>

        <t><figure anchor="ex5"
            title="MAP request (Remove an Existing Mapping)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 0 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>

        <t><figure anchor="ex6"
            title="MAP response (Remove an Existing Mapping)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 0 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Assigned External Port: 3938
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>
      </section>

      <section title="Suggested External Port Not Honored by the PCP Server">
        <t>This example illustrates the content of exchanged PCP messages when
        the PCP client does not include any PCP Option in its request. In this
        example, the PCP server does not assign the suggested external port
        number. In reference to <xref target="create"></xref>, the content of
        exchanged PCP messages is as follows:</t>

        <t><figure anchor="ex7"
            title="MAP request (Suggested External Port Not Honored by the PCP Server)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 11000
 Suggested External Port: 11000
 Suggested External IP Address: ::ffff:0.0.0.0]]></artwork>
          </figure></t>

        <t><figure anchor="ex8"
            title="MAP response (Suggested External Port Not Honored by the PCP Server)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 11000
 Assigned External Port: 15200
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>
      </section>

      <section title="Suggested External IP Address">
        <t>This example illustrates the content of exchanged PCP messages when
        the PCP client does not include any PCP Option in its request. In this
        example, the PCP client indicates a hinted external IP address honored
        by the PCP server. In reference to <xref target="create"></xref>, the
        content of exchanged PCP messages is as follows:</t>

        <t><figure anchor="ex9"
            title="MAP request (Suggested External IP Address)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>

        <t><figure anchor="ex10"
            title="MAP response (Suggested External IP Address)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Assigned External Port: 15200
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>
      </section>

      <section title="Create Mapping with Distinct External IP Addresses">
        <t><xref target="create_d"></xref> shows a PCP server with a pool of
        public IPv4 addresses (192.0.2/24) and two PCP clients associated with
        different subscribers. The PCP clients each make a port mapping
        request to the PCP server which creates the mapping from its
        192.0.2/24 pool.</t>

        <t><figure align="center" anchor="create_d"
            title="Example of creating mappings with distinct external IP addresses">
            <preamble></preamble>

            <artwork><![CDATA[+--------+                     +------+                   +--------+
|  PCP   |                     | PCP  |                   |  PCP   |
|Client 1|                     |Server|                   |Client 2|
+--------+                     +------+                   +--------+
    |    (1) PCP MAP Request      |                            |
    |---------------------------->|                            |
    |    (2) PCP MAP Response     |                            |       
    |<----------------------------|   (a) PCP MAP Request      |
    |                             |<---------------------------|
    |                             |   (b) PCP MAP Response     |
    |                             |--------------------------->| 
    |                             |                            |

]]></artwork>
          </figure></t>

        <t>In this example, the PCP clients were mapped to different public
        addresses as illustrated in the content of the PCP messages listed
        below.</t>

        <t>The content of PCP messages exchanged between PCP client 1 and the
        PCP server is as follows:</t>

        <t><figure anchor="ex11" title="MAP request (PCP Client 1)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: TCP (6)
 Internal Port: 15333
 Suggested External Port: 15333
 Suggested External IP Address: ::ffff:0.0.0.0]]></artwork>
          </figure></t>

        <t><figure anchor="ex12" title="MAP response (PCP Client 1)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 15685
 Protocol: TCP (6)
 Internal Port: 15333
 Assigned External Port: 12000
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>

        <t>The content of PCP messages exchanged between PCP client 2 and the
        PCP server is as follows:</t>

        <t><figure anchor="ex13" title="MAP request  (PCP Client 2)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.2
MAP Request: 
 Mapping Nonce: 59869
 Protocol: UDP (17)
 Internal Port: 12000
 Suggested External Port: 12000
 Suggested External IP Address: ::ffff:0.0.0.0]]></artwork>
          </figure></t>

        <t><figure anchor="ex14" title="MAP response  (PCP Client 2)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 59869
 Protocol: UDP (17)
 Internal Port: 12000
 Assigned External Port: 6000
 Assigned External IP Address: ::ffff:192.0.2.2]]></artwork>
          </figure></t>
      </section>

      <section title="Mapping Nonce Doesn't Match: Base PCP Specification">
        <t>CAUTION: The behavior described in this section is obsoleted by
        <xref target="I-D.cheshire-pcp-unsupp-family"></xref>. This section
        records the behavior as initially specified the base PCP specification
        <xref target="RFC6887"></xref>.</t>

        <t>This example illustrates the content of exchanged PCP messages when
        the PCP client does not include any PCP Option in its request. In this
        example, the PCP client indicates a distinct Mapping Nonce than the
        one stored by the PCP server. In reference to <xref
        target="create"></xref>, the content of exchanged PCP messages is as
        follows:</t>

        <t><figure anchor="ex15"
            title="MAP request (Mapping Nonce Doesn't Match)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 45687
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>

        <t><figure anchor="ex16"
            title="MAP response (Mapping Nonce Doesn't Match)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: NOT_AUTHORIZED (0x02)
Lifetime: 35550 sec
Epoch Time: 1300
]]></artwork>
          </figure></t>

        <t></t>
      </section>

      <section title="Mapping Nonce Doesn't Match: Updated Specification">
        <t>Nonce validation checks are problematic in various scenarios as
        discussed in <xref target="I-D.cheshire-pcp-unsupp-family"></xref>. As
        a consequence, the nonce validation checks are relaxed as follows: If
        operating in the Simple Threat Model (Section 18.1 of the PCP
        specification [RFC6887]), and the internal port, protocol, internal
        address, and external address family match an existing explicit
        dynamic mapping, but the mapping nonce does not match, then the
        existing mapping is not modified in any way, and a valid PCP reply is
        returned to the client, using the client-specified nonce, reporting
        the external address, port, and remaining lifetime of the existing
        mapping. An example is shown in <xref target="ex28r"></xref> and<xref
        target="ex2"> </xref>.</t>

        <t>The request shown in <xref target="ex28r"></xref> matches an
        existing mapping (see <xref target="ex2"></xref>). Even if the nonce
        of the exiting mapping does not match the one indicated in the
        request, a positive answer is returned to the requesting PCP client
        without any change to the existing mapping. The nonce of the existing
        mapping (i.e., 15685) is not returned in the response.</t>

        <t><figure anchor="ex28r" title="MAP request">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 45687
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>

        <figure anchor="ex28res" title="MAP response">
          <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 10000 sec
Epoch Time: 3500
MAP Response:
 Mapping Nonce: 45687
 Protocol: UDP (17)
 Internal Port: 3938
 Assigned External Port: 3938
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
        </figure>

        <t></t>
      </section>

      <section anchor="FAILURE_OK"
               title="PREFER_FAILURE Option: Requested Port is Honored">
        <t>This flow shows an example of the content of PCP messages that will
        be exchanged to create a mapping in a PCP-controlled device. In this
        example, the PCP client indicates a requested external UDP port number
        and also a PREFER_FAILURE Option. In this example, we suppose the
        requested port can be honored by the PCP server. In reference to <xref
        target="create"></xref>, the content of exchanged PCP messages is as
        follows:</t>

        <t><figure anchor="ex17"
            title="MAP request ( PREFER_FAILURE Option: Requested Port is Honored)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 1234
 Suggested External Port: 12536
 Suggested External IP Address: ::ffff:0.0.0.0
Option Code: PREFER_FAILURE (0x02) Option Length: 0 bytes Data: (NULL)]]></artwork>
          </figure></t>

        <t><figure anchor="ex18"
            title="MAP response ( PREFER_FAILURE Option: Requested Port is Honored)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 36000 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 1234
 Assigned External Port: 12536
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>
      </section>

      <section anchor="FAILURE_NOK"
               title="PREFER_FAILURE Option: Requested Port is not Honored">
        <t>This flow shows an example of the content of PCP messages that will
        be exchanged to create a mapping in a PCP-controlled device. In this
        example, the PCP client indicates a requested external UDP port number
        and also a PREFER_FAILURE Option. In this example, we suppose the
        requested port cannot be honored by the PCP server. In reference to
        <xref target="create"></xref>, the content of exchanged PCP messages
        is as follows:</t>

        <t><figure anchor="ex19"
            title="MAP request (PREFER_FAILURE Option: Requested Port is not Honored)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 1234
 Suggested External Port: 1234
 Suggested External IP Address: ::ffff:0.0.0.0
Option Code: PREFER_FAILURE (0x02) Option Length: 0 bytes Data: (NULL)]]></artwork>
          </figure></t>

        <t><figure anchor="ex20"
            title="MAP response (PREFER_FAILURE Option: Requested Port is not Honored)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: CANNOT_PROVIDE_EXTERNAL (0x11)
Lifetime: 1560 sec
Epoch Time: 1300]]></artwork>
          </figure></t>
      </section>

      <section title="Negative Impact of PREFER_FAILURE Option">
        <t>The presence of PREFER_FAILURE option in a request may have
        negative impact on an application which does not require it. <xref
        target="pref"></xref> shows two examples:<list style="numbers">
            <t>With PREFER_FAILURE option: several round trips are needed for
            the client to retrieve the requested mapping.</t>

            <t>Without PREFER_FAILURE option: the client retrieves a mapping
            without any extra delay.</t>
          </list></t>

        <t><figure align="center" anchor="pref"
            title="Negative Impact of the mis-usage of PREFER_FAILURE option">
            <artwork><![CDATA[    (1) PREFER_FAILURE Option        (2) No PREFER_FAILURE Option

+------+                  +------+ +------+                  +------+
| PCP  |                  |  PCP | | PCP  |                  |  PCP |
|Client|                  |Server| |Client|                  |Server|
+------+                  +------+ +------+                  +------+
 |       PCP MAP Request      |      |       PCP MAP Request      |
 |Suggested External Port=8080|      |Suggested External Port=8080|
 |       PREFER_FAILURE       |      |--------------------------->|
 |--------------------------->|      |                            |
 |      PCP MAP Response      |      |       PCP MAP Response     |
 |   CANNOT_PROVIDE_EXTERNAL  |      |Assigned External Port=6598 |
 |<---------------------------|      |<---------------------------|
 |                            |      |          TCP SYN           |
 |       PCP MAP Request      |      |--------------------------->|
 |Suggested External Port=5485|
 |       PREFER_FAILURE       |
 |--------------------------->|
 |      PCP MAP Response      |
 |   CANNOT_PROVIDE_EXTERNAL  |
 |<---------------------------|
                ....
 |       PCP MAP Request      |
 |Suggested External Port=6591|
 |       PREFER_FAILURE       |
 |--------------------------->|
 |      PCP MAP Response      |
 |   CANNOT_PROVIDE_EXTERNAL  |
 |<---------------------------|
 
]]></artwork>
          </figure></t>
      </section>

      <section title="Existing Implicit Mapping">
        <t>This example illustrates the content of exchanged PCP messages when
        the PCP client requests a mapping which matches an existing implicit
        dynamic mapping (see <xref target="create_syn"></xref>). In this
        example, the PCP-Controlled device assigns 10000 as external port
        number when translating the packet from the client having with source
        port set to 1234.</t>

        <t>This behavior is specified in Section 11.3 of <xref
        target="RFC6887"></xref>.</t>

        <t><figure align="center" anchor="create_syn"
            title="Example of creating a mapping">
            <preamble></preamble>

            <artwork><![CDATA[+------+                           +------+
| PCP  |                           | PCP  |
|Client|                           |Server|
+------+                           +------+
    |      (a) TCP SYN(src:1234)       |
    |--------------------------------->|
    |      (1) PCP MAP Request         |
    |--------------------------------->|
    |      (2) PCP MAP Response        |
    |<---------------------------------|
    |                                  |

]]></artwork>

            <postamble></postamble>
          </figure>In reference to <xref target="create"></xref>, the content
        of exchanged PCP messages is as follows:</t>

        <t><figure anchor="ex22"
            title="MAP request (Existing Implicit Mapping)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: TCP (0x06)
 Internal Port: 1234
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:0.0.0.0]]></artwork>
          </figure></t>

        <t><figure anchor="ex23"
            title="MAP response (Existing Implicit Mapping)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 15685
 Protocol: TCP (0x06)
 Internal Port: 1234
 Assigned External Port: 10000
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>
      </section>

      <section title="Shortening a Mapping Lifetime in the Presence of Client-Originated Traffic">
        <t><xref target="exist"></xref> shows an example illustrating the
        impact of requesting the deletion of a mapping in the presence of
        traffic originated from the client. In this example, the PCP server
        does not remove the requested mapping immediately; the returned
        lifetime is set to the remaining lifetime.</t>

        <t>This behavior is specified in Section 15 of <xref
        target="RFC6887"></xref>.</t>

        <t><figure align="center" anchor="exist"
            title="Shortening a Mapping Lifetime in the Presence of Client-Originated Traffic">
            <preamble></preamble>

            <artwork><![CDATA[+------+                  +---------------------+
| PCP  |                  |    PCP server       |
|Client|                  |PCP-Controlled Device|
+------+                  +---------------------+
    |                                  |
    |=========Traffic==================|===========> 
    |   PCP MAP Request (Lifetime=0)   |
    |--------------------------------->|
    |  PCP MAP Response (Lifetime=     |
    |          remaining idle-timeout) |
    |<---------------------------------|
    |<========Traffic==================|<========== 
    |                                  |

]]></artwork>

            <postamble></postamble>
          </figure></t>
      </section>

      <section title="Create a Mapping for All Incoming Traffic of a Given Protocol">
        <t>This example illustrates the content of the PCP MAP request to
        create a mapping for all incoming traffic of a given protocol (UDP is
        used in this example).</t>

        <t><figure anchor="ex24"
            title="MAP request (Create a mapping for all incoming traffic of a given protocol)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 0
 Suggested External Port: 0
 Suggested External IP Address: ::ffff:0.0.0.0]]></artwork>
          </figure></t>

        <t>The PCP server may honor the request or reject it by sending
        UNSUPP_PROTOCOL (0x09) error.</t>

        <t></t>
      </section>

      <section title="Create a Mapping for All Protocols">
        <t>This example illustrates the content of the PCP MAP request to
        create a mapping for the traffic of all protocols.</t>

        <t><figure anchor="ex25"
            title="MAP request (Create a mapping for all protocols)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: ANY (0)
 Internal Port: 0
 Suggested External Port: 0
 Suggested External IP Address: ::ffff:0.0.0.0]]></artwork>
          </figure></t>

        <t>The PCP server may honor the request or reject it by sending
        UNSUPP_PROTOCOL (0x09) error.</t>
      </section>

      <section title="Malformed Request">
        <t>This flow shows an example of the content of PCP messages that will
        be exchanged when a malformed request is received by the PCP server.
        In this example, the Protocol field is set to null.</t>

        <t><figure anchor="ex26" title="MAP request (Malformed Request)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 45698
 Protocol: ANY (0)
 Internal Port: 5698
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:0.0.0.0
Option Code: PREFER_FAILURE (0x02) Option Length: 0 bytes Data: (NULL)]]></artwork>
          </figure></t>

        <t><figure anchor="ex27" title="MAP response (Malformed Request)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: MALFORMED_REQUEST (0x02)
Lifetime: 0 sec
Epoch Time: 1300
]]></artwork>
          </figure></t>
      </section>

      <section title="Exceeded Port Quota">
        <t>This flow shows an example of the content of PCP messages that will
        be exchanged when a per-user quota is reached. A short lifetime is
        returned so that the client may retry and see if the request can be
        honored because another state has been removed.</t>

        <t><figure anchor="ex28" title="MAP request (Exceeded Port Quota)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 45698
 Protocol: UDP (17)
 Internal Port: 8695
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:0.0.0.0
Option Code: PREFER_FAILURE (0x02) Option Length: 0 bytes Data: (NULL)]]></artwork>
          </figure></t>

        <t><figure anchor="ex29" title="MAP response (Exceeded Port Quota)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: USER_EX_QUOTA (10)
Lifetime: 300 sec
Epoch Time: 1300
]]></artwork>
          </figure></t>
      </section>

      <section title="Unsupported Address Family">
        <t>This flow shows an example of the content of PCP messages that will
        be exchanged when the requested external address family is not
        supported by the PCP server. In this example, IPv6 is indicated as the
        requested AF. The PCP server answers with an UNSUPP_FAMILY (14) error
        as defined in <xref
        target="I-D.cheshire-pcp-unsupp-family"></xref>.</t>

        <t><figure anchor="ex217r"
            title="MAP request (Unsupported Address Family)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 45698
 Protocol: UDP (17)
 Internal Port: 8695
 Suggested External Port: 3938
 Suggested External IP Address: ::
]]></artwork>
          </figure></t>

        <t><figure anchor="ex217re"
            title="MAP response (Unsupported Address Family)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: UNSUPP_FAMILY (14)
Lifetime: 0 sec
Epoch Time: 1300
]]></artwork>
          </figure></t>

        <t></t>

        <t></t>
      </section>

      <section title="Unsupported Protocol">
        <t>This flow shows an example of the content of PCP messages that will
        be exchanged when the requested port is not supported by the PCP
        server. In this example, SCTP is indicated as the requested
        protocol.</t>

        <t><figure anchor="ex30" title="MAP request (Unsupported Protocol)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 45698
 Protocol: SCTP (132)
 Internal Port: 8695
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:0.0.0.0
]]></artwork>
          </figure></t>

        <t><figure anchor="ex31" title="MAP response (Unsupported Protocol)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: UNSUPP_PROTOCOL (9)
Lifetime: 0 sec
Epoch Time: 1300
]]></artwork>
          </figure></t>
      </section>

      <section title="Unsolicited MAP Response">
        <t>Suppose the client has instructed a UDP mapping for port 3938
        (assigned external port is 15000 and assigned external IPv4 address
        is: 192.0.2.1). Upon a change of a state: e.g., change of the external
        IP Address, the PCP server issues an unsolicited MAP response. The
        content of the MAP response sent by the PCP server is shown below. The
        PCP client is now aware of the new assigned external IP address.</t>

        <t><figure anchor="ex32" title="Unsolicited MAP Response">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 15685
 Protocol: TCP (0x06)
 Internal Port: 1234
 Assigned External Port: 10000
 Assigned External IP Address: ::ffff:192.0.2.2]]></artwork>
          </figure></t>
      </section>

      <section title="Mapping Repair">
        <t>An example of mapping repair is shown in <xref
        target="repair"></xref>.</t>

        <t><figure align="center" anchor="repair"
            title="Flow Example of a PING/PONG exchange: Check the availability of the PCP Server">
            <artwork><![CDATA[+------+                      +------+
| PCP  |                      | PCP  |
|Client|                      |Server|
+------+                      +------+
    |     (1) PCP ANNOUNCE        |
    |<----------------------------|
    |     (2) PCP MAP REQUEST     |
    |---------------------------->|
    |     (3) PCP MAP RESPONSE    |
    |<----------------------------|
    |                             |

]]></artwork>
          </figure></t>

        <t><figure anchor="ex33" title="Unsolicited ANNOUNCE">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: ANNOUNCE (0x00)
Result Code: 0
Lifetime: 0 sec
Epoch Time: 0
]]></artwork>
          </figure></t>

        <t><figure anchor="ex34" title="MAP request (Mapping Repair)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 11000
 Assigned External Port: 15200
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>

        <t><figure anchor="ex35" title="MAP response (Mapping Repair)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 10
MAP Response: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 11000
 Assigned External Port: 15200
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
          </figure></t>

        <t></t>
      </section>
    </section>

    <section title="NAT Detect Example">
      <t>Let us suppose a PCP-unaware NAT is located between the PCP server
      and the PCP client. An example of PCP MAP request issued by the PCP
      client is shown below.</t>

      <t><figure anchor="ex36" title="MAP request (NAT Detect)">
          <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 11000
 Assigned External Port: 15200
 Assigned External IP Address: ::ffff:0.0.0.0]]></artwork>
        </figure>This message will be translated by the PCP-unaware NAT. The
      source IP address if the resulting message will be another address than
      198.51.100.1. Upon receipt of this message, the PCP server compares the
      source IP address and the content of PCP client's IP Address field.
      Because the two addresses are not equal, the PCP server concludes there
      is PCP-unaware device in the path. As a result, the PCP server will
      issue the following error message:</t>

      <t><figure anchor="ex37" title="MAP Response (NAT Detect)">
          <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: ADDRESS_MISMATCH (12)
Lifetime: 0 sec
Epoch Time: 36000
]]></artwork>
        </figure></t>

      <t>This behavior is specified in Section 8.2 of <xref
      target="RFC6887"></xref>.</t>
    </section>

    <section title="Retrieve the External IP Address">
      <t>In order to retrieve the IP address used on the external side of the
      PCP-controlled device, the PCP client sends a short-lived mapping (e.g.,
      Discard service (TCP/9 or UDP/9) or other port). The returned IP address
      can be displayed by any application requiring such information.</t>

      <t><figure anchor="ex38"
          title="MAP request (Retrieve the External IP Address)">
          <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 5 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 9
 Suggested External Port: 9
 Suggested External IP Address: ::ffff:0.0.0.0]]></artwork>
        </figure></t>

      <t><figure anchor="ex39"
          title="MAP Response (Retrieve the External IP Address)">
          <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 60 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 9
 Suggested External Port: 9
 Assigned External IP Address: ::ffff:192.0.2.1]]></artwork>
        </figure></t>

      <t>This behavior is specified in Section 11.6 of <xref
      target="RFC6887"></xref>.</t>
    </section>

    <section title="THIRD_PARTY Examples">
      <t>These examples follow the behavior specified in Section 13.1 of <xref
      target="RFC6887"></xref>.</t>

      <section title="THIRD_PARTY Enabled at the Server Side">
        <t>The following messages are exchanged when the THIRD_PARTY option is
        enabled in the PCP server side. In this example the PCP client creates
        a mapping for the host assigned with 198.51.100.2.</t>

        <t><figure anchor="ex40" title="MAP request with THIRD_PARTY">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 16584
 Protocol: UDP (17)
 Internal Port: 8080
 Suggested External Port: 8080
 Suggested External IP Address: ::ffff:0.0.0.0
Option Code: THIRD_PARTY (0x01) Option Length: 16 bytes Data:
            ::ffff:198.51.100.2
]]></artwork>
          </figure></t>

        <t><figure anchor="ex41" title="MAP Response with THIRD_PARTY">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 16584
 Protocol: UDP (17)
 Internal Port: 8080
 Assigned External Port: 15000
 Assigned External IP Address: ::ffff:161.105.194.14
Option Code: THIRD_PARTY (0x01) Option Length: 16 bytes Data:
            ::ffff:198.51.100.2]]></artwork>
          </figure></t>

        <t></t>
      </section>

      <section title="THIRD_PARTY Disabled at the Server Side">
        <t>The following messages are exchanged when the THIRD_PARTY option is
        disabled in the PCP server side. In this example the PCP client tries
        to create a mapping for the host assigned with 198.51.100.2.</t>

        <t><figure anchor="ex42" title="MAP request with THIRD_PARTY">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 16584
 Protocol: UDP (17)
 Internal Port: 8080
 Suggested External Port: 8080
 Suggested External IP Address: ::ffff:0.0.0.0
Option Code: THIRD_PARTY (0x01) Option Length: 16 bytes Data:
            ::ffff:198.51.100.2
]]></artwork>
          </figure></t>

        <t><figure anchor="ex43" title="MAP Response with THIRD_PARTY">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: UNSUPP_OPTION (0x05)
Lifetime: 0 sec
Epoch Time: 1562]]></artwork>
          </figure></t>
      </section>

      <section title="Malformed Request">
        <t>In this example the PCP client inserts a THIRD_PARTY option which
        include the IP address of the PCP client.</t>

        <t><figure anchor="ex44" title="MAP request with THIRD_PARTY">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 16584
 Protocol: UDP (17)
 Internal Port: 8080
 Suggested External Port: 8080
 Suggested External IP Address: ::ffff:0.0.0.0
Option Code: THIRD_PARTY (0x01) Option Length: 16 bytes Data:
            ::ffff:198.51.100.1
]]></artwork>
          </figure></t>

        <t><figure anchor="ex45" title="MAP Response with THIRD_PARTY">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: MALFORMED_REQUEST (0x03)
Lifetime: 0 sec
Epoch Time: 1562
]]></artwork>
          </figure></t>

        <t></t>
      </section>
    </section>

    <section title="MAP with FILTER Examples">
      <t>These examples follow the behavior specified in Section 13.3 of <xref
      target="RFC6887"></xref>.</t>

      <section title="Basic Filter Usage">
        <t>This example illustrates the content of exchanged PCP messages when
        the PCP client wants to receive traffic only from 192.0.2.200:5968. In
        reference to <xref target="create"></xref>, the content of exchanged
        PCP messages is as follows:</t>

        <t><figure anchor="ex46" title="MAP request (Basic Filter Usage)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:0.0.0.0
Option Code: FILTER (0x03) Option Length: 20 bytes Data:
            Prefix Length: 128
            Remote Peer Port: 5968
            Remote Peer IP Address: ::ffff:192.0.2.200]]></artwork>
          </figure></t>

        <t><figure anchor="ex47" title="MAP Response (Basic Filter Usage)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Assigned External Port: 3938
 Assigned External IP Address: ::ffff:192.0.2.1
Option Code: FILTER (0x03) Option Length: 20 bytes Data:
            Prefix Length: 128
            Remote Peer Port: 5968
            Remote Peer IP Address: ::ffff:192.0.2.200]]></artwork>
          </figure></t>
      </section>

      <section title="Remove All Filters">
        <t>This example illustrates the content of exchanged PCP messages when
        the PCP client wants to remove all filters. In reference to <xref
        target="create"></xref>, the content of exchanged PCP messages is as
        follows:</t>

        <t><figure anchor="ex49" title="MAP request (Remove All Filters)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:0.0.0.0
Option Code: FILTER (0x03) Option Length: 20 bytes Data:
            Prefix Length: 0
            Remote Peer Port: 0
            Remote Peer IP Address: ::ffff:0:0
]]></artwork>
          </figure></t>

        <t><figure anchor="ex50" title="MAP response (Remove All Filters)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
MAP Response: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Assigned External Port: 3938
 Assigned External IP Address: ::ffff:192.0.2.1
Option Code: FILTER (0x03) Option Length: 20 bytes Data:
            Prefix Length: 0
            Remote Peer Port: 0
            Remote Peer IP Address: ::ffff:0:0
]]></artwork>
          </figure></t>
      </section>

      <section title="Change an Existing Filter">
        <t>This example illustrates the content of exchanged PCP messages when
        the PCP client wants to change an existing filter. In reference to
        <xref target="create"></xref>, the content of exchanged PCP messages
        is as follows:</t>

        <t><figure anchor="ex51"
            title="MAP request (Change an Existing Filter)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:0.0.0.0
Option Code: FILTER (0x03) Option Length: 20 bytes Data:
            Prefix Length: 0
            Remote Peer Port: 0
            Remote Peer IP Address: ::ffff:0:0
Option Code: FILTER (0x03) Option Length: 20 bytes Data:
            Prefix Length: 128
            Remote Peer Port: 5968
            Remote Peer IP Address: ::ffff:192.0.2.201
]]></artwork>
          </figure></t>

        <t></t>
      </section>
    </section>

    <section title="Assess the Reachability of the PCP Server">
      <t>In this example, the PCP client issues a PCP ANNOUNCE request to a
      PCP server. Once received by the PCP server, since it is configured to
      reply to such request, it sends back a PCP ANNOUNCE response. This
      procedure can be used to retrieve the Epoch time. <figure align="center"
          anchor="announce"
          title="Flow example of a PING/PONG exchange: Check the availability of the PCP server">
          <preamble></preamble>

          <artwork><![CDATA[+------+                      +------+
| PCP  |                      | PCP  |
|Client|                      |Server|
+------+                      +------+
    |   (1) PCP ANNOUNCE REQUEST  |
    |---------------------------->|
    |   (2) PCP ANNOUNCE RESPONSE |
    |<----------------------------|
    |                             |

]]></artwork>

          <postamble></postamble>
        </figure></t>

      <t><figure anchor="ex52"
          title="ANNOUNCE request (Assess the Reachability of the PCP Server)">
          <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: ANNOUNCE (0x00)
Requested Lifetime: 0 sec
PCP client's IP Address: ::ffff:198.51.100.1
]]></artwork>
        </figure></t>

      <t><figure anchor="ex53"
          title="ANNOUNCE response (Assess the Reachability of the PCP Server)">
          <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: ANNOUNCE (0x00)
Result Code: 0
Lifetime: 0 sec
Epoch Time: 3600
]]></artwork>
        </figure></t>

      <t></t>
    </section>

    <section title="PEER Operations">
      <t>The following figure illustrates the messages which are exchanged
      when PEER opcode is used:</t>

      <t><figure align="center" anchor="peer"
          title="Typical usage of PEER message">
          <artwork><![CDATA[+------+                           +------+
| PCP  |                           | PCP  |
|Client|                           |Server|
+------+                           +------+
    |      (1) PCP PEER Request        |
    |--------------------------------->|
    |      (2) PCP PEER Response       |
    |<---------------------------------|
    |                                  |

]]></artwork>
        </figure></t>

      <t>Examples listed below follow the behavior specified in Section 12.2
      and Section 12.3 of <xref target="RFC6887"></xref>.</t>

      <section title="No Mapping Exists for the Internal Port Number">
        <t>In reference to <xref target="peer"></xref>, the content of
        exchanged PEER messages when no mapping is maintained by the PCP
        server for the indicated external port number:</t>

        <t><figure anchor="ex54"
            title="PEER request (No Mapping Exists for the Internal Port Number)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: PEER (0x02)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
PEER Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:0.0.0.0
 Remote Peer Port: 12456
 Remote IP Address: ::ffff:198.51.100.2
]]></artwork>
          </figure></t>

        <t><figure anchor="ex55"
            title="PEER response (No Mapping Exists for the Internal Port Number)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: PEER (0x02)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
PEER Response: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Assigned External Port: 3938
 Assigned External IP Address: ::ffff:192.0.2.1
 Remote Peer Port: 12456
 Remote IP Address: ::ffff:198.51.100.2]]></artwork>
          </figure></t>

        <t></t>
      </section>

      <section title="A Mapping Exists for the External Port Number">
        <t>In reference to <xref target="peer"></xref>, the content of
        exchanged PEER messages when a mapping is maintained by the PCP server
        for the indicated external port number:</t>

        <t><figure anchor="ex56"
            title="PEER request (A Mapping Exists for the External Port Number)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: PEER (0x02)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
PEER Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:0.0.0.0
 Remote Peer Port: 12456
 Remote IP Address: ::ffff:198.51.100.2
]]></artwork>
          </figure></t>

        <t><figure anchor="ex57"
            title="PEER response (A Mapping Exists for the External Port Number)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: PEER (0x02)
Result Code: CANNOT_PROVIDE_EXTERNAL
Lifetime: 0 sec
Epoch Time: 36000
]]></artwork>
          </figure></t>
      </section>

      <section title="External IP Address Cannot be Honored">
        <t>In reference to <xref target="peer"></xref>, the content of
        exchanged PEER messages when the suggested external IP address does
        not match an existing mapping is shown below:</t>

        <t><figure anchor="ex58"
            title="PEER request (External IP Address Cannot be Honored)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: PEER (0x02)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
PEER Request: 
 Mapping Nonce: 15685
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:192.0.2.5
 Remote Peer Port: 12456
 Remote IP Address: ::ffff:198.51.100.2
]]></artwork>
          </figure></t>

        <t><figure anchor="ex59"
            title="PEER response (External IP Address Cannot be Honored)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: PEER (0x02)
Result Code: CANNOT_PROVIDE_EXTERNAL
Lifetime: 0 sec
Epoch Time: 36000
]]></artwork>
          </figure></t>
      </section>

      <section title="Extend the Lifetime">
        <t>In reference to <xref target="peer_syn"></xref>, the content of
        exchanged PEER messages to extend the lifetime of a mapping.</t>

        <t><figure align="center" anchor="peer_syn"
            title="Example of creating a mapping">
            <preamble></preamble>

            <artwork><![CDATA[+------+                           +------+
| PCP  |                           | PCP  |
|Client|                           |Server|
+------+                           +------+
    |      (a) TCP SYN(src:3938)       |
    |--------------------------------->|
    |      (1) PCP PEER Request        |
    |--------------------------------->|
    |      (2) PCP PEER Response       |
    |<---------------------------------|
    |                                  |

]]></artwork>

            <postamble></postamble>
          </figure></t>

        <t></t>

        <t><figure anchor="ex60" title="PEER request (Extend the Lifetime) ">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: PEER (0x02)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
PEER Request: 
 Mapping Nonce: 15685
 Protocol: TCP (6)
 Internal Port: 3938
 Suggested External Port: 0
 Suggested External IP Address: ::ffff:0.0.0.0
 Remote Peer Port: 12456
 Remote IP Address: ::ffff:198.51.100.2
]]></artwork>
          </figure></t>

        <t><figure anchor="ex61" title="PEER response (Extend the Lifetime)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: PEER (0x02)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
PEER Response:
 Mapping Nonce: 15685
 Protocol: TCP (6)
 Internal Port: 3938
 Assigned External Port: 11000
 Assigned External IP Address: ::ffff:192.0.2.1
 Remote Peer Port: 12456
 Remote IP Address: ::ffff:198.51.100.2]]></artwork>
          </figure></t>
      </section>

      <section title="Learn the Lifetime of a Mapping">
        <t>In reference to <xref target="peer_syn"></xref>, the content of
        exchanged PEER messages to learn the lifetime of a mapping is shown
        below:</t>

        <t><figure anchor="ex62"
            title="PEER request (Learn the Lifetime of a Mapping)">
            <artwork><![CDATA[Version: 2
R bit: Request (0)
opcode: PEER (0x02)
Requested Lifetime: 5 sec
PCP client's IP Address: ::ffff:198.51.100.1
PEER Request: 
 Mapping Nonce: 15685
 Protocol: TCP (6)
 Internal Port: 3938
 Suggested External Port: 0
 Suggested External IP Address: ::ffff:0.0.0.0
 Remote Peer Port: 12456
 Remote IP Address: ::ffff:198.51.100.2
]]></artwork>
          </figure></t>

        <t><figure anchor="ex63"
            title="PEER response (Learn the Lifetime of a Mapping)">
            <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: PEER (0x02)
Result Code: 0
Lifetime: 20000 sec
Epoch Time: 1250
PEER Response: 
 Mapping Nonce: 15685
 Protocol: TCP (6)
 Internal Port: 3938
 Assigned External Port: 11000
 Assigned External IP Address: ::ffff:192.0.2.1
 Remote Peer Port: 12456
 Remote IP Address: ::ffff:198.51.100.2]]></artwork>
          </figure></t>
      </section>
    </section>

    <section title="Version Negotiation">
      <t>The following exchange occurs between a PCP client that supports PCP
      version 1 and the PCP server that supports PCP version 2.</t>

      <t><figure anchor="ex64" title="MAP request with Version 1">
          <artwork><![CDATA[Version: 1
R bit: Request (0)
opcode: MAP (0x01)
Requested Lifetime: 36000 sec
PCP client's IP Address: ::ffff:198.51.100.1
MAP Request: 
 Protocol: UDP (17)
 Internal Port: 3938
 Suggested External Port: 3938
 Suggested External IP Address: ::ffff:0.0.0.0
]]></artwork>
        </figure></t>

      <t><figure anchor="ex65" title="MAP response (Unsupported Version)">
          <artwork><![CDATA[Version: 2
R bit: Response (1)
opcode: MAP (0x01)
Result Code: UNSUPP_VERSION (1)
Lifetime: 0 sec
Epoch Time: 3600
]]></artwork>
        </figure></t>

      <t>Version negotiation is specified in Section 9 of <xref
      target="RFC6887"></xref>.</t>
    </section>

    <section title="Security Considerations">
      <t>PCP security considerations are discussed in <xref
      target="RFC6887"></xref>.</t>
    </section>

    <section title="IANA Considerations">
      <t>This document has no IANA actions.</t>
    </section>

    <section title="Acknowledgements">
      <t>Many thanks to C. Jacquenet and D. Wing for the comments.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include='reference.RFC.6887'?>

      <?rfc include='reference.RFC.5737'?>

      <?rfc include='reference.RFC.3849'?>

      <?rfc include='reference.RFC.7220'?>

      <?rfc include='reference.RFC.7225'?>
    </references>

    <references title="Informative References">
      <?rfc include='reference.I-D.cheshire-pcp-unsupp-family'?>
    </references>
  </back>
</rfc>
