No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0042.xml 46KB

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM "xep.ent">
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Jabber OOB Broadcast Service (JOBS)</title>
  10. <abstract>A protocol for enabling uni-directional multicast data transfers out of band.</abstract>
  12. <number>0042</number>
  13. <status>Retracted</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XEP-0004 (OPTIONAL)</spec>
  18. <spec>XEP-0011 (RECOMMENDED)</spec>
  19. <spec>XEP-0029 (REQUIRED)</spec>
  20. </dependencies>
  21. <supersedes/>
  22. <supersededby><spec>XEP-0065</spec></supersededby>
  23. <shortname>JOBS</shortname>
  24. <author>
  25. <firstname>Matthew</firstname>
  26. <surname>Miller</surname>
  27. <email></email>
  28. <jid></jid>
  29. </author>
  30. <revision>
  31. <version>0.5</version>
  32. <date>2003-04-11</date>
  33. <initials>psa</initials>
  34. <remark>At the request of the author, changed status to Retracted.</remark>
  35. </revision>
  36. <revision>
  37. <version>0.4</version>
  38. <date>2002-10-22</date>
  39. <initials>lw</initials>
  40. <remark>More restrictive on usage of "action" attributes; Reduced session information returned in most use-cases; Added action for retrieving session information; Added action for service ("proxy") invites</remark>
  41. </revision>
  42. <revision>
  43. <version>0.3</version>
  44. <date>2002-10-20</date>
  45. <initials>lw</initials>
  46. <remark>Complete overhaul (redesign to allow for peer-to-peer operation; reduced element-set; removed "session types"; reorganized into use-cases)</remark>
  47. </revision>
  48. <revision>
  49. <version>0.2</version>
  50. <date>2002-08-20</date>
  51. <initials>lw</initials>
  52. <remark>Added "detailed" description of OOB headers</remark>
  53. </revision>
  54. <revision>
  55. <version>0.1</version>
  56. <date>2002-08-14</date>
  57. <initials>lw</initials>
  58. <remark>Initial Release</remark>
  59. </revision>
  60. </header>
  61. <section1 topic='Overview'>
  62. <section2 topic='Introduction'>
  63. <p>Distributing data out-of-band (OOB) to one or more end-points is a requirement for many Jabber clients. The Jabber OOB Broadcast Service (JOBS) is a mechanism to allow end-points to open uni-directional data streams between each other, on top of which any number of applications can be built <note>Possible applications include file transfer, audio/video streaming, and some gaming implementations.</note>.</p>
  64. <p>The aim of this document is to define a process of connecting a sender to one or more receivers through a secondary TCP port.</p>
  65. </section2>
  66. <section2 topic='Design Concepts'>
  67. <p>As the name implies, JOBS is designed to enable multicast, uni-directional OOB connections. These connections are usually between a "sender" client, a JOBS "service", and one or more "receiver" clients. Each such set of connections is collectively called a session. JOBS is designed to allow a single service to handle multiple sessions over a single host/port combination.</p>
  68. <p>To address a large number of typical uses efficiently, JOBS can multicast the data from a sender to multiple receivers. In order to keep the protcol as simple as possible, it only allows data to flow in one direction.</p>
  69. <p>JOBS utilizes a "two-band" authentication mechanism. This allows the end-points to know practically nothing about each other, yet still be assured that the OOB connection is really to/from the Jabber entity its intended to be. The authentication system is then backed-up with explicit authorization requests.</p>
  70. <p>For the OOB portion, clients connect to the host/address and port of the JOBS service for a given session. Once connected, a client-initiated handshake process occurs, and (if successful), then data is routed from the sender's connection to each receiver's connection. The only point at which any error information may be conveyed over the OOB connection is during the handshake process.</p>
  71. <table caption='Terms in Use'>
  72. <tr>
  73. <th>Term</th>
  74. <th>Description</th>
  75. </tr>
  76. <tr>
  77. <td>OOB</td>
  78. <td>Out-Of-Band. Any network connection that exists outside of the normal Jabber protocol traffic.</td>
  79. </tr>
  80. <tr>
  81. <td>session</td>
  82. <td>A session registered with a "server" for clients to connect to.</td>
  83. </tr>
  84. <tr>
  85. <td>client</td>
  86. <td>An end-point on a JOBS session.</td>
  87. </tr>
  88. <tr>
  89. <td>service</td>
  90. <td>The JOBS Jabber component/server.</td>
  91. </tr>
  92. <tr>
  93. <td>server</td>
  94. <td>A particular host/port of the JOBS service.</td>
  95. </tr>
  96. <tr>
  97. <td>sender</td>
  98. <td>The client sending data.</td>
  99. </tr>
  100. <tr>
  101. <td>receiver</td>
  102. <td>A client receiving data.</td>
  103. </tr>
  104. </table>
  105. </section2>
  106. </section1>
  107. <section1 topic='Use Cases'>
  108. <section2 topic='Discovering the Service'>
  109. <p>Discovering support for JOBS involves either &xep0011; or &xep0030;. This determines if the end-point understands the JOBS protocol.</p>
  110. <section3 topic='"jabber:iq:browse"'>
  111. <p>To determine support for JOBS via jabber:iq:browse, look for an item with a nested &lt;ns/&gt; with a value of "":</p>
  112. <example caption='Browse request'><![CDATA[
  113. <iq type='get' to='domain'>
  114. <query xmlns='jabber:iq:browse'/>
  115. </iq>
  116. ]]></example>
  117. <example caption='Browse result'><![CDATA[
  118. <iq type='get' to='sender@domain/res' from='domain'>
  119. ...
  120. <item xmlns='jabber:iq:browse'
  121. category='service'
  122. type='x-jobs'
  123. jid='jobs.domain'
  124. version='0.4'>
  125. <ns></ns>
  126. </item>
  127. ...
  128. </iq>
  129. ]]></example>
  130. </section3>
  131. </section2>
  132. <section2 topic='Creating a Session'>
  133. <p>The JOBS protocol supports various scenarios to create sessions. Most of these scenarios allow an entity to determine the possible parameters to create a session with. To actually create a session, the (would-be) sender sends an "iq-set" with a &lt;session action="create"/&gt;. This returns the details of the newly created session, including the ID and OOB host/port.</p>
  134. <p>This use-case can be completely ignored for true "peer-to-peer" systems.</p>
  135. <section3 topic='Simple'>
  136. <p>The simplest create request is:</p>
  137. <example caption='Creation request'><![CDATA[
  138. <iq type='set' from='sender@domain/res' to='jobs.domain' id='JOBS1'>
  139. <session xmlns=''
  140. action='create'/>
  141. </iq>
  142. ]]></example>
  143. <example caption='Creation result'><![CDATA[
  144. <iq
  145. type='result' to='sender@domain/res' from='jobs.domain'>
  146. <session xmlns=''
  147. status='pending'
  148. host='jobs.domain'
  149. id='01234567'
  150. port='12676'
  151. sender='sender@domain/res'
  152. buffer='0'
  153. expires='30'
  154. receivers='1'/>
  155. </iq>
  156. ]]></example>
  157. <p>This creates a session between sender@domain/resource and any one receiver. At this point, the JOBS service is ready to accept connections for this session. The &lt;session/&gt; element describes the details for the session. The value returned in the "id" attribute is the JOBS session ID <note>The exact value of the ID is left to JOBS implementations.</note>.</p>
  158. </section3>
  159. <section3 topic='With Parameters'>
  160. <p>When creating a session, parameters to &lt;session/&gt; can be supplied, explicitly requesting that certain parameters be met (such as buffer size, time to expire, and receiver limit). Since these parameters have lower- and upper-bounds specific to the JOBS service, a sender may need to determine these limits.</p>
  161. <p>To determine the limits, the sender sends an "iq-get" with a &lt;session action="create"/&gt;:</p>
  162. <example caption='Parameter statistics request'><![CDATA[
  163. <iq id='JOBS0' type='get' to='jobs.domain'>
  164. <session xmlns='' action='create'/>
  165. </iq>
  166. ]]></example>
  167. <example caption='Parameter statistics result'><![CDATA[
  168. <iq id='JOBS0' type='result' to='sender@domain/res' from='jobs.domain'>
  169. <session xmlns=''
  170. host='jobs.domain'
  171. port='12676'
  172. sender='sender@domain/res'
  173. buffer='0'
  174. expires='30'
  175. receivers='1'>
  176. <connect host='jobs.domain' port='12676'/>
  177. <limit type='buffer'
  178. default='0'
  179. max='1024'
  180. min='0'/>
  181. <limit type='expires'
  182. default='30'
  183. max='3600'
  184. min='5'/>
  185. <limit type='receivers'
  186. default='1'
  187. max='15'
  188. min='1'/>
  189. </session>
  190. </iq>
  191. ]]></example>
  192. <p>The returned &lt;session/&gt; is also prefilled with default values for all known parameters.</p>
  193. <p>To create a session with specific parameters, the sender sends an "iq-set" as in the "simple" use-case, but then specifying the parameter values desired:</p>
  194. <example caption='Creation request, with parameters'><![CDATA[
  195. <iq id='JOBS1' type='set' to='jobs.domain'>
  196. <session xmlns='' action='create'
  197. expires='-1'/>
  198. </iq>
  199. ]]></example>
  200. <example caption='Creation result, with parameters'><![CDATA[
  201. <iq type='result' to='sender@domain/res' from='jobs.domain'>
  202. <session xmlns=''
  203. status='pending'
  204. host='jobs.domain'
  205. id='01234567'
  206. port='12676'
  207. sender='sender@domain/res'
  208. buffer='0'
  209. expires='-1'
  210. receivers='1'/>
  211. </iq>
  212. ]]></example>
  213. <p>The above example creates a session that does not timeout. A JOBS service uses values from the default information set for any parameters that are missing.</p>
  214. <p>Any parameters that exceed the minimums/maximums causes an error.</p>
  215. </section3>
  216. <section3 topic='Form-based'>
  217. <p>In some cases, the session creation process requires an interface more suitable for human consumption. In such cases the JOBS protocol helps by allowing for contained elements governed by other namespaces. For form-based creation, a &xep0004; form can be embedded in the &lt;session/&gt;.</p>
  218. <p>To create a session using forms, send a &lt;session action="create"/&gt; with an embedded &lt;x xmlns="jabber:x:data"/&gt;:</p>
  219. <example caption='Creation form request'><![CDATA[
  220. <iq type='get' to='jobs.domain'>
  221. <session xmlns='' action='create'>
  222. <x xmlns='jabber:x:data'/>
  223. </session>
  224. </iq>
  225. ]]></example>
  226. <example caption='Creation form result'><![CDATA[
  227. <iq type='result' from='jobs.domain' to='sender@domain/res'>
  228. <session xmlns=''
  229. host='jobs.domain'
  230. port='12676'
  231. buffer='0'
  232. expires='-1'
  233. receivers='1'>
  234. <x xmlns='jabber:x:data' type='form'>
  235. <instructions>Please specify values for the given fields.</instructions>
  236. <field var='hostport' type='select-single' label='JOBS host/port'>
  237. <option>jobs.domain:12676</option>
  238. </field>
  239. <field var='buffer' type='text' label='Buffer Size (in bytes)'><value>0</value></field>
  240. <field var='expires' type='text' label='Timeout (in seconds)'><value>30</value></field>
  241. <field var='receivers' type='text' label='Number of Recipients'><value>1</value></field>
  242. </x>
  243. </session>
  244. </iq>
  245. ]]></example>
  246. <p>The exact fields present in the form are dependent upon the JOBS implementation. The form SHOULD allow a user to at least specify the &lt;session/&gt; attributes.</p>
  247. <p>Using the form-based approach, the session is then created by sending a &lt;session action='create'/&gt; with a form submission (as defined for "jabber:x:data"):</p>
  248. <example caption='Creation request (form-based)'><![CDATA[
  249. <iq type='set' to='jobs.domain'>
  250. <session xmlns='' action='create'>
  251. <x xmlns='jabber:x:data' type='submit'>
  252. <field var='hostport'><value>jobs.domain:12676</value></field>
  253. <field var='buffer'><value>0</value></field>
  254. <field var='expires'><value>300</value></field>
  255. <field var='receivers'><value>1</value></field>
  256. </x>
  257. </session>
  258. </iq>
  259. ]]></example>
  260. <example caption='Creation result (form-based)'><![CDATA[
  261. <iq type='result' from='jobs.domain' to='sender@domain/res'>
  262. <session xmlns=''
  263. status='pending'
  264. host='jobs.domain'
  265. id='01234567'
  266. port='12676'
  267. sender='sender@domain/res'
  268. buffer='0'
  269. expires='300'
  270. receivers='1'/>
  271. </iq>
  272. ]]></example>
  273. </section3>
  274. </section2>
  275. <section2 topic='Inviting Receivers'>
  276. <p>Once the session is created, the sender invites receivers to connect. The sender can invite receivers either directly, or via the JOBS service. Most invitations are distributed via &lt;message/&gt;.</p>
  277. <section3 topic='Inviting Directly'>
  278. <p>The sender can invite receivers directly. This is done using a &lt;message/&gt;:</p>
  279. <example caption='Invitation message (direct)'><![CDATA[
  280. <message from='sender@domain/res' to='receiver@domain/res'>
  281. <body>Let's connect!</body>
  282. <session xmlns=''
  283. host='jobs.domain'
  284. id='01234567'
  285. port='12676'
  286. sender='sender@domain/res'
  287. buffer='0'
  288. expires='30'
  289. receivers='1'/>
  290. </message>
  291. ]]></example>
  292. <p>When inviting directly, the &lt;session/&gt; MUST contain enough information for a receiver to connect OOB. The required information is:</p>
  293. <ul>
  294. <li>host</li>
  295. <li>id</li>
  296. <li>port</li>
  297. </ul>
  298. </section3>
  299. <section3 topic='Inviting via JOBS'>
  300. <p>Alternatively, a sender can invite receivers via the JOBS service. This is also done using a &lt;message/&gt;, with a &lt;session action="notify"/&gt; containing one or more &lt;item action="invite" type="connection"/&gt;:</p>
  301. <example caption='Invitation message (to JOBS service)'><![CDATA[
  302. <message from='sender@domain/res' to='jobs.domain'>
  303. <body>Let's connect!</body>
  304. <session xmlns=''
  305. action='notify'
  306. id='01234567'>
  307. <item type='connection' action='invite'>receiver@domain</item>
  308. </message>
  309. ]]></example>
  310. <p>This results in the JOBS service sending the &lt;message/&gt; to each &lt;item/&gt;. Any additional elements (such as a &lt;body/&gt;) are passed onto those invited:</p>
  311. <example caption='Invitation message (from JOBS service)'><![CDATA[
  312. <message from='jobs.domain' to='receiver@domain'>
  313. <body>Let's connect!</body>
  314. <session xmlns=''
  315. action='notify'
  316. status='pending'
  317. host='jobs.domain'
  318. id='01234567'
  319. port='12676'
  320. sender='sender@domain/res'
  321. buffer='0'
  322. expires='30'
  323. receivers='1'>
  324. <item type='connection' action='invite'/>
  325. </message>
  326. ]]></example>
  327. </section3>
  328. </section2>
  329. <section2 topic='Retrieving Session Information'>
  330. <p>At any time, a client can request information about sessions for a JOBS service. The request can be directed for "all" sessions, or a specific session<note>Who is allowed to perform this action is left up to the JOBS service implementation.</note>.</p>
  331. <section3 topic='Service-wide'>
  332. <p>A client can request all the sessions for a JOBS service by sending an "iq-get" containing a &lt;session action="info"/&gt; with no ID:</p>
  333. <example caption='Information request (all sessions)'><![CDATA[
  334. <iq type='get' to='jobs.domain'>
  335. <session xmlns=''
  336. action='info'/>
  337. </iq>
  338. ]]></example>
  339. <p>The JOBS service responds with all the sessions within the "iq-result". This is the only case where a result can have more than one &lt;session/&gt;.</p>
  340. <example caption='Information result (all sessions)'><![CDATA[
  341. <iq type='result' from='jobs.domain' to='sender@domain/res'>
  342. <session xmlns=''
  343. action='info'
  344. status='active'
  345. host='jobs.domain'
  346. id='01234567'
  347. port='12676'
  348. buffer='0'
  349. expires='30'
  350. receivers='1'>
  351. <item type='connection' action='accept'>sender@domain/res</item>
  352. </session>
  353. <session xmlns=''
  354. action='info'
  355. status='pending'
  356. host='jobs.domain'
  357. id='87654321'
  358. port='12676'
  359. buffer='0'
  360. expires='30'
  361. receivers='1'/>
  362. </iq>
  363. ]]></example>
  364. </section3>
  365. <section3 topic='Session-specific'>
  366. <p>Alternatively, a client can request the information for a specific session by sending an "iq-get" containing a &lt;session action="info"/&gt; with the ID:</p>
  367. <example caption='Information request (session-specific)'><![CDATA[
  368. <iq type='get' to='jobs.domain'>
  369. <session xmlns=''
  370. action='info'
  371. id='01234567'/>
  372. </iq>
  373. ]]></example>
  374. <p>The service responds with an "iq-result" of just the requested session.</p>
  375. <example caption='Information result (session-specific)'><![CDATA[
  376. <iq type='result' from='jobs.domain' sender='sender@domain/res'>
  377. <session xmlns=''
  378. action='info'
  379. status='active'
  380. host='jobs.domain'
  381. id='01234567'
  382. port='12676'
  383. buffer='0'
  384. expires='30'
  385. receivers='1'>
  386. <item type='connection' action='accept'>sender@domain/res</item>
  387. </session>
  388. </iq>
  389. ]]></example>
  390. </section3>
  391. </section2>
  392. <section2 topic='Connecting OOB'>
  393. <section3 topic='Initiating and Authenticating'>
  394. <p>When a client connects (sender or receivers), a client-initiated handshake takes place. The purpose of this handshake is to authenticate the OOB connection, in relation to the client's JID. This authentication utilizes both in-band and OOB packets.</p>
  395. <p>To start the handshake, the client sends an "init" packet on its established connection:</p>
  396. <example caption='Client INIT'><![CDATA[
  397. jobs/0.4 init
  398. session-id: 01234567
  399. client-jid: sender@domain/res
  400. ]]></example>
  401. <p>If the session exists, and the client's JID is not automatically rejected, the JOBS service responds with an auth-challenge packet, containing an unique, arbitrary token:</p>
  402. <example caption='Server AUTH-CHALLENGE'><![CDATA[
  403. jobs/0.4 auth-challenge
  404. confirm: SID00001234
  405. ]]></example>
  406. <p>Once received, the client then sends an "iq-set" containing a &lt;session action="authenticate"/&gt;, which itself contains an &lt;item type='auth' action='confirm'/&gt; with this confirm key:</p>
  407. <example caption='Authentication request (from Client)'><![CDATA[
  408. <iq type='set' to='jobs.domain'>
  409. <session xmlns=''
  410. action='authenticate'
  411. id='01234567'>
  412. <item type='auth' action='confirm'>SID00001234</item>
  413. </session>
  414. </iq>hehe
  415. ]]></example>
  416. <p>The service then compares this confirm key to that sent with the "auth-challenge" OOB packet. If this matches correctly, and the service determines this connection is authorized, the session will respond with a &lt;session action="authenticate"/&gt; containing a &lt;item type="auth" action="accept"/&gt; with the accept key:</p>
  417. <example caption='Authentication result (from Server)'><![CDATA[
  418. <iq type='result' from='jobs.domain' to='sender@domain/res'>
  419. <session xmlns=''
  420. action='authenticate'
  421. status='pending'
  422. id='01234567'>
  423. <item type='auth' action='accept'>SID88884321</accept>
  424. </session>
  425. </iq>
  426. ]]></example>
  427. <p>At this point, the client responds on the OOB data stream with an "auth-response" packet:</p>
  428. <example caption='Client AUTH-RESPONSE'><![CDATA[
  429. jobs/0.4 auth-response
  430. accept: SID88884321
  431. ]]></example>
  432. <p>If the connection is accepted, the JOBS service sends a "connected" packet:</p>
  433. <example caption='Server CONNECTED'><![CDATA[
  434. jobs/0.4 connected
  435. ]]></example>
  436. <p>and after this, the data transfer occurs. If this connection is the sender, they may start sending data now (regardless if receivers are connected). If this connection is a receiver, the sender's data immediately follows the terminating "newline".</p>
  437. </section3>
  438. <section3 topic='Authorizing'>
  439. <p>Authenticating ensures the OOB connection matches a particular JID. Authorizing ensures to the service that receiver is allowed to be connected to the session. To determine if the session connection should be accepted or rejected, the JOBS service first checks if the JID matches the sender. This matches against the "full" JID, including node, domain, and resource. If this connection is the sender, it is allowed. Otherwise, the service confirms the connection with the sender.</p>
  440. <p>If a confirmation is required, the service sends an "iq-get" to the sender, with a &lt;session action="authorize"/&gt; containing an &lt;item type"connection" action="confirm"/&gt; with the full JID of the receiver:</p>
  441. <example caption='Confirmation request'><![CDATA[
  442. <iq type='get' to='sender@domain/res' id='JOBS5' from='jobs.domain'>
  443. <session xmlns=''
  444. action='authorize'
  445. status='active'
  446. id='01234567'>
  447. <item type='connection' action='confirm'>receiver@domain/res</item>
  448. </session>
  449. </iq>
  450. ]]></example>
  451. <p>One or more &lt;item type="connection" action="confirm/&gt; elements, each specifying a JID to accept/reject. To accept (or reject) a connection, the sender responds with an "iq-result", wrapping each JID in either an &lt;item type="connection" action="accept"/&gt; or &lt;item type="connection" action="reject"/&gt;.</p>
  452. <example caption='Confirmation result (accept)'><![CDATA[
  453. <iq id='JOBS5' type='result' to='jobs.domain'>
  454. <session xmlns=''
  455. action='authorize'
  456. id='01234567'>
  457. <item type='connection' action='accept'>receiver@domain/res</item>
  458. </session>
  459. </iq>
  460. ]]></example>
  461. <example caption='Confirmation result (reject)'><![CDATA[
  462. <iq id='JOBS5' type='result' to='jobs.domain'>
  463. <session xmlns=''
  464. action='authorize'
  465. id='01234567'>
  466. <item type='connection' action='reject'>receiver@domain/res</item>
  467. </session>
  468. </iq>
  469. ]]></example>
  470. <p>If the connection is rejected, the service drops the connection, and notifies the sender and receiver of the dropped connection.</p>
  471. </section3>
  472. <section3 topic='Dropping'>
  473. <p>The sender may drop a connection at any time. To drop a connection, the sender sends an "iq-set" with the &lt;session/&gt; containing the "connection" to drop:</p>
  474. <example caption='Drop request'><![CDATA[
  475. <iq type='set' to='jobs.domain'>
  476. <session xmlns=''
  477. action='notify'
  478. id='01234567'>
  479. <item type='connection' action='drop'>receiver@domain/res</item>
  480. </session>
  481. </iq>
  482. ]]></example>
  483. <p>If the connection is successfully dropped, the service returns an "iq-result":</p>
  484. <example caption='Drop result'><![CDATA[
  485. <iq type='result' from='jobs.domain' to='sender@domain/res'>
  486. <session xmlns=''
  487. status='active'
  488. id='01234567'/>
  489. </iq>
  490. ]]></example>
  491. <p>The service also sends notification messages to the sender and the JID of the dropped connection (detailed in the "Being Notified about Events" section).</p>
  492. </section3>
  493. </section2>
  494. <section2 topic='Deleting a Session'>
  495. <p>Sessions are deleted either by timeout or explicitly. Sessions are deleted by timeout automatically under certain conditions. Sessions can also be deleted explicity by their senders, at any time. Regardless of the method of deletion, a notice is sent to all connected.</p>
  496. <p>This use-case can be completely ignored for true "peer-to-peer" systems.</p>
  497. <section3 topic='Expiring'>
  498. <p>The exact conditions that expire a session are mostly up to the implementation. At a minimum, a session SHOULD be expired when there are less than two connections, and the "expires" time is reached.</p>
  499. </section3>
  500. <section3 topic='Deleting Explicitly'>
  501. <p>To explictly delete a session, the sender sends an "iq-set" containing a &lt;session action="delete"/&gt;:</p>
  502. <example caption='Delete request'><![CDATA[
  503. <iq id='JOBS50' type='set' to='jobs.domain'>
  504. <session xmlns=''
  505. action='delete'/>
  506. </iq>
  507. ]]></example>
  508. <example caption='Delete result'><![CDATA[
  509. <iq id='JOBS50' type='result' to='sender@domain/res' from='jobs.domain'>
  510. <session xmlns=''
  511. status='closed'
  512. id='01234567'/>
  513. </iq>
  514. ]]></example>
  515. </section3>
  516. </section2>
  517. <section2 topic='Being Notified about Events'>
  518. <section3 topic='Connection Accepted'>
  519. <p>When a connection is accepted, the service sends a "notify" message to the sender and (if appropriate) the accepted receiver, with a &lt;item type='connection' action='accept'/&gt;:</p>
  520. <example caption='"Connection Accepted" message'><![CDATA[
  521. <message to='sender@domain/res' from='jobs.domain'>
  522. <session xmlns=''
  523. action='notify'
  524. status='pending'
  525. id='01234567'>
  526. <item type='connection' action='accept'/>
  527. </session>
  528. </message>
  529. ]]></example>
  530. <p>If the notification is not about the recipient of the message, then the &lt;item/&gt; contains the JID this notification pertains to.</p>
  531. </section3>
  532. <section3 topic='Connection Rejected'>
  533. <p>When a connection is rejected, the service sends a "notify" message to the sender and (if appropriate) the accepted receiver, with a &lt;item type='connection' action='reject'/&gt;:</p>
  534. <example caption='"Connection Rejected" message'><![CDATA[
  535. <message to='receiver@domain/res' from='jobs.domain'>
  536. <session xmlns=''
  537. action='notify'
  538. status='pending'
  539. id='01234567'>
  540. <item type='connection' action='reject'/>
  541. </session>
  542. </message>
  543. ]]></example>
  544. <p>If the notification is not about the recipient of the message, then the &lt;item/&gt; contains the JID this notification pertains to.</p>
  545. </section3>
  546. <section3 topic='Connection Dropped'>
  547. <p>When a connection is dropped, the service sends a "notify" message to the sender and (if appropriate) the accepted receiver, with a &lt;item type='connection' action='drop'/&gt;:</p>
  548. <example caption='"Connection Dropped" message'><![CDATA[
  549. <message to='receiver@domain/res' from='jobs.domain'>
  550. <session xmlns=''
  551. action='notify'
  552. status='pending'
  553. id='01234567'>
  554. <item type='connection' action='drop'/>
  555. </session>
  556. </message>
  557. ]]></example>
  558. <p>If the notification is not about the recipient of the message, then the &lt;item/&gt; contains the JID this notification pertains to.</p>
  559. </section3>
  560. <section3 topic='Session Deleted'>
  561. <p>When a session is deleted, any clients connected to the session are immediately disconnected. The "notify" message is sent to the sender and any receivers still connected, with the &lt;session action="notify"/&gt; containing an &lt;item type="status"/&gt;:</p>
  562. <example caption='"Session Deleted (explicitly)" message'><![CDATA[
  563. <message to='sender@domain/res' from='jobs.domain'>
  564. <session xmlns=''
  565. action='notify'
  566. status='closed'
  567. id='01234567'>
  568. <item type='status' action='delete'/>
  569. </session>
  570. </message>
  571. ]]></example>
  572. <example caption='"Session Deleted (timed out)" message'><![CDATA[
  573. <message to='sender@domain/res' from='jobs.domain'>
  574. <session xmlns=''
  575. action='notify'
  576. status='closed'
  577. id='01234567'>
  578. <item type='status' action='expire'/>
  579. </session>
  580. </message>
  581. ]]></example>
  582. <p>The reason the session is deleted is specified by the action attribute. A value of "delete" means it was explicitly deleted. A value of "expire" means it timed out.</p>
  583. </section3>
  584. </section2>
  585. </section1>
  586. <section1 topic='Formal Description'>
  587. <section2 topic='In-Band Protocol'>
  588. <section3 topic='DTD'>
  589. <code><![CDATA[
  590. <!ELEMENT session ( ( item | ( connect? , limit+ ) )* | #PCDATA* ) >
  591. <!ATTLIST session
  592. action ( 'authenticate' | 'authorize' | 'create' | 'delete' | 'info' | 'notify' ) #OPTIONAL
  593. status ( 'active' | 'closed' | 'in-use' | 'pending' ) #OPTIONAL
  594. host CDATA #OPTIONAL
  596. port CDATA #OPTIONAL
  597. sender CDATA #OPTIONAL
  598. buffer CDATA #OPTIONAL
  599. expires CDATA #OPTIONAL
  600. receivers CDATA #OPTIONAL
  601. >
  602. <!ELEMENT item ( #PCDATA )* >
  603. <!ATTLIST item
  604. action ( 'accept' | 'confirm' | 'delete' | 'drop' | 'expire' | 'invite' | 'reject') #OPTIONAL
  605. type ( 'auth' | 'connection' | 'status' ) #OPTIONAL
  606. >
  607. <!ELEMENT connect () >
  608. <!ATTLIST connect
  609. host CDATA #REQUIRED
  610. port CDATA #REQUIRED
  611. >
  612. <!ELEMENT limit () >
  613. <!ATTLIST limit
  614. default CDATA #REQUIRED
  615. max CDATA #REQUIRED
  616. min CDATA #REQUIRED
  617. >
  618. ]]></code>
  619. </section3>
  620. <section3 topic='&lt;session/&gt; Element'>
  621. <p>The &lt;session/&gt; element is the core element to the protocol. This element provides both information about a session and the action applied to it. It has a large number of attributes, and contains zero or more &lt;item/&gt; elements, zero or more &lt;connect/&gt; elements, and zero or three &lt;limit/&gt; elements. It may also contain elements governed by other namespaces.</p>
  622. <p>The "action" attribute specifies the action to apply or being applied to the session. From clients, this attribute MUST be specified. From the service this attribute MAY be specified (to prevent ambiguity). The value of "action" MUST be one of the following:</p>
  623. <table caption='Possible "action" values'>
  624. <tr>
  625. <th>Value</th>
  626. <th>Description</th>
  627. </tr>
  628. <tr>
  629. <td>authenticate</td>
  630. <td>Authenticating one or more connections.</td>
  631. </tr>
  632. <tr>
  633. <td>authorize</td>
  634. <td>Authorizing one or more connections.</td>
  635. </tr>
  636. <tr>
  637. <td>create</td>
  638. <td>Create a new session.</td>
  639. </tr>
  640. <tr>
  641. <td>delete</td>
  642. <td>Delete an existing session.</td>
  643. </tr>
  644. <tr>
  645. <td>notify</td>
  646. <td>Notification about the session.</td>
  647. </tr>
  648. </table>
  649. <p>The "status" attribute specifies the current status of the session. This attribute MUST NOT be present if the session does not have an identifier (i.e. does not yet exist). Only the service can provide this attribute. The value of "status" MUST be one of the following:</p>
  650. <table caption='Possible "status" values'>
  651. <tr>
  652. <th>Value</th>
  653. <th>Description</th>
  654. </tr>
  655. <tr>
  656. <td>active</td>
  657. <td>The session is active, but not yet in use.</td>
  658. </tr>
  659. <tr>
  660. <td>closed</td>
  661. <td>The session has closed.</td>
  662. </tr>
  663. <tr>
  664. <td>in-use</td>
  665. <td>The session is in use (e.g. data is being transferred).</td>
  666. </tr>
  667. <tr>
  668. <td>pending</td>
  669. <td>The session is ready, but not yet active (e.g. not enough connections).</td>
  670. </tr>
  671. </table>
  672. <p>The "host" attribute specifies the OOB hostname for the session. This attribute SHOULD be specified when possible. The value of this attribute can either be the "raw" dotted-decimal address or a fully-qualified domain name.</p>
  673. <p>The "id" attribute identifies the session. This attribute is required for all uses of &lt;session/&gt; except the request to create a session. This value is any string that the service and clients can use to uniquely identify it.</p>
  674. <p>The "port" attribute specifies the OOB port number for the session. This attribute SHOULD be specified when possible.</p>
  675. <p>The "sender" attribute specifies the JID of the sender. This attribute SHOULD be specified when possible. The value of this attribute MUST be the full JID of the sender, including node and resource (if possible).</p>
  676. <p>The "buffer" attribute specifies the size of a temporary transfer buffer. This attribute MAY be present at any time, and SHOULD be presented by the service wherever possible. The value of this attribute MUST be a non-negative number. A value of 0 means there is no buffer. This value has limits defined by the "jobs:buffer" parameter statistic.</p>
  677. <p>The "expires" attribute specifies the number of seconds before this session times out. This attribute MAY be present at any time, and SHOULD be presented by the service wherever possible. The value of this attribute MUST be either a positive number or -1. A value of -1 means this session does not expire. This value has limits defined by the "jobs:expires" parameter statistic.</p>
  678. <p>The "receivers" attribute specifies the maximum number of receivers this session can have. this attribute MAY be present at any time, and SHOULD be presented by the service wherever possible. The value of this attribute MUST be either a positive number of -1. A value of -1 means this session can (theoretically) have any number of receivers. This value has limits defined by the "jobs:receivers" parameter statistic.</p>
  679. </section3>
  680. <section3 topic='&lt;item/&gt; Element'>
  681. <p>The &lt;item/&gt; element is used for detailed information about specific items of a session. It is used to contain authentication keys, to define connections, and provide more detailed status for a session. It has attributes for the type of item and the action associated with this item. This element contains only character data.</p>
  682. <p>The "action" attribute specifies the action to apply or being applied to this item. From clients, this attribute SHOULD be specified. From the service, this attribute MUST be specified (to prevent ambiguity). The value of "action" MUST be one of the following:</p>
  683. <table caption='Possible "action" values'>
  684. <tr>
  685. <th>Value</th>
  686. <th>Description</th>
  687. <th>Notes</th>
  688. </tr>
  689. <tr>
  690. <td>accept</td>
  691. <td>The item is accepted.</td>
  692. <td>This value MUST only be used when the type is "auth" or "connection".</td>
  693. </tr>
  694. <tr>
  695. <td>confirm</td>
  696. <td>The item needs confirmation.</td>
  697. <td>This value MUST only be used when the type is "auth" or "connection".</td>
  698. </tr>
  699. <tr>
  700. <td>delete</td>
  701. <td>The item is deleted.</td>
  702. <td>This value MUST only be used when the type is "status".</td>
  703. </tr>
  704. <tr>
  705. <td>drop</td>
  706. <td>The item is dropped.</td>
  707. <td>This value MUST only be used when the type is "connection".</td>
  708. </tr>
  709. <tr>
  710. <td>expire</td>
  711. <td>The item has expired.</td>
  712. <td>This value MUST only be used when the type is "status".</td>
  713. </tr>
  714. <tr>
  715. <td>invite</td>
  716. <td>The item is invited to the session.</td>
  717. <td>This value MUST only be used when the type is "connection".</td>
  718. </tr>
  719. <tr>
  720. <td>reject</td>
  721. <td>The item is rejected.</td>
  722. <td>This value MUST only be used when the type is "auth" or "connection".</td>
  723. </tr>
  724. </table>
  725. <p>The "type" attribute specifies the type of item. This attribute MUST be present. The value of "type" MUST be one of the following:</p>
  726. <table caption='Possible "action" values'>
  727. <tr>
  728. <th>Value</th>
  729. <th>Description</th>
  730. </tr>
  731. <tr>
  732. <td>auth</td>
  733. <td>The item pertains to authentication keys.</td>
  734. </tr>
  735. <tr>
  736. <td>connection</td>
  737. <td>The item details a session connection. The CDATA is the JID that is connected.</td>
  738. </tr>
  739. <tr>
  740. <td>status</td>
  741. <td>The item details a session status event.</td>
  742. </tr>
  743. </table>
  744. </section3>
  745. <section3 topic='&lt;connect/&gt; Element'>
  746. <p>The &lt;connect/&gt; element specifies a valid host/port combination for a session. An instance of this element MUST be present for each host/port combination possible. This element SHOULD only be present when information on creating sessions is requested. It has attributes to define the OOB hostname and port number. This element is empty.</p>
  747. <p>The "host" attribute specifies the OOB hostname. This attribute MUST be present. The value is either the "raw" dotted-decimal IP address, or the fully-qualified domain name.</p>
  748. <p>The "port" attribute specifies the OOB port number. This attribute MUST be present. The value MUST be a positive integer in the range (0 &lt; port &lt;= 1024).</p>
  749. </section3>
  750. <section3 topic='&lt;limit/&gt; Element'>
  751. <p>The &lt;limit/&gt; element specifies a valid host/port combination for a session. An instance of this element MUST be present for each "type". This element SHOULD only be present when information on creating sessions is requested. It has attributes to define the type of limit, the default value, the minimum value, and the maximum value. This element is empty.</p>
  752. <p>The "type" attribute specifies the type of limit. This attribute MUST be present. Each type corresponds to an attribute of &lt;session/&gt;. The value of "type" MUST be one of the following:</p>
  753. <table caption='Possible "type" values'>
  754. <tr>
  755. <th>Value</th>
  756. <th>Description</th>
  757. </tr>
  758. <tr>
  759. <td>buffer</td>
  760. <td>The buffer size limits. The units for "default", "max", and "min" are bytes.</td>
  761. </tr>
  762. <tr>
  763. <td>expires</td>
  764. <td>The expires time limits. The units for "default", "max", and "min" are seconds.</td>
  765. </tr>
  766. <tr>
  767. <td>receivers</td>
  768. <td>The receiver count limits. The units for "default", "max", and "min" are number of connections.</td>
  769. </tr>
  770. </table>
  771. <p>The "default" attribute specifies the default value for this limit. This attribute MUST be present. The value of "default" MUST be a number.</p>
  772. <p>The "max" attribute specifies the maximum value for this limit. This attribute MUST be present. The value of "max" MUST be a number. A value of -1 means there is no maximum value.</p>
  773. <p>The "min" attribute specifies the minimum value for this limit. This attribute MUST be present. The value of "min" MUST be a number. A value of -1 means there is no minimum value.</p>
  774. </section3>
  775. <section3 topic='Possible Errors'>
  776. <table caption='&lt;session action="authenticate"/&gt; errors'>
  777. <tr>
  778. <th>Code</th>
  779. <th>Message</th>
  780. <th>Cause</th>
  781. </tr>
  782. <tr>
  783. <td>400</td>
  784. <td>Bad Request</td>
  785. <td>The JOBS service did not understand the request.</td>
  786. </tr>
  787. <tr>
  788. <td>403</td>
  789. <td>Forbidden</td>
  790. <td>The JOBS service cannot accept the authentication request from the requesting JID.</td>
  791. </tr>
  792. <tr>
  793. <td>404</td>
  794. <td>Not Found</td>
  795. <td>The JOBS service could not find the given session.</td>
  796. </tr>
  797. <tr>
  798. <td>406</td>
  799. <td>Not Acceptable</td>
  800. <td>The authentication is not valid.</td>
  801. </tr>
  802. </table>
  803. <table caption='&lt;session action="authorize"/&gt; errors'>
  804. <tr>
  805. <th>Code</th>
  806. <th>Message</th>
  807. <th>Cause</th>
  808. </tr>
  809. <tr>
  810. <td>400</td>
  811. <td>Bad Request</td>
  812. <td>The JOBS service did not understand the request.</td>
  813. </tr>
  814. <tr>
  815. <td>403</td>
  816. <td>Forbidden</td>
  817. <td>The JOBS service cannot accept the authorization request from the requesting JID.</td>
  818. </tr>
  819. <tr>
  820. <td>404</td>
  821. <td>Not Found</td>
  822. <td>The JOBS service could not find the given session.</td>
  823. </tr>
  824. <tr>
  825. <td>406</td>
  826. <td>Not Acceptable</td>
  827. <td>The authorization is not valid.</td>
  828. </tr>
  829. </table>
  830. <table caption='&lt;session action="create"/&gt; errors'>
  831. <tr>
  832. <th>Code</th>
  833. <th>Message</th>
  834. <th>Cause</th>
  835. </tr>
  836. <tr>
  837. <td>400</td>
  838. <td>Bad Request</td>
  839. <td>The JOBS service did not understand the request.</td>
  840. </tr>
  841. <tr>
  842. <td>403</td>
  843. <td>Forbidden</td>
  844. <td>The JOBS service cannot accept any creation requests from this JID.</td>
  845. </tr>
  846. <tr>
  847. <td>406</td>
  848. <td>Server Not Acceptable</td>
  849. <td>The JOBS service cannot accept any creation requests using the requested &lt;server/&gt; parameters.</td>
  850. </tr>
  851. <tr>
  852. <td>406</td>
  853. <td>Restrictions Not Acceptable</td>
  854. <td>The JOBS service cannot accept any creation requests using the requested &lt;accept/&gt;, &lt;confirm/&gt;, and/or &lt;reject/&gt; parameters.</td>
  855. </tr>
  856. <tr>
  857. <td>503</td>
  858. <td>Service Unavailable</td>
  859. <td>The JOBS service cannot accept any additional sessions at this time. Future requests may be accepted.</td>
  860. </tr>
  861. </table>
  862. <table caption='&lt;session action="delete"/&gt; errors'>
  863. <tr>
  864. <th>Code</th>
  865. <th>Message</th>
  866. <th>Cause</th>
  867. </tr>
  868. <tr>
  869. <td>400</td>
  870. <td>Bad Request</td>
  871. <td>The JOBS service did not understand the request.</td>
  872. </tr>
  873. <tr>
  874. <td>403</td>
  875. <td>Forbidden</td>
  876. <td>The JOBS service cannot accept deletion requests from the requesting JID.</td>
  877. </tr>
  878. <tr>
  879. <td>404</td>
  880. <td>Not Found</td>
  881. <td>The JOBS service could not find a given session.</td>
  882. </tr>
  883. </table>
  884. <table caption='&lt;session action="notify"/&gt; errors'>
  885. <tr>
  886. <th>Code</th>
  887. <th>Message</th>
  888. <th>Cause</th>
  889. </tr>
  890. <tr>
  891. <td>400</td>
  892. <td>Bad Request</td>
  893. <td>The JOBS service did not understand the request.</td>
  894. </tr>
  895. <tr>
  896. <td>403</td>
  897. <td>Forbidden</td>
  898. <td>The JOBS service denied the connection for any reason.</td>
  899. </tr>
  900. <tr>
  901. <td>404</td>
  902. <td>Not Found</td>
  903. <td>The JOBS service could not find a given connection and/or JID.</td>
  904. </tr>
  905. <tr>
  906. <td>406</td>
  907. <td>Not Acceptable</td>
  908. <td>The JOBS service denied the notify for some reason.</td>
  909. </tr>
  910. <tr>
  911. <td>504</td>
  912. <td>Remote Server Timeout</td>
  913. <td>The JOBS connection timed out.</td>
  914. </tr>
  915. </table>
  916. </section3>
  917. </section2>
  918. <section2 topic='OOB Protocol'>
  919. <p>The OOB protocol consists of a series of hanshaking headers, then the normal data transfer process. The syntax of the hanshake packets is similar to HTTP and SIP, in that it includes a "version and method" line, followed by zero or more "headers". The end of a packet is marked by two adjacent carriage returns (i.e. a single "empty" line). The primary difference is with the first line ("version and method"), where the protocol name and version precede the method.</p>
  920. <section3 topic='Header EBNF'><code><![CDATA[
  921. jobs-oob := header CRLF ?(BINDATA)
  922. header := command-line CRLF *( header-field CRLF )
  923. command-line := jobs-version-tag SP method
  924. jobs-version-tag := "jobs" "/" *DIGIT 1*( "." *DIGIT )
  925. method := "init" | "auth-challenge" | "auth-response" | "connected" | "error"
  926. header-field := header-name ":" *1(SP header-value)
  927. header-name := NMCHAR *1( ( "." | "-" | NMCHAR ) NMCHAR)
  928. header-value := TEXT
  929. name-char := UALPHA | LALPHA | DIGIT
  930. CRLF := CR LF
  931. TEXT := <any OCTECT except CTLs>
  932. OCTET := <any 8-bit sequence of data>
  933. CTL := <any US-ASCII control character (octets 0 - 31) and DEL (127)>
  934. UALPHA := <any US-ASCII uppercase letter "A".."Z">
  935. LALPHA := <any US-ASCII lowercase letter "a".."z">
  936. DIGIT := <any US-ASCII digit "0".."9">
  937. SP := <US-ASCII SP, space (32)>
  938. CR := <US-ASCII CR, carriage return (13)>
  939. LF := <US-ASCII LF, linefeed (10)>
  940. BINDATA := <Arbitrary Binary Data>
  941. ]]></code></section3>
  942. <section3 topic='State Details'>
  943. <table caption='"init" details'>
  944. <tr>
  945. <th>Comand-line (example)</th>
  946. <td><code>jobs/0.4 init</code></td>
  947. </tr>
  948. <tr>
  949. <th>Expected header-fields</th>
  950. <td><ul>
  951. <li>"session-id" - The JOBS session ID</li>
  952. <li>"client-jid" - The (full) client JID</li>
  953. </ul></td>
  954. </tr>
  955. </table>
  956. <table caption='"auth-challenge" details'>
  957. <tr>
  958. <th>Comand-line (example)</th>
  959. <td><code>jobs/0.4 auth-challenge</code></td>
  960. </tr>
  961. <tr>
  962. <th>Expected header-fields</th>
  963. <td><ul>
  964. <li>confirm - A unique &lt;item type="auth" action="confirm"/&gt; token</li>
  965. </ul></td>
  966. </tr>
  967. </table>
  968. <table caption='"auth-response" details'>
  969. <tr>
  970. <th>Comand-line (example)</th>
  971. <td><code>jobs/0.4 auth-response</code></td>
  972. </tr>
  973. <tr>
  974. <th>Expected header-fields</th>
  975. <td><ul>
  976. <li>accept - A unique &lt;item type="auth" action="accept"/&gt; token</li>
  977. </ul></td>
  978. </tr>
  979. </table>
  980. <table caption='"connected" details'>
  981. <tr>
  982. <th>Comand-line (example)</th>
  983. <td><code>jobs/0.4 connected</code></td>
  984. </tr>
  985. <tr>
  986. <th>Expected header-fields</th>
  987. <td>NONE</td>
  988. </tr>
  989. </table>
  990. <table caption='"error" details'>
  991. <tr>
  992. <th>Comand-line (example)</th>
  993. <td><code>jobs/0.4 error</code></td>
  994. </tr>
  995. <tr>
  996. <th>Expected header-fields</th>
  997. <td><ul>
  998. <li>error-code - The HTTP-like error code</li>
  999. <li>error-msg - Detailed error message</li>
  1000. </ul></td>
  1001. </tr>
  1002. </table>
  1003. </section3>
  1004. <section3 topic='Possible Errors'>
  1005. </section3>
  1006. </section2>
  1007. </section1>
  1008. </xep>