<?xml version="1.0"?>
<?xml-stylesheet type='text/xsl'
	href='http://xml.resource.org/authoring/rfc2629.xslt' ?>

<?rfc strict='no' ?>
<?rfc toc='yes' ?>
<?rfc symrefs='yes' ?>
<?rfc editing='no' ?>

<?rfc include='ocp-core-entities.xml' ?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd">

<rfc ipr="full2026" docName="draft-ietf-opes-ocp-core">


<front>
	<title>OPES Callout Protocol Core</title>

	<?rfc include='author.rousskov.xml' ?>

	<date day="3" month="May" year="2004" />

	<area>Applications</area>
	<workgroup>Open Pluggable Edge Services</workgroup>
	<keyword>Internet-Draft</keyword>
	<keyword>callout server</keyword>
	<keyword>callout protocol</keyword>
	<keyword>OPES dispatcher</keyword>

	<abstract>

		<t>This document specifies the core of the Open Pluggable Edge
		Services (OPES) Callout Protocol (OCP). OCP marshals application
		messages from other communication protocols: an OPES intermediary
		sends original application messages to a callout server; the callout
		server sends adapted application messages back to the processor. OCP
		is designed with typical adaptation tasks in mind (e.g., virus and
		spam management, language and format translation, message
		anonymization, or advertisement manipulation). OCP Core defined in
		this document consists of application-agnostic mechanisms essential
		for efficient support of typical adaptations.</t>

	</abstract>

</front>

<middle>

<section anchor="intro" title="Introduction">

	<t>The Open Pluggable Edge Services (OPES) architecture <xref
	target="I-D.ietf-opes-architecture" />, enables cooperative application
	services (OPES services) between a data provider, a data consumer, and
	zero or more OPES processors.  The application services under
	consideration analyze and possibly transform application-level messages
	exchanged between the data provider and the data consumer.</t>

	<t>The OPES processor can delegate the responsibility of service execution
	by communicating with callout servers.  As described in <xref
	target="I-D.ietf-opes-protocol-reqs" />, an OPES processor invokes and
	communicates with services on a callout server by using an OPES callout
	protocol (OCP). This document specifies the core of that protocol.</t>

	<t>OCP Core specification documents general, application-independent
	protocol mechanisms. A separate series of documents describe
	application-specific aspects of OCP. For example, <xref
	target="I-D.ietf-opes-http">"HTTP adaptation with OPES"</xref> describes,
	in part, how HTTP messages and HTTP meta-information can be communicated
	over OCP.</t>

	<t><xref target="section_opes-map" /> provides a brief overview of the
	entire OPES document collection, including documents describing OPES use
	cases and security threats.</t>

<section anchor="proxies-scope" title="Scope">

	<t>OCP Core specification documents behavior of OCP agents and
	requirements for OCP extensions. OCP Core does not contain requirements or
	mechanisms specific for application protocols being adapted.</t>

	<t>As an application proxy, OPES processor proxies a single application
	protocol or converts from one application protocol to another. At the same
	time, OPES processor may be an OCP client, using OCP to facilitate
	adaptation of proxied messages at callout servers. It is therefore natural
	to assume that an OPES processor takes application messages being proxied,
	marshals them over OCP to callout servers, and then puts the adaptation
	results back on the wire. However, such an assumption implies that OCP is
	applied directly to application messages that OPES processor is proxing,
	which may not be the case.</t>

	<t><figure>
		<artwork><?rfc include='art.scope.xml' ?></artwork>
	</figure></t>

	<t>An OPES processor may preprocess (or postprocess) proxied application
	messages before (or after) they are adapted at callout servers. For
	example, a processor may take an HTTP response being proxied and pass it
	as is, along with metadata about the corresponding HTTP connection.
	Another processor may take an HTTP response, extract its body, and pass
	that body, along with the content-encoding metadata.  Moreover, to perform
	adaptation, OPES processor may execute several callout services, iterating
	over several callout servers. Such preprocessing, postprocessing, and
	iterations make it impossible to rely on any specific relationship between
	application messages being proxied and application messages being sent to
	a callout service. Similarly, specific adaptation actions at the callout
	server are outside of OCP Core scope.</t>

	<t>This specification does not define or require any specific relationship
	among application messages being proxied by an OPES processor and
	application messages being exchanged between an OPES processor and
	a callout server via OCP. OPES processor usually provides some mapping
	among these application messages, but processor's specific actions are
	beyond OCP scope. In other words, this specification is not concerned with
	the OPES processor role as an application proxy, or as an iterator of
	callout services. The scope of OCP Core is communication between a single
	OPES processor and a single callout server.</t>

	<t>Furthermore, an OPES processor is at liberty to choose which proxied
	application messages or information about them to send over OCP.  All
	proxied messages on all proxied connections (if connections are defined
	for a given application protocol), everything on some connections,
	selected proxied messages, or nothing might be sent over OCP to callout
	servers.  OPES processor and callout server state related to proxied
	protocols can be relayed over OCP as application message metadata.</t>

</section>

<section anchor="section_opes-map" title="OPES Document Map">

	<t>This document belongs to a large set of OPES specifications produced by
	the IETF OPES Working Group. Familiarity with the overall OPES approach
	and typical scenarios is often essential when trying to comprehend
	isolated OPES documents. This section provides an index of OPES documents
	to assist the reader with finding "missing" information.</t>

	<t><list style="symbols">

		<t>The document on <xref target="I-D.ietf-opes-scenarios">"OPES
		Use Cases and Deployment Scenarios"</xref> describes a set of services
		and applications that are considered in scope for OPES and have been
		used as a motivation and guidance in designing the OPES
		architecture.</t>

		<t>The OPES architecture and common terminology are described in <xref
		target="I-D.ietf-opes-architecture">"An Architecture for Open
		Pluggable Edge Services (OPES)"</xref>.</t>

		<t><xref target="I-D.ietf-opes-authorization">"Policy,
		Authorization and Enforcement Requirements of OPES"</xref> outlines
		requirements and assumptions on the policy framework, without
		specifying concrete authorization and enforcement methods.</t>

		<t><xref target="I-D.ietf-opes-threats">"Security Threats and
		Risks for OPES"</xref> provides OPES risk analysis, without
		recommending specific solutions.</t>

		<t><xref target="I-D.ietf-opes-iab">"OPES Treatment of IAB Considerations"</xref> 
		addresses all architecture-level considerations expressed by the IETF
		Internet Architecture Board (IAB) when the OPES WG was chartered.</t>

		<t>At the core of the OPES architecture are the OPES processor and the
		callout server, two network elements that communicate with each other
		via an OPES Callout Protocol (OCP). The requirements for such protocol
		are discussed in <xref
		target="I-D.ietf-opes-protocol-reqs">"Requirements for OPES
		Callout Protocols"</xref>.</t>

		<t>This document, OPES Callout Protocol Core, specifies an application
		agnostic protocol core to be used for the communication between OPES
		processor and callout server.</t>

		<t><xref target="I-D.ietf-opes-end-comm">"OPES entities and
		end points communications"</xref> specifies generic tracing and bypass
		mechanisms for OPES.</t>

		<t>The OCP Core and Communications documents are independent from the
		application protocol being adapted by OPES entities. Their generic
		mechanisms have to be complemented by application-specific profiles.
		<xref target="I-D.ietf-opes-http">"HTTP adaptation with
		OPES"</xref> is such an application profile for HTTP.  It specifies
		how application-agnostic OPES mechanisms are to be used and augmented
		in order to support adaptation of HTTP messages.</t>

		<t>Finally, <xref target="I-D.ietf-opes-rules-p">"P: Message
		Processing Language"</xref> defines a language for specifying what
		OPES adaptations (e.g, translation) must be applied to what
		application messages (e.g., e-mail from bob@example.com). P language
		is meant for configuring application proxies (OPES processors).</t>

	</list></t>

</section> <!-- section_opes-map -->


<section anchor="section_terminology" title="Terminology">

	<t>The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
	"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
	document are to be interpreted as described in <xref target="RFC2119" />.
	When used with the normative meanings, these keywords will be all
	uppercase.  Occurrences of these words in lowercase comprise normal prose
	usage, with no normative implications.</t>

	<t>OPES processor works with messages from application protocols and may
	relay information about those application messages to a callout server.
	OCP is also an application protocol. Thus, protocol elements like
	"message", "connection", or "transaction" exist in OCP and other
	application protocols.  In this specification, all references to elements
	from application protocols other than OCP are used with an explicit
	"application" qualifier.  References without the "application" qualifier
	refer to OCP elements.</t>

	<t><list style="hanging">

		<t hangText="OCP message:">OCP message is a basic unit of
		communication between an OPES processor and a callout server. Message
		is a sequence of octets formatted according to <xref
		target="section_message-format">syntax rules</xref>. Message semantics
		is defined in <xref target="section_message-defs" />.</t>

		<t hangText="application message:">An entity defined by OPES processor
		and callout server negotiation. Usually, the negotiated definition
		would match the definition from an application protocol (e.g., <xref
		target="RFC2616" /> definition of an HTTP message).</t>

		<t hangText="application message data:">An opaque sequence of octets
		representing complete or partial application message. OCP Core does
		not distinguish application message structure (if any). Application
		message data may be empty.</t>

		<t hangText="data:">Same as application message data.</t>

		<t hangText="original">Referring to application message flowing from
		the OPES processor to a callout server.</t>

		<t hangText="adapted">Referring to application message
		flowing from an OPES callout server to the OPES processor.</t>

		<t hangText="adaptation:">Any kind of access by a callout server,
		including modification, generation, and copying. For example,
		translating or logging an SMTP message is adaptation of that
		application message.</t>

		<t hangText="agent:">Actor for a given communication protocol. OPES
		processor and callout server are OCP agents. An agent can be referred
		to as a sender or receiver, depending on its actions in a particular
		context.</t>

		<t hangText="immediate:">Performing the specified action before
		reacting to new incoming messages or sending any new messages
		unrelated to the specified action.</t>

		<t hangText="OCP extension:">A specification extending or adjusting
		this document for adaptation of an application protocol (a.k.a.,
		application profile, e.g., <xref target="I-D.ietf-opes-http" />), new
		OCP functionality (e.g., transport encryption and authentication),
		and/or new OCP Core version.</t>

	</list></t>

</section>

</section>


<section anchor="section_operation" title="Overall Operation">

	<t>OPES processor may use OPES callout protocol (OCP) to communicate with
	callout servers. Adaptation using callout services is sometimes called a
	"bump in the wire" architecture.</t>

<section anchor="section_operation_init" title="Initialization">

	<t>OPES processor establishes transport connections with callout servers
	for the purpose of exchanging application messages with the callout
	server(s) using OCP. After a transport-layer connection (usually TCP/IP)
	is established, communicating OCP agents exchange &CS_tref; messages.
	Next, OCP features can be negotiated between the processor and the callout
	server (see <xref target="section_negotiation" />).  For example, OCP
	agents may negotiate transport encryption and application message
	definition.  When enough settings are negotiated, OCP agents may start
	exchanging application messages.</t>

	<t>OCP Core provides negotiation and other mechanisms for agents to
	encrypt OCP connections and authenticate each other. OCP Core does not
	require OCP connection encryption or agent authentication. Application
	profiles and other OCP extensions may document and/or require these and
	other security mechanisms. OCP is expected to be used, in part, in closed
	environments where trust and privacy are established by means external to
	OCP. Implementations are expected to demand necessary security features
	via the OCP Core negotiation mechanism, depending on agent configuration
	and environment.</t>
	

</section> <!-- section_operation_init -->

<section anchor="section_operation_origin" title="Original Dataflow">

	<t>When OPES processor wants to adapt an application message, the OPES
	processor sends a &TS_tref; message to initiate an OCP transaction
	dedicated to that application message. The processor then sends an
	&AMS_tref; message to prepare the callout server for application data that
	will follow.  Once application message scope is established, application
	data can be sent to the callout server, using &DUM_tref; and related OCP
	message(s).  All these messages correspond to the original dataflow.</t>

</section> <!-- section_operation_origin -->

<section anchor="section_operation_adapted" title="Adapted Dataflow">

	<t>The callout server receives data and metadata sent by the OPES
	processor (original dataflow). The callout server analyses metadata and
	adapts data as it comes in. The server usually builds its version of
	metadata and responds to OPES processor with an &AMS_tref; message.
	Adapted application message data can be sent next, using &DUM_tref; OCP
	message(s). The application message is then announced to be "completed" or
	"closed" using an &AME_tref; message. The transaction may be closed using
	a &TE_tref; message as well. All these messages correspond to adapted data
	flow.</t>

	<!-- <t><vspace blankLines="10" /></t> -->

	<t><figure>
		<artwork><?rfc include='art.flows-zoom.xml' ?></artwork>
	</figure></t>

	<t>The OPES processor receives the adapted application message sent by the
	callout server. Other OPES processor actions specific to the application
	message received are out of this specification scope.</t>

</section> <!-- section_operation_adapted -->

<section anchor="section_operation_multim" title="Multiple Application Messages">

	<t>OCP Core specifies transactions interface dedicated to exchanging a
	single original application message and a single adapted application
	message. Some application protocols may require multiple adapted versions
	for a single original application message or even multiple original
	messages to be exchanged as a part of a single OCP transaction. For
	example, a single original e-mail message may need to be transformed into
	several e-mail messages, one custom message for each recipient.</t>

	<t>OCP extensions MAY document mechanisms for exchanging multiple original
	and/or multiple adapted application messages within a single OCP
	transaction.</t>

</section> <!-- section_operation_multim -->

<section anchor="section_operation_term" title="Termination">

	<t>Either OCP agent can terminate application message delivery,
	transaction, or connection by sending an appropriate OCP message.
	Usually, the callout server terminates adapted application message
	delivery and the transaction. Premature and abnormal terminations at
	arbitrary times are supported. The termination message includes a result
	description.</t>

</section> <!-- section_operation_term -->

<section anchor="section_operation_exchange" title="Message Exchange Patterns">

	<t>In addition to messages carrying application data, OCP agents may also
	exchange messages related to their configuration, state, transport
	connections, application connections, etc. A callout server may remove
	itself from the application message processing loop. A single OPES
	processor can communicate with many callout servers and vice versa.
	Though many OCP exchange patterns do not follow a classic client-server
	model, it is possible to think of an OPES processor as an "OCP client"
	and of a callout server as an "OCP server". The OPES architecture <xref
	target="I-D.ietf-opes-architecture">document</xref> describes
	configuration possibilities.</t>

	<t>The following informal rules illustrate relationships between 
	connections, transactions, OCP messages, and application messages:

	<list style="symbols">
	
		<t>An OCP agent may communicate with multiple OCP agents.
		Communication with multiple OCP agents is outside of this
		specification scope.</t>

		<t>An OPES processor may have multiple concurrent OCP connections to a
		callout server. Communication over multiple OCP connections is outside
		of this specification scope.</t>

		<t>A connection may carry multiple concurrent transactions.  A
		transaction is always associated with a single connection (i.e., a
		transaction cannot span multiple concurrent connections).</t>

		<t>A connection may carry at most one message at a time, including
		control messages and transaction-related messages.  A message is
		always associated with a single connection (i.e., a message cannot
		span multiple concurrent connections).</t>

		<t>A transaction is a sequence of messages related to application of a
		given set of callout services to a single application message.  A
		sequence of transaction messages from an OPES processor to a callout
		server is called original flow. A sequence of transaction messages
		from a callout server to an OPES processor is called adapted
		flow. The two flows may overlap in time.</t>

		<t>In OCP Core, a transaction is associated with a single (original)
		and a single (adapted) application message. OCP Core extensions
		may extend transaction scope to more application messages.</t>

		<t>An application message (adapted or original) is transferred
		using a sequence of OCP messages.</t>

	</list></t>

</section> <!-- section_operation_exchange -->

<section anchor="section_operation_tout" title="Timeouts">

	<t>OCP violations, resource limits, external dependencies, and other
	factors may lead to states when an OCP agent is not receiving required
	messages from the other OCP agent. OCP Core defines no messages to address
	such situations. In the absence of any extension mechanism, OCP agents
	must implement timeouts for OCP operations: an OCP agent MUST forcefully
	terminate any OCP connection, negotiation, transaction, etc. that is not
	making progress.  This rule covers both dead- and livelock situations.</t>

	<t>In their implementation, OCP agents MAY rely on transport-level or
	other external timeouts if such external timeouts are guaranteed to happen
	for a given OCP operation.  Depending on the OCP operation, an agent may
	benefit from "pinging" the other side using a &PQ_tref; message before
	terminating an OCP transaction or connection. The latter is especially
	useful for adaptations that may take a long time at the callout server
	before producing any adapted data.</t>

</section> <!-- section_operation_tout -->

<section anchor="section_operation_env" title="Environment">

	<t>OCP communication is assumed to usually take place over TCP/IP
	connections on the Internet (though no default TCP port is assigned to OCP
	in this specification). This does not preclude OCP from being implemented
	on top of other transport protocols, or on other networks. High-level
	transport protocols such as <xref target="RFC3080">BEEP</xref> may be
	used. OCP Core requires a reliable and message-order-preserving transport;
	any protocol that provides such guarantees can be used; the mapping of OCP
	message structures onto the transport data units of the protocol in
	question is outside the scope of this specification.</t>

	<t>OCP Core is application-agnostic. OCP messages can carry
	application-specific information as payload or as application-specific
	message parameters.</t>

	<t>OCP Core overhead in terms of extra traffic on the wire is about
	100-200 octets per small application message. Pipelining, preview, data
	preservation, and early termination optimizations as well as as-is
	encapsulation of application data make fast exchange of application
	messages possible.</t>

</section> <!-- section_operation_env -->

</section>


<section anchor="section_messages" title="Messages">

	<t>As defined in <xref target="section_terminology" />, an OCP message is
	a basic unit of communication between an OPES processor and a callout
	server. A message is a sequence of octets formatted according to <xref
	target="section_message-format">syntax rules</xref>. Message semantics is
	defined in <xref target="section_message-defs" />.  Messages are
	transmitted on top of OCP transport.</t>

	<t>OCP messages deal with transport and transaction management as
	well as application data exchange between a single OPES processor and
	a single callout server.  Some messages can only be emitted by an OPES
	processor; some only by a callout server; some can be emitted by both
	OPES processor and callout server. Some messages require responses
	(one could call such messages "requests"); some can only be used in
	response to other messages ("responses"); some may be sent without
	solicitation and/or may not require a response.</t>

<section anchor="section_message-format" title="Message Format">

	<t>An OCP message consists of a message name followed by optional
	parameters and payload. The exact message syntax is defined by the
	following Augmented Backus-Naur Form (ABNF) <xref target="RFC2234"
	/>:</t>

	<t><figure>
		<artwork><?rfc include='art.msg-bnf.xml' ?></artwork>
	</figure></t>

	<t>Several normative rules accompany the above ABNF:

	<list style="symbols">

		<t>There is no "implied linear space" (LWS) rule. LWS rules are common
		to MIME-based grammars, but are not used here. The whitespace syntax
		is restricted to what is explicitly allowed by the above ABNF.</t>

		<t>All protocol elements are case sensitive unless specified
		otherwise. In particular, message names and parameter names are case
		sensitive.</t>

		<t>Sizes are interpreted as decimal values and cannot have
		leading zeros.</t>

		<t>Sizes do not exceed &SIZE_MAX;.</t>

		<t>The size attribute in a quoted-value encoding specifies the
		exact number of OCTETs following the column (':') separator.
		If size OCTETs are not followed by a quote ('"') character,
		the encoding is syntactically invalid.</t>

		<t>Empty quoted-values are encoded as a 4-OCTET sequence "0:".</t>

		<t>Any bare-value can be encoded as a quoted-value. A quoted-value
		is interpreted after the encoding is removed. For example, number
		1234 can be encoded as four OCTETs 1234 or as eight OCTETs "4:1234",
		yielding exactly the same meaning.</t>

		<t>Unicode UTF-8 is the default encoding. Note that ASCII is a UTF-8
		subset, and that the syntax prohibits non-ASCII characters outside of
		the "data" element.</t>

	</list></t>

	<t>Messages violating formatting rules are, by definition, invalid.  See
	<xref target="section_invalid" /> for rules governing processing of
	invalid messages.</t>

</section>

<section anchor="section_message-rendering" title="Message Rendering">
	
	<t>OCP message samples in this specification and its extensions may not be
	typeset to depict minor syntactical details of OCP message format.
	Specifically, SP and CRLF characters are not shown explicitly. No
	rendering of an OCP message can be used to infer message format. The
	message format definition above is the only normative source for all
	implementations.</t>

	<t>On occasion, an OCP message line exceeds text width allowed by this
	specification format. A backslash ("\"), a "soft linebreak" character, is
	used to emphasize a protocol-violating presentation-only linebreak.  Bare
	backslashes are prohibited by OCP syntax. Similarly, a "\r\n" string is
	sometimes used to emphasize the presence of a CRLF sequence, usually
	before OCP message payload. Normally, visible end of line corresponds to
	the CRLF sequence on the wire.</t>

	<t>The next <xref target="section_message-examples">section</xref>
	contains specific OCP message examples, some of which illustrate the above
	rendering techniques.</t>

</section>


<section anchor="section_message-examples" title="Message Examples">

	<t>OCP syntax provides for compact representation of short control
	messages and required parameters while allowing for parameter extensions.
	Below are examples of short control messages.  The required CRLF sequence
	at the end of each line is not shown explicitly (see <xref
	target="section_message-rendering"/>).</t>

	<t><figure>
		<artwork trimspace='yes'>
			&PQ;;
			&TS; 1 2;
			&DWM; 22;
			&DWP; 22 16;
			x-doit "5:xyzzy";
		</artwork>
	</figure></t>

	<t>The above examples contain atomic anonymous parameter values such as
	number and string constants. OCP messages sometimes use more complicated
	parameters such as item lists or structures with named values. As both
	messages below illustrate, structures and lists can be nested:</t>

	<t><figure>
		<artwork trimspace='yes'>
			&NO; ({"28:http://iana.org/assignments/opes/ocp/tls"});
			&NO; ({\
  			"50:http://iana.org/assignments/opes/ocp/http/response"
		        Optional-Parts: (request-header)
			},{\
			"50:http://iana.org/assignments/opes/ocp/http/response"
		        Optional-Parts: (request-header,request-body)
		        Transfer-Encodings: (chunked)
			});
		</artwork>
	</figure></t>

	<t>Optional parameters and extensions are possible using named
	parameters approach as illustrated by the following example. The
	&DWM_ref; message in the example has two anonymous parameters (the
	last one being an extension) and two named parameters (the last one
	being an extension).</t>

	<t><figure>
		<artwork trimspace='yes'>
			&DWM; 1 3
			Size-Request: 16384
			X-Need-Info: "26:twenty six octet extension";
		</artwork>
	</figure></t>

	<t>Finally, any message may have a payload part. For example, the
	&DUM_tref; message below carries 8865 octets of raw data.</t>

	<t><figure>
		<artwork trimspace='yes'>
			&DUM; 1 13
			Modp: 75
			\r\n
			8865:... 8865 octets of raw data ...;
		</artwork>
	</figure></t>

</section>

<section anchor="section_message-names" title="Message Names">

	<t>Most OCP messages defined in this specification have short names,
	formed by abbreviating or compressing a longer but human-friendlier
	message title. Short names without a central registration system (like
	this specification or IANA registry) are likely to cause conflicts.
	Informal protocol extensions should avoid short names. To emphasize
	what is already defined by message syntax, implementations cannot
	assume that all message names are very short.</t>

</section>

</section>


<section anchor="section_transactions" title="Transactions">

	<t>An OCP transaction is a logical sequence of OCP messages processing a
	single original application message. The result of the processing may be
	zero or more application messages, adapted from the original. A typical
	transaction consists of two message flows: a flow from the OPES processor
	to the callout server (sending original application message) and a flow
	from the callout server to the OPES processor (sending adapted application
	messages). The number of application messages produced by the callout
	server and whether the callout server actually modifies original
	application message may depend on the requested callout service and other
	factors. The OPES processor or the callout server can terminate the
	transaction by sending a corresponding message to the other side.</t>

	<t>An OCP transaction starts with a &TS_tref; message sent by the OPES
	processor. A transaction ends with the first &TE_tref; message sent or
	received, explicit or implied. a &TE; message can be sent by either side.
	Zero or more OCP messages associated with the transaction can be exchanged
	in between. The figure below illustrates possible message sequence (prefix
	"P" stands for the OPES processor; prefix "S" stands for the callout
	server). Some message details are omitted.</t>

	<t><figure>
		<artwork><?rfc include='art.ex.xact.xml' ?></artwork>
	</figure></t>

</section>

<!--
<section anchor="section_connections" title="Connections">

	<t>OCP connection is a logical abstraction representing a stream of
	possibly interleaved OCP transactions and transaction-independent messages
	associated with the same transport connection. Connections allow for
	efficient handling of state common to several OCP transactions, including
	processing prioritization. The figure below illustrates possible message
	sequence.</t>
	
	<t><figure>
		<artwork><?rfc include='art.ex.conn.xml' ?></artwork>
	</figure></t>

	<t>There is no relationship between OCP connections and application
	connections. Application connections are out of OCP scope. Their existence
	is not assumed by the callout protocol. Information about application
	connection may be a part of the metadata.</t>

	<t>When raw TCP/IP transport is used, a single TCP connection corresponds
	to a single OCP connection.</t>

</section>
-->

<section anchor="section_invalid" title="Invalid Input">

	<t>This specification contains many criteria for valid OCP messages and
	their parts, including syntax rules, semantics requirements, and
	relationship to agents state.  "Invalid input" in this context means
	messages or message parts that violate at least one of the normative
	rules. A message with an invalid part is, by definition, invalid. If an
	OCP agent resources are exhausted while parsing or interpreting a message,
	the agent MUST treat the corresponding OCP message as invalid.</t>

	<t>Unless explicitly allowed otherwise, an OCP agent MUST terminate the
	transaction if it receives an invalid message with transaction scope and
	MUST terminate the connection if it receives an invalid message with a
	connection scope. A terminating agent MUST use the result status code of
	400 and MAY specify termination cause information in the result status
	reason parameter (see <xref target="section_param-def-result" />). If an
	OCP agent is unable to determine the scope of an invalid message it
	received, the agent MUST treat the message as having connection scope.</t>

	<t>OCP usually deals with optional but invasive application message
	manipulations where correctness ought to be valued above robustness.  For
	example, a failure to insert or remove certain optional web page content
	is usually far less disturbing than corrupting (making unusable) the host
	page while performing that insertion or removal. Most OPES adaptations are
	high-level in nature, which makes it impossible to automatically assess
	correctness of adaptations, especially if "robustness guesses" are
	involved.</t>

</section>

<section anchor="section_negotiation" title="Negotiation">

	<t>The negotiation mechanism allows OCP agents to agree on mutually
	acceptable set of features, including optional and application-specific
	behavior as well as OCP extensions. For example, transport encryption,
	data format, and support for a new message can be negotiated. Negotiation
	implies intent for a behavioral change. For a related mechanism allowing
	an agent to query capabilities of its counterpart without changing
	counterpart's behavior, see &AQ_tref; and &AA_tref; message
	definitions.</t>

	<t>Most negotiations require at least one round trip time delay.  In rare
	cases when other side's response is not required immediately, negotiation
	delay can be eliminated, with an inherent risk of an overly optimistic
	assumption about the negotiation response.</t>

	<t>A detected violation of negotiation rules leads to OCP connection
	termination.  This design reduces the number of negotiation scenarios
	resulting in a deadlock when one of the agents is not compliant.</t>

	<t>Two core negotiation primitives are supported: negotiation offer and
	negotiation response. A &NO_tref; message allows an agent to specify a set
	of features from which the responder has to select at most one feature it
	prefers. The selection is sent using a &NR_tref; message.  If the response
	is positive, both sides assume that the selected feature is in effect
	immediately (see <xref target="section_msg-&NR;" /> for details).  If the
	response is negative, no behavioral changes are assumed.  In either case,
	further offers may follow.</t>

	<t>Negotiating OCP agents have to take into account prior negotiated
	(i.e., already enabled) features. OCP agents MUST NOT make and MUST reject
	offers that would lead to a conflict with already negotiated features. For
	example, an agent cannot offer an HTTP application profile for a
	connection that already has SMTP application profile enabled because there
	would be no way to resolve the conflict for a given transaction.
	Similarly, once TLSv1 connection encryption is negotiated, an agent must
	not offer and must reject offers for SSLv2 connection encryption (unless a
	negotiated feature explicitly allows for changing encryption scheme on the
	fly).</t>

	<t>&NO_tref; messages may be sent by either agent. OCP extensions
	documenting negotiation MAY assign initiator role to one of the agents,
	depending on the feature being negotiated.  For example, negotiation of
	transport security feature should be initiated by OPES processors to avoid
	situations where both agents wait for each other to make an offer.</t>

	<t>Since either agent may make an offer, two "concurrent" offers may be
	made at the same time, by the two communicating agents. Unmanaged
	concurrent offers may lead to a negotiation deadlock. By giving OPES
	processor a priority, <xref target="section_msg-&NO;">offer handling
	rules</xref> ensure that only one offer per OCP connection is
	honored at a time, and the other concurrent offers are ignored by both
	agents.</t>

<section anchor="section_negotiation_phase" title="Negotiation Phase">

	<t>A Negotiation Phase is a mechanism to ensure that both agents have a
	chance to negotiate all features they require before proceeding further.
	Negotiation Phases have OCP connection scope and do not overlap. For each
	OCP agent, Negotiation Phase starts with the first &NO_tref; message
	received or the first &NR_tref; message sent, provided the message is not
	a part of an already existing Phase. For each OCP agent, Negotiation Phase
	ends with the first &NR_tref; message (sent or received) after which the
	agent expects no more negotiations.  Agent expectation rules are defined
	later in this section.</t>

	<t>During a Negotiation Phase, an OCP agent MUST NOT send messages
	other than the following "Negotiation Phase messages": &NO_t;, &NR_t;,
	&AQ_t;, &AA_t;, &PQ_t;, &PA_t;, &PR_t;, and &CE_t;.</t>

	<t>Multiple Negotiation Phases may happen during the lifespan of a single
	OCP connection. An agent may attempt to start a new Negotiation Phase
	immediately after the old Phase is over, but it is possible that the other
	agent will send messages other than "Negotiation Phase messages" before
	receiving the new &NO_t;. The agent that starts a Phase has to be prepared
	to handle those messages while its offer is reaching the recipient.</t>

	<t>An OPES processor MUST make a negotiation offer immediately after
	sending a &CS_tref; message. If the OPES processor has nothing to
	negotiate, the processor MUST send a &NO_t; message with an empty
	features list. These two rules bootstrap the first Negotiation Phase.
	Agents are expected to negotiate at least the application profile for
	OCP Core. Thus, these bootstrapping requirements are unlikely to result
	in any extra work.</t>

	<t>Once a Negotiation Phase starts, an agent MUST expect further
	negotiations if and only if the last &NO; sent or the last &NR; received
	contained a true "Offer-Pending" parameter value. Informally, an agent can
	keep the phase open by sending true "Offer-Pending" parameters with
	negotiation offers or responses. Moreover, if there exist a possibility
	that the agent may need to continue the Negotiation Phase, the agent must
	send a true "Offer-Pending" parameter.</t>

</section>

<section anchor="section_negotiation_ex" title="Negotiation Examples">

	<t>Below is an example of the simplest negotiation possible. The OPES
	processor is offering nothing and is predictably receiving a
	rejection.  Note that the &NR; message terminates the Negotiation
	Phase in this case because neither of the messages contains a true
	"Offer-Pending" value:</t>

	<t><figure>
		<artwork trimspace='yes'>
			P: NO ();
			S: NR;
		</artwork>
	</figure></t>

	<t>The next example illustrates how a callout server can force negotiation
	of a feature that an OPES processor has not negotiated.  Note that the
	server sets the "Offer-Pending" parameter to true when responding to the
	processor &NO_t; message. The processor chooses to accept the feature:</t>

	<t><figure>
		<artwork trimspace='yes'>
			P: NO ();
			S: NR
			   Offer-Pending: true
			   ;
			S: NO ({"22:ocp://feature/example/"})
			   Offer-Pending: false
			   ;
			P: NR {"22:ocp://feature/example/"};
		</artwork>
	</figure></t>

	<t>If the server changes its mind to continue the above negotiations after
	sending a true "Offer-Pending" value, the server's only option would be
	send an empty negotiation offer (see the first example above). If the
	server does nothing instead, the OPES processor would wait for the server
	and would eventually timeout the connection.</t>

	<t>The following example shows a dialog with a callout server that insists
	on two imaginary features to be used: strong transport encryption and use
	of volatile storage for responses. The server is designed to exchange no
	sensitive messages until both features are enabled. Naturally, the
	volatile storage feature has to be negotiated securely. The OPES processor
	supports one of the strong encryption mechanisms but prefers not to offer
	(volunteer support for) strong encryption, perhaps for performance
	reasons. The server has to send a true "Offer-Pending" parameter to get a
	chance to offer strong encryption (which is successfully negotiated in
	this case).  Any messages sent by either agent after the (only) successful
	&NR; response are encrypted with "strongB" encryption scheme. The OPES
	processor does not understand the volatile storage feature, and the last
	negotiation fails (over an strongly encrypted transport connection).</t>

	<t><figure>
		<artwork trimspace='yes'>
			P: NO ({"29:ocp://example/encryption/weak"})
			   ;
			S: NR
			   Offer-Pending: true
			   ;
			S: NO ({"32:ocp://example/encryption/strongA"},\
			   {"32:ocp://example/encryption/strongB"})
			   Offer-Pending: true
			   ;
			P: NR {"32:ocp://example/encryption/strongB"}
			   ;
			... all traffic below is encrypted using strongB ...
			S: NO ({"31:ocp://example/storage/volatile"})
			   Offer-Pending: false
			   ;
			P: NR
			   Unknowns: ({"31:ocp://example/storage/volatile"})
			   ;
			S: CSE { 400 "33:lack of VolStore protocol support" }
			   ;
		</artwork>
	</figure></t>

	<t>The following example from <xref target="I-D.ietf-opes-http" />
	illustrates successful HTTP application profile negotiation:</t>

	<t><figure>
		<artwork trimspace='yes'>
			P: NO ({"50:http://iana.org/assignments/opes/ocp/http/response"
			   Aux-Parts: (request-header,request-body)
			   })
			   SG: 5;
			S: NR {"50:http://iana.org/assignments/opes/ocp/http/response"
			   Aux-Parts: (request-header)
			   Pause-At-Body: 30
			   Wont-Send-Body: 2147483647
			   Content-Encodings: (gzip)
			   }
			   SG: 5;</artwork>
	</figure></t>

</section>

</section>

<section anchor="section_keeping" title="'Data Preservation' Optimization">

	<t>Many adaptations do not require any data modifications (e.g., message
	logging or blocking). Some adaptations modify only a small portion of
	application message content (e.g., HTTP cookies filtering or ad
	insertion). Yet, in many cases, the callout service needs to see complete
	data. By default, unmodified data would first travel from the OPES
	processor to the callout server and then back.  The "data preservation"
	optimization in OCP helps to eliminate the return trip if both OCP agents
	cooperate. Such cooperation is optional: OCP agents MAY support data
	preservation optimization.</t>

	<t>To avoid sending unmodified data back, a callout service has to
	know that the OPES processor has a copy of the data. Since data sizes
	can be very large and the callout service may not know in advance
	whether it will be able to utilize the processor copy, it is not
	possible to require the processor to keep a copy of the entire
	original data. Instead, it is expected that a processor may keep some
	portion of the data, depending on processor settings and state.</t>

	<t>When an OPES processor commits to keeping a data chunk, it announces
	its decision and the chunk parameters via a Kept parameter of a &DUM_tref;
	message. The callout server MAY "use" the chunk by sending a &DUY_tref;
	message referring to the preserved chunk. That OCP message does not have
	payload and, hence, the return trip is eliminated.</t>

	<t>Since the mapping between original and adapted data is not known to the
	processor, the processor MUST keep the announced-as-preserved chunk until
	the end of the corresponding transaction, unless the callout server
	explicitly tells the processor that the chunk is not needed. As implied by
	the above requirement, the processor cannot assume that a data chunk is no
	longer needed just because the callout server sent a &DUY_tref; message or
	adapted data with, say, the same offset as the preserved chunk.</t>

	<t>For simplicity, preserved data is always a contiguous chunk of original
	data, described by an (offset, size) pair using a "Kept" parameter of a
	&DUM_tref; message. An OPES processor may volunteer to increase the size
	of the kept data. An OPES processor may increase the offset if the callout
	server indicated that the kept data is no longer needed.</t>

	<t>Both agents may benefit from data reuse. An OPES processor has to
	allocate storage to support this optimization while a callout server does
	not. On the other hand, it is the callout server that is responsible for
	relieving the processor from data preservation commitments. There is no
	simple way to resolve this conflict of interest on a protocol level. Some
	OPES processors may allocate a relatively small buffer for data
	preservation purposes and stop preserving data when the buffer gets full.
	Such technique would benefit callout services that can quickly reuse or
	discard kept data. Another processor strategy would be to size the buffer
	based on historical data reuse statistics. To improve chances of
	beneficial cooperation, callout servers are strongly encouraged to
	immediately notify OPES processors of unwanted data. The callout server
	that made a decision not to send &DUY_tref; messages (for a specific data
	ranges or at all), SHOULD immediately inform the OPES processor of that
	decision with the corresponding &DPI_tref; message(s) or other
	mechanisms.</t>

</section>

<section anchor="section_data-stop" title="'Premature Dataflow Termination' Optimizations">

	<t>Many callout services adapt small portions of large messages and would
	prefer not to be in the loop when that adaptation is over. Some callout
	services may not be interested in data modification and would prefer not
	to send data back to the OPES processor, even if the OPES processor is not
	supporting the data preservation <xref
	target="section_keeping">optimization</xref>. By OCP design, unilateral
	premature dataflow termination by a callout server would lead to
	termination of an OCP transaction with an error. Thus, the two agents must
	cooperate to allow for error-free premature termination.</t>

	<t>This section documents two mechanisms for premature termination of
	original or adapted dataflow.  In combination, the mechanisms allow the
	callout server to get completely out of the processing loop.</t>


<section anchor="section_data-stop-org" title="Original Dataflow">

	<t>There are scenarios when a callout server is not interested in the
	remaining original dataflow. For example, a simple access blocking or "this
	site is temporary down" callout service needs to send an adapted
	(generated) application message, but would prefer not to receive
	original data from the OPES processor.</t>

	<t>OCP Core supports premature original dataflow termination via the
	&DWSR_tref; message. A callout server that does not want to receive
	additional original data (beyond a certain size) sends a &DWSR;
	message.  The OPES processor receiving a &DWSR; message
	terminates original dataflow by sending an &AME_tref; message with a
	206 (partial) status code.</t>

	<t>The following figure illustrates a typical sequence of events. The
	downward lines connecting the two dataflows illustrate the transmission
	delay that allows for more OCP messages to be sent while waiting for the
	opposing agent reaction.</t>
	
		<t><figure>
			<artwork trimspace='yes'>
OPES                 Callout
Processor            Server
    &DUM;>             &lt;&DUM;
    &DUM;>             &lt;&DWSR;  &lt;-- server is ready to stop receiving
    ...        _____/&lt;&DUM;   &lt;-- server continues as usual 
    &DUM;>______/      &lt;&DUM;                                              
    &AME;>             ...    &lt;-- processor stops sending original data
        \_____       &lt;&DUM;   
              \______&lt;&DUM;
                     &lt;&DUM;   &lt;-- server continues to send adapted data
                     ...
                     &lt;&AME;</artwork>
		</figure></t>

	<t>The mechanism described in this section has no effect on the adapted
	dataflow. Receiving an &AME_tref; message with 206 (partial) result status
	code from the OPES processor does not introduce any special requirements
	for the adapted dataflow termination. However, it is not possible to
	terminate adapted dataflow prematurely after the original dataflow has
	been prematurely terminated (see <xref
	target="section_data-stop-all"/>).</t>

</section>

<section anchor="section_data-stop-adp" title="Adapted Dataflow">

	<t>There are scenarios when a callout service may want to stop sending
	adapted data before a complete application message has been sent. For
	example, a logging-only callout service needs to receive all application
	messages, but would prefer not to send their copies back to the OPES
	processor.</t>

	<t>OCP Core supports premature adapted dataflow termination via a
	combination of &DWSS_tref; and &DSS_tref; messages. A callout service that
	wants to stop sending data sends a &DWSS; message, soliciting an OPES
	processor permission to stop. While waiting for the permission, the server
	continues with its usual routine.</t>

	<t>An OPES processor receiving a &DWSS_tref; message responds with a
	&DSS_tref; message. The processor may then pause to wait for the callout
	server to terminate the adapted dataflow or may continue to send original
	data while making a copy of it.  Once the server terminates the adapted
	dataflow, the processor is responsible for using original data (sent or
	paused after sending &DSS;) instead of the adapted data.</t>

	<t>The callout server receiving a &DSS; message terminates the adapted
	dataflow (see &DSS_tref; message definition for the exact requirements and
	corner cases).</t>

	<t>The following figure illustrates a typical sequence of events,
	including a possible pause in original dataflow when the OPES processor is
	waiting for the adapted dataflow to end. The downward lines connecting the
	two dataflows illustrate the transmission delay that allows for more OCP
	messages to be sent while waiting for the opposing agent reaction.</t>

		<t><figure>
			<artwork trimspace='yes'>
OPES                 Callout
Processor            Server
    &DUM;>             &lt;&DUM;
    &DUM;>             &lt;&DWSS;    &lt;-- server is ready to stop sending
    ...        _____/&lt;&DUM;     &lt;-- server continues as usual,
    &DUM;>______/      &lt;&DUM;          waiting for DSS
    &DSS;>             ...
        \_____       &lt;&DUM;
  possible    \______&lt;&DUM;
  org-dataflow       &lt;&AME; 206 &lt;-- server terminates adapted dataflow
  pause        _____/             upon receiving the DSS message
        ______/      
    &DUM;>                      &lt;-- processor resumes original dataflow
    &DUM;>                          to the server and starts using
    ...                           original data without adapting it
    &AME;></artwork>
		</figure></t>

	<t>Premature adapted dataflow preservation is not trivial because the OPES
	processor is relying on the callout server to provide adapted data
	(modified or not) to construct the adapted application message. If the
	callout server wants to quit its job, special care must be taken to ensure
	that the OPES processor is capable of constructing the complete
	application message. On a logical level, this mechanism is equivalent to
	switching from one callout server to another (non-modifying) callout
	server in the middle of an OCP transaction.</t>
	
	<t>Other than a possible pause in the original dataflow, the mechanism
	described in this section has no effect on the original dataflow.
	Receiving an &AME_tref; message with 206 (partial) result status code from
	the callout server does not introduce any special requirements for the
	original dataflow termination.</t>
	
</section>

<section anchor="section_data-stop-all" title="Getting Out Of The Loop">

	<t>Some adaptation services work on application message prefixes and are
	not interested in being in the adaptation loop once their work is done.
	For example, an ad insertion service that did its job by modifying the
	first fragment of a web "page" would not be interested in receiving more
	original data or performing further adaptations. The 'Getting Out Of The
	Loop' optimization allows a callout server to get completely out of
	application message processing loop.</t>

	<t>The "Getting Out Of The Loop" optimization is possible by terminating
	the adapted dataflow (<xref target="section_data-stop-adp" />) and then
	terminating the original dataflow (<xref target="section_data-stop-org"
	/>). The order of termination is very important.</t>

	<t>If the original dataflow is terminated first, the OPES processor would
	not allow the adapted dataflow to be terminated prematurely because the
	processor would not be able to reconstruct the remaining portion of the
	adapted application message; the processor would not know which suffix of
	the remaining original data needs to follow the adapted parts. The mapping
	between original and adapted octets is known only to the callout
	service.</t>

	<t>An OPES processor that received a &DWSS; message followed by a &DWSR;
	message MUST NOT send an &AME; message with a 206 (partial) status code
	before sending a &DSS; message. Informally, this rule means that the
	callout server that wants to get out of the loop fast should send a &DWSS;
	message immediately followed by a &DWSR; message; the server does not need
	to wait for the OPES processor's permission to terminate adapted dataflow
	before requesting the OPES processor to terminate original dataflow.</t>

</section>

</section> <!-- section_data-stop -->


<section anchor="section_message-PETDM" title="Protocol Element Type Declaration Mnemonic (PETDM)">

	<t>A protocol element type is a named set of syntax and semantics rules.
	This section defines a simple, formal declaration mnemonic for protocol
	element types, labeled PETDM. PETDM simplicity is meant to ease type
	declarations in this specification. PETDM formality is meant to improve
	interoperability among implementations. Two protocol elements are
	supported by PETDM: message parameter values and messages.</t>

	<t>All OCP Core parameter and message types are declared using PETDM. OCP
	extensions SHOULD use PETDM when declaring new types.</t>

	<t>Atom, list, structure, and message constructs are four available base
	types.  Their syntax and semantics rules are defined in <xref
	target="section_message-format" />.  New types can be declared in PETDM to
	extend base types semantics, using the following declaration templates.
	The new semantics rules are meant to be attached to each declaration using
	prose text.</t>

	<t>Things in angle brackets are template placeholders, to be substituted
	with actual type names or parameter name tokens. Square brackets surround
	optional elements such as structure members or message payload.</t>

	<t><list style="symbols">

		<t>Declaring a new atomic type:

			<figure>
				<artwork><![CDATA[<new-type-name>: extends atom;]]></artwork>
			</figure>

		</t>

		<t>Declaring a new list with old-type-name items:

			<figure>
				<artwork><![CDATA[<new-type-name>: extends list of <old-type-name>;]]></artwork>
			</figure>

			Unless explicitly noted otherwise, empty lists are valid and
			have semantics of a absent parameter value.

		</t>

		<t>Declaring a new structure with members:

			<figure>

				<artwork><![CDATA[<new-type-name>: extends structure with {
	<old-type-nameA> <old-type-nameB> [<old-type-nameC>] ...;
	<member-name1>: <old-type-name1>;
	<member-name2>: <old-type-name2>;
	[<member-name3>: <old-type-name3>];
	...
};]]></artwork>

			</figure>

			The new structure may have anonymous members and named members.
			Neither group have to exist. Note that it is always possible for
			extensions to add more members to old structures without affecting
			type semantics because unrecognized members are ignored by
			compliant agents.

		</t>

		<t>Declaring a new message with parameters:

			<figure>

				<artwork><![CDATA[<new-type-name>: extends message with {
	<old-type-nameA> <old-type-nameB> [<old-type-nameC>] ...;
	<parameter-name1>: <old-type-name1>;
	<parameter-name2>: <old-type-name2>;
	[<parameter-name3>: <old-type-name3>];
	...
};]]></artwork>

			</figure>

			The new type name becomes the message name. Just like when
			extending a structure, the new message may have anonymous
			parameters and named parameters.  Neither group have to exist.
			Note that it is always possible for extensions to add more
			parameters to old messages without affecting type semantics
			because unrecognized parameters are ignored by compliant agents.

		</t>

		<t>Extending a type with more semantics details:

			<figure>
				<artwork><![CDATA[<new-type-name>: extends <old-type-name>;]]></artwork>
			</figure>

		</t>

		<t>Extending a structure- or message-base type:

			<figure>

				<artwork><![CDATA[<new-type-name>: extends <old-type-name> with {
	<old-type-nameA> <old-type-nameB> [<old-type-nameC>] ...;
	<member-name1>: <old-type-name1>;
	<member-name2>: <old-type-name2>;
	[<member-name3>: <old-type-name3>];
	...
};]]></artwork>

			</figure>

			New anonymous members are appended to the anonymous members of the
			old type, and new named members are merged with named members of
			the old type.

		</t>

		<t>Extending a message-base type with payload semantics:

			<figure>

				<artwork><![CDATA[<new-type-name>: extends <old-type-name> with {
	...
} and payload;]]></artwork>

			</figure>

			Any any OCP message can have payload, but only some message types
			have known payload semantics. Like any parameter, payload may be
			required or optional.

		</t>

		<t>Extending type semantics without renaming the type:

			<figure>

				<artwork><![CDATA[<old-type-name>: extends <namespace>::<old-type-name>;]]></artwork>

			</figure>

			The above template can be used by OCP Core extensions that want to
			change the semantics of OCP Core types without renaming them. This
			technique is essential for extending OCP messages because message
			name is the same as the message type name. For example, an SMTP
			profile for OCP might use the following declaration to extend an
			&AMS_tref; message with Am-Id, a parameter defined in that
			profile:

			<figure>
				<artwork>
&AMS;: extends Core::&AMS; with {
	Am-Id: am-id;
};</artwork>
			</figure>

		</t>

	</list></t>

	<t>All extended types may be used as a replacement of the types they
	extend. For example, a &NO_tref; message uses a parameter of type
	Features. <xref target="section_param-def-features">Features</xref> is a
	list of <xref target="section_param-def-feature">feature</xref> items. A
	Feature is a structure-based type. An OCP extension (e.g., an HTTP
	application profile) may extend the feature type and use a value of that
	extended type in a negotiation offer.  Recipients that are aware of the
	extension will recognize added members in feature items and negotiate
	accordingly. Other recipients will ignore them.</t>

	<t>OCP Core namespace tag is "Core". OCP extensions that declare types
	MUST define their namespace tags (so that other extensions and
	documentation can use them in their PETDM declarations).</t>

<section anchor="section_PETDM_opt" title="Optional Parameters">

	<t>Anonymous parameters are positional: parameter's position (i.e., the
	number of anonymous parameters to the left) is its "name". Thus, when a
	structure or message have multiple optional anonymous parameters,
	parameters to the right can be used only if all parameters to the left are
	present. The following notation:</t>

	<t><figure><artwork trimspace='yes'>
		[name1] [name2] [name3] ... [nameN]
	</artwork></figure></t>

	<t>is interpreted as:</t>

	<t><figure><artwork trimspace='yes'>
		[name1 [ name2 [ name3 ... [nameN] ... ]]]
	</artwork></figure></t>

	<t>When adding an anonymous parameter to a structure or message that have
	optional anonymous parameters, the new parameter has to be optional, and
	the new parameter can only be used if all old optional parameters are in
	use. Named parameters do not have such limitations because they are not
	positional but associative; they are identified by their explicit and
	unique names.</t>
	
</section>

</section>


<section anchor="section_message-params" title="Message Parameter Types">

	<t>This section defines parameter value types that are used for <xref
	target="section_message-defs">message definitions</xref>.  Before using a
	parameter value, an OCP agent MUST check whether the value has the
	expected type (i.e., whether it complies with all rules from the type
	definition).  A single rule violation means that the parameter is invalid.
	See <xref target="section_invalid" /> for rules on processing invalid
	input.</t>

	<t>OCP extensions MAY define their own types. If they do, OCP extensions
	MUST define types with exactly one base format and MUST specify type of
	every new protocol element they introduce.</t>

<section anchor="section_param-type-uri" title="uri">

	<t><figure>
		<artwork trimspace='yes'>
			uri: extends atom;
		</artwork>
	</figure></t>

	<t>Uri (universal resource identifier) is an atom formatted according
	to URI rules in <xref target="RFC2396" />.</t>

	<t>Often, a uri parameter is used as a unique (within a given scope)
	identifier. Uni semantics is incomplete without the scope specification.
	Many uri parameters are URLs. Unless noted otherwise, URL identifiers do
	not imply existence of a serviceable resource at the location they
	specify. For example, an HTTP request for an HTTP-based URI identifier may
	result in a 404 (Not Found) response.</t>

</section>

<section anchor="section_param-type-uni" title="uni">

	<t><figure>
		<artwork trimspace='yes'>
			uni: extends atom;
		</artwork>
	</figure></t>

	<t>Uni (unique numeric identifier) is an atom formatted as
	dec-number and with a value in the [0, &SIZE_MAX;] inclusive
	range.</t>

	<t>A uni parameter is used as a unique (within a given scope) identifier.
	Uni semantics is incomplete without the scope specification. Some OCP
	messages create identifiers (i.e., bring them into scope). Some OCP
	messages destroy them (i.e, remove them from scope).  An OCP agent MUST
	NOT create the same uni value more than once within the same scope. When
	creating a new identifier of the same type and within the same scope as
	some old identifier, an OCP agent MUST use a higher numerical value for
	the new identifier. The first rule makes uni identifiers suitable for
	cross-referencing logs and other artifacts.  The second rule makes
	efficient checks of the first rule possible.</t>

	<t>For example, a previously used transaction identifier "xid" must not be
	used for a new &TS_tref; message within the same OCP transaction, even if
	a prior &TE_tref; message was sent for the same transaction.</t>

	<t>An OCP agent MUST terminate the state associated with uni uniqueness
	scope if all unique values have been used up.</t>

</section>


<section anchor="section_param-type-size" title="size">

	<t><figure>
		<artwork trimspace='yes'>
			size: extends atom;
		</artwork>
	</figure></t>

	<t>Size is an atom formatted as dec-number and with a value in the [0,
	&SIZE_MAX;] inclusive range.</t>

	<t>Size value is the number of octets in the associated data chunk.</t>

	<t>OCP Core cannot handle application messages that exceed &SIZE_MAX;
	octets in size, require larger sizes as a part of OCP marshaling process,
	or use sizes with granularity other than 8 bits. This limitation can be
	addressed by OCP extensions as hinted in <xref
	target="section_compliance_ext" />.</t>

</section>


<section anchor="section_param-def-offset" title="offset">

	<t><figure>
		<artwork trimspace='yes'>
			offset: extends atom;
		</artwork>
	</figure></t>

	<t>Offset is an atom formatted as dec-number and with a value in the [0,
	&SIZE_MAX;] inclusive range.</t>

	<t>Offset is an octet position expressed in the number of octets relative
	to the first octet of the associated dataflow. The offset of the first
	data octet has a value of zero.</t>

</section>

<section anchor="section_param-type-percent" title="percent">

	<t><figure>
		<artwork trimspace='yes'>
			percent: extends atom;
		</artwork>
	</figure></t>

	<t>Percent is an atom formatted as dec-number and with a value in the [0,
	100] inclusive range.</t>

	<t>Percent semantics is incomplete without associating its value with a
	boolean statement or assertion. The value of 0 indicates absolute
	impossibility.  The value of 100 indicates an absolute certainty. In
	either case, the associated statement can be relied upon as if it was
	expressed in boolean rather than probabilistic terms. Values in the [1,99]
	inclusive range indicate corresponding levels of certainty that the
	associated statement is true.</t>

</section>


<section anchor="section_param-type-boolean" title="boolean">

	<t><figure>
		<artwork trimspace='yes'>
			boolean: extends atom;
		</artwork>
	</figure></t>

	<t>Boolean type is an atom with two valid values: true and false.  A
	boolean parameter expresses truthfulness of the associated statement.</t>

</section>

<section anchor="section_param-def-xid" title="xid">

	<t><figure>
		<artwork trimspace='yes'>
			xid: extends uni;
		</artwork>
	</figure></t>

	<t>"Xid", an OCP transaction identifier, uniquely identifies an OCP
	transaction within an OCP connection.</t>

</section>

<!--
<section anchor="section_param-def-rid" title="rid">

	<t><figure>
		<artwork trimspace='yes'>
			rid: extends uni;
		</artwork>
	</figure></t>

	<t>"Rid", an OCP request identifier, uniquely identifies an OCP
	request message on a connection. Request identifiers are used to match
	certain requests and responses.</t>

</section>
-->

<section anchor="section_param-def-sg-id" title="sg-id">

		<t><figure>
			<artwork trimspace='yes'>
				sg-id: extends uni;
			</artwork>
		</figure></t>

		<t>"Sg-id", a service group identifier, uniquely identifies a group of
		services on an OCP connection.</t>

</section>

<section anchor="section_param-def-modp" title="modp">

		<t><figure>
			<artwork trimspace='yes'>
				modp: extends percent;
			</artwork>
		</figure></t>

		<t>Modp extends the percent type to express senders confidence that
		application data will be modified. The boolean statement associated
		with the percentage value is "data will be modified". Modification is
		defined as adaptation that changes numerical value of at least one
		data octet.</t>

</section>

<section anchor="section_param-def-result" title="result">

		<t><figure>
			<artwork trimspace='yes'>
				result: extends structure with {
					atom [atom];
				};
			</artwork>
		</figure></t>

		<t>OCP processing result is expressed as a structure with two
		documented members: a required Uni status code and an optional reason.
		The reason member contains informative textual information not
		intended for automated processing. For example,</t>

		<t><figure><artwork trimspace='yes'>
			{ 200 OK }
			{ 200 "6:got it" }
			{ 200 "27:27 octets in UTF-8 encoding" }
		</artwork></figure></t>

		<t>This specification defines the following status codes:</t>

		<texttable>

			<preamble>Result Status Codes</preamble>

			<ttcol width='10%' align='right'>code</ttcol>
			<ttcol width='20%' align='center'>text</ttcol>
			<ttcol align='left'>semantics</ttcol>

			<c>200</c>
			<c>OK</c>

			<c>Overall success. This specification does not
			contain any general actions for 200 status code
			recipients.</c>


			<c>206</c>
			<c>partial</c>

			<c>Partial success. This status code is documented for &AME_tref;
			messages only. The code indicates that the agent terminated the
			corresponding dataflow prematurely (i.e., more data would be
			needed to reconstruct a complete application message). Premature
			termination of one dataflow does not introduce any special
			requirements for the other dataflow termination. See dataflow
			termination <xref target="section_data-stop">optimizations</xref>
			for use cases.</c>

			<c>400</c>
			<c>failure</c>

			<c>An error, exception, or trouble. A recipient of a 400 (failure)
			result of an &AME;, &TE;, or &CE; message MUST destroy any state or
			data associated with the corresponding dataflow, transaction, or
			connection. For example, adapted version of the application
			message data must be purged from the processor cache if the OPES
			processor receives an &AME_t; message with result code of 400.</c>

			<postamble>Specific OCP messages may require code-specific
			actions.</postamble>

		</texttable>

		<t>Extending result semantics is possible by adding new "result"
		structure members or negotiating additional result codes
		(e.g., as a part of a negotiated profile). A recipient of an unknown
		(in then-current context) result code MUST act as if code 400
		(failure) was received.</t>

		<t>The recipient of a message without the actual result parameter, but
		with an optional formal result parameter MUST act as if code 200 (OK)
		was received.</t>

		<t>Textual information (the second anonymous parameter of the result
		structure) is often referred to as "reason" or "reason phrase".  To
		assist manual troubleshooting efforts, OCP agents are encouraged to
		include descriptive reasons with all results indicating a failure.</t>

		<t>An OCP message with result status code of 400 (failure) is called
		"a message indicating a failure" in this specification.</t>

</section>

<section anchor="section_param-def-feature" title="feature">

		<t><figure>
			<artwork trimspace='yes'>
				feature: extends structure with {
					uri;
				};
			</artwork>
		</figure></t>

		<t>Feature extends structure to relay an OCP feature identifier and to
		reserve a "place" for optional feature-specific parameters (sometimes
		called feature attributes). Feature values are used to declare support
		for and negotiate use of OCP features.</t>

		<t>This specification does not define any features.</t>

</section>


<section anchor="section_param-def-features" title="features">

		<t><figure>
			<artwork trimspace='yes'>
				features: extends list of feature;
			</artwork>
		</figure></t>

		<t>"Features" is a list of "feature" values. Unless noted otherwise,
		the list can be empty and features are listed in decreasing preference
		order.</t>

</section>

<section anchor="section_param-def-service" title="service">

		<t><figure>
			<artwork trimspace='yes'>
				service: extends structure with {
					uri;
				};
			</artwork>
		</figure></t>

		<t>"Service" structure has one anonymous member, an OPES service
		identifier of type "uri". Services may have service-dependent
		parameters. An OCP extension defining a service for use with OCP MUST
		define service identifier and service-dependent parameters as
		additional "service" structure members, if any. For example, a
		service value may look like this:</t>

		<t><figure><artwork trimspace='yes'>
			{"37:http://iana.org/assignments/opes/ocp/tls" "8:blowfish"}
		</artwork></figure></t>

</section>


<section anchor="section_param-def-services" title="services">

		<t><figure>
			<artwork trimspace='yes'>
				services: extends list of service;
			</artwork>
		</figure></t>

		<t>"Services" is a list of "service" values. Unless noted otherwise,
		the list can be empty and the order of the values is the requested or
		actual service application order.</t>

</section>


<section anchor="section_param-def-perflow" title="Dataflow Specializations">

		<t>Several parameter types such as "offset" apply to both original and
		adapted dataflow. It is relatively easy to misidentify type's dataflow
		affiliation, especially when parameters with different affiliation are
		mixed together in one message declaration. The following statements
		declare new dataflow-specific types using their dataflow-agnostic
		versions (denoted by a &lt;type&gt; placeholder).</t>

		<t>The following new types refer to original data only:</t>

			<t><figure><artwork trimspace='yes'>
				org-&lt;type&gt;: extends &lt;type&gt;;
			</artwork></figure></t>

		<t>The following new types refer to adapted data only:</t>

			<t><figure><artwork trimspace='yes'>
				adp-&lt;type&gt;: extends &lt;type&gt;;
			</artwork></figure></t>

		<t>The following new types refer to sender's dataflow only:</t>

			<t><figure><artwork trimspace='yes'>
				my-&lt;type&gt;: extends &lt;type&gt;;
			</artwork></figure></t>

		<t>The following new types refer to recipient's dataflow only:</t>

			<t><figure><artwork trimspace='yes'>
				your-&lt;type&gt;: extends &lt;type&gt;;
			</artwork></figure></t>

		<t>OCP Core specification uses the above type naming scheme to
		implement dataflow specialization for the following types: offset,
		size, and sg-id.  OCP extensions SHOULD use the same scheme.</t>

</section>

</section>


<section anchor="section_message-defs" title="Message Definitions">

	<t>This section describes specific OCP messages. Each message is given a
	unique name and usually has a set of anonymous and/or named parameters.
	The order of anonymous parameters is specified in the message definitions
	below. No particular order for named parameters is implied by this
	specification. OCP extensions MUST NOT introduce order-dependent named
	parameters. No more than one named-parameter with a given name can appear
	in the message; messages with multiple equally-named parameters are
	semantically invalid.</t>

	<t>A recipient MUST be able to parse any message in valid format (see
	<xref target="section_message-format" />), subject to recipient resources
	limitations.</t>

	<t>Unknown or unexpected message names, parameters, and payloads may be
	valid extensions. For example, an "extra" named parameter may be used for
	a given message, in addition to what is documented in the message
	definition below. A recipient MUST ignore any valid but unknown or
	unexpected name, parameter, member, or payload.</t>

	<t>Some message parameter values use uni identifiers to refer to various
	OCP states (see <xref target="section_param-type-uni" /> and <xref
	target="section_state-sum" />). These identifiers are created, used, and
	destroyed by OCP agents via corresponding messages.  Except when creating
	a new identifier, an OCP agent MUST NOT send a uni identifier that
	corresponds to an inactive state (i.e., that was either never created or
	was already destroyed). Such identifiers invalidate the host OCP message
	(see <xref target="section_invalid" />). For example, the recipient must
	terminate the transaction when the xid parameter in a &DUM_tref; message
	refers to an unknown or already terminated OCP transaction.</t>

	<section anchor="section_msg-&CS;" title="&CS_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&CS;: extends message;
			</artwork>
		</figure></t>

		<t>A &CS_t; message indicates the start of an OCP connection. An
		OCP agent MUST send this message before any other message on the
		connection. If the first message an OCP agent receives is not &CS_t;,
		the agent MUST terminate the connection with a &CE_tref; message
		having 400 (failure) result status code. An OCP agent
		MUST send &CS_t; message exactly once. An OCP agent MUST ignore
		repeated &CS_t; messages.</t>

		<t>At any time, a callout server MAY refuse further processing on an
		OCP connection by sending a &CE_tref; message with status code 400
		(failure). Note that the above requirement to send a &CS; message
		first still applies.</t>

		<t>With TCP/IP as transport, raw TCP connections (local and remote
		peer IP addresses with port numbers) identify an OCP connection. Other
		transports may provide OCP connection identifiers to distinguish
		logical connections that share the same transport. For example, a
		single <xref target="RFC3080">BEEP</xref> channel may be designated as
		a single OCP connection.</t>

	</section>

	<section anchor="section_msg-&CE;" title="&CE_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&CE;: extends message with {
					[result];
				};
			</artwork>
		</figure></t>

		<t>&CE_t; Indicates an end of an OCP connection. The agent initiating
		closing or termination of a connection MUST send this message
		immediately prior to closing or termination. The recipient MUST free
		associated state, including transport state.</t>

		<t>Connection termination without a &CE_t; message indicates that the
		connection was prematurely closed, possibly without the closing-side
		agent prior knowledge or intent. When an OCP agent detects a
		prematurely closed connection, the agent MUST act as if a
		&CE_t; message indicating a failure was received.</t>

		<t>A &CE_t; message implies the end of all transactions,
		negotiations, and service groups opened or active on the connection
		being ended.</t>

	</section>

	<section anchor="section_msg-&SGC;" title="&SGC_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&SGC;: extends message with {
					my-sg-id services;
				};
			</artwork>
		</figure></t>

		<t>An &SGC_t; message informs the recipient that a list of adaptation
		services has been associated with the given service group identifier
		("my-sg-id"). Following this message, the sender can refer to the
		group using the identifier. The recipient MUST maintain the
		association until a matching &SGD_tref; message is received or the
		corresponding OCP connection is closed.</t>

		<t>Service groups have a connection scope. Transaction management
		messages do not affect existing service groups.</t>

		<t>Maintaining service group associations requires resources (e.g.,
		storage to keep the group identifier and a list of service IDs).
		Thus, there is a finite number of associations an implementation can
		maintain. Callout servers MUST be able to maintain at least one
		association for each OCP connection they accept.  If a recipient of a
		&SGC_t; message does not create the requested association, it MUST
		immediately terminate the connection with a &CE_tref;
		message indicating a failure.</t>

	</section>

	<section anchor="section_msg-&SGD;" title="&SGD_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&SGD;: extends message with {
					my-sg-id;
				};
			</artwork>
		</figure></t>

		<t>A &SGD_t; message instructs the recipient to forget about the
		service group associated with the specified identifier. The recipient
		MUST destroy the identified service group association.</t>

	</section>

	<section anchor="section_msg-&TS;" title="&TS_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&TS;: extends message with {
					xid my-sg-id;
				};
			</artwork>
		</figure></t>

		<t>Sent by an OPES processor, a &TS; message indicates the start of an
		OCP transaction. Upon receiving of this message, the callout server
		MAY refuse further transaction processing by responding with a
		corresponding &TE_tref; message. A callout server MUST maintain the
		state until it receives a message indicating the end of the
		transaction or until it terminates the transaction itself.</t>

		<t>The required "my-sg-id" identifier refers to a service group
		created with a &SGC_tref; message. The callout server MUST apply the
		list of services associated with "my-sg-id", in the specified
		order.</t>

		<t>This message introduces transaction identifier (xid).</t>

	</section>

	<section anchor="section_msg-&TE;" title="&TE_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&TE;: extends message with {
					xid [result];
				};
			</artwork>
		</figure></t>

		<t>Indicates the end of the identified OCP transaction.</t>

		<t>An OCP agent MUST send a &TE_t; message immediately after it makes
		a decision to send no more messages related to the corresponding
		transaction.  Violating this requirement may cause, for example,
		unnecessary delays, rejection of new transactions, and even timeouts
		for agents that rely on this end-of-file condition to proceed.</t>

		<t>This message terminates the life of the transaction identifier
		(xid).</t>

	</section>

	<section anchor="section_msg-&AMS;" title="&AMS_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&AMS;: extends message with { 
					xid;
					[Services: services];
				};
			</artwork>
		</figure></t>

		<t>An &AMS; message indicates the start of the original or adapted
		application message processing and dataflow. The recipient MAY refuse
		further processing by sending an &AME_tref; message indicating a
		failure.</t>

		<t>When an &AMS; message is sent by the OPES processor, the callout
		server usually sends an &AMS; message back, announcing the creation of
		an adapted version of the original application message.  Such
		announcement may be delayed. For example, the callout server may wait
		for more information to come from the OPES processor.</t>

		<t>When an &AMS; message is sent by the callout server, an optional
		"Services" parameter describes OPES services that the server MAY apply
		to the original application message. Usually, the "services" value
		matches what was asked by the OPES processor. The callout server
		SHOULD send a "Services" parameter the parameter value would differ
		from the list of services requested by the OPES processor. Since the
		same service may be known under many names, the mismatch does not
		necessarily imply an error).</t>

	</section>

	<section anchor="section_msg-&AME;" title="&AME_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&AME;: extends message with {
					xid [result];
				};
			</artwork>
		</figure></t>

		<t>An &AME; message indicates the end of the original or adapted
		application message processing and dataflow. The recipient should
		expect no more data for the corresponding application message.</t>

		<t>An &AME_t; message ends any data preservation commitments and any
		other state associated with the corresponding application message.</t>

		<t>An OCP agent MUST send an &AME_t; message immediately after it
		makes a decision to stop processing of its application message.
		Violating this requirement may cause, for example, unnecessary delays,
		rejection of new transactions, and even timeouts for agents that rely
		on this end-of-file condition to proceed.</t>
		
	</section>

	<section anchor="section_msg-&DUM;" title="&DUM_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&DUM;: extends message with {
					xid my-offset;
					[As-is: org-offset];
					[Kept: org-offset org-size ];
					[Modp: modp];
				} and payload;
			</artwork>
		</figure></t>

		<t>A &DUM; message carries application data. It is the only OCP Core
		message with documented payload. The sender MUST NOT make any gaps in
		data supplied by &DUM_t; and &DUY_t; messages (i.e., the my-offset of
		the next data message must be equal to my-offset plus the payload size
		of the previous data message). Messages with gaps are invalid. The
		sender MUST send payload and MAY use empty payload (i.e., payload with
		zero size). A &DUM; message without payload is invalid. Empty payloads
		are useful for communicating meta-information about the data (e.g.,
		modification predictions or preservation commitments) without sending
		data.</t>

		<t>An OPES processor MAY send a "Kept" parameter to indicate its
		current <xref target="section_keeping">data preservation
		commitment</xref> for original data.  When an OPES processor sends a
		"Kept" parameter, the processor MUST keep a copy of the specified data
		(the preservation commitment starts or continues).  The Kept offset
		parameter specifies the offset of the first octet of the preserved
		data. The Kept size parameter is the size of preserved data. Note that
		data preservation rules allow (i.e., do not prohibit) OPES processor
		to decrease offset and to specify a data range not yet fully delivered
		to the callout server. OCP Core does not require any relationship
		between &DUM; payload and the "Kept" parameter.</t>

		<t>If the "Kept" parameter value violates data preservation rules, but
		the recipient has not sent any &DUY_tref; messages for the given OCP
		transaction yet, then the recipient MUST NOT use any preserved data
		for the given transaction (i.e., must not sent any &DUY_tref;
		messages). If the "Kept" parameter value violates data preservation
		rules, and the recipient has already sent &DUY_tref; messages, the
		&DUM; message is invalid and the rules of <xref
		target="section_invalid" /> apply. These requirements help preserve
		data integrity when "Kept" optimization is used by the OPES
		processor.</t>

		<t>A callout server MUST send a "Modp" parameter if the server can
		provide a reliable value and has not already sent the same parameter
		value for the corresponding application message. The definition of
		"reliable" is entirely up to the callout server. The data modification
		prediction includes &DUM; payload. That is, if attached payload has
		been modified, the modp value cannot be 0%.</t>

		<t>A callout server SHOULD send an "As-is" parameter if the attached
		data is identical to a fragment at the specified offset in the
		original dataflow.  An "As-is" parameter specifying a data fragment
		that have not been sent to the callout server is invalid. The
		recipient MUST ignore invalid "As-is" parameters. Identical means that
		all adapted octets have the same numeric value as the corresponding
		original octets. This parameter is meant to allow for partial data
		preservation optimizations without a preservation commitment. The
		preserved data still crosses the connection with the callout server
		twice, but OPES processor may be able to optimize its handling of the
		data.</t>

		<t>The OPES processor MUST NOT terminate its <xref
		target="section_keeping">data preservation commitment</xref> in
		reaction to receiving a &DUM_t; message.</t>

	</section>

	<section anchor="section_msg-&DUY;" title="&DUY_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&DUY;: extends message with {
					xid org-offset org-size;
				};
			</artwork>
		</figure></t>

		<t>The callout server tells the OPES processor to use the "size" bytes
		of preserved original data starting at the specified offset, as if
		that data chunk came from the callout server in a &DUM_tref;
		message.</t>

		<t>The OPES processor MUST NOT terminate its <xref
		target="section_keeping">data preservation commitment</xref> in
		reaction to receiving a &DUY_t; message.</t>

	</section>

	<section anchor="section_msg-&DPI;" title="&DPI_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&DPI;: extends message with {
					xid org-offset org-size;
				};
			</artwork>
		</figure></t>

		<t>The &DPI_t; message describes an original data chunk using the
		first octet offset and size as parameters. The chunk is the only area
		of original data that callout server may be interested in referring to
		in future &DUY_tref; messages. This data chunk is referred to as
		"reusable data".  The rest of the original data is referred to as
		"disposable data". Thus, disposable data consists of octets below the
		specified offset and at or above the (offset+size) offset.</t>

		<t>After sending this message, the callout server MUST NOT send
		&DUY_t; messages referring to disposable data chunk(s). If an OPES
		processor is not preserving some reusable data, it MAY start
		preserving that data. If the OPES processor preserves some disposable
		data, it MAY stop preserving that data. If an OPES processor does not
		preserve some disposable data, it MAY NOT start preserving that
		data.</t>

		<t>A callout server MUST NOT indicate reusable data areas that overlap
		with disposable data areas indicated in previous &DPI_t; messages. In
		other words, reusable data must not grow and disposable data must not
		shrink. If a callout server violates this rule, the &DPI_t; message
		is invalid (see <xref target="section_invalid" />).</t>

		<t>The &DPI_t; message cannot force the OPES processor to preserve
		data. The term reusable in this context stands for callout server
		interest in reusing the data in the future, given the OPES processor
		cooperation.</t>
		
		<t>For example, an offset value of zero and the size value of
		&SIZE_MAX; indicates that the server may want to reuse all the
		original data. The size value of zero indicates that the server is not
		going to send any more &DUY_t; messages.</t>

	</section>

	<section anchor="section_msg-&DWSR;" title="&DWSR_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&DWSR;: extends message with {
					xid org-size;
				};
			</artwork>
		</figure></t>

		<t>The &DWSR_t; message informs OPES processor that the callout server
		wants to stop receiving original data any time after receiving at
		least org-size worth of application message prefix. That is, the
		server is asking the processor to terminate original dataflow
		prematurely (see <xref target="section_data-stop-org" />) after
		sending at least org-size octets.</t>

		<t>An OPES processor receiving a &DWSR_tref; message SHOULD terminate
		original dataflow by sending an &AME_tref; message with a 206 (partial)
		status code.</t>

		<t>An OPES processor MUST NOT terminate its <xref
		target="section_keeping">data preservation commitment</xref> in
		reaction to receiving a &DWSR_t; message. Just like with any other
		message, an OPES processor may use information supplied by &DWSR_t; to
		decide on future preservation commitments.</t>

	</section>

	<section anchor="section_msg-&DWSS;" title="&DWSS_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&DWSS;: extends message with {
					xid;
				};
			</artwork>
		</figure></t>

		<t>The &DWSS_t; message informs OPES processor that the callout server
		wants to stop sending adapted data as soon as possible; the server is
		asking the processor for a permission to terminate adapted dataflow
		prematurely (see <xref target="section_data-stop-adp" />). The OPES
		processor can grant such a permission using a &DSS_tref; message.</t>

		<t>Once the &DWSS; message is sent, the callout server MUST NOT
		prematurely terminate adapted dataflow until the server receives a
		&DSS; message from the OPES processor. If the server violates this
		rule, the OPES processor MUST act as if no &DWSS; message was
		received. The latter implies that the OCP transaction is terminated by
		the processor, with an error.</t>

		<t>An OPES processor receiving a &DWSS; message SHOULD respond with an
		&DSS_tref; message, provided the processor would not violate &DSS;
		message requirements by doing so. The processor SHOULD respond
		immediately once &DSS; message requirements can be satisfied.</t>

	</section>

	<section anchor="section_msg-&DSS;" title="&DSS_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&DSS;: extends message with {
					xid;
				};
			</artwork>
		</figure></t>

		<t>The &DSS_t; message instructs the callout server to terminate
		adapted dataflow prematurely by sending an &AME_tref; message with a
		206 (partial) status code. A callout server is expected to solicit the
		&DSS_t; message by sending a &DWSS_tref; message (see <xref
		target="section_data-stop-adp" />).</t>

		<t>A callout server receiving a solicited &DSS_tref; message for a
		yet-unterminated adapted dataflow MUST immediately terminate dataflow
		by sending an &AME_tref; message with a 206 (partial) status code. If
		the callout server already terminated adapted dataflow, the callout
		server MUST ignore the &DSS_tref; message. A callout server receiving
		an unsolicited &DSS; message for a yet-unterminated adapted dataflow
		MUST either treat that message as invalid or as solicited (i.e., the
		server cannot simply ignore unsolicited &DSS; messages).</t>

		<t>The OPES processor sending a &DSS_tref; message MUST be able to
		correctly reconstruct adapted application message after the callout
		server terminates dataflow. This requirement implies that the
		processor must have access to any original data sent to the callout
		after the &DSS_tref; message, if any. Consequently, the OPES processor
		has to either send no data at all or keep a copy of it.</t>

		<t>If a callout server receives a &DSS; message and, in violation of
		the above rules, waits for more original data before sending an
		&AME_tref; response, a deadlock may occur: the OPES processor may
		wait for the &AME_tref; message to send more original data.</t>

	</section>

	<section anchor="section_msg-&DWP;" title="&DWP_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&DWP;: extends message with {
					xid your-offset;
				};
			</artwork>
		</figure></t>

		<t>The &DWP_t; message indicates sender's temporary lack of
		interest in receiving data starting with the specified offset. This
		disinterest in receiving data is temporary in nature and implies
		nothing about sender's intent to send data.</t>

		<t>The "your-offset" parameter refers to dataflow originating
		at the OCP agent receiving the parameter.</t>

		<t>If, at the time the &DWP_t; message was received, the recipient has
		already sent data at the specified offset, the message recipient MUST
		stop sending data immediately. Otherwise, the recipient MUST stop
		sending data immediately after it sends the specified offset. Once
		the recipient stops sending more data, it MUST immediately send a
		&DPM_tref; message and MUST NOT send more data until it receives a
		&DWM_tref; message.</t>
	
		<t>As most OCP Core mechanisms, data pausing is asynchronous. The
		sender of the &DWP_t; message MUST NOT rely on the data being
		paused exactly at the specified offset or at all.</t>

	</section>

	<section anchor="section_msg-&DPM;" title="&DPM_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&DPM;: extends message with {
					xid;
				};
			</artwork>
		</figure></t>

		<t>The &DPM_t; message indicates sender's commitment to send
		no more data until the sender receives a &DWM_tref; message.</t>

		<t>The recipient of the &DPM_t; message MAY expect the data
		delivery being paused. If the recipient receives data despite this
		expectation, it MAY abort the corresponding transaction with a
		&TE_tref; message indicating a failure.</t>

	</section>

	<section anchor="section_msg-&DWM;" title="&DWM_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&DWM;: extends message with {
					xid;
					[Size-request: your-size];
				};
			</artwork>
		</figure></t>

		<t>The &DWM_t; message indicates sender's need for more
		data.</t>

		<t>Message parameters always refer to dataflow originating at the
		other OCP agent: when sent by an OPES processor, your-size is adp-size;
		when sent by a callout server, your-size is org-size.</t>

		<t>The "Size-request" parameter refers to dataflow originating at the
		OCP agent receiving the parameter. If a "Size-request" parameter is
		present, its value is the suggested minimum data size. It is meant to
		allow the recipient to deliver data in fewer chunks. The recipient MAY
		ignore the "Size-request" parameter. An absent "Size-request"
		parameter implies "any size".</t>

		<t>The message also cancels the &DPM_tref; message effect. If
		the recipient was not sending any data because of its &DPM;
		message, the recipient MAY resume sending data. Note, however, that
		the &DWM_t; message can be sent regardless of whether the
		dataflow in question has been paused. The "Size-request" parameter
		makes this message a useful stand-alone optimization.</t>

	</section>

	<section anchor="section_msg-&NO;" title="&NO_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&NO;: extends message with {
					features;
					[SG: my-sg-id];
					[Offer-Pending: boolean];
				};
			</artwork>
		</figure></t>

		<t>A &NO_t; message solicits a selection of a single "best" feature
		out of a supplied list, using a &NR_tref; message. The sender is
		expected to list preferred features first when possible.  The
		recipient MAY ignore sender preferences. If the list of features is
		empty, the negotiation is bound to fail but remains valid.</t>

		<t>Both OPES processor and callout server are allowed to
		send &NO_t; messages. The rules in this section ensure
		that only one offer is honored if two offers are submitted
		concurrently. An agent MUST NOT send a &NO_t; message
		if it still expects a response to its previous offer on the same
		connection.</t>

		<t>If an OPES processor receives a &NO_t; message while its own offer
		is pending, the processor MUST disregard the server offer. Otherwise,
		it MUST respond immediately.</t>

		<t>If a callout server receives a &NO_t; message when its own offer is
		pending, the server MUST disregard its own offer.  In either case, the
		server MUST respond immediately.</t>

		<t>If an agent receives a message sequence that violates any of the
		above rules in this section, the agent MUST terminate the connection
		with a &CE_tref; message indicating a failure.</t>

		<t>An optional "Offer-Pending" parameter is used for Negotiation Phase
		<xref target="section_negotiation_phase">maintenance</xref>. The
		option's value defaults to "false".</t>

		<t>An optional "SG" parameter is used to narrow the scope of
		negotiations to the specified service group. If SG is present, the
		negotiated features are negotiated and enabled only for transactions
		that use the specified service group ID. Connection-scoped features
		are negotiated and enabled for all service groups. The presence of
		scope does not imply automatic conflict resolution common to
		programming languages; no conflicts are allowed. When negotiating
		connection-scoped features, an agent MUST check for conflicts within
		each existing service group.  When negotiating group-scoped features,
		an agent MUST check for conflicts with connection-scoped features
		already negotiated.  For example, it must not be possible to negotiate
		a connection-scoped HTTP application profile if one service group
		already has an SMTP application profile and vice versa.</t>

		<t>OCP agents SHOULD NOT send offers with service groups used by
		pending transactions. Unless explicitly noted otherwise in a feature
		documentation, OCP agents MUST NOT apply any negotiations to pending
		transactions. In other words, negotiated features take effect with the
		new OCP transaction.</t>

		<t>As with other protocol elements, OCP Core extensions may document
		additional negotiation restrictions. For example, specification of a
		transport security feature may prohibit the use of SG parameter in
		negotiation offers, to avoid situations where encryption is enabled
		for only a portion of overlapping transactions on the same transport
		connection.</t>

	</section>

	<section anchor="section_msg-&NR;" title="&NR_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&NR;: extends message with {
					[feature];
					[SG: my-sg-id];
					[Rejects: features];
					[Unknowns: features];
					[Offer-Pending: boolean];
				};
			</artwork>
		</figure></t>

		<t>A &NR_t; message conveys recipient's reaction to a &NO_tref;
		request.  An accepted offer (a.k.a., positive response) is indicated
		by the presence of an anonymous "feature" parameter, containing the
		selected feature. If the selected feature does not match any of the
		offered features, the offering agent MUST consider negotiation failed
		and MAY terminate the connection with a &CE_tref; message indicating a
		failure.</t>

		<t>A rejected offer (a.k.a., negative response) is indicated by
		omitting the anonymous "feature" parameter.</t>

		<t>The successfully negotiated feature becomes effective immediately:
		The sender of a positive response MUST consider the corresponding
		feature enabled immediately after the response is sent; the recipient
		of a positive response MUST consider the corresponding feature enabled
		immediately after the response is received. Note that the scope of the
		negotiated feature application may be limited to a specified service
		group. The negotiation phase state does not affect enabling of the
		feature.</t>

		<t>If negotiation offer contains an SG parameter, the responder MUST
		include that parameter in the &NR_t; message.  The
		recipient of a &NR; message without the expected
		SG parameter MUST treat negotiation response as invalid.</t>

		<t>If negotiation offer lacks an SG parameter, the responder MUST NOT
		include that parameter in the &NR_t; message.  The
		recipient of a &NR; message with an unexpected SG
		parameter MUST treat negotiation response as invalid.</t>

		<t>An optional "Offer-Pending" parameter is used for Negotiation Phase
		<xref target="section_negotiation_phase">maintenance</xref>. The
		option's value defaults to "false".</t>

		<t>When accepting or rejecting an offer, the sender of the &NR_t;
		message MAY supply additional details via Rejects and Unknowns
		parameters.  The Rejects parameter can be used to list features that
		were known to the &NO_tref; recipient but could not be supported given
		negotiated state that existed when &NO; message was received. The
		Unknowns parameter can be used to list features that were unknown to
		the &NO; recipient.</t>

	</section>

	<section anchor="section_msg-&AQ;" title="&AQ_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&AQ;: extends message with {
					feature;
				};
			</artwork>
		</figure></t>

		<t>A &AQ_t; message solicits an immediate &AA_tref; response. The
		recipient MUST respond immediately with a &AA; message. This is a
		read-only, non-modifying interface. The recipient MUST NOT enable or
		disable any features due to an &AQ; request.</t>

		<t>OCP extensions documenting a feature MAY extend &AQ; messages to
		supply additional information about the feature or the query
		itself.</t>

		<t>The primary intended purpose of the ability inquiry interface is
		debugging and troubleshooting rather than automated fine-tuning of
		agent behavior and configuration. The latter may be better achieved by
		the OCP <xref target="section_negotiation">negotiation
		mechanism</xref>.</t>

	</section>

	<section anchor="section_msg-&AA;" title="&AA_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&AA;: extends message with {
					boolean;
				};
			</artwork>
		</figure></t>

		<t>A &AA_t; message expresses senders support for a feature requested
		via a &AQ_tref; message.  The sender MUST set the value of the
		anonymous boolean parameter to the truthfulness of the following
		statement: "at the time of this answer generation, the sender supports
		the feature in question". The meaning of "support" and additional
		details are feature-specific. OCP extensions documenting a feature
		MUST document the definition of "support" in the scope of the above
		statement and MAY extend &AA; messages to supply additional
		information about the feature or the answer itself.</t>

	</section>

	<section anchor="section_msg-&PQ;" title="&PQ_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&PQ;: extends message with {
					[xid];
				};
			</artwork>
		</figure></t>

		<t>A &PQ_t; message solicits an immediate &PA_tref; response. The
		recipient MUST immediately respond to a &PQ; request, even if the
		transaction identifier is invalid from the recipient point of
		view.</t>

	</section>

	<section anchor="section_msg-&PA;" title="&PA_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&PA;: extends message with {
					[xid];
					[Org-Data: org-size];
				};
			</artwork>
		</figure></t>

		<t>A &PA; message carries sender's state. The "Org-Data" size is the
		total original data size received or sent by the agent so far for the
		identified application message (an agent can be either sending or
		receiving original data so there is no ambiguity). When referring to
		received data, progress information does not imply that the data has
		been otherwise processed in some way.</t>

		<t>The progress inquiry interface is useful for several purposes,
		including keeping idle OCP connections "alive", gauging the agent
		processing speed, verifying agent's progress, and debugging OCP
		communications.  Verifying progress, for example, may be essential to
		implement timeouts for callout servers that do not send any adapted
		data until the entire original application message is received and
		processed.</t>

		<t>A recipient of a &PA; message MUST NOT assume that the sender is
		not working on any transaction or application message not identified
		in the &PA; message. A &PA; message does not carry information about
		multiple transactions or application messages.</t>
		
		<t>If an agent is working on the transaction identified in the &PQ_t;
		request, the agent MUST send the corresponding transaction ID (xid)
		when answering &PQ; with a &PA; message.  Otherwise, the agent MUST
		NOT send the transaction ID.  If an agent is working on the original
		application message for the specified transaction, the agent MUST send
		the Org-Data parameter.  Otherwise (i.e., the agent has already sent or
		received the &AME_tref; message for the original dataflow), the agent
		MUST NOT send the Org-data parameter.</t>

		<t>Informally, the &PA; message relays sender's progress with the
		transaction and original dataflow identified by the &PQ_tref; message,
		provided the transaction identifier is still valid at the time of the
		answer.  Absent information in the answer indicates invalid, unknown,
		or closed transaction and/or original dataflow from the query recipient
		point of view.</t>

	</section>

	<section anchor="section_msg-&PR;" title="&PR_t;">

		<t><figure>
			<artwork trimspace='yes'>
				&PR;: extends message with {
					[xid];
					[Org-Data: org-size];
				};
			</artwork>
		</figure></t>

		<t>A &PR; message carries senders state. The message semantics and
		associated requirements are identical to that of a &PA_tref; message
		except that the &PR; message is sent unsolicited. The sender MAY
		report progress at any time. The sender MAY report progress unrelated
		to any transaction or original application message or related to any
		valid (current) transaction or original dataflow.</t>

		<t>Unsolicited progress reports are especially useful for OCP
		extensions dealing with "slow" callout services that introduce
		significant delays for the final application message recipient.  The
		report may contain progress information that will make that final
		recipient more delay-tolerant.</t>

	</section>

</section>


<section anchor="section_iab" title="IAB Considerations">

	<t>OPES treatment of IETF Internet Architecture Board (IAB) <xref
	target="RFC3238">considerations</xref> are documented in <xref
	target="I-D.ietf-opes-iab" />.</t>

</section>


<section anchor="section_security" title="Security Considerations">

	<t>This section examines security considerations for OCP. OPES threats
	are documented in <xref target="I-D.ietf-opes-threats" />.</t>

	<t>OCP relays application messages that may contain sensitive information.
	Appropriate transport encryption can be negotiated to prevent information
	leakage or modification (see <xref target="section_negotiation" />), but
	OCP agents may support unencrypted transport by default.  Such default OCP
	agent configurations will expose application messages to third party
	recording and modification, even if OPES proxies themselves are secure.</t>

	<t>OCP implementation bugs may lead to security vulnerabilities in OCP
	agents, even if OCP traffic itself remains secure. For example, a buffer
	overflow in a callout server caused by a malicious OPES processor may
	grant that processor access to information from other (100% secure) OCP
	connections, including connections with other OPES processors.</t>

	<t>Careless OCP implementations may rely on various OCP identifiers to be
	unique across all OCP agents. A malicious agent can inject an OCP message
	that matches identifiers used by other agents, in an attempt to get access
	to sensitive data. OCP implementations must always check an identifier for
	being "local" to the corresponding connection before using that
	identifier.</t>

	<t>OCP is a stateful protocol. Several OCP commands increase the amount of
	state that the recipient has to maintain. For example, a &SGC_tref;
	message instructs the recipient to maintain an association between a
	service group identifier and a list of services.</t>

	<t>Implementations that cannot handle resource exhaustion correctly
	increase security risks. The following are known OCP-related resources
	that may be exhausted during a compliant OCP message exchange:

		<list style="hanging">

			<t hangText="OCP message structures:">OCP message syntax does not
			limit the nesting depth of OCP message structures and does not
			place an upper limit on the length (number of OCTETs) of most
			syntax elements.</t>

			<t hangText="concurrent connections:">OCP does not place an upper
			limit on the number of concurrent connections that a callout
			server may be instructed to create via &CS_tref; messages.</t>

			<t hangText="service groups:">OCP does not place an upper limit on
			the number of service group associations that a callout server may
			be instructed to create via &SGC_tref; messages.</t>

			<t hangText="concurrent transactions:">OCP does not place an upper
			limit on the number of concurrent transactions that a callout
			server may be instructed to maintain via &TS_tref;
			messages.</t>

			<t hangText="concurrent flows:">OCP Core does not place an upper
			limit on the number of concurrent adapted flows that an OPES
			processor may be instructed to maintain via &AMS_tref;
			messages.</t>

		</list>

	</t>

</section>

<section anchor="section_iana" title="IANA Considerations">

	<t>The IANA maintains a list of OCP features, including application
	profiles (Section 10.11). For each feature, its "uri" parameter value is
	registered along with the extension parameters (if any).  Registered
	feature syntax and semantics are documented using PETDM <xref
	target="section_message-PETDM">notation</xref>.</t>

	<t>The IESG is responsible for assigning a designated expert to review
	each standards-track registration prior to the IANA making the assignment.
	The OPES working group mailing list may be used to solicit commentary for
	both standards-track and non-standards-track features.</t>

	<t>Standards-track OCP Core extensions SHOULD use
	"http://iana.org/assignments/opes/ocp/" prefix for feature "uri"
	parameters.  It is suggested that the IANA populates resources identified
	by such "uri" parameters with corresponding feature registrations.  It is
	also suggested that the IANA maintains an index of all registered OCP
	features at http://iana.org/assignments/opes/ocp/ URL or on a page linked
	from that URL.</t>

	<t>This specification defines no OCP features for IANA registration.</t>

</section>

<section anchor="section_compliance" title="Compliance">

	<t>This specification defines compliance for the following compliance
	subjects:  OPES processors (OCP client implementations), callout servers
	(OCP server implementations), OCP extensions. An OCP agent (a processor or
	callout server) may also be referred to as "sender" or "recipient" of an
	OCP message.</t>

	<t>A compliance subject is compliant if it satisfies all applicable "MUST"
	and "SHOULD" level requirements. By definition, to satisfy a "MUST" level
	requirement means to act as prescribed by the requirement; to satisfy a
	"SHOULD" level requirement means to either act as prescribed by the
	requirement or have a reason to act differently. A requirement is
	applicable to the subject if it instructs (addresses) the subject.</t>

	<t>Informally, OCP compliance means that there are no known "MUST"
	violations, and all "SHOULD" violations are conscious. In other words, a
	"SHOULD" means "MUST satisfy or MUST have a reason to violate".  It is
	expected that compliance claims are accompanied by a list of unsupported
	SHOULDs (if any), in an appropriate format, explaining why preferred
	behavior was not chosen.</t>

	<t>Only normative parts of this specification affect compliance.
	Normative parts are: parts explicitly marked using the word "normative",
	definitions, and phrases containing unquoted capitalized keywords from
	<xref target="RFC2119" />. Consequently, examples and illustrations are
	not normative.</t>

<section anchor="section_compliance_ext" title="Adapting OCP Core">

	<t>OCP extensions MAY change any normative requirement documented in this
	specification, including OCP message syntax, except for the following
	rule: OCP extensions MUST require that changes to normative parts of OCP
	Core are negotiated prior to taking effect. In other words, this
	specification defines compliant agent behavior until changes to this
	specifications (if any) are successfully negotiated.</t>

	<t>For example, if an RTSP profile for OCP requires support for sizes
	exceeding &SIZE_MAX; octets, the profile specification can document
	appropriate OCP message syntax and semantics changes while requiring that
	RTSP adaptation agents negotiate "large size" support before using large
	sizes. Such negotiation can be bundled with negotiating another feature
	(e.g., negotiating an RTSP profile may imply support for large sizes).</t>

	<t>As implied by the above rule, OCP extensions may dynamically alter the
	negotiation mechanism itself. Such an alternation would have to be
	negotiated first, using the negotiation mechanism defined by this
	specification. For example, successfully negotiating a feature might
	change the default "Offer-Pending" value from false to true.</t>

</section> <!-- Adapting OCP Core -->

</section>

<appendix anchor="section_message-sum" title="Message Summary">

	<t>This appendix is not normative. The table below summarizes key OCP
	message properties. For each message, the table provides the following
	information:

	<list style="hanging">

		<t hangText="name:">message name as seen on the wire;</t>

		<t hangText="title:">human-friendly message title;</t>

		<t hangText="P:">whether this specification documents message
			semantics as sent by an OPES processor;</t>

		<t hangText="S:">whether this specification documents message
			semantics as sent by a callout server;</t> 

		<t hangText="tie:">related messages such as associated request or
			response message or associated state message.</t>

	</list>

	</t>

	<texttable>

		<ttcol width='10%'  align='center'>name</ttcol>
		<ttcol             align='center'>title</ttcol>
		<ttcol width='5%'  align='center'>P</ttcol>
		<ttcol width='5%'  align='center'>S</ttcol>
		<ttcol width='22%' align='center'>tie</ttcol>

		<c>&CS;</c>
		<c>&CS_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&CE;</c>

		<c>&CE;</c>
		<c>&CE_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&CS;</c>

		<c>&SGC;</c>
		<c>&SGC_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&SGD; &TS;</c>

		<c>&SGD;</c>
		<c>&SGD_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&SGC;</c>

		<c>&TS;</c>
		<c>&TS_jt;</c>
		<c>X</c>
		<c></c>
		<c>&TE; &SGC;</c>

		<c>&TE;</c>
		<c>&TE_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&TS;</c>

		<c>&AMS;</c>
		<c>&AMS_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&AME;</c>

		<c>&AME;</c>
		<c>&AME_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&AMS; &DSS;</c>

		<c>&DUM;</c>
		<c>&DUM_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&DUY; &DWP;</c>

		<c>&DUY;</c>
		<c>&DUY_jt;</c>
		<c></c>
		<c>X</c>
		<c>&DUM; &DPI;</c>

		<c>&DPI;</c>
		<c>&DPI_jt;</c>
		<c></c>
		<c>X</c>
		<c>&DUY;</c>

		<c>&DWSS;</c>
		<c>&DWSS_jt;</c>
		<c></c>
		<c>X</c>
		<c>&DWSR; &DSS;</c>

		<c>&DWSR;</c>
		<c>&DWSR_jt;</c>
		<c></c>
		<c>X</c>
		<c>&DWSS;</c>

		<c>&DSS;</c>
		<c>&DSS_jt;</c>
		<c>X</c>
		<c></c>
		<c>&DWSS;</c>

		<c>&DWP;</c>
		<c>&DWP_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&DPM;</c>

		<c>&DPM;</c>
		<c>&DPM_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&DWP; &DWM;</c>

		<c>&DWM;</c>
		<c>&DWM_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&DPM;</c>

		<c>&NO;</c>
		<c>&NO_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&NR; &SGC;</c>

		<c>&NR;</c>
		<c>&NR_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&NO;</c>

		<c>&PQ;</c>
		<c>&PQ_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&PA;</c>

		<c>&PA;</c>
		<c>&PA_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&PQ; &PR;</c>

		<c>&PR;</c>
		<c>&PR_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&PA;</c>

		<c>&AQ;</c>
		<c>&AQ_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&AA;</c>

		<c>&AA;</c>
		<c>&AA_jt;</c>
		<c>X</c>
		<c>X</c>
		<c>&AQ;</c>

	</texttable>

</appendix>


<appendix anchor="section_state-sum" title="State Summary">

	<t>This appendix is not normative. The table below summarizes OCP states.
	Some states are maintained across multiple transactions and application
	messages. Some states correspond to a single request/response dialog;
	asynchronous nature of most OCP message exchanges requires OCP agents to
	process other messages while waiting for a response to a request and,
	hence, maintaining the state of the dialog.</t>

	<t>For each state, the table provides the following information:

	<list style="hanging">

		<t hangText="state:">short state label</t>
	
		<t hangText="birth:">messages creating this state</t>

		<t hangText="death:">messages destroying this state</t>

		<t hangText="ID:">associated identifier, if any</t>

	</list>

	</t>

	<texttable>

		<ttcol width='25%' align='center'>state</ttcol>
		<ttcol  align='left'>birth</ttcol>
		<ttcol  align='left'>death</ttcol>
		<ttcol width='20%' align='center'>ID</ttcol>

		<c>connection</c>
		<c>&CS;</c>
		<c>&CE;</c>
		<c></c>

		<c>service group</c>
		<c>&SGC;</c>
		<c>&SGD;</c>
		<c>sg-id</c>

		<c>transaction</c>
		<c>&TS;</c>
		<c>&TE;</c>
		<c>xid</c>

		<c>application message and dataflow</c>
		<c>&AMS;</c>
		<c>&AME;</c>
		<c></c>

		<c>premature org-dataflow termination</c>
		<c>&DWSR;</c>
		<c>&AME;</c>
		<c></c>

		<c>premature adp-dataflow termination</c>
		<c>&DWSS;</c>
		<c>&DSS; &AME;</c>
		<c></c>

		<c>paused dataflow</c>
		<c>&DPM;</c>
		<c>&DWM;</c>
		<c></c>

		<c>preservation commitment</c>
		<c>&DUM;</c>
		<c>&DPI; &AME;</c>
		<c></c>

		<c>negotiation</c>
		<c>&NO;</c>
		<c>&NR;</c>
		<c></c>

		<c>progress inquiry</c>
		<c>&PQ;</c>
		<c>&PA;</c>
		<c></c>

		<c>ability inquiry</c>
		<c>&PQ;</c>
		<c>&PA;</c>
		<c></c>

	</texttable>

</appendix>

<appendix anchor="section_acks" title="Acknowledgments">

	<t>The author gratefully acknowledges the contributions of: Abbie Barbir
	(Nortel Networks), Oskar Batuner (Independent Consultant), Larry Masinter
	(Adobe), Karel Mittig (France Telecom R&amp;D), Markus Hofmann (Bell
	Labs), Hilarie Orman (The Purple Streak), Reinaldo Penno (Nortel
	Networks), Martin Stecher (Webwasher) as well as an anonymous OPES working
	group participant.</t>

	<t>Special thanks to Marshall Rose for his xml2rfc tool.</t>

</appendix>

<appendix anchor="section_change_log" title="Change Log">

	<t>RFC Editor Note: This section is to be removed during the final
	publication of the document.</t>

	<t>Internal WG revision control ID: $Id: ocp-core.xml,v 1.88 2004/05/04 05:54:09 rousskov Exp $</t>

	<t><list style="hanging">

	<t hangText="2004/05/03"><list style="symbols">

		<t>Explicitly and formally required that negotiated features are
		effective immediately and polished negotiation example to reflect
		that.</t>

		<t>Further clarified that extensions may change Core requirements,
		including negotiation mechanisms, as long as all changes are
		negotiated first. For example, the first dynamic change to the
		negotiation mechanism would have to be negotiated using the Core
		negotiation mechanism.</t>

		<t>Informally noted that extensions may add further restrictions on
		negotiation semantics.</t>

		<t>Filled IANA Considerations section and changed example URIs to
		reflect proposed IANA registration format.</t>

	</list></t>

	<t hangText="2003/12/15"><list style="symbols">

		<t>Added an OPES Document Map boilerplate.</t>

	</list></t>

	<t hangText="2003/12/12"><list style="symbols">

		<t>Be explicit about one premature dataflow termination not affecting
		the other dataflow termination.</t>

		<t>Editorial changes.</t>

	</list></t>

	<t hangText="2003/12/11"><list style="symbols">

		<t>Polished Abstract.</t>

		<t>Replaced overlapping DIY and DWOL mechanisms with atomic mechanisms
		to terminate original or adapted dataflow that can be combined to
		support "Getting Out Of The Data Loop" optimization. Streamlined
		related 206 (partial) status code definition.</t>

		<t>Added namespace tags to PETDM so that extensions can extend Core
		messages without renaming them (changing OCP message type changes its
		name which is not acceptable for most extensions). The same technique
		can be useful for extending Core types when the extended type is meant
		to be used everywhere the original core type was used.</t>

		<t>Renamed "application binding" to "application profile".</t>

		<t>Acknowledged Larry Masinter contribution. Larry reviewed HTTP
		Adaptations draft and gave a few very useful comments related to OCP
		Core.</t>

		<t>Editorial changes.</t>

	</list></t>

	<t hangText="2003/12/07"><list style="symbols">

		<t>Be more explicit about absence of OCP connection encryption and
		agent authentication requirements in OCP Core.</t>

		<t>Removed application message identifier (am-id). OCP Core now
		defaults to single original and adapted messages, leaving it up to OCP
		extensions to specify how to distinguish multiple original or adapted
		dataflows within the same transaction. HTTP binding does not need to
		do that. SMTP binding will need to do that.</t>

		<t>Editorial changes.</t>

		<t>Added request/response states to State Summary appendix.</t>

	</list></t>

	<t hangText="2003/11/01"><list style="symbols">

		<t>Simplified/streamlined ping-pong interface: Moved "unsolicited pong"
		semantics to a Progress Report (PR) message. Moved "solicited pong"
		semantics to a Progress Answer (PA) message. Renamed Progress
		Request (ping) to Progress Query (PQ). Renamed "Progress"
		parameter to "Org-Data".</t>

		<t>Added informative summaries of OCP messages and states as
		appendices.</t>

		<t>Added a requirement for uni values to increase so that
		agents can easily enforce uni uniqueness.</t>

		<t>Added Dataflow-specific types for size, offset, am-id, and sg-id.
		Resolved several ambiguities in message declarations: "which am-id
		should this message use, original or adapted?".</t>

		<t>Renamed Data Interested in Using Yours (DIUY) message to Data
		Preservation Interest (DPI).</t>

		<t>Renamed Data Won't Look At Yours (DWLY) message to Ignoring Your
		Data (DIY).</t>

		<t>Renamed Data Pause (data-pause) message to Want Data Paused
		(DWP).</t>

		<t>Renamed Data Paused (data-paused) message to Paused My Data
		(DPM).</t>

		<t>Renamed Data Need (data-need) message to Wont More Data (DWM).</t>

		<t>Renamed Data Want Out (DWO) message to Want Out Of The Data Loop
		(DWOL).</t>

	</list></t>

	<t hangText="2003/10/31"><list style="symbols">

		<t>Changed Kept parameter syntax and clarified/simplified/improved its
		semantics. Renamed DWSY message to DIUY and
		clarified/simplified/improved its semantics. All data preservation
		interface is now built around a single continues data chunk that Kept
		parameter and DIUY message refer to when they need to specify what is
		preserved or needs to be.</t>

		<t>Added Negotiation Phase and an optional "Offer-Pending" parameter
		to NO and NR messages to ensure that an OCP agent can negotiate
		vital features before application data is seen on the wire.</t>

		<t>Polished dataflow pausing interface and made its support mandatory.
		Gave an OPES processor the same abilities to pause/resume dataflow
		that a callout server has.</t>

		<t>Added a Timeouts section, requiring all OCP agents to
		support timeouts of some sort.</t>

		<t>Removed data loss to-do item. Extensions would have to take
		care of that complication.</t>

	</list></t>

	<t hangText="2003/10/30"><list style="symbols">

		<t>Merged Capability and State Inquiry mechanisms into a simpler
		Ability Query/Answer (AQ/AA) interface. Added a new MUST:  OCP
		extensions must document what it means to "support" a given feature
		they document. The definition is needed for generation of AA
		messages.</t>

		<t>Removed DoS attacks against callout service as a security
		consideration because its place is in OPES architecture or OPES
		security drafts.</t>

		<t>Merged DACK mechanism into a polished ping-pong mechanism.</t>

		<t>Added a new requirement: An OCP application binding specification MUST
		document whether multiple adapted versions of an original message are
		allowed.</t>

		<t>Declared all OCP messages using PETDM.</t>

		<t>Deleted "Application Protocol Requirements" Section as essentially
		unused.</t>

	</list></t>

	<t hangText="2003/10/28"><list style="symbols">

		<t>Simplified and polished CS message rules. Callout servers MUST send
		CS now so that processors can be sure the other end is talking
		OCP.</t>

		<t>Made "Type Declaration Mnemonic (TDM)" a top-level section titled
		"Protocol Element Type Declaration Mnemonic (PETDM)" and documented
		OCP message declaration mnemonic.</t>

		<t>Merged parameter type declarations with parameter declarations.</t>

		<t>Polished parameter type declarations.</t>

	</list></t>

	<t hangText="2003/10/26"><list style="symbols">

		<t>Started using TDM for Core value types.</t>

		<t>Added Data Want Out (DWO) message.</t>

		<t>Added Data Wont Look at Yours (DWLY) message.</t>

		<t>Renamed Wont-Use to more specific Wont-Send. Made Wont-Send
		parameter into a Data Wont Send Yours (DWSY) message because it
		controls original dataflow and is not specific to a particular
		adapted AM (there can be many). This change means that
		Data Use Yours (DUY) messages are no longer terminating
		preservation commitment by default. Thus, we lost a little
		in terms of performance (unless processors look ahead for
		DWSYs) but gained a lot of simplicity in terms of support
		for multiple adapted application messages (SMTP case).</t>

		<t>Added 206 (partial data) status code definition.</t>

		<t>206 status code should be used with AME, not TE.</t>

		<t>Replaced "global scope" with "connection scope" in
		negotiation rules.</t>

	</list></t>

	<t hangText="2003/10/25"><list style="symbols">

		<t>Clarified negotiation mechanism when it comes to negotiating
		multiple [possibly conflicting] features.</t>

		<t>Clarified service group-scoped negotiations. Agents
		must watch out for global conflicts when doing group-scoped
		negotiations and vice-versa.</t>

	</list></t>

	<t hangText="2003/10/24"><list style="symbols">

		<t>Added 'Out Of The Loop' Optimization section.</t>

		<t>Added 'Data Recycling' Optimization section.</t>

		<t>Added "Type Declaration Mnemonic" (TDM) to facilitate type
		declarations here and in OCP extensions.</t>

	</list></t>

	<t hangText="2003/10/19"><list style="symbols">

		<t>Removed optional "sizep" parameter. HTTP needs
		content-dependent parameter (AM-EL), and we do not know
		any generic application for sizep that would be worth
		supporting in Core.</t>

	</list></t>

	<t hangText="2003/10/08"><list style="symbols">

		<t>Documented backslash (\) and CRLF (\r\n) OCP message
		rendering tricks.</t>

	</list></t>

	<t hangText="2003/10/07"><list style="symbols">

		<t>Added named structure members to message BNF. Used
		MIME-like syntax already used for named parameters.
		Named members are needed to represent optional
		structure members.</t>

	</list></t>

	<t hangText="head-sid15"><list style="symbols">

		<t>Removed leftovers of data-have message name. Use Data Use Mine
		instead (Karel Mittig).</t>

		<t>Anonymized named parameters and removed currently unused "rid"
		parameter in ping and pong messages (Karel Mittig).</t>

		<t>Renamed DUM.please-ack to "DUM.ack" (Karel Mittig). More work is
		needed to polish and simplify acknowledgment mechanism.</t>

	</list></t>

	<t hangText="head-sid14"><list style="symbols">

		<t>Documented known resource-exhaustion security risks.</t>

		<t>Polished compliance definition. Avoid two levels of 
		compliance.</t>

	</list></t>

	<t hangText="head-sid13"><list style="symbols">

		<t>Added SG parameter to Negotiation Offer (NO) and Negotiation
		Response (NR) messages to limit the result of negotiations to
		the specified service group. Still need to document SG-related
		logic in the Negotiation section.</t>

		<t>Removed "services" parameter from Transaction Start (TS) message
		because we have to rely on service groups exclusively, because only
		service groups can have negotiated application profiles associated
		with them.</t>

		<t>Replaced data-id parameter with "Kept: kept-offset" and "Wont-Use:
		used-size" parameter. We probably need octet-based granularity, and
		old data-id only offered fragment-based granularity.</t>

		<t>Made AME and TE messages required.</t>

		<t>Documented result parameter syntax and two
		result codes: 200 (success) and 400 (failure).</t>

		<t>Added optional "result" parameter to CE.</t>

	</list></t>

	<t hangText="head-sid12"><list style="symbols">

		<t>Fixed BNF to remove extra SP and "," in front of
		structure and list values.</t>

		<t>Fixed the type of "id" field in a "service" structure.</t>

		<t>Documented "sg-id" parameter.</t>

		<t>Renamed "copied" to "data-id" so that it can be used by both
		agents. An OPES processor uses named "Copied: data-id" parameter and a
		callout server uses anonymous "data-id" parameter (instead of
		previously documented "copy-am-offset").</t>

		<t>Removed "rid" parameter from Negotiation Offer (NO) message as
		unused.</t>

		<t>Removed "size" parameter from messages with payload since
		payload syntax includes an explicit size value.</t>

		<t>Renamed Data Have (DH) message to Data Use Mine (DUM)
		message to preserve the symmetry with Data Use Yours (DUY)
		message and to prepare for possible addition of Data Check
		Mine (DCM) message.</t>

		<t>Finished phasing out the "modified" message parameter.</t>

		<t>Added an "As-is" named-parameter to mark adapted pieces
		of data identical to the original.</t>

		<t>Replaced a huge "message nesting" figure with a set of short
		specific rules illustrating the same concept. Added a new
		"Exchange Patterns" subsection to accommodate the rules and
		related matters. The figure was not clear enough. Hopefully,
		the rules are.</t>

	</list></t>

	<t hangText="head-sid10"><list style="symbols">

		<t>Removed the concept of OCP connection as a group
		of messages sharing the same group of callout
		services. Now there is no difference between OCP connection
		and transport connection.</t>

		<t>Added a concept of a Service Group, which is a list of services
		with an identifier, for now. A given Service Group is referenced
		by the creating/destroying side only, to prevent destruction
		synchronization.</t>

		<t>Removed Connection Services (CSvc) message.</t>

		<t>Removed connection priority until proven generally useful. Can 
		be implemented as an extension.</t>

	</list></t>

	<t hangText="head-sid9"><list style="symbols">

		<t>Added Negotiation and Capability Inquiry sections.</t>

		<t>Deleted data-end message because AME (Application Message End)
		already does the same thing and because there is no data-start
		message.</t>

		<t>Deleted meta-* messages. Data-* messages are now used for
		both metadata and data since OCP does not know the difference,
		but must provide the same exchange mechanism for both.</t>

		<t>Use a single message name (short or long, depending on the message)
		instead of using full and abbreviated versions and trying to
		enforce abbreviations on the wire. Be more consistent in
		creating short message names.</t>

		<t>Resurrected OCP scope figure based on popular demand.</t>

		<t>Applied Martin Stecher comments dated 2003/05/30.</t>

	</list></t>

	<t hangText="head-sid8"><list style="symbols">

		<t>Added structure and list values to ABNF syntax.</t>

		<t>Messages with multiple equally-named parameters are
		semantically invalid.</t>

		<t>Added types for message parameters.</t>

		<t>Started replacing complicated, error-prone, and
		probably mostly useless "modified" parameter with 
		a clear and simple "as-is" parameter.</t>

		<t>Converted parameter descriptions from list items to
		subsections.</t>

		<t>OCP syntax requires one or two character lookups to determine the
		next message part. Fixed a comment for implementors saying that one
		lookup is always sufficient.</t>

	</list></t>

	<t hangText="head-sid7"><list style="symbols">

		<t>Mentioned TCP/IP/Internet as assumed transport/network, with
		any other reliable connection-oriented transport/network
		usable as well. We do not document how OCP messages are
		mapped to TCP but it should be obvious. See Overall Operation
		section.</t>

		<t>Applied Martin Stecher's corrections to OCP message syntax
		and definitions of messages.</t>

		<t>Restricted full message name use to documentation,
		debuggers, and such. The differences in abbreviated and full
		name usage still need more consideration and polishing.</t>

		<t>IAB Considerations section now refers to
		the future opes-iab draft.</t>

	</list></t>

	<t hangText="head-sid6"><list style="symbols">

		<t>Added OCP message syntax. Reformatted message descriptions to match
		new syntax concepts.</t>

		<t>Started adding meta-have message to exchange metadata details.
		Removed negotiation messages for now (posted new messages to
		the list for a discussion).</t>

		<t>Added Security Considerations section (based on Abbie Barbir's
		original text).</t>

	</list></t>

	<t hangText="head-sid4"><list style="symbols">

		<t>Changed document labels to reflect future "WG draft" status.</t>

		<t>Added Acknowledgments section.</t>

		<t>Added "Core" to the title since we expect application specific
		drafts to follow and because this document, even when complete, cannot
		specify a "working" protocol without application-specific parts. This
		change is still debatable.</t>

		<t>Added reference to required future application-specific specs in
		the Introduction.</t>

		<t>Moved all rant about irrelevance of application protocols proxied
		by an OPES processor to the "Application proxies and OCP scope"
		section. Removed "processor input" and "processor output" terms. No
		reason to define a new term when its only purpose is to document
		irrelevance?</t>

		<t>Moved "OCP message" definition to the terminology section.</t>

		<t>Clarified "application message" definition based on recent WG
		discussions and suggestions. There seems to be consensus that
		"application message" is whatever OPES processor and callout server
		define or agree on, but OCP needs some minimal structure (content +
		metadata)</t>

		<t>Synced data and metadata definitions with the new "application
		message" definition.</t>

		<t>Simplified "Overall Operation" section since it no longer need to
		talk about irrelevance of application protocols proxied by an OPES
		processor.</t>

		<t>Illustrated nesting/relationship of key OCP concepts (application
		message, OCP message, transaction, connection, transport connection,
		etc.). The figure needs more work.</t>

		<t>Listed all from-processor and from-server OCP messages in one
		place, with references to message definitions.</t>

		<t>Added "services" message parameter, assuming that more than one
		service may be requested/executed with one transaction.</t>

		<t>Gave callout server ability to report what services were actually
		applied (see "services" parameter definition).</t>

	</list></t>

	<t hangText="head-sid3"><list style="symbols">

		<t>clarified application message definition and OCP boundaries
		by introducing three kinds of "applications": processor input,
		processor output, and OCP application</t>

		<t>made "Overall Operation" a top-level section since it got
		long and has its own subsections now; lots of editorial changes
		in this sections, new figures</t>

		<t>added illustrations of OCP messages, transactions, and
		connections</t>

	</list></t>

	<t hangText="head-sid2"><list style="symbols">

		<t>introduced a notion of meta-data to both simplify OCP and make OCP
		agnostic to application meta-data; previous approach essentially
		assumed existence of a few common properties like protocol name or
		application message source/destination while not allowing any other
		properties to be exchanged between OCP agents); specific meta-data
		format/contents is not important to OCP but OCP will help agents to
		negotiate that format/contents</t>

		<t>removed wording implying that OCP adapts application messages;
		OCP only used to exchange data and meta-data (which facilitates
		adaptation)</t>

		<t>changed most of the definitions; added definitions
		for meta-data, original/adapted flows, and others</t>

		<t>split 'data-pause' message into 'data-pause' request by the callout
		server and 'data-paused' notification by the OPES processor; fixed
		"paused" state management</t>

		<t>added motivation for data acking mechanism</t>

		<t>replaced "am-proto", "am-kind", "am-source", and "am-destination"
		parameters with "meta-data"</t>

		<t>replaced SERVER and CLIENT placeholders with "callout
		server" and "OPES processor"</t>

		<t>added editing marks</t>

	</list></t>

	</list></t>

</appendix>

</middle>

<back>

<references title='Normative References'>

<?rfc include='reference.RFC.2119.xml' ?>
<?rfc include='reference.RFC.2234.xml' ?>
<?rfc include='reference.RFC.2396.xml' ?>
<?rfc include='reference.I-D.ietf-opes-architecture.xml' ?>

</references>

<references title='Informative References'>

<?rfc include='reference.I-D.ietf-opes-protocol-reqs.xml' ?>
<?rfc include='reference.I-D.ietf-opes-threats.xml' ?>
<?rfc include='reference.I-D.ietf-opes-scenarios.xml' ?>
<?rfc include='reference.I-D.ietf-opes-authorization.xml' ?>
<?rfc include='reference.I-D.ietf-opes-end-comm.xml' ?>
<?rfc include='reference.I-D.ietf-opes-rules-p.xml' ?>
<?rfc include='reference.I-D.ietf-opes-iab.xml' ?>
<?rfc include='reference.I-D.ietf-opes-http.xml' ?>
<?rfc include='reference.I-D.ietf-fax-esmtp-conneg.xml' ?>
<?rfc include='reference.RFC.2616.xml' ?>
<?rfc include='reference.RFC.3080.xml' ?>
<?rfc include='reference.RFC.3238.xml' ?>

</references>

</back>

</rfc>
