<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM 'rfc2629.dtd'>
<rfc number="4827" category="std">
	<?rfc rfcedstyle="yes" ?>
	<?rfc subcompact="no" ?>
	<?rfc toc="yes"?>
	<front>
		<title abbrev="XCAP for Manipulating Presence Document">An Extensible Markup Language (XML) Configuration Access Protocol (XCAP) Usage for
		Manipulating Presence Document Contents</title>
		<author fullname="Markus Isomaki" surname="Isomaki" initials="M.">
			<organization>Nokia</organization>
			<address>
				<postal>
					<street>P.O. BOX 100</street>
					<city>00045 NOKIA GROUP</city>
					<!-- [rfced] no city? 
					[author]: this information is ok-->
					<country>Finland</country>
				</postal>
				<email>markus.isomaki@nokia.com</email>
			</address>
		</author>
		<author fullname="Eva Leppanen" surname="Leppanen" initials="E.">
			<organization>Nokia</organization>
			<address>
				<postal>
					<street>P.O. BOX 785</street>
					<city>33101 Tampere</city>
					<country>Finland</country>
				</postal>
				<email>eva-maria.leppanen@nokia.com</email>
			</address>
		</author>
		<date month="March" year="2007"/>
		<area>Application</area>
		<workgroup>SIMPLE WG</workgroup>
		<!-- [rfced] Please insert any keywords (beyond those that appear in 
 the title) for use on http://www.rfc-editor.org/search.html. 
 [authors] Some proposals: PIDF, AUID, hard state, PUBLISH, SIP Presence, SIMPLE, pidf-manipulation, XCAP application usage -->
		<abstract>
			<t>This document describes a usage of the Extensible Markup Language
  (XML) Configuration Access Protocol (XCAP) for manipulating the
  contents of Presence Information Data Format (PIDF) based presence
  documents. It is intended to be used in Session Initiation Protocol
  (SIP) based presence systems, where the Event State Compositor can
  use the XCAP-manipulated presence document as one of the inputs on
  which it builds the overall presence state for the presentity.     
			</t>
		</abstract>
	</front>
	<middle>
		<section title="Introduction" anchor="Introduction">
			<t>
The Session Initiation Protocol (SIP) for Instant Messaging and Presence (SIMPLE) specifications allow a user, called a watcher, to subscribe to another user, called a presentity, in order to learn its presence information <xref target="RFC3856"/>. The presence data model has been specified in <xref target="RFC4479"/>.  The data model makes a clean separation between person-, service-, and device-related information.
</t>
			<t>
A SIP-based mechanism, SIP PUBLISH method, has been defined for
publishing presence state <xref target="RFC3903"/>. Using SIP PUBLISH, a Presence User Agent (PUA) can publish its view of the presence state, independently of and without the need to learn about the states set by other PUAs. However, SIP PUBLISH has a limited scope and does not address all the requirements for setting presence state. The main issue is that SIP PUBLISH creates a soft state that expires after the negotiated lifetime unless it is refreshed. This makes it unsuitable for cases where the state should prevail without active devices capable of refreshing the state.
</t>
			<t>
There are three main use cases where setting of permanent presence state that is independent of activeness of any particular device is useful. The first case concerns setting person-related state. The presentity would often like to set its presence state even for periods when it has no active devices capable of publishing available. Good examples are 
traveling, vacations, and so on. The second case is about setting state for
services that are open for communication, even if the presentity does
not have a device running that service online. Examples of these kinds
of services include e-mail, Multimedia Messaging Service (MMS), and
Short Message Service (SMS). In these services, the
presentity is provisioned with a server that makes the service
persistently available, at least in certain forms, and it would be
good to be able to advertise this to the watchers. Since it is not
realistic to assume that all e-mail, MMS, or SMS servers can publish
presence state on their own (and even if this were possible, such
state would almost never change), this has to be done by some other
device. And since the availability of the service is not dependent on
that device, it would be impractical to require that device to be
constantly active just to publish such availability. The third case
concerns setting the default state of any person, service, or device in the absence of any device capable of actively publishing such state.  For instance, the presentity might 
want to advertise that his or her voice service is currently closed,
just to let the watchers know that such service might be open at some
point. Again, this type of default state is independent of any
particular device and can be considered rather persistent.
</t>
			<t>
				<?rfc needLines="5" ?>
Even though SIP PUBLISH remains the main way of publishing presence
state in SIMPLE-based presence systems and is especially well-suited
for publishing dynamic state (which presence mainly is), it needs to
be complemented by the mechanism described in this document to address the use cases presented above.
</t>
			<t>
XML Configuration Access Protocol (XCAP) <xref target="RFC4825"/> allows a client to read, write, and modify
application configuration data stored in XML format on a server. The
data has no expiration time, so it must be explicitly inserted and
deleted. The protocol allows multiple clients to manipulate the data,
provided that they are authorized to do so. XCAP is already used in
SIMPLE-based presence systems for manipulation of presence lists and
presence authorization policies. This makes XCAP an ideal choice for
doing device-independent presence document manipulation. 
</t>
			<t>
This document defines an XML Configuration Access Protocol (XCAP)
application usage for manipulating the contents of presence
document. Presence Information Document Format (PIDF) <xref target="RFC3863"/> is used as the presence document format, since the
event state compositor already has to support it, as it is used in SIP
PUBLISH.
</t>
			<t>
				<xref target="Framework"/> describes
				in detail how the presence
				document manipulated with XCAP is
				related to soft state publishing done
				with SIP PUBLISH.
</t>
			<t>
XCAP requires application usages to standardize several pieces of
information, including a unique application usage ID (AUID) and an
XML schema for the manipulated data. These are specified starting from
<xref target="AUID"/>.
			</t>
		</section>
		<section title="Conventions" anchor="Conventions">
			<t>
In this document, the key words &apos;MUST&apos;, &apos;MUST NOT&apos;, &apos;REQUIRED&apos;, &apos;SHALL&apos;, &apos;SHALL NOT&apos;, &apos;SHOULD&apos;, &apos;SHOULD NOT&apos;, &apos;RECOMMENDED&apos;, &apos;MAY&apos;, and &apos;OPTIONAL&apos; are to be interpreted as described in RFC 2119 <xref target="RFC2119_1"/>  and indicate requirement levels for compliant implementations.
</t>
			<t>
Comprehensive terminology of presence and event state publishing is
			provided in "Session Initiation Protocol (SIP)
			Extension for Event State Publication" <xref target="RFC3903"/>.
			</t>
		</section>
		<section title="Relationship with Presence State Published Using SIP PUBLISH" anchor="Framework">
			<t>
The framework for publishing presence state is described in Figure 1. A central part of the framework is the event state compositor element, whose function is to compose presence information received from several sources into a single coherent presence document.
</t>
			<t>
The presence state manipulated with XCAP can be seen as one of the
information sources for the compositor to be combined with the soft
state information published using SIP PUBLISH. This is illustrated in
Figure 1. It is expected that, in the normal case, there can be
several PUAs publishing their separate views with SIP PUBLISH, but
only a single XCAP manipulated presence document. As shown in the
figure, multiple XCAP clients (for instance, in different physical
devices) can manipulate the same document on the XCAP server, but this still creates only one input to the event state compositor. 
The XCAP server stores the XCAP manipulated presence document under the "users" tree in the XCAP document hierarchy. See <xref target="Naming-conv"/> for details and <xref target="Examples"/> for an example.
</t>
			<t>		
As individual inputs, the presence states set by XCAP and SIP PUBLISH are completely separated, and it is not possible to directly manipulate the state set by one mechanism with the other. How the compositor treats XCAP-based inputs with respect to SIP PUBLISH-based inputs is a matter of compositor policy, which is beyond the scope of this specification. Since the SIP PUBLISH specification already mandates the compositor to be able to construct the overall presence state from multiple inputs, which may contain non-orthogonal (or in some ways even conflicting) information, this XCAP usage does not impose any new requirements on the compositor functionality. 
</t>
			<figure title="Framework for Presence Publishing and Event State Composition" anchor="FIG1">
				<artwork><![CDATA[
            +---------------+         +------------+
            |   Event State |         |  Presence  |<-- SIP SUBSCRIBE
            |   Compositor  +---------+  Agent     |--> SIP NOTIFY
            |               |         |   (PA)     |
            +-------+-------+         +------------+
              ^     ^     ^
              |     |     |
              |     |     |       +---------------+
     +--------+     |     +-------|  XCAP server  |
     |              |             +-------+-------+
     |              |                 ^         ^
     | SIP Publish  |                 |  XCAP   |
     |              |                 |         |
  +--+--+        +--+--+         +-------+   +-------+
  | PUA |        | PUA |         | XCAP  |   | XCAP  |
  |     |        |     |         | client|   | client|
  +-----+        +-----+         +-------+   +-------+
			 
			]]></artwork>
			</figure>
			<t>
The protocol interface between XCAP server and the event state compositor is not specified here. 


			</t>
		</section>
		<section title="Application Usage ID" anchor="AUID">
			<t>
XCAP requires application usages to define a unique application usage ID (AUID) in either the IETF tree or a vendor tree. This specification defines the &apos;pidf-manipulation&apos; AUID within the IETF tree, via the IANA registration in <xref target="IANA"/>.
			</t>
		</section>
		<section title="MIME Type" anchor="MIME">
			<t>The MIME type for this application usage is 'application/pidf+xml'.</t>
		</section>
		<section title="Structure of Manipulated Presence Information" anchor="Structure-of-PI">
			<t>
The XML Schema of the presence information is defined in the Presence Information Data Format (PIDF) <xref target="RFC3863"/>. 
<!-- [rfced] Why is RFC 3863 referred to as "CPIM PIDF" throughout 
  this document? Is it commonly referred to as that? "CPIM" does not 
  appear in the title of 3863. 
  [author] The title of RFC3863 has changed after this document written. The change to use only "PIDF" instead of "CPIM PIDF" should be made. -->
The PIDF also defines a mechanism for
extending presence information. See <xref target="RFC4480"/>,
<xref target="RFC4482"/>, <xref target="prescaps-ext"/>, and
<xref target="RFC4481"/> for currently defined PIDF extensions and their XML Schemas.
</t>
			<t>
The namespace URI for PIDF is &apos;urn:ietf:params:xml:ns:pidf&apos; which is also the XCAP default document namespace.
			</t>
		</section>
		<section title="Additional Constraints" anchor="Constr">
			<t>
There are no constraints on the document beyond those described in the XML schemas (PIDF and its extensions) and in the description of PIDF <xref target="RFC3863"/>.
				</t>
		</section>
		<section title="Resource Interdependencies" anchor="Res-interdep">
			<t>
There are no resource interdependencies beyond the possible interdependencies defined in PIDF <xref target="RFC3863"/> and XCAP <xref target="RFC4825"/> that need to be defined for this application usage.
				</t>
		</section>
		<section title="Naming Conventions" anchor="Naming-conv">
			<t>
The XCAP server MUST store only a single XCAP manipulated presence document for each user. The presence document MUST be located under the "users" tree, using filename "index". See an example in <xref target="Examples"/>.
				</t>
		</section>
		<section title="Authorization Policies" anchor="Auth">
			<t>
This application usage does not modify the default XCAP authorization policy, which allows only a user (owner) to read, write, or modify their own documents. A server can allow privileged users to modify documents that they do not own, but the establishment and indication of such policies is outside the scope of this document.
				</t>
		</section>
		<section title="Example" anchor="Examples">
			<t>
The section provides an example of a presence document provided by an
    			XCAP Client to an XCAP Server. The presence
    			document illustrates the situation where a
    			(human) presentity has left for vacation, and
    			before that, has set his presence information
    			so that he is only available via e-mail. In
    			the absence of any published soft state
    			information, this would be the sole input to
    			the compositor forming the presence
    			document. The example document contains PIDF
    			extensions specified in "RPID: Rich Presence
    			Extensions to the Presence Information Data
    			Format (PIDF)" <xref target="RFC4480"/> and
    			"CIPID: Contact Information in Presence Information Data Format" <xref target="RFC4482"/>.
</t>
			<t>
It is assumed that the presentity is a SIP user with Address-of-Record (AOR) sip:someone@example.com. 
The XCAP root URI for example.com is assumed to be http://xcap.example.com. The XCAP User Identifier (XUI) is 
assumed to be identical to the SIP AOR, according to XCAP recommendations. In this case, the presence document 
would be located at http://xcap.example.com/pidf-manipulation/users/sip:someone@example.com/index. </t>
			<t>The presence document is created with the following XCAP operation:</t>
			<t>
</t>
			<figure>
				<artwork><![CDATA[PUT /pidf-manipulation/users/sip:someone@example.com/index HTTP/1.1
Host: xcap.example.com
Content-Type: application/pidf+xml
...

<?xml version="1.0" encoding="UTF-8"?>
      <presence xmlns="urn:ietf:params:xml:ns:pidf"
           xmlns:rp="urn:ietf:params:xml:ns:pidf:rpid"
           xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
           xmlns:ci="urn:ietf:params:xml:ns:pidf:cipid"
           entity="sip:someone@example.com">

        <tuple id="x8eg92m">
          <status>
            <basic>closed</basic>
          </status>
	  <rp:user-input>idle</rp:user-input>
          <rp:class>auth-1</rp:class>
          <contact priority="0.5">sip:user@example.com</contact>
          <note>I'm available only by e-mail.</note>
          <timestamp>2004-02-06T16:49:29Z</timestamp>
        </tuple>

        <tuple id="x8eg92n">
          <status>
            <basic>open</basic>
          </status>
          <rp:class>auth-1</rp:class>
          <contact priority="1.0">mailto:someone@example.com</contact>
          <note>I'm reading mail a couple of times a week</note>
        </tuple>

        <dm:person id="p1">
           <rp:class>auth-A</rp:class>
           <ci:homepage>http://www.example.com/~someone</ci:homepage>
           <rp:activities>
	       <rp:vacation/>
           </rp:activities>
        </dm:person>

      </presence>


When the user wants to change the note related to e-mail service, 
it is done with the following XCAP operation:

PUT /pidf-manipulation/users/sip:someone@example.com/index/
~~/presence/tuple%5b@id='x8eg92n'%5d/note HTTP/1.1
If-Match: "xyz"
Host: xcap.example.com
Content-Type: application/xcap-el+xml
...

<note>I'm reading mails on Tuesdays and Fridays</note>


			]]></artwork>
			</figure>
		</section>
		<section title="Security Considerations" anchor="Security">
			<t>
A presence document may contain information that is highly
                  sensitive. Its delivery to watchers needs to happen
                  strictly according to the relevant authorization
                  policies. It is also important that only authorized
                  clients are able to manipulate the presence information. 
</t>
			<t>
The XCAP base specification mandates that all XCAP servers MUST implement HTTP Digest authentication specified in RFC 2617 <xref target="RFC2617"/>. Furthermore, XCAP servers MUST implement HTTP over TLS <xref target="RFC2818"/>. It is recommended that administrators of XCAP servers use an HTTPS URI as the XCAP root services' URI, so that the digest client authentication occurs over TLS. By using these means, XCAP client and server can ensure the confidentiality and integrity of the XCAP presence document manipulation operations, and that only authorized clients are allowed to perform them.    
			</t>
		</section>
		<section title="IANA Considerations" anchor="IANA">
			<t>
There is an IANA consideration associated with this specification.
			</t>
			<section title="XCAP Application Usage ID">
				<t>
This section registers a new XCAP Application Usage ID (AUID) according to the IANA procedures defined in <xref target="RFC4825"/>.
</t>
				<t>
Name of the AUID: pidf-manipulation
</t>
				<t>
Description: Pidf-manipulation application usage defines how XCAP is used to manipulate the contents of PIDF-based presence documents.
				</t>
			</section>
		</section>
		<section title="Acknowledgements" anchor="Ack">
			<t>
The authors would like to thank Jari Urpalainen, Jonathan Rosenberg, Hisham Khartabil, Aki Niemi, Mikko Lonnfors, Oliver Biot, Alex Audu, Krisztian Kiss, Jose Costa-Requena, George Foti, and Paul Kyzivat for their comments.
			</t>
		</section>
	</middle>
	<back>
		<references title="Normative References">
			<reference anchor="RFC2119_1">
				<front>
					<title>Key words for use in RFCs to Indicate Requirement Levels</title>
					<author initials="S." fullname="Bradner" surname="Bradner">
						<organization/>
					</author>
					<date year="1997" month="March"/>
				</front>
				<seriesInfo name="BCP" value="14"/>
				<seriesInfo name="RFC" value="2119"/>
			</reference>
			<!-- draft-ietf-simple-xcap-12 will be RFC 4825 -->
			<reference anchor="RFC4825">
				<front>
					<title>The Extensible Markup Language (XML) Configuration Access Protocol (XCAP)</title>
					<author initials="J." fullname="Jonathan Rosenberg" surname="Rosenberg">
						<organization/>
					</author>
					<date year="2007" month="February"/>
				</front>
				<seriesInfo name="RFC" value="4825"/>
			</reference>
			<!-- draft-ietf-impp-cpim-pidf-08.txt published as 3863 -->
			<?rfc include="reference.RFC.3863" ?>
			<!-- draft-ietf-sip-publish published as 3903 -->
			<?rfc include="reference.RFC.3903" ?>
			<reference anchor="RFC2617">
				<front>
					<title>HTTP Authentication: Basic and Digest Access Authentication</title>
					<author initials="J., et al." surname="Franks">
						<organization/>
					</author>
					<date year="1999" month="June"/>
				</front>
				<seriesInfo name="RFC" value="2617"/>
			</reference>
			<reference anchor="RFC2818">
				<front>
					<title>HTTP Over TLS</title>
					<author initials="E." surname="Rescorla">
						<organization/>
					</author>
					<date year="2000" month="May"/>
				</front>
				<seriesInfo name="RFC" value="2818"/>
			</reference>
		</references>
		<references title="Informative References">
			<?rfc include="reference.RFC.3856" ?>
			<!-- draft-ietf-simple-rpid  published as RFC 4480 -->
			<?rfc include="reference.RFC.4480" ?>
			<!-- draft-ietf-simple-cipid published as RFC 4482 -->
			<?rfc include="reference.RFC.4482" ?>
			<!-- draft-ietf-simple-presence-data-model published as RFC 4479 -->
			<?rfc include="reference.RFC.4479" ?>
			<reference anchor="prescaps-ext">
				<front>
					<title>Session Initiation Protocol (SIP) User Agent Capability Extension to Presence Information Data Format (PIDF)</title>
					<author initials="M" surname="Lonnfors" fullname="Mikko Lonnfors">
						<organization/>
					</author>
					<author initials="K" surname="Kiss" fullname="Krisztian Kiss">
						<organization/>
					</author>
					<date month="July" day="31" year="2006"/>
				</front>
				<seriesInfo name="Work in" value="Progress"/>
				<format type="TXT" target="http://www.ietf.org/internet-drafts/draft-ietf-simple-prescaps-ext-07.txt"/>
			</reference>
			<!-- draft-ietf-simple-future published as RFC 4481 -->
			<?rfc include="reference.RFC.4481" ?>
		</references>
	</back>
</rfc>
