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