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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813
|
<pre>Internet Engineering Task Force (IETF) P. Saint-Andre
Request for Comments: 6120 Cisco
Obsoletes: <a href="./rfc3920">3920</a> March 2011
Category: Standards Track
ISSN: 2070-1721
<span class="h1">Extensible Messaging and Presence Protocol (XMPP): Core</span>
Abstract
The Extensible Messaging and Presence Protocol (XMPP) is an
application profile of the Extensible Markup Language (XML) that
enables the near-real-time exchange of structured yet extensible data
between any two or more network entities. This document defines
XMPP's core protocol methods: setup and teardown of XML streams,
channel encryption, authentication, error handling, and communication
primitives for messaging, network availability ("presence"), and
request-response interactions. This document obsoletes <a href="./rfc3920">RFC 3920</a>.
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in <a href="./rfc5741#section-2">Section 2 of RFC 5741</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="http://www.rfc-editor.org/info/rfc6120">http://www.rfc-editor.org/info/rfc6120</a>.
Copyright Notice
Copyright (c) 2011 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
<span class="grey">Saint-Andre Standards Track [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Table of Contents
<a href="#section-1">1</a>. Introduction . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-8">8</a>
<a href="#section-1.1">1.1</a>. Overview . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-8">8</a>
<a href="#section-1.2">1.2</a>. History . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-8">8</a>
<a href="#section-1.3">1.3</a>. Functional Summary . . . . . . . . . . . . . . . . . . . <a href="#page-9">9</a>
<a href="#section-1.4">1.4</a>. Terminology . . . . . . . . . . . . . . . . . . . . . . <a href="#page-11">11</a>
<a href="#section-2">2</a>. Architecture . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-13">13</a>
<a href="#section-2.1">2.1</a>. Global Addresses . . . . . . . . . . . . . . . . . . . . <a href="#page-13">13</a>
<a href="#section-2.2">2.2</a>. Presence . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a>
<a href="#section-2.3">2.3</a>. Persistent Streams . . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a>
<a href="#section-2.4">2.4</a>. Structured Data . . . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a>
<a href="#section-2.5">2.5</a>. Distributed Network of Clients and Servers . . . . . . . <a href="#page-14">14</a>
<a href="#section-3">3</a>. TCP Binding . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-16">16</a>
<a href="#section-3.1">3.1</a>. Scope . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-16">16</a>
<a href="#section-3.2">3.2</a>. Resolution of Fully Qualified Domain Names . . . . . . . <a href="#page-17">17</a>
<a href="#section-3.2.1">3.2.1</a>. Preferred Process: SRV Lookup . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-3.2.2">3.2.2</a>. Fallback Processes . . . . . . . . . . . . . . . . . <a href="#page-18">18</a>
<a href="#section-3.2.3">3.2.3</a>. When Not to Use SRV . . . . . . . . . . . . . . . . <a href="#page-18">18</a>
<a href="#section-3.2.4">3.2.4</a>. Use of SRV Records with Add-On Services . . . . . . <a href="#page-19">19</a>
<a href="#section-3.3">3.3</a>. Reconnection . . . . . . . . . . . . . . . . . . . . . . <a href="#page-19">19</a>
<a href="#section-3.4">3.4</a>. Reliability . . . . . . . . . . . . . . . . . . . . . . <a href="#page-20">20</a>
<a href="#section-4">4</a>. XML Streams . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-20">20</a>
<a href="#section-4.1">4.1</a>. Stream Fundamentals . . . . . . . . . . . . . . . . . . <a href="#page-20">20</a>
<a href="#section-4.2">4.2</a>. Opening a Stream . . . . . . . . . . . . . . . . . . . . <a href="#page-23">23</a>
<a href="#section-4.3">4.3</a>. Stream Negotiation . . . . . . . . . . . . . . . . . . . <a href="#page-24">24</a>
<a href="#section-4.3.1">4.3.1</a>. Basic Concepts . . . . . . . . . . . . . . . . . . . <a href="#page-24">24</a>
<a href="#section-4.3.2">4.3.2</a>. Stream Features Format . . . . . . . . . . . . . . . <a href="#page-25">25</a>
<a href="#section-4.3.3">4.3.3</a>. Restarts . . . . . . . . . . . . . . . . . . . . . . <a href="#page-27">27</a>
<a href="#section-4.3.4">4.3.4</a>. Resending Features . . . . . . . . . . . . . . . . . <a href="#page-27">27</a>
<a href="#section-4.3.5">4.3.5</a>. Completion of Stream Negotiation . . . . . . . . . . <a href="#page-27">27</a>
<a href="#section-4.3.6">4.3.6</a>. Determination of Addresses . . . . . . . . . . . . . <a href="#page-28">28</a>
<a href="#section-4.3.7">4.3.7</a>. Flow Chart . . . . . . . . . . . . . . . . . . . . . <a href="#page-29">29</a>
<a href="#section-4.4">4.4</a>. Closing a Stream . . . . . . . . . . . . . . . . . . . . <a href="#page-31">31</a>
<a href="#section-4.5">4.5</a>. Directionality . . . . . . . . . . . . . . . . . . . . . <a href="#page-32">32</a>
<a href="#section-4.6">4.6</a>. Handling of Silent Peers . . . . . . . . . . . . . . . . <a href="#page-33">33</a>
<a href="#section-4.6.1">4.6.1</a>. Dead Connection . . . . . . . . . . . . . . . . . . <a href="#page-34">34</a>
<a href="#section-4.6.2">4.6.2</a>. Broken Stream . . . . . . . . . . . . . . . . . . . <a href="#page-34">34</a>
<a href="#section-4.6.3">4.6.3</a>. Idle Peer . . . . . . . . . . . . . . . . . . . . . <a href="#page-34">34</a>
<a href="#section-4.6.4">4.6.4</a>. Use of Checking Methods . . . . . . . . . . . . . . <a href="#page-35">35</a>
<a href="#section-4.7">4.7</a>. Stream Attributes . . . . . . . . . . . . . . . . . . . <a href="#page-35">35</a>
<a href="#section-4.7.1">4.7.1</a>. from . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-35">35</a>
<a href="#section-4.7.2">4.7.2</a>. to . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-37">37</a>
<a href="#section-4.7.3">4.7.3</a>. id . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-38">38</a>
<a href="#section-4.7.4">4.7.4</a>. xml:lang . . . . . . . . . . . . . . . . . . . . . . <a href="#page-39">39</a>
<a href="#section-4.7.5">4.7.5</a>. version . . . . . . . . . . . . . . . . . . . . . . <a href="#page-41">41</a>
<a href="#section-4.7.6">4.7.6</a>. Summary of Stream Attributes . . . . . . . . . . . . <a href="#page-43">43</a>
<a href="#section-4.8">4.8</a>. XML Namespaces . . . . . . . . . . . . . . . . . . . . . <a href="#page-43">43</a>
<span class="grey">Saint-Andre Standards Track [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<a href="#section-4.8.1">4.8.1</a>. Stream Namespace . . . . . . . . . . . . . . . . . . <a href="#page-43">43</a>
<a href="#section-4.8.2">4.8.2</a>. Content Namespace . . . . . . . . . . . . . . . . . <a href="#page-43">43</a>
<a href="#section-4.8.3">4.8.3</a>. XMPP Content Namespaces . . . . . . . . . . . . . . <a href="#page-44">44</a>
<a href="#section-4.8.4">4.8.4</a>. Other Namespaces . . . . . . . . . . . . . . . . . . <a href="#page-46">46</a>
<a href="#section-4.8.5">4.8.5</a>. Namespace Declarations and Prefixes . . . . . . . . <a href="#page-47">47</a>
<a href="#section-4.9">4.9</a>. Stream Errors . . . . . . . . . . . . . . . . . . . . . <a href="#page-48">48</a>
<a href="#section-4.9.1">4.9.1</a>. Rules . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-48">48</a>
<a href="#section-4.9.1.1">4.9.1.1</a>. Stream Errors Are Unrecoverable . . . . . . . . . <a href="#page-48">48</a>
<a href="#section-4.9.1.2">4.9.1.2</a>. Stream Errors Can Occur During Setup . . . . . . <a href="#page-49">49</a>
4.9.1.3. Stream Errors When the Host Is Unspecified or
Unknown . . . . . . . . . . . . . . . . . . . . . <a href="#page-50">50</a>
<a href="#section-4.9.1.4">4.9.1.4</a>. Where Stream Errors Are Sent . . . . . . . . . . <a href="#page-50">50</a>
<a href="#section-4.9.2">4.9.2</a>. Syntax . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-51">51</a>
<a href="#section-4.9.3">4.9.3</a>. Defined Stream Error Conditions . . . . . . . . . . <a href="#page-52">52</a>
<a href="#section-4.9.3.1">4.9.3.1</a>. bad-format . . . . . . . . . . . . . . . . . . . <a href="#page-52">52</a>
<a href="#section-4.9.3.2">4.9.3.2</a>. bad-namespace-prefix . . . . . . . . . . . . . . <a href="#page-52">52</a>
<a href="#section-4.9.3.3">4.9.3.3</a>. conflict . . . . . . . . . . . . . . . . . . . . <a href="#page-53">53</a>
<a href="#section-4.9.3.4">4.9.3.4</a>. connection-timeout . . . . . . . . . . . . . . . <a href="#page-54">54</a>
<a href="#section-4.9.3.5">4.9.3.5</a>. host-gone . . . . . . . . . . . . . . . . . . . . <a href="#page-54">54</a>
<a href="#section-4.9.3.6">4.9.3.6</a>. host-unknown . . . . . . . . . . . . . . . . . . <a href="#page-55">55</a>
<a href="#section-4.9.3.7">4.9.3.7</a>. improper-addressing . . . . . . . . . . . . . . . <a href="#page-56">56</a>
<a href="#section-4.9.3.8">4.9.3.8</a>. internal-server-error . . . . . . . . . . . . . . <a href="#page-56">56</a>
<a href="#section-4.9.3.9">4.9.3.9</a>. invalid-from . . . . . . . . . . . . . . . . . . <a href="#page-56">56</a>
<a href="#section-4.9.3.10">4.9.3.10</a>. invalid-namespace . . . . . . . . . . . . . . . . <a href="#page-57">57</a>
<a href="#section-4.9.3.11">4.9.3.11</a>. invalid-xml . . . . . . . . . . . . . . . . . . . <a href="#page-57">57</a>
<a href="#section-4.9.3.12">4.9.3.12</a>. not-authorized . . . . . . . . . . . . . . . . . <a href="#page-58">58</a>
<a href="#section-4.9.3.13">4.9.3.13</a>. not-well-formed . . . . . . . . . . . . . . . . . <a href="#page-59">59</a>
<a href="#section-4.9.3.14">4.9.3.14</a>. policy-violation . . . . . . . . . . . . . . . . <a href="#page-59">59</a>
<a href="#section-4.9.3.15">4.9.3.15</a>. remote-connection-failed . . . . . . . . . . . . <a href="#page-60">60</a>
<a href="#section-4.9.3.16">4.9.3.16</a>. reset . . . . . . . . . . . . . . . . . . . . . . <a href="#page-60">60</a>
<a href="#section-4.9.3.17">4.9.3.17</a>. resource-constraint . . . . . . . . . . . . . . . <a href="#page-61">61</a>
<a href="#section-4.9.3.18">4.9.3.18</a>. restricted-xml . . . . . . . . . . . . . . . . . <a href="#page-61">61</a>
<a href="#section-4.9.3.19">4.9.3.19</a>. see-other-host . . . . . . . . . . . . . . . . . <a href="#page-62">62</a>
<a href="#section-4.9.3.20">4.9.3.20</a>. system-shutdown . . . . . . . . . . . . . . . . . <a href="#page-64">64</a>
<a href="#section-4.9.3.21">4.9.3.21</a>. undefined-condition . . . . . . . . . . . . . . . <a href="#page-64">64</a>
<a href="#section-4.9.3.22">4.9.3.22</a>. unsupported-encoding . . . . . . . . . . . . . . <a href="#page-64">64</a>
<a href="#section-4.9.3.23">4.9.3.23</a>. unsupported-feature . . . . . . . . . . . . . . . <a href="#page-65">65</a>
<a href="#section-4.9.3.24">4.9.3.24</a>. unsupported-stanza-type . . . . . . . . . . . . . <a href="#page-65">65</a>
<a href="#section-4.9.3.25">4.9.3.25</a>. unsupported-version . . . . . . . . . . . . . . . <a href="#page-66">66</a>
<a href="#section-4.9.4">4.9.4</a>. Application-Specific Conditions . . . . . . . . . . <a href="#page-67">67</a>
<a href="#section-4.10">4.10</a>. Simplified Stream Examples . . . . . . . . . . . . . . . <a href="#page-68">68</a>
<a href="#section-5">5</a>. STARTTLS Negotiation . . . . . . . . . . . . . . . . . . . . <a href="#page-69">69</a>
<a href="#section-5.1">5.1</a>. Fundamentals . . . . . . . . . . . . . . . . . . . . . . <a href="#page-69">69</a>
<a href="#section-5.2">5.2</a>. Support . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-70">70</a>
<a href="#section-5.3">5.3</a>. Stream Negotiation Rules . . . . . . . . . . . . . . . . <a href="#page-70">70</a>
<a href="#section-5.3.1">5.3.1</a>. Mandatory-to-Negotiate . . . . . . . . . . . . . . . <a href="#page-70">70</a>
<a href="#section-5.3.2">5.3.2</a>. Restart . . . . . . . . . . . . . . . . . . . . . . <a href="#page-70">70</a>
<a href="#section-5.3.3">5.3.3</a>. Data Formatting . . . . . . . . . . . . . . . . . . <a href="#page-70">70</a>
<span class="grey">Saint-Andre Standards Track [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<a href="#section-5.3.4">5.3.4</a>. Order of TLS and SASL Negotiations . . . . . . . . . <a href="#page-71">71</a>
<a href="#section-5.3.5">5.3.5</a>. TLS Renegotiation . . . . . . . . . . . . . . . . . <a href="#page-71">71</a>
<a href="#section-5.3.6">5.3.6</a>. TLS Extensions . . . . . . . . . . . . . . . . . . . <a href="#page-72">72</a>
<a href="#section-5.4">5.4</a>. Process . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-72">72</a>
<a href="#section-5.4.1">5.4.1</a>. Exchange of Stream Headers and Stream Features . . . <a href="#page-72">72</a>
<a href="#section-5.4.2">5.4.2</a>. Initiation of STARTTLS Negotiation . . . . . . . . . <a href="#page-73">73</a>
<a href="#section-5.4.2.1">5.4.2.1</a>. STARTTLS Command . . . . . . . . . . . . . . . . <a href="#page-73">73</a>
<a href="#section-5.4.2.2">5.4.2.2</a>. Failure Case . . . . . . . . . . . . . . . . . . <a href="#page-73">73</a>
<a href="#section-5.4.2.3">5.4.2.3</a>. Proceed Case . . . . . . . . . . . . . . . . . . <a href="#page-74">74</a>
<a href="#section-5.4.3">5.4.3</a>. TLS Negotiation . . . . . . . . . . . . . . . . . . <a href="#page-74">74</a>
<a href="#section-5.4.3.1">5.4.3.1</a>. Rules . . . . . . . . . . . . . . . . . . . . . . <a href="#page-74">74</a>
<a href="#section-5.4.3.2">5.4.3.2</a>. TLS Failure . . . . . . . . . . . . . . . . . . . <a href="#page-75">75</a>
<a href="#section-5.4.3.3">5.4.3.3</a>. TLS Success . . . . . . . . . . . . . . . . . . . <a href="#page-76">76</a>
<a href="#section-6">6</a>. SASL Negotiation . . . . . . . . . . . . . . . . . . . . . . <a href="#page-77">77</a>
<a href="#section-6.1">6.1</a>. Fundamentals . . . . . . . . . . . . . . . . . . . . . . <a href="#page-77">77</a>
<a href="#section-6.2">6.2</a>. Support . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-77">77</a>
<a href="#section-6.3">6.3</a>. Stream Negotiation Rules . . . . . . . . . . . . . . . . <a href="#page-77">77</a>
<a href="#section-6.3.1">6.3.1</a>. Mandatory-to-Negotiate . . . . . . . . . . . . . . . <a href="#page-77">77</a>
<a href="#section-6.3.2">6.3.2</a>. Restart . . . . . . . . . . . . . . . . . . . . . . <a href="#page-78">78</a>
<a href="#section-6.3.3">6.3.3</a>. Mechanism Preferences . . . . . . . . . . . . . . . <a href="#page-78">78</a>
<a href="#section-6.3.4">6.3.4</a>. Mechanism Offers . . . . . . . . . . . . . . . . . . <a href="#page-78">78</a>
<a href="#section-6.3.5">6.3.5</a>. Data Formatting . . . . . . . . . . . . . . . . . . <a href="#page-79">79</a>
<a href="#section-6.3.6">6.3.6</a>. Security Layers . . . . . . . . . . . . . . . . . . <a href="#page-80">80</a>
<a href="#section-6.3.7">6.3.7</a>. Simple User Name . . . . . . . . . . . . . . . . . . <a href="#page-80">80</a>
<a href="#section-6.3.8">6.3.8</a>. Authorization Identity . . . . . . . . . . . . . . . <a href="#page-80">80</a>
<a href="#section-6.3.9">6.3.9</a>. Realms . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-81">81</a>
<a href="#section-6.3.10">6.3.10</a>. Round Trips . . . . . . . . . . . . . . . . . . . . <a href="#page-81">81</a>
<a href="#section-6.4">6.4</a>. Process . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-82">82</a>
<a href="#section-6.4.1">6.4.1</a>. Exchange of Stream Headers and Stream Features . . . <a href="#page-82">82</a>
<a href="#section-6.4.2">6.4.2</a>. Initiation . . . . . . . . . . . . . . . . . . . . . <a href="#page-83">83</a>
<a href="#section-6.4.3">6.4.3</a>. Challenge-Response Sequence . . . . . . . . . . . . <a href="#page-84">84</a>
<a href="#section-6.4.4">6.4.4</a>. Abort . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-84">84</a>
<a href="#section-6.4.5">6.4.5</a>. SASL Failure . . . . . . . . . . . . . . . . . . . . <a href="#page-85">85</a>
<a href="#section-6.4.6">6.4.6</a>. SASL Success . . . . . . . . . . . . . . . . . . . . <a href="#page-86">86</a>
<a href="#section-6.5">6.5</a>. SASL Errors . . . . . . . . . . . . . . . . . . . . . . <a href="#page-87">87</a>
<a href="#section-6.5.1">6.5.1</a>. aborted . . . . . . . . . . . . . . . . . . . . . . <a href="#page-88">88</a>
<a href="#section-6.5.2">6.5.2</a>. account-disabled . . . . . . . . . . . . . . . . . . <a href="#page-88">88</a>
<a href="#section-6.5.3">6.5.3</a>. credentials-expired . . . . . . . . . . . . . . . . <a href="#page-88">88</a>
<a href="#section-6.5.4">6.5.4</a>. encryption-required . . . . . . . . . . . . . . . . <a href="#page-89">89</a>
<a href="#section-6.5.5">6.5.5</a>. incorrect-encoding . . . . . . . . . . . . . . . . . <a href="#page-89">89</a>
<a href="#section-6.5.6">6.5.6</a>. invalid-authzid . . . . . . . . . . . . . . . . . . <a href="#page-89">89</a>
<a href="#section-6.5.7">6.5.7</a>. invalid-mechanism . . . . . . . . . . . . . . . . . <a href="#page-90">90</a>
<a href="#section-6.5.8">6.5.8</a>. malformed-request . . . . . . . . . . . . . . . . . <a href="#page-90">90</a>
<a href="#section-6.5.9">6.5.9</a>. mechanism-too-weak . . . . . . . . . . . . . . . . . <a href="#page-90">90</a>
<a href="#section-6.5.10">6.5.10</a>. not-authorized . . . . . . . . . . . . . . . . . . . <a href="#page-91">91</a>
<a href="#section-6.5.11">6.5.11</a>. temporary-auth-failure . . . . . . . . . . . . . . . <a href="#page-91">91</a>
<a href="#section-6.6">6.6</a>. SASL Definition . . . . . . . . . . . . . . . . . . . . <a href="#page-91">91</a>
<a href="#section-7">7</a>. Resource Binding . . . . . . . . . . . . . . . . . . . . . . <a href="#page-92">92</a>
<span class="grey">Saint-Andre Standards Track [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<a href="#section-7.1">7.1</a>. Fundamentals . . . . . . . . . . . . . . . . . . . . . . <a href="#page-92">92</a>
<a href="#section-7.2">7.2</a>. Support . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-93">93</a>
<a href="#section-7.3">7.3</a>. Stream Negotiation Rules . . . . . . . . . . . . . . . . <a href="#page-93">93</a>
<a href="#section-7.3.1">7.3.1</a>. Mandatory-to-Negotiate . . . . . . . . . . . . . . . <a href="#page-93">93</a>
<a href="#section-7.3.2">7.3.2</a>. Restart . . . . . . . . . . . . . . . . . . . . . . <a href="#page-93">93</a>
<a href="#section-7.4">7.4</a>. Advertising Support . . . . . . . . . . . . . . . . . . <a href="#page-93">93</a>
<a href="#section-7.5">7.5</a>. Generation of Resource Identifiers . . . . . . . . . . . <a href="#page-94">94</a>
<a href="#section-7.6">7.6</a>. Server-Generated Resource Identifier . . . . . . . . . . <a href="#page-94">94</a>
<a href="#section-7.6.1">7.6.1</a>. Success Case . . . . . . . . . . . . . . . . . . . . <a href="#page-94">94</a>
<a href="#section-7.6.2">7.6.2</a>. Error Cases . . . . . . . . . . . . . . . . . . . . <a href="#page-95">95</a>
<a href="#section-7.6.2.1">7.6.2.1</a>. Resource Constraint . . . . . . . . . . . . . . . <a href="#page-95">95</a>
<a href="#section-7.6.2.2">7.6.2.2</a>. Not Allowed . . . . . . . . . . . . . . . . . . . <a href="#page-96">96</a>
<a href="#section-7.7">7.7</a>. Client-Submitted Resource Identifier . . . . . . . . . . <a href="#page-96">96</a>
<a href="#section-7.7.1">7.7.1</a>. Success Case . . . . . . . . . . . . . . . . . . . . <a href="#page-96">96</a>
<a href="#section-7.7.2">7.7.2</a>. Error Cases . . . . . . . . . . . . . . . . . . . . <a href="#page-97">97</a>
<a href="#section-7.7.2.1">7.7.2.1</a>. Bad Request . . . . . . . . . . . . . . . . . . . <a href="#page-97">97</a>
<a href="#section-7.7.2.2">7.7.2.2</a>. Conflict . . . . . . . . . . . . . . . . . . . . <a href="#page-97">97</a>
<a href="#section-7.7.3">7.7.3</a>. Retries . . . . . . . . . . . . . . . . . . . . . . <a href="#page-99">99</a>
<a href="#section-8">8</a>. XML Stanzas . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-99">99</a>
<a href="#section-8.1">8.1</a>. Common Attributes . . . . . . . . . . . . . . . . . . . <a href="#page-100">100</a>
<a href="#section-8.1.1">8.1.1</a>. to . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-100">100</a>
<a href="#section-8.1.1.1">8.1.1.1</a>. Client-to-Server Streams . . . . . . . . . . . . <a href="#page-100">100</a>
<a href="#section-8.1.1.2">8.1.1.2</a>. Server-to-Server Streams . . . . . . . . . . . . <a href="#page-101">101</a>
<a href="#section-8.1.2">8.1.2</a>. from . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-101">101</a>
<a href="#section-8.1.2.1">8.1.2.1</a>. Client-to-Server Streams . . . . . . . . . . . . <a href="#page-101">101</a>
<a href="#section-8.1.2.2">8.1.2.2</a>. Server-to-Server Streams . . . . . . . . . . . . <a href="#page-102">102</a>
<a href="#section-8.1.3">8.1.3</a>. id . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-103">103</a>
<a href="#section-8.1.4">8.1.4</a>. type . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-103">103</a>
<a href="#section-8.1.5">8.1.5</a>. xml:lang . . . . . . . . . . . . . . . . . . . . . . <a href="#page-103">103</a>
<a href="#section-8.2">8.2</a>. Basic Semantics . . . . . . . . . . . . . . . . . . . . <a href="#page-105">105</a>
<a href="#section-8.2.1">8.2.1</a>. Message Semantics . . . . . . . . . . . . . . . . . <a href="#page-105">105</a>
<a href="#section-8.2.2">8.2.2</a>. Presence Semantics . . . . . . . . . . . . . . . . . <a href="#page-105">105</a>
<a href="#section-8.2.3">8.2.3</a>. IQ Semantics . . . . . . . . . . . . . . . . . . . . <a href="#page-105">105</a>
<a href="#section-8.3">8.3</a>. Stanza Errors . . . . . . . . . . . . . . . . . . . . . <a href="#page-107">107</a>
<a href="#section-8.3.1">8.3.1</a>. Rules . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-108">108</a>
<a href="#section-8.3.2">8.3.2</a>. Syntax . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-109">109</a>
<a href="#section-8.3.3">8.3.3</a>. Defined Conditions . . . . . . . . . . . . . . . . . <a href="#page-110">110</a>
<a href="#section-8.3.3.1">8.3.3.1</a>. bad-request . . . . . . . . . . . . . . . . . . . <a href="#page-110">110</a>
<a href="#section-8.3.3.2">8.3.3.2</a>. conflict . . . . . . . . . . . . . . . . . . . . <a href="#page-111">111</a>
<a href="#section-8.3.3.3">8.3.3.3</a>. feature-not-implemented . . . . . . . . . . . . . <a href="#page-111">111</a>
<a href="#section-8.3.3.4">8.3.3.4</a>. forbidden . . . . . . . . . . . . . . . . . . . . <a href="#page-112">112</a>
<a href="#section-8.3.3.5">8.3.3.5</a>. gone . . . . . . . . . . . . . . . . . . . . . . <a href="#page-113">113</a>
<a href="#section-8.3.3.6">8.3.3.6</a>. internal-server-error . . . . . . . . . . . . . . <a href="#page-113">113</a>
<a href="#section-8.3.3.7">8.3.3.7</a>. item-not-found . . . . . . . . . . . . . . . . . <a href="#page-114">114</a>
<a href="#section-8.3.3.8">8.3.3.8</a>. jid-malformed . . . . . . . . . . . . . . . . . . <a href="#page-114">114</a>
<a href="#section-8.3.3.9">8.3.3.9</a>. not-acceptable . . . . . . . . . . . . . . . . . <a href="#page-115">115</a>
<a href="#section-8.3.3.10">8.3.3.10</a>. not-allowed . . . . . . . . . . . . . . . . . . . <a href="#page-116">116</a>
<a href="#section-8.3.3.11">8.3.3.11</a>. not-authorized . . . . . . . . . . . . . . . . . <a href="#page-116">116</a>
<span class="grey">Saint-Andre Standards Track [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<a href="#section-8.3.3.12">8.3.3.12</a>. policy-violation . . . . . . . . . . . . . . . . <a href="#page-117">117</a>
<a href="#section-8.3.3.13">8.3.3.13</a>. recipient-unavailable . . . . . . . . . . . . . . <a href="#page-117">117</a>
<a href="#section-8.3.3.14">8.3.3.14</a>. redirect . . . . . . . . . . . . . . . . . . . . <a href="#page-118">118</a>
<a href="#section-8.3.3.15">8.3.3.15</a>. registration-required . . . . . . . . . . . . . . <a href="#page-119">119</a>
<a href="#section-8.3.3.16">8.3.3.16</a>. remote-server-not-found . . . . . . . . . . . . . <a href="#page-119">119</a>
<a href="#section-8.3.3.17">8.3.3.17</a>. remote-server-timeout . . . . . . . . . . . . . . <a href="#page-120">120</a>
<a href="#section-8.3.3.18">8.3.3.18</a>. resource-constraint . . . . . . . . . . . . . . . <a href="#page-121">121</a>
<a href="#section-8.3.3.19">8.3.3.19</a>. service-unavailable . . . . . . . . . . . . . . . <a href="#page-121">121</a>
<a href="#section-8.3.3.20">8.3.3.20</a>. subscription-required . . . . . . . . . . . . . . <a href="#page-122">122</a>
<a href="#section-8.3.3.21">8.3.3.21</a>. undefined-condition . . . . . . . . . . . . . . . <a href="#page-123">123</a>
<a href="#section-8.3.3.22">8.3.3.22</a>. unexpected-request . . . . . . . . . . . . . . . <a href="#page-123">123</a>
<a href="#section-8.3.4">8.3.4</a>. Application-Specific Conditions . . . . . . . . . . <a href="#page-124">124</a>
<a href="#section-8.4">8.4</a>. Extended Content . . . . . . . . . . . . . . . . . . . . <a href="#page-125">125</a>
<a href="#section-9">9</a>. Detailed Examples . . . . . . . . . . . . . . . . . . . . . . <a href="#page-128">128</a>
<a href="#section-9.1">9.1</a>. Client-to-Server Examples . . . . . . . . . . . . . . . <a href="#page-128">128</a>
<a href="#section-9.1.1">9.1.1</a>. TLS . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-128">128</a>
<a href="#section-9.1.2">9.1.2</a>. SASL . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-130">130</a>
<a href="#section-9.1.3">9.1.3</a>. Resource Binding . . . . . . . . . . . . . . . . . . <a href="#page-132">132</a>
<a href="#section-9.1.4">9.1.4</a>. Stanza Exchange . . . . . . . . . . . . . . . . . . <a href="#page-133">133</a>
<a href="#section-9.1.5">9.1.5</a>. Close . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-134">134</a>
<a href="#section-9.2">9.2</a>. Server-to-Server Examples . . . . . . . . . . . . . . . <a href="#page-134">134</a>
<a href="#section-9.2.1">9.2.1</a>. TLS . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-134">134</a>
<a href="#section-9.2.2">9.2.2</a>. SASL . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-136">136</a>
<a href="#section-9.2.3">9.2.3</a>. Stanza Exchange . . . . . . . . . . . . . . . . . . <a href="#page-137">137</a>
<a href="#section-9.2.4">9.2.4</a>. Close . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-137">137</a>
<a href="#section-10">10</a>. Server Rules for Processing XML Stanzas . . . . . . . . . . . <a href="#page-138">138</a>
<a href="#section-10.1">10.1</a>. In-Order Processing . . . . . . . . . . . . . . . . . . <a href="#page-138">138</a>
<a href="#section-10.2">10.2</a>. General Considerations . . . . . . . . . . . . . . . . . <a href="#page-140">140</a>
<a href="#section-10.3">10.3</a>. No 'to' Address . . . . . . . . . . . . . . . . . . . . <a href="#page-141">141</a>
<a href="#section-10.3.1">10.3.1</a>. Message . . . . . . . . . . . . . . . . . . . . . . <a href="#page-141">141</a>
<a href="#section-10.3.2">10.3.2</a>. Presence . . . . . . . . . . . . . . . . . . . . . . <a href="#page-141">141</a>
<a href="#section-10.3.3">10.3.3</a>. IQ . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-141">141</a>
<a href="#section-10.4">10.4</a>. Remote Domain . . . . . . . . . . . . . . . . . . . . . <a href="#page-142">142</a>
<a href="#section-10.4.1">10.4.1</a>. Existing Stream . . . . . . . . . . . . . . . . . . <a href="#page-142">142</a>
<a href="#section-10.4.2">10.4.2</a>. No Existing Stream . . . . . . . . . . . . . . . . . <a href="#page-142">142</a>
<a href="#section-10.4.3">10.4.3</a>. Error Handling . . . . . . . . . . . . . . . . . . . <a href="#page-143">143</a>
<a href="#section-10.5">10.5</a>. Local Domain . . . . . . . . . . . . . . . . . . . . . . <a href="#page-143">143</a>
<a href="#section-10.5.1">10.5.1</a>. domainpart . . . . . . . . . . . . . . . . . . . . . <a href="#page-143">143</a>
<a href="#section-10.5.2">10.5.2</a>. domainpart/resourcepart . . . . . . . . . . . . . . <a href="#page-143">143</a>
<a href="#section-10.5.3">10.5.3</a>. localpart@domainpart . . . . . . . . . . . . . . . . <a href="#page-143">143</a>
<a href="#section-10.5.3.1">10.5.3.1</a>. No Such User . . . . . . . . . . . . . . . . . . <a href="#page-144">144</a>
<a href="#section-10.5.3.2">10.5.3.2</a>. User Exists . . . . . . . . . . . . . . . . . . . <a href="#page-144">144</a>
<a href="#section-10.5.4">10.5.4</a>. localpart@domainpart/resourcepart . . . . . . . . . <a href="#page-144">144</a>
<a href="#section-11">11</a>. XML Usage . . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-145">145</a>
<a href="#section-11.1">11.1</a>. XML Restrictions . . . . . . . . . . . . . . . . . . . . <a href="#page-145">145</a>
<a href="#section-11.2">11.2</a>. XML Namespace Names and Prefixes . . . . . . . . . . . . <a href="#page-146">146</a>
<a href="#section-11.3">11.3</a>. Well-Formedness . . . . . . . . . . . . . . . . . . . . <a href="#page-146">146</a>
<a href="#section-11.4">11.4</a>. Validation . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-147">147</a>
<span class="grey">Saint-Andre Standards Track [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<a href="#section-11.5">11.5</a>. Inclusion of XML Declaration . . . . . . . . . . . . . . <a href="#page-147">147</a>
<a href="#section-11.6">11.6</a>. Character Encoding . . . . . . . . . . . . . . . . . . . <a href="#page-147">147</a>
<a href="#section-11.7">11.7</a>. Whitespace . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-148">148</a>
<a href="#section-11.8">11.8</a>. XML Versions . . . . . . . . . . . . . . . . . . . . . . <a href="#page-148">148</a>
<a href="#section-12">12</a>. Internationalization Considerations . . . . . . . . . . . . . <a href="#page-148">148</a>
<a href="#section-13">13</a>. Security Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-148">148</a>
<a href="#section-13.1">13.1</a>. Fundamentals . . . . . . . . . . . . . . . . . . . . . . <a href="#page-148">148</a>
<a href="#section-13.2">13.2</a>. Threat Model . . . . . . . . . . . . . . . . . . . . . . <a href="#page-149">149</a>
<a href="#section-13.3">13.3</a>. Order of Layers . . . . . . . . . . . . . . . . . . . . <a href="#page-150">150</a>
<a href="#section-13.4">13.4</a>. Confidentiality and Integrity . . . . . . . . . . . . . <a href="#page-150">150</a>
<a href="#section-13.5">13.5</a>. Peer Entity Authentication . . . . . . . . . . . . . . . <a href="#page-151">151</a>
<a href="#section-13.6">13.6</a>. Strong Security . . . . . . . . . . . . . . . . . . . . <a href="#page-151">151</a>
<a href="#section-13.7">13.7</a>. Certificates . . . . . . . . . . . . . . . . . . . . . . <a href="#page-152">152</a>
<a href="#section-13.7.1">13.7.1</a>. Certificate Generation . . . . . . . . . . . . . . . <a href="#page-152">152</a>
<a href="#section-13.7.1.1">13.7.1.1</a>. General Considerations . . . . . . . . . . . . . <a href="#page-152">152</a>
<a href="#section-13.7.1.2">13.7.1.2</a>. Server Certificates . . . . . . . . . . . . . . . <a href="#page-153">153</a>
<a href="#section-13.7.1.3">13.7.1.3</a>. Client Certificates . . . . . . . . . . . . . . . <a href="#page-156">156</a>
<a href="#section-13.7.1.4">13.7.1.4</a>. XmppAddr Identifier Type . . . . . . . . . . . . <a href="#page-156">156</a>
<a href="#section-13.7.2">13.7.2</a>. Certificate Validation . . . . . . . . . . . . . . . <a href="#page-157">157</a>
<a href="#section-13.7.2.1">13.7.2.1</a>. Server Certificates . . . . . . . . . . . . . . . <a href="#page-158">158</a>
<a href="#section-13.7.2.2">13.7.2.2</a>. Client Certificates . . . . . . . . . . . . . . . <a href="#page-158">158</a>
13.7.2.3. Checking of Certificates in Long-Lived Streams . 160
<a href="#section-13.7.2.4">13.7.2.4</a>. Use of Certificates in XMPP Extensions . . . . . <a href="#page-160">160</a>
<a href="#section-13.8">13.8</a>. Mandatory-to-Implement TLS and SASL Technologies . . . . <a href="#page-160">160</a>
<a href="#section-13.8.1">13.8.1</a>. For Authentication Only . . . . . . . . . . . . . . <a href="#page-161">161</a>
<a href="#section-13.8.2">13.8.2</a>. For Confidentiality Only . . . . . . . . . . . . . . <a href="#page-161">161</a>
13.8.3. For Confidentiality and Authentication with
Passwords . . . . . . . . . . . . . . . . . . . . . <a href="#page-162">162</a>
13.8.4. For Confidentiality and Authentication without
Passwords . . . . . . . . . . . . . . . . . . . . . <a href="#page-163">163</a>
<a href="#section-13.9">13.9</a>. Technology Reuse . . . . . . . . . . . . . . . . . . . . <a href="#page-163">163</a>
<a href="#section-13.9.1">13.9.1</a>. Use of Base 64 in SASL . . . . . . . . . . . . . . . <a href="#page-163">163</a>
<a href="#section-13.9.2">13.9.2</a>. Use of DNS . . . . . . . . . . . . . . . . . . . . . <a href="#page-163">163</a>
<a href="#section-13.9.3">13.9.3</a>. Use of Hash Functions . . . . . . . . . . . . . . . <a href="#page-164">164</a>
<a href="#section-13.9.4">13.9.4</a>. Use of SASL . . . . . . . . . . . . . . . . . . . . <a href="#page-164">164</a>
<a href="#section-13.9.5">13.9.5</a>. Use of TLS . . . . . . . . . . . . . . . . . . . . . <a href="#page-165">165</a>
<a href="#section-13.9.6">13.9.6</a>. Use of UTF-8 . . . . . . . . . . . . . . . . . . . . <a href="#page-165">165</a>
<a href="#section-13.9.7">13.9.7</a>. Use of XML . . . . . . . . . . . . . . . . . . . . . <a href="#page-166">166</a>
<a href="#section-13.10">13.10</a>. Information Leaks . . . . . . . . . . . . . . . . . . . <a href="#page-166">166</a>
<a href="#section-13.10.1">13.10.1</a>. IP Addresses . . . . . . . . . . . . . . . . . . . . <a href="#page-166">166</a>
<a href="#section-13.10.2">13.10.2</a>. Presence Information . . . . . . . . . . . . . . . . <a href="#page-166">166</a>
<a href="#section-13.11">13.11</a>. Directory Harvesting . . . . . . . . . . . . . . . . . . <a href="#page-166">166</a>
<a href="#section-13.12">13.12</a>. Denial of Service . . . . . . . . . . . . . . . . . . . <a href="#page-167">167</a>
<a href="#section-13.13">13.13</a>. Firewalls . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-169">169</a>
<a href="#section-13.14">13.14</a>. Interdomain Federation . . . . . . . . . . . . . . . . . <a href="#page-169">169</a>
<a href="#section-13.15">13.15</a>. Non-Repudiation . . . . . . . . . . . . . . . . . . . . <a href="#page-169">169</a>
<a href="#section-14">14</a>. IANA Considerations . . . . . . . . . . . . . . . . . . . . . <a href="#page-170">170</a>
<a href="#section-14.1">14.1</a>. XML Namespace Name for TLS Data . . . . . . . . . . . . <a href="#page-170">170</a>
<span class="grey">Saint-Andre Standards Track [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<a href="#section-14.2">14.2</a>. XML Namespace Name for SASL Data . . . . . . . . . . . . <a href="#page-170">170</a>
<a href="#section-14.3">14.3</a>. XML Namespace Name for Stream Errors . . . . . . . . . . <a href="#page-170">170</a>
<a href="#section-14.4">14.4</a>. XML Namespace Name for Resource Binding . . . . . . . . <a href="#page-171">171</a>
<a href="#section-14.5">14.5</a>. XML Namespace Name for Stanza Errors . . . . . . . . . . <a href="#page-171">171</a>
<a href="#section-14.6">14.6</a>. GSSAPI Service Name . . . . . . . . . . . . . . . . . . <a href="#page-171">171</a>
<a href="#section-14.7">14.7</a>. Port Numbers and Service Names . . . . . . . . . . . . . <a href="#page-171">171</a>
<a href="#section-15">15</a>. Conformance Requirements . . . . . . . . . . . . . . . . . . <a href="#page-172">172</a>
<a href="#section-16">16</a>. References . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-181">181</a>
<a href="#section-16.1">16.1</a>. Normative References . . . . . . . . . . . . . . . . . . <a href="#page-181">181</a>
<a href="#section-16.2">16.2</a>. Informative References . . . . . . . . . . . . . . . . . <a href="#page-184">184</a>
<a href="#appendix-A">Appendix A</a>. XML Schemas . . . . . . . . . . . . . . . . . . . . <a href="#page-190">190</a>
<a href="#appendix-A.1">A.1</a>. Stream Namespace . . . . . . . . . . . . . . . . . . . . <a href="#page-190">190</a>
<a href="#appendix-A.2">A.2</a>. Stream Error Namespace . . . . . . . . . . . . . . . . . <a href="#page-192">192</a>
<a href="#appendix-A.3">A.3</a>. STARTTLS Namespace . . . . . . . . . . . . . . . . . . . <a href="#page-193">193</a>
<a href="#appendix-A.4">A.4</a>. SASL Namespace . . . . . . . . . . . . . . . . . . . . . <a href="#page-194">194</a>
<a href="#appendix-A.5">A.5</a>. Client Namespace . . . . . . . . . . . . . . . . . . . . <a href="#page-196">196</a>
<a href="#appendix-A.6">A.6</a>. Server Namespace . . . . . . . . . . . . . . . . . . . . <a href="#page-201">201</a>
<a href="#appendix-A.7">A.7</a>. Resource Binding Namespace . . . . . . . . . . . . . . . <a href="#page-206">206</a>
<a href="#appendix-A.8">A.8</a>. Stanza Error Namespace . . . . . . . . . . . . . . . . . <a href="#page-206">206</a>
<a href="#appendix-B">Appendix B</a>. Contact Addresses . . . . . . . . . . . . . . . . . <a href="#page-208">208</a>
<a href="#appendix-C">Appendix C</a>. Account Provisioning . . . . . . . . . . . . . . . . <a href="#page-208">208</a>
<a href="#appendix-D">Appendix D</a>. Differences from <a href="./rfc3920">RFC 3920</a> . . . . . . . . . . . . . <a href="#page-208">208</a>
<a href="#appendix-E">Appendix E</a>. Acknowledgements . . . . . . . . . . . . . . . . . . <a href="#page-210">210</a>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
<span class="h3"><a class="selflink" id="section-1.1" href="#section-1.1">1.1</a>. Overview</span>
The Extensible Messaging and Presence Protocol (XMPP) is an
application profile of the Extensible Markup Language [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>] that
enables the near-real-time exchange of structured yet extensible data
between any two or more network entities. This document defines
XMPP's core protocol methods: setup and teardown of XML streams,
channel encryption, authentication, error handling, and communication
primitives for messaging, network availability ("presence"), and
request-response interactions.
<span class="h3"><a class="selflink" id="section-1.2" href="#section-1.2">1.2</a>. History</span>
The basic syntax and semantics of XMPP were developed originally
within the Jabber open-source community, mainly in 1999. In late
2002, the XMPP Working Group was chartered with developing an
adaptation of the base Jabber protocol that would be suitable as an
IETF instant messaging (IM) and presence technology in accordance
with [<a href="#ref-IMP-REQS" title=""Instant Messaging / Presence Protocol Requirements"">IMP-REQS</a>]. In October 2004, [<a href="./rfc3920" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">RFC3920</a>] and [<a href="./rfc3921" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">RFC3921</a>] were
published, representing the most complete definition of XMPP at that
time.
<span class="grey">Saint-Andre Standards Track [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Since 2004 the Internet community has gained extensive implementation
and deployment experience with XMPP, including formal
interoperability testing carried out under the auspices of the XMPP
Standards Foundation (XSF). This document incorporates comprehensive
feedback from software developers and XMPP service providers,
including a number of backward-compatible modifications summarized
under <a href="#appendix-D">Appendix D</a>. As a result, this document reflects the rough
consensus of the Internet community regarding the core features of
XMPP 1.0, thus obsoleting <a href="./rfc3920">RFC 3920</a>.
<span class="h3"><a class="selflink" id="section-1.3" href="#section-1.3">1.3</a>. Functional Summary</span>
This non-normative section provides a developer-friendly, functional
summary of XMPP; refer to the sections that follow for a normative
definition of XMPP.
The purpose of XMPP is to enable the exchange of relatively small
pieces of structured data (called "XML stanzas") over a network
between any two (or more) entities. XMPP is typically implemented
using a distributed client-server architecture, wherein a client
needs to connect to a server in order to gain access to the network
and thus be allowed to exchange XML stanzas with other entities
(which can be associated with other servers). The process whereby a
client connects to a server, exchanges XML stanzas, and ends the
connection is:
1. Determine the IP address and port at which to connect, typically
based on resolution of a fully qualified domain name
(<a href="#section-3.2">Section 3.2</a>)
2. Open a Transmission Control Protocol [<a href="#ref-TCP" title=""Transmission Control Protocol"">TCP</a>] connection
3. Open an XML stream over TCP (<a href="#section-4.2">Section 4.2</a>)
4. Preferably negotiate Transport Layer Security [<a href="#ref-TLS" title=""The Transport Layer Security (TLS) Protocol Version 1.2"">TLS</a>] for channel
encryption (<a href="#section-5">Section 5</a>)
5. Authenticate using a Simple Authentication and Security Layer
[<a href="#ref-SASL" title=""Simple Authentication and Security Layer (SASL)"">SASL</a>] mechanism (<a href="#section-6">Section 6</a>)
6. Bind a resource to the stream (<a href="#section-7">Section 7</a>)
7. Exchange an unbounded number of XML stanzas with other entities
on the network (<a href="#section-8">Section 8</a>)
8. Close the XML stream (<a href="#section-4.4">Section 4.4</a>)
9. Close the TCP connection
<span class="grey">Saint-Andre Standards Track [Page 9]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Within XMPP, one server can optionally connect to another server to
enable inter-domain or inter-server communication. For this to
happen, the two servers need to negotiate a connection between
themselves and then exchange XML stanzas; the process for doing so
is:
1. Determine the IP address and port at which to connect, typically
based on resolution of a fully qualified domain name
(<a href="#section-3.2">Section 3.2</a>)
2. Open a TCP connection
3. Open an XML stream (<a href="#section-4.2">Section 4.2</a>)
4. Preferably negotiate TLS for channel encryption (<a href="#section-5">Section 5</a>)
5. Authenticate using a Simple Authentication and Security Layer
[<a href="#ref-SASL" title=""Simple Authentication and Security Layer (SASL)"">SASL</a>] mechanism (<a href="#section-6">Section 6</a>) *
6. Exchange an unbounded number of XML stanzas both directly for the
servers and indirectly on behalf of entities associated with each
server, such as connected clients (<a href="#section-8">Section 8</a>)
7. Close the XML stream (<a href="#section-4.4">Section 4.4</a>)
8. Close the TCP connection
* Interoperability Note: At the time of writing, most deployed
servers still use the Server Dialback protocol [<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>] to
provide weak identity verification instead of using SASL with PKIX
certificates to provide strong authentication, especially in cases
where SASL negotiation would not result in strong authentication
anyway (e.g., because TLS negotiation was not mandated by the peer
server, or because the PKIX certificate presented by the peer
server during TLS negotiation is self-signed and has not been
previously accepted); for details, see [<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>]. The solutions
specified in this document offer a significantly stronger level of
security (see also <a href="#section-13.6">Section 13.6</a>).
This document specifies how clients connect to servers and specifies
the basic semantics of XML stanzas. However, this document does not
define the "payloads" of the XML stanzas that might be exchanged once
a connection is successfully established; instead, those payloads are
defined by various XMPP extensions. For example, [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>] defines
extensions for basic instant messaging and presence functionality.
In addition, various specifications produced in the XSF's XEP series
[<a href="#ref-XEP-0001" title=""XMPP Extension Protocols"">XEP-0001</a>] define extensions for a wide range of applications.
<span class="grey">Saint-Andre Standards Track [Page 10]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-1.4" href="#section-1.4">1.4</a>. Terminology</span>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in <a href="./rfc2119">RFC</a>
<a href="./rfc2119">2119</a> [<a href="#ref-KEYWORDS" title=""Key words for use in RFCs to Indicate Requirement Levels"">KEYWORDS</a>].
Certain security-related terms are to be understood in the sense
defined in [<a href="#ref-SEC-TERMS" title=""Internet Security Glossary, Version 2"">SEC-TERMS</a>]; such terms include, but are not limited to,
"assurance", "attack", "authentication", "authorization",
"certificate", "certification authority", "certification path",
"confidentiality", "credential", "downgrade", "encryption", "hash
value", "identity", "integrity", "signature", "self-signed
certificate", "sign", "spoof", "tamper", "trust", "trust anchor",
"validate", and "verify".
Certain terms related to certificates, domains, and application
service identity are to be understood in the sense defined in
[<a href="#ref-TLS-CERTS" title=""Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)"">TLS-CERTS</a>]; these include, but are not limited to, "PKIX
certificate", "source domain", "derived domain", and the identifier
types "CN-ID", "DNS-ID", and "SRV-ID".
Other security-related terms are to be understood in the sense
defined in the referenced specifications (for example, "denial of
service" as described in [<a href="#ref-DOS" title=""Internet Denial- of-Service Considerations"">DOS</a>] or "end entity certificate" as
described in [<a href="#ref-PKIX" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">PKIX</a>]).
The term "whitespace" is used to refer to any character or characters
matching the "S" production from [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>], i.e., one or more instances
of the SP, HTAB, CR, or LF rules defined in [<a href="#ref-ABNF" title=""Augmented BNF for Syntax Specifications: ABNF"">ABNF</a>].
The terms "localpart", "domainpart", and "resourcepart" are defined
in [<a href="#ref-XMPP-ADDR" title=""Extensible Messaging and Presence Protocol (XMPP): Address Format"">XMPP-ADDR</a>].
The term "bare JID" refers to an XMPP address of the form
<localpart@domainpart> (for an account at a server) or of the form
<domainpart> (for a server).
The term "full JID" refers to an XMPP address of the form
<localpart@domainpart/resourcepart> (for a particular authorized
client or device associated with an account) or of the form
<domainpart/resourcepart> (for a particular resource or script
associated with a server).
The term "XML stream" (also "stream") is defined under <a href="#section-4.1">Section 4.1</a>.
<span class="grey">Saint-Andre Standards Track [Page 11]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
The term "XML stanza" (also "stanza") is defined under <a href="#section-4.1">Section 4.1</a>.
There are three kinds of stanzas: message, presence, and IQ (short
for "Info/Query"). These communication primitives are defined under
Sections <a href="#section-8.2.1">8.2.1</a>, <a href="#section-8.2.2">8.2.2</a>, and <a href="#section-8.2.3">8.2.3</a>, respectively.
The term "originating entity" refers to the entity that first
generates a stanza that is sent over an XMPP network (e.g., a
connected client, an add-on service, or a server). The term
"generated stanza" refers to the stanza so generated.
The term "input stream" designates an XML stream over which a server
receives data from a connected client or remote server, and the term
"output stream" designates an XML stream over which a server sends
data to a connected client or remote server. The following terms
designate some of the actions that a server can perform when
processing data received over an input stream:
route: pass the data to a remote server for direct processing by
the remote server or eventual delivery to a client associated
with the remote server
deliver: pass the data to a connected client
ignore: discard the data without acting upon it or returning an
error to the sender
When the term "ignore" is used with regard to client processing of
data it receives, the phrase "without acting upon it" explicitly
includes not presenting the data to a human user.
Following the "XML Notation" used in [<a href="#ref-IRI" title=""Internationalized Resource Identifiers (IRIs)"">IRI</a>] to represent characters
that cannot be rendered in ASCII-only documents, some examples in
this document use the form "&#x...." as a notational device to
represent [<a href="#ref-UNICODE" title=""The Unicode Standard, Version 6.0"">UNICODE</a>] characters (e.g., the string "&#x0159;" stands
for the Unicode character LATIN SMALL LETTER R WITH CARON); this form
is definitely not to be sent over the wire in XMPP systems.
Consistent with the convention used in [<a href="#ref-URI" title=""Uniform Resource Identifier (URI): Generic Syntax"">URI</a>] to represent Uniform
Resource Identifiers, XMPP addresses in running text are enclosed
between '<' and '>' (although natively they are not URIs).
In examples, lines have been wrapped for improved readability,
"[...]" means elision, and the following prepended strings are used
(these prepended strings are not to be sent over the wire):
o C: = a client
o E: = any XMPP entity
<span class="grey">Saint-Andre Standards Track [Page 12]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
o I: = an initiating entity
o P: = a peer server
o R: = a receiving entity
o S: = a server
o S1: = server1
o S2: = server2
Readers need to be aware that the examples are not exhaustive and
that, in examples for some protocol flows, the alternate steps shown
would not necessarily be triggered by the exact data sent in the
previous step; in all cases the protocol definitions specified in
this document or in normatively referenced documents rule over any
examples provided here. All examples are fictional and the
information exchanged (e.g., usernames and passwords) does not
represent any existing users or servers.
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Architecture</span>
XMPP provides a technology for the asynchronous, end-to-end exchange
of structured data by means of direct, persistent XML streams among a
distributed network of globally addressable, presence-aware clients
and servers. Because this architectural style involves ubiquitous
knowledge of network availability and a conceptually unlimited number
of concurrent information transactions in the context of a given
client-to-server or server-to-server session, we label it
"Availability for Concurrent Transactions" (ACT) to distinguish it
from the "Representational State Transfer" [<a href="#ref-REST" title=""Architectural Styles and the Design of Network-based Software Architectures"">REST</a>] architectural style
familiar from the World Wide Web. Although the architecture of XMPP
is similar in important ways to that of email (see [<a href="#ref-EMAIL-ARCH" title=""Internet Mail Architecture"">EMAIL-ARCH</a>]), it
introduces several modifications to facilitate communication in close
to real time. The salient features of this ACTive architectural
style are as follows.
<span class="h3"><a class="selflink" id="section-2.1" href="#section-2.1">2.1</a>. Global Addresses</span>
As with email, XMPP uses globally unique addresses (based on the
Domain Name System) in order to route and deliver messages over the
network. All XMPP entities are addressable on the network, most
particularly clients and servers but also various additional services
that can be accessed by clients and servers. In general, server
addresses are of the form <domainpart> (e.g., <im.example.com>),
accounts hosted at a server are of the form <localpart@domainpart>
(e.g., <juliet@im.example.com>, called a "bare JID"), and a
<span class="grey">Saint-Andre Standards Track [Page 13]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
particular connected device or resource that is currently authorized
for interaction on behalf of an account is of the form
<localpart@domainpart/resourcepart> (e.g.,
<juliet@im.example.com/balcony>, called a "full JID"). For
historical reasons, XMPP addresses are often called Jabber IDs or
JIDs. Because the formal specification of the XMPP address format
depends on internationalization technologies that are in flux at the
time of writing, the format is defined in [<a href="#ref-XMPP-ADDR" title=""Extensible Messaging and Presence Protocol (XMPP): Address Format"">XMPP-ADDR</a>] instead of this
document. The terms "localpart", "domainpart", and "resourcepart"
are defined more formally in [<a href="#ref-XMPP-ADDR" title=""Extensible Messaging and Presence Protocol (XMPP): Address Format"">XMPP-ADDR</a>].
<span class="h3"><a class="selflink" id="section-2.2" href="#section-2.2">2.2</a>. Presence</span>
XMPP includes the ability for an entity to advertise its network
availability or "presence" to other entities. In XMPP, this
availability for communication is signaled end-to-end by means of a
dedicated communication primitive: the <presence/> stanza. Although
knowledge of network availability is not strictly necessary for the
exchange of XMPP messages, it facilitates real-time interaction
because the originator of a message can know before initiating
communication that the intended recipient is online and available.
End-to-end presence is defined in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>].
<span class="h3"><a class="selflink" id="section-2.3" href="#section-2.3">2.3</a>. Persistent Streams</span>
Availability for communication is also built into each point-to-point
"hop" through the use of persistent XML streams over long-lived TCP
connections. These "always-on" client-to-server and server-to-server
streams enable each party to push data to the other party at any time
for immediate routing or delivery. XML streams are defined under
<a href="#section-4">Section 4</a>.
<span class="h3"><a class="selflink" id="section-2.4" href="#section-2.4">2.4</a>. Structured Data</span>
The basic protocol data unit in XMPP is not an XML stream (which
simply provides the transport for point-to-point communication) but
an XML "stanza", which is essentially a fragment of XML that is sent
over a stream. The root element of a stanza includes routing
attributes (such as "from" and "to" addresses), and the child
elements of the stanza contain a payload for delivery to the intended
recipient. XML stanzas are defined under <a href="#section-8">Section 8</a>.
<span class="h3"><a class="selflink" id="section-2.5" href="#section-2.5">2.5</a>. Distributed Network of Clients and Servers</span>
In practice, XMPP consists of a network of clients and servers that
inter-communicate (however, communication between any two given
deployed servers is strictly discretionary and a matter of local
service policy). Thus, for example, the user <juliet@im.example.com>
<span class="grey">Saint-Andre Standards Track [Page 14]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
associated with the server <im.example.com> might be able to exchange
messages, presence, and other structured data with the user
<romeo@example.net> associated with the server <example.net>. This
pattern is familiar from messaging protocols that make use of global
addresses, such as the email network (see [<a href="#ref-SMTP" title=""Simple Mail Transfer Protocol"">SMTP</a>] and [<a href="#ref-EMAIL-ARCH" title=""Internet Mail Architecture"">EMAIL-ARCH</a>]).
As a result, end-to-end communication in XMPP is logically peer-to-
peer but physically client-to-server-to-server-to-client, as
illustrated in the following diagram.
example.net <--------------> im.example.com
^ ^
| |
v v
romeo@example.net juliet@im.example.com
Figure 1: Distributed Client-Server Architecture
Informational Note: Architectures that employ XML streams
(<a href="#section-4">Section 4</a>) and XML stanzas (<a href="#section-8">Section 8</a>) but that establish peer-
to-peer connections directly between clients using technologies
based on [<a href="#ref-LINKLOCAL" title=""Dynamic Configuration of IPv4 Link-Local Addresses"">LINKLOCAL</a>] have been deployed, but such architectures
are not defined in this specification and are best described as
"XMPP-like"; for details, see [<a href="#ref-XEP-0174" title=""Link-Local Messaging"">XEP-0174</a>]. In addition, XML
streams can be established end-to-end over any reliable transport,
including extensions to XMPP itself; however, such methods are out
of scope for this specification.
The following paragraphs describe the responsibilities of clients and
servers on the network.
A client is an entity that establishes an XML stream with a server by
authenticating using the credentials of a registered account (via
SASL negotiation (<a href="#section-6">Section 6</a>)) and that then completes resource
binding (<a href="#section-7">Section 7</a>) in order to enable delivery of XML stanzas
between the server and the client over the negotiated stream. The
client then uses XMPP to communicate with its server, other clients,
and any other entities on the network, where the server is
responsible for delivering stanzas to other connected clients at the
same server or routing them to remote servers. Multiple clients can
connect simultaneously to a server on behalf of the same registered
account, where each client is differentiated by the resourcepart of
an XMPP address (e.g., <juliet@im.example.com/balcony> vs.
<juliet@im.example.com/chamber>), as defined under [<a href="#ref-XMPP-ADDR" title=""Extensible Messaging and Presence Protocol (XMPP): Address Format"">XMPP-ADDR</a>] and
<a href="#section-7">Section 7</a>.
<span class="grey">Saint-Andre Standards Track [Page 15]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
A server is an entity whose primary responsibilities are to:
o Manage XML streams (<a href="#section-4">Section 4</a>) with connected clients and deliver
XML stanzas (<a href="#section-8">Section 8</a>) to those clients over the negotiated
streams; this includes responsibility for ensuring that a client
authenticates with the server before being granted access to the
XMPP network.
o Subject to local service policies on server-to-server
communication, manage XML streams (<a href="#section-4">Section 4</a>) with remote servers
and route XML stanzas (<a href="#section-8">Section 8</a>) to those servers over the
negotiated streams.
Depending on the application, the secondary responsibilities of an
XMPP server can include:
o Storing data that is used by clients (e.g., contact lists for
users of XMPP-based instant messaging and presence applications as
defined in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]); in this case, the relevant XML stanza is
handled directly by the server itself on behalf of the client and
is not routed to a remote server or delivered to a connected
client.
o Hosting add-on services that also use XMPP as the basis for
communication but that provide additional functionality beyond
that defined in this document or in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]; examples include
multi-user conferencing services as specified in [<a href="#ref-XEP-0045" title=""Multi-User Chat"">XEP-0045</a>] and
publish-subscribe services as specified in [<a href="#ref-XEP-0060" title=""Publish-Subscribe"">XEP-0060</a>].
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. TCP Binding</span>
<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>. Scope</span>
As XMPP is defined in this specification, an initiating entity
(client or server) MUST open a Transmission Control Protocol [<a href="#ref-TCP" title=""Transmission Control Protocol"">TCP</a>]
connection to the receiving entity (server) before it negotiates XML
streams with the receiving entity. The parties then maintain that
TCP connection for as long as the XML streams are in use. The rules
specified in the following sections apply to the TCP binding.
Informational Note: There is no necessary coupling of XML streams
to TCP, and other transports are possible. For example, two
entities could connect to each other by means of [<a href="#ref-HTTP" title=""Hypertext Transfer Protocol -- HTTP/1.1"">HTTP</a>] as
specified in [<a href="#ref-XEP-0124" title=""Bidirectional-streams Over Synchronous HTTP (BOSH)"">XEP-0124</a>] and [<a href="#ref-XEP-0206" title=""XMPP Over BOSH"">XEP-0206</a>]. However, this
specification defines only a binding of XMPP to TCP.
<span class="grey">Saint-Andre Standards Track [Page 16]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>. Resolution of Fully Qualified Domain Names</span>
Because XML streams are sent over TCP, the initiating entity needs to
determine the IPv4 or IPv6 address (and port) of the receiving entity
before it can attempt to open an XML stream. Typically this is done
by resolving the receiving entity's fully qualified domain name or
FQDN (see [<a href="#ref-DNS-CONCEPTS" title=""Domain names - concepts and facilities"">DNS-CONCEPTS</a>]).
<span class="h4"><a class="selflink" id="section-3.2.1" href="#section-3.2.1">3.2.1</a>. Preferred Process: SRV Lookup</span>
The preferred process for FQDN resolution is to use [<a href="#ref-DNS-SRV" title=""A DNS RR for specifying the location of services (DNS SRV)"">DNS-SRV</a>] records
as follows:
1. The initiating entity constructs a DNS SRV query whose inputs
are:
* a Service of "xmpp-client" (for client-to-server connections)
or "xmpp-server" (for server-to-server connections)
* a Proto of "tcp"
* a Name corresponding to the "origin domain" [<a href="#ref-TLS-CERTS" title=""Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)"">TLS-CERTS</a>] of the
XMPP service to which the initiating entity wishes to connect
(e.g., "example.net" or "im.example.com")
2. The result is a query such as "_xmpp-client._tcp.example.net." or
"_xmpp-server._tcp.im.example.com.".
3. If a response is received, it will contain one or more
combinations of a port and FDQN, each of which is weighted and
prioritized as described in [<a href="#ref-DNS-SRV" title=""A DNS RR for specifying the location of services (DNS SRV)"">DNS-SRV</a>]. (However, if the result
of the SRV lookup is a single resource record with a Target of
".", i.e., the root domain, then the initiating entity MUST abort
SRV processing at this point because according to [<a href="#ref-DNS-SRV" title=""A DNS RR for specifying the location of services (DNS SRV)"">DNS-SRV</a>] such
a Target "means that the service is decidedly not available at
this domain".)
4. The initiating entity chooses at least one of the returned FQDNs
to resolve (following the rules in [<a href="#ref-DNS-SRV" title=""A DNS RR for specifying the location of services (DNS SRV)"">DNS-SRV</a>]), which it does by
performing DNS "A" or "AAAA" lookups on the FDQN; this will
result in an IPv4 or IPv6 address.
5. The initiating entity uses the IP address(es) from the
successfully resolved FDQN (with the corresponding port number
returned by the SRV lookup) as the connection address for the
receiving entity.
<span class="grey">Saint-Andre Standards Track [Page 17]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
6. If the initiating entity fails to connect using that IP address
but the "A" or "AAAA" lookups returned more than one IP address,
then the initiating entity uses the next resolved IP address for
that FDQN as the connection address.
7. If the initiating entity fails to connect using all resolved IP
addresses for a given FDQN, then it repeats the process of
resolution and connection for the next FQDN returned by the SRV
lookup based on the priority and weight as defined in [<a href="#ref-DNS-SRV" title=""A DNS RR for specifying the location of services (DNS SRV)"">DNS-SRV</a>].
8. If the initiating entity receives a response to its SRV query but
it is not able to establish an XMPP connection using the data
received in the response, it SHOULD NOT attempt the fallback
process described in the next section (this helps to prevent a
state mismatch between inbound and outbound connections).
9. If the initiating entity does not receive a response to its SRV
query, it SHOULD attempt the fallback process described in the
next section.
<span class="h4"><a class="selflink" id="section-3.2.2" href="#section-3.2.2">3.2.2</a>. Fallback Processes</span>
The fallback process SHOULD be a normal "A" or "AAAA" address record
resolution to determine the IPv4 or IPv6 address of the origin
domain, where the port used is the "xmpp-client" port of 5222 for
client-to-server connections or the "xmpp-server" port of 5269 for
server-to-server connections (these are the default ports as
registered with the IANA as described under <a href="#section-14.7">Section 14.7</a>).
If connections via TCP are unsuccessful, the initiating entity might
attempt to find and use alternative connection methods such as the
HTTP binding (see [<a href="#ref-XEP-0124" title=""Bidirectional-streams Over Synchronous HTTP (BOSH)"">XEP-0124</a>] and [<a href="#ref-XEP-0206" title=""XMPP Over BOSH"">XEP-0206</a>]), which might be
discovered using [<a href="#ref-DNS-TXT" title=""Using the Domain Name System To Store Arbitrary String Attributes"">DNS-TXT</a>] records as described in [<a href="#ref-XEP-0156" title=""Discovering Alternative XMPP Connection Methods"">XEP-0156</a>].
<span class="h4"><a class="selflink" id="section-3.2.3" href="#section-3.2.3">3.2.3</a>. When Not to Use SRV</span>
If the initiating entity has been explicitly configured to associate
a particular FQDN (and potentially port) with the origin domain of
the receiving entity (say, to "hardcode" an association from an
origin domain of example.net to a configured FQDN of
apps.example.com), the initiating entity is encouraged to use the
configured name instead of performing the preferred SRV resolution
process on the origin domain.
<span class="grey">Saint-Andre Standards Track [Page 18]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-3.2.4" href="#section-3.2.4">3.2.4</a>. Use of SRV Records with Add-On Services</span>
Many XMPP servers are implemented in such a way that they can host
add-on services (beyond those defined in this specification and
[<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]) at DNS domain names that typically are "subdomains" of the
main XMPP service (e.g., conference.example.net for a [<a href="#ref-XEP-0045" title=""Multi-User Chat"">XEP-0045</a>]
service associated with the example.net XMPP service) or "subdomains"
of the first-level domain of the underlying service (e.g.,
muc.example.com for a [<a href="#ref-XEP-0045" title=""Multi-User Chat"">XEP-0045</a>] service associated with the
im.example.com XMPP service). If an entity associated with a remote
XMPP server wishes to communicate with such an add-on service, it
would generate an appropriate XML stanza and the remote server would
attempt to resolve the add-on service's DNS domain name via an SRV
lookup on resource records such as "_xmpp-
server._tcp.conference.example.net." or "_xmpp-
server._tcp.muc.example.com.". Therefore, if the administrators of
an XMPP service wish to enable entities associated with remote
servers to access such add-on services, they need to advertise the
appropriate "_xmpp-server" SRV records in addition to the "_xmpp-
server" record for their main XMPP service. In case SRV records are
not available, the fallback methods described under <a href="#section-3.2.2">Section 3.2.2</a> can
be used to resolve the DNS domain names of add-on services.
<span class="h3"><a class="selflink" id="section-3.3" href="#section-3.3">3.3</a>. Reconnection</span>
It can happen that an XMPP server goes offline unexpectedly while
servicing TCP connections from connected clients and remote servers.
Because the number of such connections can be quite large, the
reconnection algorithm employed by entities that seek to reconnect
can have a significant impact on software performance and network
congestion. If an entity chooses to reconnect, it:
o SHOULD set the number of seconds that expire before reconnecting
to an unpredictable number between 0 and 60 (this helps to ensure
that not all entities attempt to reconnect at exactly the same
number of seconds after being disconnected).
o SHOULD back off increasingly on the time between subsequent
reconnection attempts (e.g., in accordance with "truncated binary
exponential backoff" as described in [<a href="#ref-ETHERNET" title=""Information technology - Telecommunications and information exchange between systems - Local and metropolitan area networks - Specific requirements - Part 3: Carrier sense multiple access with collision detection (CSMA/CD) access method and physical layer specifications"">ETHERNET</a>]) if the first
reconnection attempt does not succeed.
It is RECOMMENDED to make use of TLS session resumption [<a href="#ref-TLS-RESUME" title=""Transport Layer Security (TLS) Session Resumption without Server-Side State"">TLS-RESUME</a>]
when reconnecting. A future version of this document, or a separate
specification, might provide more detailed guidelines regarding
methods for speeding the reconnection process.
<span class="grey">Saint-Andre Standards Track [Page 19]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-3.4" href="#section-3.4">3.4</a>. Reliability</span>
The use of long-lived TCP connections in XMPP implies that the
sending of XML stanzas over XML streams can be unreliable, since the
parties to a long-lived TCP connection might not discover a
connectivity disruption in a timely manner. At the XMPP application
layer, long connectivity disruptions can result in undelivered
stanzas. Although the core XMPP technology defined in this
specification does not contain features to overcome this lack of
reliability, there exist XMPP extensions for doing so (e.g.,
[<a href="#ref-XEP-0198" title=""Stream Management"">XEP-0198</a>]).
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. XML Streams</span>
<span class="h3"><a class="selflink" id="section-4.1" href="#section-4.1">4.1</a>. Stream Fundamentals</span>
Two fundamental concepts make possible the rapid, asynchronous
exchange of relatively small payloads of structured information
between XMPP entities: XML streams and XML stanzas. These terms are
defined as follows.
Definition of XML Stream: An XML stream is a container for the
exchange of XML elements between any two entities over a network.
The start of an XML stream is denoted unambiguously by an opening
"stream header" (i.e., an XML <stream> tag with appropriate
attributes and namespace declarations), while the end of the XML
stream is denoted unambiguously by a closing XML </stream> tag.
During the life of the stream, the entity that initiated it can
send an unbounded number of XML elements over the stream, either
elements used to negotiate the stream (e.g., to complete TLS
negotiation (<a href="#section-5">Section 5</a>) or SASL negotiation (<a href="#section-6">Section 6</a>)) or XML
stanzas. The "initial stream" is negotiated from the initiating
entity (typically a client or server) to the receiving entity
(typically a server), and can be seen as corresponding to the
initiating entity's "connection to" or "session with" the
receiving entity. The initial stream enables unidirectional
communication from the initiating entity to the receiving entity;
in order to enable exchange of stanzas from the receiving entity
to the initiating entity, the receiving entity MUST negotiate a
stream in the opposite direction (the "response stream").
Definition of XML Stanza: An XML stanza is the basic unit of meaning
in XMPP. A stanza is a first-level element (at depth=1 of the
stream) whose element name is "message", "presence", or "iq" and
whose qualifying namespace is 'jabber:client' or 'jabber:server'.
By contrast, a first-level element qualified by any other
namespace is not an XML stanza (stream errors, stream features,
TLS-related elements, SASL-related elements, etc.), nor is a
<span class="grey">Saint-Andre Standards Track [Page 20]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<message/>, <presence/>, or <iq/> element that is qualified by the
'jabber:client' or 'jabber:server' namespace but that occurs at a
depth other than one (e.g., a <message/> element contained within
an extension element (<a href="#section-8.4">Section 8.4</a>) for reporting purposes), nor is
a <message/>, <presence/>, or <iq/> element that is qualified by a
namespace other than 'jabber:client' or 'jabber:server'. An XML
stanza typically contains one or more child elements (with
accompanying attributes, elements, and XML character data) as
necessary in order to convey the desired information, which MAY be
qualified by any XML namespace (see [<a href="#ref-XML-NAMES" title=""Namespaces in XML 1.0 (Third Edition)"">XML-NAMES</a>] as well as
<a href="#section-8.4">Section 8.4</a> in this specification).
There are three kinds of stanzas: message, presence, and IQ (short
for "Info/Query"). These stanza types provide three different
communication primitives: a "push" mechanism for generalized
messaging, a specialized "publish-subscribe" mechanism for
broadcasting information about network availability, and a "request-
response" mechanism for more structured exchanges of data (similar to
[<a href="#ref-HTTP" title=""Hypertext Transfer Protocol -- HTTP/1.1"">HTTP</a>]). Further explanations are provided under <a href="#section-8.2.1">Section 8.2.1</a>,
Section 8.2.2, and <a href="#section-8.2.3">Section 8.2.3</a>, respectively.
Consider the example of a client's connection to a server. The
client initiates an XML stream by sending a stream header to the
server, preferably preceded by an XML declaration specifying the XML
version and the character encoding supported (see <a href="#section-11.5">Section 11.5</a> and
<a href="#section-11.6">Section 11.6</a>). Subject to local policies and service provisioning,
the server then replies with a second XML stream back to the client,
again preferably preceded by an XML declaration. Once the client has
completed SASL negotiation (<a href="#section-6">Section 6</a>) and resource binding
(<a href="#section-7">Section 7</a>), the client can send an unbounded number of XML stanzas
over the stream. When the client desires to close the stream, it
simply sends a closing </stream> tag to the server as further
described under <a href="#section-4.4">Section 4.4</a>.
In essence, then, one XML stream functions as an envelope for the XML
stanzas sent during a session and another XML stream functions as an
envelope for the XML stanzas received during a session. We can
represent this in a simplistic fashion as follows.
<span class="grey">Saint-Andre Standards Track [Page 21]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
+--------------------+--------------------+
| INITIAL STREAM | RESPONSE STREAM |
+--------------------+--------------------+
| <stream> | |
|--------------------|--------------------|
| | <stream> |
|--------------------|--------------------|
| <presence> | |
| <show/> | |
| </presence> | |
|--------------------|--------------------|
| <message to='foo'> | |
| <body/> | |
| </message> | |
|--------------------|--------------------|
| <iq to='bar' | |
| type='get'> | |
| <query/> | |
| </iq> | |
|--------------------|--------------------|
| | <iq from='bar' |
| | type='result'> |
| | <query/> |
| | </iq> |
|--------------------|--------------------|
| [ ... ] | |
|--------------------|--------------------|
| | [ ... ] |
|--------------------|--------------------|
| </stream> | |
|--------------------|--------------------|
| | </stream> |
+--------------------+--------------------+
Figure 2: A Simplistic View of Two Streams
Those who are accustomed to thinking of XML in a document-centric
manner might find the following analogies useful:
o The two XML streams are like two "documents" (matching the
"document" production from [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>]) that are built up through the
accumulation of XML stanzas.
o The root <stream/> element is like the "document entity" for each
"document" (as described in Section 4.8 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>]).
o The XML stanzas sent over the streams are like "fragments" of the
"documents" (as described in [<a href="#ref-XML-FRAG" title=""XML Fragment Interchange"">XML-FRAG</a>]).
<span class="grey">Saint-Andre Standards Track [Page 22]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
However, these descriptions are merely analogies, because XMPP does
not deal in documents and fragments but in streams and stanzas.
The remainder of this section defines the following aspects of XML
streams (along with related topics):
o How to open a stream (<a href="#section-4.2">Section 4.2</a>)
o The stream negotiation process (<a href="#section-4.3">Section 4.3</a>)
o How to close a stream (<a href="#section-4.4">Section 4.4</a>)
o The directionality of XML streams (<a href="#section-4.5">Section 4.5</a>)
o How to handle peers that are silent (<a href="#section-4.6">Section 4.6</a>)
o The XML attributes of a stream (<a href="#section-4.7">Section 4.7</a>)
o The XML namespaces of a stream (<a href="#section-4.8">Section 4.8</a>)
o Error handling related to XML streams (<a href="#section-4.9">Section 4.9</a>)
<span class="h3"><a class="selflink" id="section-4.2" href="#section-4.2">4.2</a>. Opening a Stream</span>
After connecting to the appropriate IP address and port of the
receiving entity, the initiating entity opens a stream by sending a
stream header (the "initial stream header") to the receiving entity.
I: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
The receiving entity then replies by sending a stream header of its
own (the "response stream header") to the initiating entity.
<span class="grey">Saint-Andre Standards Track [Page 23]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
R: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
The entities can then proceed with the remainder of the stream
negotiation process.
<span class="h3"><a class="selflink" id="section-4.3" href="#section-4.3">4.3</a>. Stream Negotiation</span>
<span class="h4"><a class="selflink" id="section-4.3.1" href="#section-4.3.1">4.3.1</a>. Basic Concepts</span>
Because the receiving entity for a stream acts as a gatekeeper to the
domains it services, it imposes certain conditions for connecting as
a client or as a peer server. At a minimum, the initiating entity
needs to authenticate with the receiving entity before it is allowed
to send stanzas to the receiving entity (for client-to-server streams
this means using SASL as described under <a href="#section-6">Section 6</a>). However, the
receiving entity can consider conditions other than authentication to
be mandatory-to-negotiate, such as encryption using TLS as described
under <a href="#section-5">Section 5</a>. The receiving entity informs the initiating entity
about such conditions by communicating "stream features": the set of
particular protocol interactions that the initiating entity needs to
complete before the receiving entity will accept XML stanzas from the
initiating entity, as well as any protocol interactions that are
voluntary-to-negotiate but that might improve the handling of an XML
stream (e.g., establishment of application-layer compression as
described in [<a href="#ref-XEP-0138" title=""Stream Compression"">XEP-0138</a>]).
The existence of conditions for connecting implies that streams need
to be negotiated. The order of layers (TCP, then TLS, then SASL,
then XMPP as described under <a href="#section-13.3">Section 13.3</a>) implies that stream
negotiation is a multi-stage process. Further structure is imposed
by two factors: (1) a given stream feature might be offered only to
certain entities or only after certain other features have been
negotiated (e.g., resource binding is offered only after SASL
authentication), and (2) stream features can be either mandatory-to-
negotiate or voluntary-to-negotiate. Finally, for security reasons
the parties to a stream need to discard knowledge that they gained
during the negotiation process after successfully completing the
protocol interactions defined for certain features (e.g., TLS in all
cases and SASL in the case when a security layer might be
<span class="grey">Saint-Andre Standards Track [Page 24]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
established, as defined in the specification for the relevant SASL
mechanism). This is done by flushing the old stream context and
exchanging new stream headers over the existing TCP connection.
<span class="h4"><a class="selflink" id="section-4.3.2" href="#section-4.3.2">4.3.2</a>. Stream Features Format</span>
If the initiating entity includes in the initial stream header the
'version' attribute set to a value of at least "1.0" (see
<a href="#section-4.7.5">Section 4.7.5</a>), after sending the response stream header the
receiving entity MUST send a <features/> child element (typically
prefixed by the stream namespace prefix as described under
<a href="#section-4.8.5">Section 4.8.5</a>) to the initiating entity in order to announce any
conditions for continuation of the stream negotiation process. Each
condition takes the form of a child element of the <features/>
element, qualified by a namespace that is different from the stream
namespace and the content namespace. The <features/> element can
contain one child, contain multiple children, or be empty.
Implementation Note: The order of child elements contained in any
given <features/> element is not significant.
If a particular stream feature is or can be mandatory-to-negotiate,
the definition of that feature needs to do one of the following:
1. Declare that the feature is always mandatory-to-negotiate (e.g.,
this is true of resource binding for XMPP clients); or
2. Specify a way for the receiving entity to flag the feature as
mandatory-to-negotiate for this interaction (e.g., for STARTTLS,
this is done by including an empty <required/> element in the
advertisement for that stream feature, but that is not a generic
format for all stream features); it is RECOMMENDED that stream
feature definitions for new mandatory-to-negotiate features do so
by including an empty <required/> element as is done for
STARTTLS.
Informational Note: Because there is no generic format for
indicating that a feature is mandatory-to-negotiate, it is
possible that a feature that is not understood by the initiating
entity might be considered mandatory-to-negotiate by the receiving
entity, resulting in failure of the stream negotiation process.
Although such an outcome would be undesirable, the working group
deemed it rare enough that a generic format was not needed.
For security reasons, certain stream features necessitate the
initiating entity to send a new initial stream header upon successful
negotiation of the feature (e.g., TLS in all cases and SASL in the
case when a security layer might be established). If this is true of
<span class="grey">Saint-Andre Standards Track [Page 25]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
a given stream feature, the definition of that feature needs to
specify that a stream restart is expected after negotiation of the
feature.
A <features/> element that contains at least one mandatory-to-
negotiate feature indicates that the stream negotiation is not
complete and that the initiating entity MUST negotiate further
features.
R: <stream:features>
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
<required/>
</starttls>
</stream:features>
A <features/> element MAY contain more than one mandatory-to-
negotiate feature. This means that the initiating entity can choose
among the mandatory-to-negotiate features at this stage of the stream
negotiation process. As an example, perhaps a future technology will
perform roughly the same function as TLS, so the receiving entity
might advertise support for both TLS and the future technology at the
same stage of the stream negotiation process. However, this applies
only at a given stage of the stream negotiation process and does not
apply to features that are mandatory-to-negotiate at different stages
(e.g., the receiving entity would not advertise both STARTTLS and
SASL as mandatory-to-negotiate, or both SASL and resource binding as
mandatory-to-negotiate, because TLS would need to be negotiated
before SASL and because SASL would need to be negotiated before
resource binding).
A <features/> element that contains both mandatory-to-negotiate and
voluntary-to-negotiate features indicates that the negotiation is not
complete but that the initiating entity MAY complete the voluntary-
to-negotiate feature(s) before it attempts to negotiate the
mandatory-to-negotiate feature(s).
R: <stream:features>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
<compression xmlns='http://jabber.org/features/compress'>
<method>zlib</method>
<method>lzw</method>
</compression>
</stream:features>
A <features/> element that contains only voluntary-to-negotiate
features indicates that the stream negotiation is complete and that
the initiating entity is cleared to send XML stanzas, but that the
initiating entity MAY negotiate further features if desired.
<span class="grey">Saint-Andre Standards Track [Page 26]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
R: <stream:features>
<compression xmlns='http://jabber.org/features/compress'>
<method>zlib</method>
<method>lzw</method>
</compression>
</stream:features>
An empty <features/> element indicates that the stream negotiation is
complete and that the initiating entity is cleared to send XML
stanzas.
R: <stream:features/>
<span class="h4"><a class="selflink" id="section-4.3.3" href="#section-4.3.3">4.3.3</a>. Restarts</span>
On successful negotiation of a feature that necessitates a stream
restart, both parties MUST consider the previous stream to be
replaced but MUST NOT send a closing </stream> tag and MUST NOT
terminate the underlying TCP connection; instead, the parties MUST
reuse the existing connection, which might be in a new state (e.g.,
encrypted as a result of TLS negotiation). The initiating entity
then MUST send a new initial stream header, which SHOULD be preceded
by an XML declaration as described under <a href="#section-11.5">Section 11.5</a>. When the
receiving entity receives the new initial stream header, it MUST
generate a new stream ID (instead of reusing the old stream ID)
before sending a new response stream header (which SHOULD be preceded
by an XML declaration as described under <a href="#section-11.5">Section 11.5</a>).
<span class="h4"><a class="selflink" id="section-4.3.4" href="#section-4.3.4">4.3.4</a>. Resending Features</span>
The receiving entity MUST send an updated list of stream features to
the initiating entity after a stream restart. The list of updated
features MAY be empty if there are no further features to be
advertised or MAY include any combination of features.
<span class="h4"><a class="selflink" id="section-4.3.5" href="#section-4.3.5">4.3.5</a>. Completion of Stream Negotiation</span>
The receiving entity indicates completion of the stream negotiation
process by sending to the initiating entity either an empty
<features/> element or a <features/> element that contains only
voluntary-to-negotiate features. After doing so, the receiving
entity MAY send an empty <features/> element (e.g., after negotiation
of such voluntary-to-negotiate features) but MUST NOT send additional
stream features to the initiating entity (if the receiving entity has
new features to offer, preferably limited to mandatory-to-negotiate
or security-critical features, it can simply close the stream with a
<reset/> stream error (<a href="#section-4.9.3.16">Section 4.9.3.16</a>) and then advertise the new
features when the initiating entity reconnects, preferably closing
<span class="grey">Saint-Andre Standards Track [Page 27]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
existing streams in a staggered way so that not all of the initiating
entities reconnect at once). Once stream negotiation is complete,
the initiating entity is cleared to send XML stanzas over the stream
for as long as the stream is maintained by both parties.
Informational Note: Resource binding as specified under <a href="#section-7">Section 7</a>
is an historical exception to the foregoing rule, since it is
mandatory-to-negotiate for clients but uses XML stanzas for
negotiation purposes.
The initiating entity MUST NOT attempt to send XML stanzas
(<a href="#section-8">Section 8</a>) to entities other than itself (i.e., the client's
connected resource or any other authenticated resource of the
client's account) or the server to which it is connected until stream
negotiation has been completed. Even if the initiating entity does
attempt to do so, the receiving entity MUST NOT accept such stanzas
and MUST close the stream with a <not-authorized/> stream error
(<a href="#section-4.9.3.12">Section 4.9.3.12</a>). This rule applies to XML stanzas only (i.e.,
<message/>, <presence/>, and <iq/> elements qualified by the content
namespace) and not to XML elements used for stream negotiation (e.g.,
elements used to complete TLS negotiation (<a href="#section-5">Section 5</a>) or SASL
negotiation (<a href="#section-6">Section 6</a>)).
<span class="h4"><a class="selflink" id="section-4.3.6" href="#section-4.3.6">4.3.6</a>. Determination of Addresses</span>
After the parties to an XML stream have completed the appropriate
aspects of stream negotiation, the receiving entity for a stream MUST
determine the initiating entity's JID.
For client-to-server communication, both SASL negotiation (<a href="#section-6">Section 6</a>)
and resource binding (<a href="#section-7">Section 7</a>) MUST be completed before the server
can determine the client's address. The client's bare JID
(<localpart@domainpart>) MUST be the authorization identity (as
defined by [<a href="#ref-SASL" title=""Simple Authentication and Security Layer (SASL)"">SASL</a>]), either (1) as directly communicated by the client
during SASL negotiation (<a href="#section-6">Section 6</a>) or (2) as derived by the server
from the authentication identity if no authorization identity was
specified during SASL negotiation. The resourcepart of the full JID
(<localpart@domainpart/resourcepart>) MUST be the resource negotiated
by the client and server during resource binding (<a href="#section-7">Section 7</a>). A
client MUST NOT attempt to guess at its JID but instead MUST consider
its JID to be whatever the server returns to it during resource
binding. The server MUST ensure that the resulting JID (including
localpart, domainpart, resourcepart, and separator characters)
conforms to the canonical format for XMPP addresses defined in
[<a href="#ref-XMPP-ADDR" title=""Extensible Messaging and Presence Protocol (XMPP): Address Format"">XMPP-ADDR</a>]; to meet this restriction, the server MAY replace the JID
sent by the client with the canonicalized JID as determined by the
server and communicate that JID to the client during resource
binding.
<span class="grey">Saint-Andre Standards Track [Page 28]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-29" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
For server-to-server communication, the initiating server's bare JID
(<domainpart>) MUST be the authorization identity (as defined by
[<a href="#ref-SASL" title=""Simple Authentication and Security Layer (SASL)"">SASL</a>]), either (1) as directly communicated by the initiating server
during SASL negotiation (<a href="#section-6">Section 6</a>) or (2) as derived by the
receiving server from the authentication identity if no authorization
identity was specified during SASL negotiation. In the absence of
SASL negotiation, the receiving server MAY consider the authorization
identity to be an identity negotiated within the relevant
verification protocol (e.g., the 'from' attribute of the <result/>
element in Server Dialback [<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>]).
Security Warning: Because it is possible for a third party to
tamper with information that is sent over the stream before a
security layer such as TLS is successfully negotiated, it is
advisable for the receiving server to treat any such unprotected
information with caution; this applies especially to the 'from'
and 'to' addresses on the first initial stream header sent by the
initiating entity.
<span class="h4"><a class="selflink" id="section-4.3.7" href="#section-4.3.7">4.3.7</a>. Flow Chart</span>
We summarize the foregoing rules in the following non-normative flow
chart for the stream negotiation process, presented from the
perspective of the initiating entity.
<span class="grey">Saint-Andre Standards Track [Page 29]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-30" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
+---------------------+
| open TCP connection |
+---------------------+
|
v
+---------------+
| send initial |<-------------------------+
| stream header | ^
+---------------+ |
| |
v |
+------------------+ |
| receive response | |
| stream header | |
+------------------+ |
| |
v |
+----------------+ |
| receive stream | |
+------------------>| features | |
^ {OPTIONAL} +----------------+ |
| | |
| v |
| +<-----------------+ |
| | |
| {empty?} ----> {all voluntary?} ----> {some mandatory?} |
| | no | no | |
| | yes | yes | yes |
| | v v |
| | +---------------+ +----------------+ |
| | | MAY negotiate | | MUST negotiate | |
| | | any or none | | one feature | |
| | +---------------+ +----------------+ |
| v | | |
| +---------+ v | |
| | DONE |<----- {negotiate?} | |
| +---------+ no | | |
| yes | | |
| v v |
| +--------->+<---------+ |
| | |
| v |
+<-------------------------- {restart mandatory?} ------------>+
no yes
Figure 3: Stream Negotiation Flow Chart
<span class="grey">Saint-Andre Standards Track [Page 30]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-31" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-4.4" href="#section-4.4">4.4</a>. Closing a Stream</span>
An XML stream from one entity to another can be closed at any time,
either because a specific stream error (<a href="#section-4.9">Section 4.9</a>) has occurred or
in the absence of an error (e.g., when a client simply ends its
session).
A stream is closed by sending a closing </stream> tag.
E: </stream:stream>
If the parties are using either two streams over a single TCP
connection or two streams over two TCP connections, the entity that
sends the closing stream tag MUST behave as follows:
1. Wait for the other party to also close its outbound stream before
terminating the underlying TCP connection(s); this gives the
other party an opportunity to finish transmitting any outbound
data to the closing entity before the termination of the TCP
connection(s).
2. Refrain from sending any further data over its outbound stream to
the other entity, but continue to process data received from the
other entity (and, if necessary, process such data).
3. Consider both streams to be void if the other party does not send
its closing stream tag within a reasonable amount of time (where
the definition of "reasonable" is a matter of implementation or
deployment).
4. After receiving a reciprocal closing stream tag from the other
party or waiting a reasonable amount of time with no response,
terminate the underlying TCP connection(s).
Security Warning: In accordance with Section 7.2.1 of [<a href="#ref-TLS" title=""The Transport Layer Security (TLS) Protocol Version 1.2"">TLS</a>], to
help prevent a truncation attack the party that is closing the
stream MUST send a TLS close_notify alert and MUST receive a
responding close_notify alert from the other party before
terminating the underlying TCP connection(s).
If the parties are using multiple streams over multiple TCP
connections, there is no defined pairing of streams and therefore the
behavior is a matter for implementation.
<span class="grey">Saint-Andre Standards Track [Page 31]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-32" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-4.5" href="#section-4.5">4.5</a>. Directionality</span>
An XML stream is always unidirectional, by which is meant that XML
stanzas can be sent in only one direction over the stream (either
from the initiating entity to the receiving entity or from the
receiving entity to the initiating entity).
Depending on the type of session that has been negotiated and the
nature of the entities involved, the entities might use:
o Two streams over a single TCP connection, where the security
context negotiated for the first stream is applied to the second
stream. This is typical for client-to-server sessions, and a
server MUST allow a client to use the same TCP connection for both
streams.
o Two streams over two TCP connections, where each stream is
separately secured. In this approach, one TCP connection is used
for the stream in which stanzas are sent from the initiating
entity to the receiving entity, and the other TCP connection is
used for the stream in which stanzas are sent from the receiving
entity to the initiating entity. This is typical for server-to-
server sessions.
o Multiple streams over two or more TCP connections, where each
stream is separately secured. This approach is sometimes used for
server-to-server communication between two large XMPP service
providers; however, this can make it difficult to maintain
coherence of data received over multiple streams in situations
described under <a href="#section-10.1">Section 10.1</a>, which is why a server MAY close the
stream with a <conflict/> stream error (<a href="#section-4.9.3.3">Section 4.9.3.3</a>) if a
remote server attempts to negotiate more than one stream (as
described under <a href="#section-4.9.3.3">Section 4.9.3.3</a>).
This concept of directionality applies only to stanzas and explicitly
does not apply to first-level children of the stream root that are
used to bootstrap or manage the stream (e.g., first-level elements
used for TLS negotiation, SASL negotiation, Server Dialback
[<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>], and Stream Management [<a href="#ref-XEP-0198" title=""Stream Management"">XEP-0198</a>]).
The foregoing considerations imply that while completing STARTTLS
negotiation (<a href="#section-5">Section 5</a>) and SASL negotiation (<a href="#section-6">Section 6</a>) two servers
would use one TCP connection, but after the stream negotiation
process is done that original TCP connection would be used only for
the initiating server to send XML stanzas to the receiving server.
In order for the receiving server to send XML stanzas to the
initiating server, the receiving server would need to reverse the
roles and negotiate an XML stream from the receiving server to the
<span class="grey">Saint-Andre Standards Track [Page 32]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-33" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
initiating server over a separate TCP connection. This separate TCP
connection is then secured using a new round of TLS and/or SASL
negotiation.
Implementation Note: For historical reasons, a server-to-server
session always uses two TCP connections. While that approach
remains the standard behavior described in this document,
extensions such as [<a href="#ref-XEP-0288" title=""Bidirectional Server-to- Server Connections"">XEP-0288</a>] enable servers to negotiate the use
of a single TCP connection for bidirectional stanza exchange.
Informational Note: Although XMPP developers sometimes apply the
terms "unidirectional" and "bidirectional" to the underlying TCP
connection (e.g., calling the TCP connection for a client-to-
server session "bidirectional" and the TCP connection for a
server-to-server session "unidirectional"), strictly speaking a
stream is always unidirectional (because the initiating entity and
receiving entity always have a minimum of two streams, one in each
direction) and a TCP connection is always bidirectional (because
TCP traffic can be sent in both directions). Directionality
applies to the application-layer traffic sent over the TCP
connection, not to the transport-layer traffic sent over the TCP
connection itself.
<span class="h3"><a class="selflink" id="section-4.6" href="#section-4.6">4.6</a>. Handling of Silent Peers</span>
When an entity that is a party to a stream has not received any XMPP
traffic from its stream peer for some period of time, the peer might
appear to be silent. There are several reasons why this might
happen:
1. The underlying TCP connection is dead.
2. The XML stream is broken despite the fact that the underlying TCP
connection is alive.
3. The peer is idle and simply has not sent any XMPP traffic over
its XML stream to the entity.
These three conditions are best handled separately, as described in
the following sections.
Implementation Note: For the purpose of handling silent peers, we
treat a two unidirectional TCP connections as conceptually
equivalent to a single bidirectional TCP connection (see
<a href="#section-4.5">Section 4.5</a>); however, implementers need to be aware that, in the
case of two unidirectional TCP connections, responses to traffic
at the XMPP application layer will come back from the peer on the
second TCP connection. In addition, the use of multiple streams
<span class="grey">Saint-Andre Standards Track [Page 33]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-34" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
in each direction (which is a somewhat frequent deployment choice
for server-to-server connectivity among large XMPP service
providers) further complicates application-level checking of XMPP
streams and their underlying TCP connections, because there is no
necessary correlation between any given initial stream and any
given response stream.
<span class="h4"><a class="selflink" id="section-4.6.1" href="#section-4.6.1">4.6.1</a>. Dead Connection</span>
If the underlying TCP connection is dead, stream-level checks (e.g.,
[<a href="#ref-XEP-0199" title=""XMPP Ping"">XEP-0199</a>] and [<a href="#ref-XEP-0198" title=""Stream Management"">XEP-0198</a>]) are ineffective. Therefore, it is
unnecessary to close the stream with or without an error, and it is
appropriate instead to simply terminate the TCP connection.
One common method for checking the TCP connection is to send a space
character (U+0020) between XML stanzas, which is allowed for XML
streams as described under <a href="#section-11.7">Section 11.7</a>; the sending of such a space
character is properly called a "whitespace keepalive" (the term
"whitespace ping" is often used, despite the fact that it is not a
ping since no "pong" is possible). However, this is not allowed
during TLS negotiation or SASL negotiation, as described under
<a href="#section-5.3.3">Section 5.3.3</a> and <a href="#section-6.3.5">Section 6.3.5</a>.
<span class="h4"><a class="selflink" id="section-4.6.2" href="#section-4.6.2">4.6.2</a>. Broken Stream</span>
Even if the underlying TCP connection is alive, the peer might never
respond to XMPP traffic that the entity sends, whether normal stanzas
or specialized stream-checking traffic such as the application-level
pings defined in [<a href="#ref-XEP-0199" title=""XMPP Ping"">XEP-0199</a>] or the more comprehensive Stream
Management protocol defined in [<a href="#ref-XEP-0198" title=""Stream Management"">XEP-0198</a>]. In this case, it is
appropriate for the entity to close a broken stream with a
<connection-timeout/> stream error (<a href="#section-4.9.3.4">Section 4.9.3.4</a>).
<span class="h4"><a class="selflink" id="section-4.6.3" href="#section-4.6.3">4.6.3</a>. Idle Peer</span>
Even if the underlying TCP connection is alive and the stream is not
broken, the peer might have sent no stanzas for a certain period of
time. In this case, the peer itself MAY close the stream (as
described under <a href="#section-4.4">Section 4.4</a>) rather than leaving an unused stream
open. If the idle peer does not close the stream, the other party
MAY either close the stream using the handshake described under
<a href="#section-4.4">Section 4.4</a> or close the stream with a stream error (e.g., <resource-
constraint/> (<a href="#section-4.9.3.17">Section 4.9.3.17</a>) if the entity has reached a limit on
the number of open TCP connections or <policy-violation/>
(<a href="#section-4.9.3.14">Section 4.9.3.14</a>) if the connection has exceeded a local timeout
policy). However, consistent with the order of layers (specified
under <a href="#section-13.3">Section 13.3</a>), the other party is advised to verify that the
underlying TCP connection is alive and the stream is unbroken (as
<span class="grey">Saint-Andre Standards Track [Page 34]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-35" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
described above) before concluding that the peer is idle.
Furthermore, it is preferable to be liberal in accepting idle peers,
since experience has shown that doing so improves the reliability of
communication over XMPP networks and that it is typically more
efficient to maintain a stream between two servers than to
aggressively time out such a stream.
<span class="h4"><a class="selflink" id="section-4.6.4" href="#section-4.6.4">4.6.4</a>. Use of Checking Methods</span>
Implementers are advised to support whichever stream-checking and
connection-checking methods they deem appropriate, but to carefully
weigh the network impact of such methods against the benefits of
discovering broken streams and dead TCP connections in a timely
manner. The length of time between the use of any particular check
is very much a matter of local service policy and depends strongly on
the network environment and usage scenarios of a given deployment and
connection type. At the time of writing, it is RECOMMENDED that any
such check be performed not more than once every 5 minutes and that,
ideally, such checks will be initiated by clients rather than
servers. Those who implement XMPP software and deploy XMPP services
are encouraged to seek additional advice regarding appropriate timing
of stream-checking and connection-checking methods, particularly when
power-constrained devices are being used (e.g., in mobile
environments).
<span class="h3"><a class="selflink" id="section-4.7" href="#section-4.7">4.7</a>. Stream Attributes</span>
The attributes of the root <stream/> element are defined in the
following sections.
Security Warning: Until and unless the confidentiality and
integrity of the stream are protected via TLS as described under
<a href="#section-5">Section 5</a> or an equivalent security layer (such as the SASL GSSAPI
mechanism), the attributes provided in a stream header could be
tampered with by an attacker.
Implementation Note: The attributes of the root <stream/> element
are not prepended by a namespace prefix because, as explained in
[<a href="#ref-XML-NAMES" title=""Namespaces in XML 1.0 (Third Edition)"">XML-NAMES</a>], "[d]efault namespace declarations do not apply
directly to attribute names; the interpretation of unprefixed
attributes is determined by the element on which they appear."
<span class="h4"><a class="selflink" id="section-4.7.1" href="#section-4.7.1">4.7.1</a>. from</span>
The 'from' attribute specifies an XMPP identity of the entity sending
the stream element.
<span class="grey">Saint-Andre Standards Track [Page 35]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-36" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
For initial stream headers in client-to-server communication, the
'from' attribute is the XMPP identity of the principal controlling
the client, i.e., a JID of the form <localpart@domainpart>. The
client might not know the XMPP identity, e.g., because the XMPP
identity is assigned at a level other than the XMPP application layer
(as in the Generic Security Service Application Program Interface
[<a href="#ref-GSS-API" title=""Generic Security Service Application Program Interface Version 2, Update 1"">GSS-API</a>]) or is derived by the server from information provided by
the client (as in some deployments of end-user certificates with the
SASL EXTERNAL mechanism). Furthermore, if the client considers the
XMPP identity to be private information then it is advised not to
include a 'from' attribute before the confidentiality and integrity
of the stream are protected via TLS or an equivalent security layer.
However, if the client knows the XMPP identity then it SHOULD include
the 'from' attribute after the confidentiality and integrity of the
stream are protected via TLS or an equivalent security layer.
I: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
For initial stream headers in server-to-server communication, the
'from' attribute is one of the configured FQDNs of the server, i.e.,
a JID of the form <domainpart>. The initiating server might have
more than one XMPP identity, e.g., in the case of a server that
provides virtual hosting, so it will need to choose an identity that
is associated with this output stream (e.g., based on the 'to'
attribute of the stanza that triggered the stream negotiation
attempt). Because a server is a "public entity" on the XMPP network,
it MUST include the 'from' attribute after the confidentiality and
integrity of the stream are protected via TLS or an equivalent
security layer.
I: <?xml version='1.0'?>
<stream:stream
from='example.net'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:server'
xmlns:stream='http://etherx.jabber.org/streams'>
<span class="grey">Saint-Andre Standards Track [Page 36]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-37" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
For response stream headers in both client-to-server and server-to-
server communication, the receiving entity MUST include the 'from'
attribute and MUST set its value to one of the receiving entity's
FQDNs (which MAY be an FQDN other than that specified in the 'to'
attribute of the initial stream header, as described under
<a href="#section-4.9.1.3">Section 4.9.1.3</a> and <a href="#section-4.9.3.6">Section 4.9.3.6</a>).
R: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
Whether or not the 'from' attribute is included, each entity MUST
verify the identity of the other entity before exchanging XML stanzas
with it, as described under <a href="#section-13.5">Section 13.5</a>.
Interoperability Note: It is possible that implementations based
on [<a href="./rfc3920" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">RFC3920</a>] will not include the 'from' address on any stream
headers (even ones whose confidentiality and integrity are
protected); an entity SHOULD be liberal in accepting such stream
headers.
<span class="h4"><a class="selflink" id="section-4.7.2" href="#section-4.7.2">4.7.2</a>. to</span>
For initial stream headers in both client-to-server and server-to-
server communication, the initiating entity MUST include the 'to'
attribute and MUST set its value to a domainpart that the initiating
entity knows or expects the receiving entity to service. (The same
information can be provided in other ways, such as a Server Name
Indication during TLS negotiation as described in [<a href="#ref-TLS-EXT" title=""Transport Layer Security (TLS) Extensions: Extension Definitions"">TLS-EXT</a>].)
I: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
For response stream headers in client-to-server communication, if the
client included a 'from' attribute in the initial stream header then
the server MUST include a 'to' attribute in the response stream
<span class="grey">Saint-Andre Standards Track [Page 37]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-38" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
header and MUST set its value to the bare JID specified in the 'from'
attribute of the initial stream header. If the client did not
include a 'from' attribute in the initial stream header then the
server MUST NOT include a 'to' attribute in the response stream
header.
R: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
For response stream headers in server-to-server communication, the
receiving entity MUST include a 'to' attribute in the response stream
header and MUST set its value to the domainpart specified in the
'from' attribute of the initial stream header.
R: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='g4qSvGvBxJ+xeAd7QKezOQJFFlw='
to='example.net'
version='1.0'
xml:lang='en'
xmlns='jabber:server'
xmlns:stream='http://etherx.jabber.org/streams'>
Whether or not the 'to' attribute is included, each entity MUST
verify the identity of the other entity before exchanging XML stanzas
with it, as described under <a href="#section-13.5">Section 13.5</a>.
Interoperability Note: It is possible that implementations based
on [<a href="./rfc3920" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">RFC3920</a>] will not include the 'to' address on stream headers;
an entity SHOULD be liberal in accepting such stream headers.
<span class="h4"><a class="selflink" id="section-4.7.3" href="#section-4.7.3">4.7.3</a>. id</span>
The 'id' attribute specifies a unique identifier for the stream,
called a "stream ID". The stream ID MUST be generated by the
receiving entity when it sends a response stream header and MUST BE
unique within the receiving application (normally a server).
<span class="grey">Saint-Andre Standards Track [Page 38]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-39" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Security Warning: The stream ID MUST be both unpredictable and
non-repeating because it can be security-critical when reused by
an authentication mechanisms, as is the case for Server Dialback
[<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>] and the "XMPP 0.9" authentication mechanism used before
<a href="./rfc3920">RFC 3920</a> defined the use of SASL in XMPP; for recommendations
regarding randomness for security purposes, see [<a href="#ref-RANDOM" title=""Randomness Requirements for Security"">RANDOM</a>].
For initial stream headers, the initiating entity MUST NOT include
the 'id' attribute; however, if the 'id' attribute is included, the
receiving entity MUST ignore it.
For response stream headers, the receiving entity MUST include the
'id' attribute.
R: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
Interoperability Note: In <a href="./rfc3920">RFC 3920</a>, the text regarding inclusion
of the 'id' attribute was ambiguous, leading some implementations
to leave the attribute off the response stream header.
<span class="h4"><a class="selflink" id="section-4.7.4" href="#section-4.7.4">4.7.4</a>. xml:lang</span>
The 'xml:lang' attribute specifies an entity's preferred or default
language for any human-readable XML character data to be sent over
the stream (an XML stanza can also possess an 'xml:lang' attribute,
as discussed under <a href="#section-8.1.5">Section 8.1.5</a>). The syntax of this attribute is
defined in Section 2.12 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>]; in particular, the value of the
'xml:lang' attribute MUST conform to the NMTOKEN datatype (as defined
in Section 2.3 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>]) and MUST conform to the language identifier
format defined in [<a href="#ref-LANGTAGS" title=""Tags for Identifying Languages"">LANGTAGS</a>].
For initial stream headers, the initiating entity SHOULD include the
'xml:lang' attribute.
<span class="grey">Saint-Andre Standards Track [Page 39]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-40" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
I: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
For response stream headers, the receiving entity MUST include the
'xml:lang' attribute. The following rules apply:
o If the initiating entity included an 'xml:lang' attribute in its
initial stream header and the receiving entity supports that
language in the human-readable XML character data that it
generates and sends to the initiating entity (e.g., in the <text/>
element for stream and stanza errors), the value of the 'xml:lang'
attribute MUST be the identifier for the initiating entity's
preferred language (e.g., "de-CH").
o If the receiving entity supports a language that matches the
initiating entity's preferred language according to the "lookup
scheme" specified in Section 3.4 of [<a href="#ref-LANGMATCH" title=""Matching of Language Tags"">LANGMATCH</a>] (e.g., "de"
instead of "de-CH"), then the value of the 'xml:lang' attribute
SHOULD be the identifier for the matching language.
o If the receiving entity does not support the initiating entity's
preferred language or a matching language according to the lookup
scheme (or if the initiating entity did not include the 'xml:lang'
attribute in its initial stream header), then the value of the
'xml:lang' attribute MUST be the identifier for the default
language of the receiving entity (e.g., "en").
R: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
If the initiating entity included the 'xml:lang' attribute in its
initial stream header, the receiving entity SHOULD remember that
value as the default xml:lang for all stanzas sent by the initiating
entity over the current stream. As described under <a href="#section-8.1.5">Section 8.1.5</a>,
<span class="grey">Saint-Andre Standards Track [Page 40]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-41" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
the initiating entity MAY include the 'xml:lang' attribute in any XML
stanzas it sends over the stream. If the initiating entity does not
include the 'xml:lang' attribute in any such stanza, the receiving
entity SHOULD add the 'xml:lang' attribute to the stanza when routing
it to a remote server or delivering it to a connected client, where
the value of the attribute MUST be the identifier for the language
preferred by the initiating entity (even if the receiving entity does
not support that language for human-readable XML character data it
generates and sends to the initiating entity, such as in stream or
stanza errors). If the initiating entity includes the 'xml:lang'
attribute in any such stanza, the receiving entity MUST NOT modify or
delete it when routing it to a remote server or delivering it to a
connected client.
<span class="h4"><a class="selflink" id="section-4.7.5" href="#section-4.7.5">4.7.5</a>. version</span>
The inclusion of the version attribute set to a value of at least
"1.0" signals support for the stream-related protocols defined in
this specification, including TLS negotiation (<a href="#section-5">Section 5</a>), SASL
negotiation (<a href="#section-6">Section 6</a>), stream features (<a href="#section-4.3.2">Section 4.3.2</a>), and stream
errors (<a href="#section-4.9">Section 4.9</a>).
The version of XMPP specified in this specification is "1.0"; in
particular, XMPP 1.0 encapsulates the stream-related protocols as
well as the basic semantics of the three defined XML stanza types
(<message/>, <presence/>, and <iq/> as described under Sections
8.2.1, 8.2.2, and 8.2.3, respectively).
The numbering scheme for XMPP versions is "<major>.<minor>". The
major and minor numbers MUST be treated as separate integers and each
number MAY be incremented higher than a single digit. Thus, "XMPP
2.4" would be a lower version than "XMPP 2.13", which in turn would
be lower than "XMPP 12.3". Leading zeros (e.g., "XMPP 6.01") MUST be
ignored by recipients and MUST NOT be sent.
The major version number will be incremented only if the stream and
stanza formats or obligatory actions have changed so dramatically
that an older version entity would not be able to interoperate with a
newer version entity if it simply ignored the elements and attributes
it did not understand and took the actions defined in the older
specification.
The minor version number will be incremented only if significant new
capabilities have been added to the core protocol (e.g., a newly
defined value of the 'type' attribute for message, presence, or IQ
stanzas). The minor version number MUST be ignored by an entity with
a smaller minor version number, but MAY be used for informational
purposes by the entity with the larger minor version number (e.g.,
<span class="grey">Saint-Andre Standards Track [Page 41]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-42" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
the entity with the larger minor version number would simply note
that its correspondent would not be able to understand that value of
the 'type' attribute and therefore would not send it).
The following rules apply to the generation and handling of the
'version' attribute within stream headers:
1. The initiating entity MUST set the value of the 'version'
attribute in the initial stream header to the highest version
number it supports (e.g., if the highest version number it
supports is that defined in this specification, it MUST set the
value to "1.0").
2. The receiving entity MUST set the value of the 'version'
attribute in the response stream header to either the value
supplied by the initiating entity or the highest version number
supported by the receiving entity, whichever is lower. The
receiving entity MUST perform a numeric comparison on the major
and minor version numbers, not a string match on
"<major>.<minor>".
3. If the version number included in the response stream header is
at least one major version lower than the version number included
in the initial stream header and newer version entities cannot
interoperate with older version entities as described, the
initiating entity SHOULD close the stream with an <unsupported-
version/> stream error (<a href="#section-4.9.3.25">Section 4.9.3.25</a>).
4. If either entity receives a stream header with no 'version'
attribute, the entity MUST consider the version supported by the
other entity to be "0.9" and SHOULD NOT include a 'version'
attribute in the response stream header.
<span class="grey">Saint-Andre Standards Track [Page 42]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-43" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-4.7.6" href="#section-4.7.6">4.7.6</a>. Summary of Stream Attributes</span>
The following table summarizes the attributes of the root <stream/>
element.
+----------+--------------------------+-------------------------+
| | initiating to receiving | receiving to initiating |
+----------+--------------------------+-------------------------+
| to | JID of receiver | JID of initiator |
| from | JID of initiator | JID of receiver |
| id | ignored | stream identifier |
| xml:lang | default language | default language |
| version | XMPP 1.0+ supported | XMPP 1.0+ supported |
+----------+--------------------------+-------------------------+
Figure 4: Stream Attributes
<span class="h3"><a class="selflink" id="section-4.8" href="#section-4.8">4.8</a>. XML Namespaces</span>
Readers are referred to the specification of XML namespaces
[<a href="#ref-XML-NAMES" title=""Namespaces in XML 1.0 (Third Edition)"">XML-NAMES</a>] for a full understanding of the concepts used in this
section, especially the concept of a "default namespace" as provided
in <a href="#section-3">Section 3</a> and <a href="#section-6.2">Section 6.2</a> of that specification.
<span class="h4"><a class="selflink" id="section-4.8.1" href="#section-4.8.1">4.8.1</a>. Stream Namespace</span>
The root <stream/> element ("stream header") MUST be qualified by the
namespace 'http://etherx.jabber.org/streams' (the "stream
namespace"). If this rule is violated, the entity that receives the
offending stream header MUST close the stream with a stream error,
which SHOULD be <invalid-namespace/> (<a href="#section-4.9.3.10">Section 4.9.3.10</a>), although
some existing implementations send <bad-format/> (<a href="#section-4.9.3.1">Section 4.9.3.1</a>)
instead.
<span class="h4"><a class="selflink" id="section-4.8.2" href="#section-4.8.2">4.8.2</a>. Content Namespace</span>
An entity MAY declare a "content namespace" as the default namespace
for data sent over the stream (i.e., data other than elements
qualified by the stream namespace). If so, (1) the content namespace
MUST be other than the stream namespace, and (2) the content
namespace MUST be the same for the initial stream and the response
stream so that both streams are qualified consistently. The content
namespace applies to all first-level child elements sent over the
stream unless explicitly qualified by another namespace (i.e., the
content namespace is the default namespace).
<span class="grey">Saint-Andre Standards Track [Page 43]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-44" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Alternatively (i.e., instead of declaring the content namespace as
the default namespace), an entity MAY explicitly qualify the
namespace for each first-level child element of the stream, using so-
called "prefix-free canonicalization". These two styles are shown in
the following examples.
When a content namespace is declared as the default namespace, in
rough outline a stream will look something like the following.
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<message>
<body>foo</body>
</message>
</stream:stream>
When a content namespace is not declared as the default namespace and
so-called "prefix-free canonicalization" is used instead, in rough
outline a stream will look something like the following.
<stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='http://etherx.jabber.org/streams'>
<message xmlns='jabber:client'>
<body>foo</body>
</message>
</stream>
Traditionally, most XMPP implementations have used the content-
namespace-as-default-namespace style rather than the prefix-free
canonicalization style for stream headers; however, both styles are
acceptable since they are semantically equivalent.
<span class="h4"><a class="selflink" id="section-4.8.3" href="#section-4.8.3">4.8.3</a>. XMPP Content Namespaces</span>
XMPP as defined in this specification uses two content namespaces:
'jabber:client' and 'jabber:server'. These namespaces are nearly
identical but are used in different contexts (client-to-server
communication for 'jabber:client' and server-to-server communication
for 'jabber:server'). The only difference between the two is that
<span class="grey">Saint-Andre Standards Track [Page 44]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-45" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
the 'to' and 'from' attributes are OPTIONAL on stanzas sent over XML
streams qualified by the 'jabber:client' namespace, whereas they are
REQUIRED on stanzas sent over XML streams qualified by the 'jabber:
server' namespace. Support for these content namespaces implies
support for the common attributes (<a href="#section-8.1">Section 8.1</a>) and basic semantics
(<a href="#section-8.2">Section 8.2</a>) of all three core stanza types (message, presence, and
IQ).
An implementation MAY support content namespaces other than 'jabber:
client' or 'jabber:server'. However, because such namespaces would
define applications other than XMPP, they are to be defined in
separate specifications.
An implementation MAY refuse to support any other content namespaces
as default namespaces. If an entity receives a first-level child
element qualified by a content namespace it does not support, it MUST
close the stream with an <invalid-namespace/> stream error
(<a href="#section-4.9.3.10">Section 4.9.3.10</a>).
Client implementations MUST support the 'jabber:client' content
namespace as a default namespace. The 'jabber:server' content
namespace is out of scope for an XMPP client, and a client MUST NOT
send stanzas qualified by the 'jabber:server' namespace.
Server implementations MUST support as default content namespaces
both the 'jabber:client' namespace (when the stream is used for
communication between a client and a server) and the 'jabber:server'
namespace (when the stream is used for communication between two
servers). When communicating with a connected client, a server MUST
NOT send stanzas qualified by the 'jabber:server' namespace; when
communicating with a peer server, a server MUST NOT send stanzas
qualified by the 'jabber:client' namespace.
Implementation Note: Because a client sends stanzas over a stream
whose content namespace is 'jabber:client', if a server routes to
a peer server a stanza it has received from a connected client
then it needs to "re-scope" the stanza so that its content
namespace is 'jabber:server'. Similarly, if a server delivers to
a connected client a stanza it has received from a peer server
then it needs to "re-scope" the stanza so that its content
namespace is 'jabber:client'. This rule applies to XML stanzas as
defined under <a href="#section-4.1">Section 4.1</a> (i.e., a first-level <message/>,
<presence/>, or <iq/> element qualified by the 'jabber:client' or
'jabber:server' namespace), and by namespace inheritance to all
child elements of a stanza. However, the rule does not apply to
elements qualified by namespaces other than 'jabber:client' and
'jabber:server' nor to any children of such elements (e.g., a
<message/> element contained within an extension element
<span class="grey">Saint-Andre Standards Track [Page 45]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-46" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
(<a href="#section-8.4">Section 8.4</a>) for reporting purposes). Although it is not
forbidden for an entity to generate stanzas in which an extension
element contains a child element qualified by the 'jabber:client'
or 'jabber:server' namespace, existing implementations handle such
stanzas inconsistently; therefore, implementers are advised to
weigh the likely lack of interoperability against the possible
utility of such stanzas. Finally, servers are advised to apply
stanza re-scoping to other stream connection methods and
alternative XMPP connection methods, such as those specified in
[<a href="#ref-XEP-0124" title=""Bidirectional-streams Over Synchronous HTTP (BOSH)"">XEP-0124</a>], [<a href="#ref-XEP-0206" title=""XMPP Over BOSH"">XEP-0206</a>], [<a href="#ref-XEP-0114" title=""Jabber Component Protocol"">XEP-0114</a>], and [<a href="#ref-XEP-0225" title=""Component Connections"">XEP-0225</a>].
<span class="h4"><a class="selflink" id="section-4.8.4" href="#section-4.8.4">4.8.4</a>. Other Namespaces</span>
Either party to a stream MAY send data qualified by namespaces other
than the content namespace and the stream namespace. For example,
this is how data related to TLS negotiation and SASL negotiation are
exchanged, as well as XMPP extensions such as Stream Management
[<a href="#ref-XEP-0198" title=""Stream Management"">XEP-0198</a>] and Server Dialback [<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>].
Interoperability Note: For historical reasons, some server
implementations expect a declaration of the 'jabber:server:
dialback' namespace on server-to-server streams, as explained in
[<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>].
However, an XMPP server MUST NOT route or deliver data received over
an input stream if that data is (a) qualified by another namespace
and (b) addressed to an entity other than the server, unless the
other party to the output stream over which the server would send the
data has explicitly negotiated or advertised support for receiving
arbitrary data from the server. This rule is included because XMPP
is designed for the exchange of XML stanzas (not arbitrary XML data),
and because allowing an entity to send arbitrary data to other
entities could significantly increase the potential for exchanging
malicious information. As an example of this rule, the server
hosting the example.net domain would not route the following first-
level XML element from <romeo@example.net> to <juliet@example.com>:
<ns1:foo xmlns:ns1='http://example.org/ns1'
from='romeo@example.net/resource1'
to='juliet@example.com'>
<ns1:bar/>
</ns1:foo>
This rule also applies to first-level elements that look like stanzas
but that are improperly namespaced and therefore really are not
stanzas at all (see also <a href="#section-4.8.5">Section 4.8.5</a>), for example:
<span class="grey">Saint-Andre Standards Track [Page 46]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-47" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<ns2:message xmlns:ns2='http://example.org/ns2'
from='romeo@example.net/resource1'
to='juliet@example.com'>
<body>hi</body>
</ns2:message>
Upon receiving arbitrary first-level XML elements over an input
stream, a server MUST either ignore the data or close the stream with
a stream error, which SHOULD be <unsupported-stanza-type/>
(<a href="#section-4.9.3.24">Section 4.9.3.24</a>).
<span class="h4"><a class="selflink" id="section-4.8.5" href="#section-4.8.5">4.8.5</a>. Namespace Declarations and Prefixes</span>
Because the content namespace is other than the stream namespace, if
a content namespace is declared as the default namespace then the
following statements are true:
1. The stream header needs to contain a namespace declaration for
both the content namespace and the stream namespace.
2. The stream namespace declaration needs to include a namespace
prefix for the stream namespace.
Interoperability Note: For historical reasons, an implementation
MAY accept only the prefix 'stream' for the stream namespace
(resulting in prefixed names such as <stream:stream> and <stream:
features>); this specification retains that allowance from
[<a href="./rfc3920" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">RFC3920</a>] for the purpose of backward compatibility.
Implementations are advised that using a prefix other than
'stream' for the stream namespace might result in interoperability
problems. If an entity receives a stream header with a stream
namespace prefix it does not accept, it MUST close the stream with
a stream error, which SHOULD be <bad-namespace-prefix/>
(<a href="#section-4.9.3.2">Section 4.9.3.2</a>), although some existing implementations send
<bad-format/> (<a href="#section-4.9.3.1">Section 4.9.3.1</a>) instead.
An implementation MUST NOT generate namespace prefixes for elements
qualified by the content namespace (i.e., the default namespace for
data sent over the stream) if the content namespace is 'jabber:
client' or 'jabber:server'. For example, the following is illegal:
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<span class="grey">Saint-Andre Standards Track [Page 47]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-48" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<foo:message xmlns:foo='jabber:client'>
<foo:body>foo</foo:body>
</foo:message>
An XMPP entity SHOULD NOT accept data that violates this rule (in
particular, an XMPP server MUST NOT route or deliver such data to
another entity without first correcting the error); instead it SHOULD
either ignore the data or close the stream with a stream error, which
SHOULD be <bad-namespace-prefix/> (<a href="#section-4.9.3.2">Section 4.9.3.2</a>).
Namespaces declared in a stream header MUST apply only to that stream
(e.g., the 'jabber:server:dialback' namespace used in Server Dialback
[<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>]). In particular, because XML stanzas intended for routing
or delivery over streams with other entities will lose the namespace
context declared in the header of the stream in which those stanzas
originated, namespaces for extended content within such stanzas MUST
NOT be declared in that stream header (see also <a href="#section-8.4">Section 8.4</a>). If
either party to a stream declares such namespaces, the other party to
the stream SHOULD close the stream with an <invalid-namespace/>
stream error (<a href="#section-4.9.3.10">Section 4.9.3.10</a>). In any case, an entity MUST ensure
that such namespaces are properly declared (according to this
section) when routing or delivering stanzas from an input stream to
an output stream.
<span class="h3"><a class="selflink" id="section-4.9" href="#section-4.9">4.9</a>. Stream Errors</span>
The root stream element MAY contain an <error/> child element that is
qualified by the stream namespace. The error child SHALL be sent by
a compliant entity if it perceives that a stream-level error has
occurred.
<span class="h4"><a class="selflink" id="section-4.9.1" href="#section-4.9.1">4.9.1</a>. Rules</span>
The following rules apply to stream-level errors.
<span class="h5"><a class="selflink" id="section-4.9.1.1" href="#section-4.9.1.1">4.9.1.1</a>. Stream Errors Are Unrecoverable</span>
Stream-level errors are unrecoverable. Therefore, if an error occurs
at the level of the stream, the entity that detects the error MUST
send an <error/> element with an appropriate child element specifying
the error condition and then immediately close the stream as
described under <a href="#section-4.4">Section 4.4</a>.
<span class="grey">Saint-Andre Standards Track [Page 48]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-49" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
C: <message><body>No closing tag!</message>
S: <stream:error>
<not-well-formed
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
The entity that receives the stream error then SHALL close the stream
as explained under <a href="#section-4.4">Section 4.4</a>.
C: </stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.1.2" href="#section-4.9.1.2">4.9.1.2</a>. Stream Errors Can Occur During Setup</span>
If the error is triggered by the initial stream header, the receiving
entity MUST still send the opening <stream> tag, include the <error/>
element as a child of the stream element, and send the closing
</stream> tag (preferably in the same TCP packet).
C: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://wrong.namespace.example.org/'>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<stream:error>
<invalid-namespace
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="grey">Saint-Andre Standards Track [Page 49]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-50" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h5"><a class="selflink" id="section-4.9.1.3" href="#section-4.9.1.3">4.9.1.3</a>. Stream Errors When the Host Is Unspecified or Unknown</span>
If the initiating entity provides no 'to' attribute or provides an
unknown host in the 'to' attribute and the error occurs during stream
setup, the value of the 'from' attribute returned by the receiving
entity in the stream header sent before closing the stream MUST be
either an authoritative FQDN for the receiving entity or the empty
string.
C: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='unknown.host.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<stream:error>
<host-unknown
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.1.4" href="#section-4.9.1.4">4.9.1.4</a>. Where Stream Errors Are Sent</span>
When two TCP connections are used between the initiating entity and
the receiving entity (one in each direction) rather than using a
single bidirectional connection, the following rules apply:
o Stream-level errors related to the initial stream are returned by
the receiving entity on the response stream via the same TCP
connection.
o Stanza errors triggered by outbound stanzas sent from the
initiating entity over the initial stream via the same TCP
connection are returned by the receiving entity on the response
stream via the other ("return") TCP connection, since they are
inbound stanzas from the perspective of the initiating entity.
<span class="grey">Saint-Andre Standards Track [Page 50]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-51" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-4.9.2" href="#section-4.9.2">4.9.2</a>. Syntax</span>
The syntax for stream errors is as follows, where XML data shown
within the square brackets '[' and ']' is OPTIONAL.
<stream:error>
<defined-condition xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
[<text xmlns='urn:ietf:params:xml:ns:xmpp-streams'
xml:lang='langcode'>
OPTIONAL descriptive text
</text>]
[OPTIONAL application-specific condition element]
</stream:error>
The "defined-condition" MUST correspond to one of the stream error
conditions defined under <a href="#section-4.9.3">Section 4.9.3</a>. However, because additional
error conditions might be defined in the future, if an entity
receives a stream error condition that it does not understand then it
MUST treat the unknown condition as equivalent to <undefined-
condition/> (<a href="#section-4.9.3.21">Section 4.9.3.21</a>). If the designers of an XMPP protocol
extension or the developers of an XMPP implementation need to
communicate a stream error condition that is not defined in this
specification, they can do so by defining an application-specific
error condition element qualified by an application-specific
namespace.
The <error/> element:
o MUST contain a child element corresponding to one of the defined
stream error conditions (<a href="#section-4.9.3">Section 4.9.3</a>); this element MUST be
qualified by the 'urn:ietf:params:xml:ns:xmpp-streams' namespace.
o MAY contain a <text/> child element containing XML character data
that describes the error in more detail; this element MUST be
qualified by the 'urn:ietf:params:xml:ns:xmpp-streams' namespace
and SHOULD possess an 'xml:lang' attribute specifying the natural
language of the XML character data.
o MAY contain a child element for an application-specific error
condition; this element MUST be qualified by an application-
defined namespace, and its structure is defined by that namespace
(see <a href="#section-4.9.4">Section 4.9.4</a>).
The <text/> element is OPTIONAL. If included, it MUST be used only
to provide descriptive or diagnostic information that supplements the
meaning of a defined condition or application-specific condition. It
MUST NOT be interpreted programmatically by an application. It MUST
NOT be used as the error message presented to a human user, but MAY
<span class="grey">Saint-Andre Standards Track [Page 51]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-52" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
be shown in addition to the error message associated with the defined
condition element (and, optionally, the application-specific
condition element).
<span class="h4"><a class="selflink" id="section-4.9.3" href="#section-4.9.3">4.9.3</a>. Defined Stream Error Conditions</span>
The following stream-level error conditions are defined.
<span class="h5"><a class="selflink" id="section-4.9.3.1" href="#section-4.9.3.1">4.9.3.1</a>. bad-format</span>
The entity has sent XML that cannot be processed.
(In the following example, the client sends an XMPP message that is
not well-formed XML, which alternatively might trigger a <not-well-
formed/> stream error (<a href="#section-4.9.3.13">Section 4.9.3.13</a>).)
C: <message>
<body>No closing tag!
</message>
S: <stream:error>
<bad-format
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
This error can be used instead of the more specific XML-related
errors, such as <bad-namespace-prefix/>, <invalid-xml/>, <not-well-
formed/>, <restricted-xml/>, and <unsupported-encoding/>. However,
the more specific errors are RECOMMENDED.
<span class="h5"><a class="selflink" id="section-4.9.3.2" href="#section-4.9.3.2">4.9.3.2</a>. bad-namespace-prefix</span>
The entity has sent a namespace prefix that is unsupported, or has
sent no namespace prefix on an element that needs such a prefix (see
<a href="#section-11.2">Section 11.2</a>).
(In the following example, the client specifies a namespace prefix of
"foobar" for the XML stream namespace.)
C: <?xml version='1.0'?>
<foobar:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xmlns='jabber:client'
xmlns:foobar='http://etherx.jabber.org/streams'>
<span class="grey">Saint-Andre Standards Track [Page 52]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-53" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<stream:error>
<bad-namespace-prefix
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.3" href="#section-4.9.3.3">4.9.3.3</a>. conflict</span>
The server either (1) is closing the existing stream for this entity
because a new stream has been initiated that conflicts with the
existing stream, or (2) is refusing a new stream for this entity
because allowing the new stream would conflict with an existing
stream (e.g., because the server allows only a certain number of
connections from the same IP address or allows only one server-to-
server stream for a given domain pair as a way of helping to ensure
in-order processing as described under <a href="#section-10.1">Section 10.1</a>).
C: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<stream:error>
<conflict
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="grey">Saint-Andre Standards Track [Page 53]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-54" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
If a client receives a <conflict/> stream error (<a href="#section-4.9.3.3">Section 4.9.3.3</a>),
during the resource binding aspect of its reconnection attempt it
MUST NOT blindly request the resourcepart it used during the former
session but instead MUST choose a different resourcepart; details are
provided under <a href="#section-7">Section 7</a>.
<span class="h5"><a class="selflink" id="section-4.9.3.4" href="#section-4.9.3.4">4.9.3.4</a>. connection-timeout</span>
One party is closing the stream because it has reason to believe that
the other party has permanently lost the ability to communicate over
the stream. The lack of ability to communicate can be discovered
using various methods, such as whitespace keepalives as specified
under <a href="#section-4.4">Section 4.4</a>, XMPP-level pings as defined in [<a href="#ref-XEP-0199" title=""XMPP Ping"">XEP-0199</a>], and
XMPP Stream Management as defined in [<a href="#ref-XEP-0198" title=""Stream Management"">XEP-0198</a>].
P: <stream:error>
<connection-timeout
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
Interoperability Note: <a href="./rfc3920">RFC 3920</a> specified that the <connection-
timeout/> stream error (<a href="#section-4.9.3.4">Section 4.9.3.4</a>) is to be used if the peer
has not generated any traffic over the stream for some period of
time. That behavior is no longer recommended; instead, the error
SHOULD be used only if the connected client or peer server has not
responded to data sent over the stream.
<span class="h5"><a class="selflink" id="section-4.9.3.5" href="#section-4.9.3.5">4.9.3.5</a>. host-gone</span>
The value of the 'to' attribute provided in the initial stream header
corresponds to an FQDN that is no longer serviced by the receiving
entity.
(In the following example, the peer specifies a 'to' address of
"foo.im.example.com" when connecting to the "im.example.com" server,
but the server no longer hosts a service at that address.)
P: <?xml version='1.0'?>
<stream:stream
from='example.net'
to='foo.im.example.com'
version='1.0'
xmlns='jabber:server'
xmlns:stream='http://etherx.jabber.org/streams'>
<span class="grey">Saint-Andre Standards Track [Page 54]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-55" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='g4qSvGvBxJ+xeAd7QKezOQJFFlw='
to='example.net'
version='1.0'
xml:lang='en'
xmlns='jabber:server'
xmlns:stream='http://etherx.jabber.org/streams'>
<stream:error>
<host-gone
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.6" href="#section-4.9.3.6">4.9.3.6</a>. host-unknown</span>
The value of the 'to' attribute provided in the initial stream header
does not correspond to an FQDN that is serviced by the receiving
entity.
(In the following example, the peer specifies a 'to' address of
"example.org" when connecting to the "im.example.com" server, but the
server knows nothing of that address.)
P: <?xml version='1.0'?>
<stream:stream
from='example.net'
to='example.org'
version='1.0'
xmlns='jabber:server'
xmlns:stream='http://etherx.jabber.org/streams'>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='g4qSvGvBxJ+xeAd7QKezOQJFFlw='
to='example.net'
version='1.0'
xml:lang='en'
xmlns='jabber:server'
xmlns:stream='http://etherx.jabber.org/streams'>
<stream:error>
<host-unknown
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="grey">Saint-Andre Standards Track [Page 55]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-56" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h5"><a class="selflink" id="section-4.9.3.7" href="#section-4.9.3.7">4.9.3.7</a>. improper-addressing</span>
A stanza sent between two servers lacks a 'to' or 'from' attribute,
the 'from' or 'to' attribute has no value, or the value violates the
rules for XMPP addresses [<a href="#ref-XMPP-ADDR" title=""Extensible Messaging and Presence Protocol (XMPP): Address Format"">XMPP-ADDR</a>].
(In the following example, the peer sends a stanza without a 'to'
address over a server-to-server stream.)
P: <message from='juliet@im.example.com'>
<body>Wherefore art thou?</body>
</message>
S: <stream:error>
<improper-addressing
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.8" href="#section-4.9.3.8">4.9.3.8</a>. internal-server-error</span>
The server has experienced a misconfiguration or other internal error
that prevents it from servicing the stream.
S: <stream:error>
<internal-server-error
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.9" href="#section-4.9.3.9">4.9.3.9</a>. invalid-from</span>
The data provided in a 'from' attribute does not match an authorized
JID or validated domain as negotiated (1) between two servers using
SASL or Server Dialback, or (2) between a client and a server via
SASL authentication and resource binding.
(In the following example, a peer that has authenticated only as
"example.net" attempts to send a stanza from an address at
"example.org".)
P: <message from='romeo@example.org' to='juliet@im.example.com'>
<body>Neither, fair saint, if either thee dislike.</body>
</message>
<span class="grey">Saint-Andre Standards Track [Page 56]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-57" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S: <stream:error>
<invalid-from
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.10" href="#section-4.9.3.10">4.9.3.10</a>. invalid-namespace</span>
The stream namespace name is something other than
"<a href="http://etherx.jabber.org/streams">http://etherx.jabber.org/streams</a>" (see <a href="#section-11.2">Section 11.2</a>) or the content
namespace declared as the default namespace is not supported (e.g.,
something other than "jabber:client" or "jabber:server").
(In the following example, the client specifies a namespace of
'http://wrong.namespace.example.org/' for the stream.)
C: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xmlns='jabber:client'
xmlns:stream='http://wrong.namespace.example.org/'>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<stream:error>
<invalid-namespace
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.11" href="#section-4.9.3.11">4.9.3.11</a>. invalid-xml</span>
The entity has sent invalid XML over the stream to a server that
performs validation (see <a href="#section-11.4">Section 11.4</a>).
(In the following example, the peer attempts to send an IQ stanza of
type "subscribe", but the XML schema defines no such value for the
'type' attribute.)
<span class="grey">Saint-Andre Standards Track [Page 57]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-58" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
P: <iq from='example.net'
id='l3b1vs75'
to='im.example.com'
type='subscribe'>
<ping xmlns='urn:xmpp:ping'/>
</iq>
S: <stream:error>
<invalid-xml
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.12" href="#section-4.9.3.12">4.9.3.12</a>. not-authorized</span>
The entity has attempted to send XML stanzas or other outbound data
before the stream has been authenticated, or otherwise is not
authorized to perform an action related to stream negotiation; the
receiving entity MUST NOT process the offending data before sending
the stream error.
(In the following example, the client attempts to send XML stanzas
before authenticating with the server.)
C: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
C: <message to='romeo@example.net'>
<body>Wherefore art thou?</body>
</message>
<span class="grey">Saint-Andre Standards Track [Page 58]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-59" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S: <stream:error>
<not-authorized
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.13" href="#section-4.9.3.13">4.9.3.13</a>. not-well-formed</span>
The initiating entity has sent XML that violates the well-formedness
rules of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>] or [<a href="#ref-XML-NAMES" title=""Namespaces in XML 1.0 (Third Edition)"">XML-NAMES</a>].
(In the following example, the client sends an XMPP message that is
not namespace-well-formed.)
C: <message>
<foo:body>What is this foo?</foo:body>
</message>
S: <stream:error>
<not-well-formed
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
Interoperability Note: In <a href="./rfc3920">RFC 3920</a>, the name of this error
condition was "xml-not-well-formed" instead of "not-well-formed".
The name was changed because the element name <xml-not-well-
formed/> violates the constraint from Section 3 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>] that
"names beginning with a match to (('X'|'x')('M'|'m')('L'|'l')) are
reserved for standardization in this or future versions of this
specification".
<span class="h5"><a class="selflink" id="section-4.9.3.14" href="#section-4.9.3.14">4.9.3.14</a>. policy-violation</span>
The entity has violated some local service policy (e.g., a stanza
exceeds a configured size limit); the server MAY choose to specify
the policy in the <text/> element or in an application-specific
condition element.
(In the following example, the client sends an XMPP message that is
too large according to the server's local service policy.)
C: <message to='juliet@im.example.com' id='foo'>
<body>[ ... the-emacs-manual ... ]</body>
</message>
<span class="grey">Saint-Andre Standards Track [Page 59]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-60" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S: <stream:error>
<policy-violation
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
<stanza-too-big xmlns='urn:xmpp:errors'/>
</stream:error>
S: </stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.15" href="#section-4.9.3.15">4.9.3.15</a>. remote-connection-failed</span>
The server is unable to properly connect to a remote entity that is
needed for authentication or authorization (e.g., in certain
scenarios related to Server Dialback [<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>]); this condition is
not to be used when the cause of the error is within the
administrative domain of the XMPP service provider, in which case the
<internal-server-error/> condition is more appropriate.
C: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<stream:error>
<remote-connection-failed
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.16" href="#section-4.9.3.16">4.9.3.16</a>. reset</span>
The server is closing the stream because it has new (typically
security-critical) features to offer, because the keys or
certificates used to establish a secure context for the stream have
expired or have been revoked during the life of the stream
(<a href="#section-13.7.2.3">Section 13.7.2.3</a>), because the TLS sequence number has wrapped
(<a href="#section-5.3.5">Section 5.3.5</a>), etc. The reset applies to the stream and to any
<span class="grey">Saint-Andre Standards Track [Page 60]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-61" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
security context established for that stream (e.g., via TLS and
SASL), which means that encryption and authentication need to be
negotiated again for the new stream (e.g., TLS session resumption
cannot be used).
S: <stream:error>
<reset
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.17" href="#section-4.9.3.17">4.9.3.17</a>. resource-constraint</span>
The server lacks the system resources necessary to service the
stream.
C: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<stream:error>
<resource-constraint
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.18" href="#section-4.9.3.18">4.9.3.18</a>. restricted-xml</span>
The entity has attempted to send restricted XML features such as a
comment, processing instruction, DTD subset, or XML entity reference
(see <a href="#section-11.1">Section 11.1</a>).
(In the following example, the client sends an XMPP message
containing an XML comment.)
<span class="grey">Saint-Andre Standards Track [Page 61]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-62" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
C: <message to='juliet@im.example.com'>
<!--<subject/>-->
<body>This message has no subject.</body>
</message>
S: <stream:error>
<restricted-xml
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.19" href="#section-4.9.3.19">4.9.3.19</a>. see-other-host</span>
The server will not provide service to the initiating entity but is
redirecting traffic to another host under the administrative control
of the same service provider. The XML character data of the <see-
other-host/> element returned by the server MUST specify the
alternate FQDN or IP address at which to connect, which MUST be a
valid domainpart or a domainpart plus port number (separated by the
':' character in the form "domainpart:port"). If the domainpart is
the same as the source domain, derived domain, or resolved IPv4 or
IPv6 address to which the initiating entity originally connected
(differing only by the port number), then the initiating entity
SHOULD simply attempt to reconnect at that address. (The format of
an IPv6 address MUST follow [<a href="#ref-IPv6-ADDR" title=""A Recommendation for IPv6 Address Text Representation"">IPv6-ADDR</a>], which includes the enclosing
the IPv6 address in square brackets '[' and ']' as originally defined
by [<a href="#ref-URI" title=""Uniform Resource Identifier (URI): Generic Syntax"">URI</a>].) Otherwise, the initiating entity MUST resolve the FQDN
specified in the <see-other-host/> element as described under
<a href="#section-3.2">Section 3.2</a>.
C: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<span class="grey">Saint-Andre Standards Track [Page 62]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-63" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<stream:error>
<see-other-host
xmlns='urn:ietf:params:xml:ns:xmpp-streams'>
[2001:41D0:1:A49b::1]:9222
</see-other-host>
</stream:error>
</stream:stream>
When negotiating a stream with the host to which it has been
redirected, the initiating entity MUST apply the same policies it
would have applied to the original connection attempt (e.g., a policy
requiring TLS), MUST specify the same 'to' address on the initial
stream header, and MUST verify the identity of the new host using the
same reference identifier(s) it would have used for the original
connection attempt (in accordance with [<a href="#ref-TLS-CERTS" title=""Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)"">TLS-CERTS</a>]). Even if the
receiving entity returns a <see-other-host/> error before the
confidentiality and integrity of the stream have been established
(thus introducing the possibility of a denial-of-service attack), the
fact that the initiating entity needs to verify the identity of the
XMPP service based on the same reference identifiers implies that the
initiating entity will not connect to a malicious entity. To reduce
the possibility of a denial-of-service attack, (a) the receiving
entity SHOULD NOT close the stream with a <see-other-host/> stream
error until after the confidentiality and integrity of the stream
have been protected via TLS or an equivalent security layer (such as
the SASL GSSAPI mechanism), and (b) the receiving entity MAY have a
policy of following redirects only if it has authenticated the
receiving entity. In addition, the initiating entity SHOULD abort
the connection attempt after a certain number of successive redirects
(e.g., at least 2 but no more than 5).
<span class="grey">Saint-Andre Standards Track [Page 63]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-64" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h5"><a class="selflink" id="section-4.9.3.20" href="#section-4.9.3.20">4.9.3.20</a>. system-shutdown</span>
The server is being shut down and all active streams are being
closed.
S: <stream:error>
<system-shutdown
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.21" href="#section-4.9.3.21">4.9.3.21</a>. undefined-condition</span>
The error condition is not one of those defined by the other
conditions in this list; this error condition SHOULD NOT be used
except in conjunction with an application-specific condition.
S: <stream:error>
<undefined-condition
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
<app-error xmlns='http://example.org/ns'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.22" href="#section-4.9.3.22">4.9.3.22</a>. unsupported-encoding</span>
The initiating entity has encoded the stream in an encoding that is
not supported by the server (see <a href="#section-11.6">Section 11.6</a>) or has otherwise
improperly encoded the stream (e.g., by violating the rules of the
[<a href="#ref-UTF-8" title=""UTF-8, a transformation format of ISO 10646"">UTF-8</a>] encoding).
(In the following example, the client attempts to encode data using
UTF-16 instead of UTF-8.)
C: <?xml version='1.0' encoding='UTF-16'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<span class="grey">Saint-Andre Standards Track [Page 64]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-65" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<stream:error>
<unsupported-encoding
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.23" href="#section-4.9.3.23">4.9.3.23</a>. unsupported-feature</span>
The receiving entity has advertised a mandatory-to-negotiate stream
feature that the initiating entity does not support, and has offered
no other mandatory-to-negotiate feature alongside the unsupported
feature.
(In the following example, the receiving entity requires negotiation
of an example feature, but the initiating entity does not support the
feature.)
R: <stream:features>
<example xmlns='urn:xmpp:example'>
<required/>
</example>
</stream:features>
I: <stream:error>
<unsupported-feature
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.24" href="#section-4.9.3.24">4.9.3.24</a>. unsupported-stanza-type</span>
The initiating entity has sent a first-level child of the stream that
is not supported by the server, either because the receiving entity
does not understand the namespace or because the receiving entity
does not understand the element name for the applicable namespace
(which might be the content namespace declared as the default
namespace).
<span class="grey">Saint-Andre Standards Track [Page 65]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-66" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
(In the following example, the client attempts to send a first-level
child element of <pubsub/> qualified by the 'jabber:client'
namespace, but the schema for that namespace defines no such
element.)
C: <pubsub xmlns='jabber:client'>
<publish node='princely_musings'>
<item id='ae890ac52d0df67ed7cfdf51b644e901'>
<entry xmlns='http://www.w3.org/2005/Atom'>
<title>Soliloquy</title>
<summary>
To be, or not to be: that is the question:
Whether 'tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles,
And by opposing end them?
</summary>
<link rel='alternate' type='text/html'
href='http://denmark.example/2003/12/13/atom03'/>
<id>tag:denmark.example,2003:entry-32397</id>
<published>2003-12-13T18:30:02Z</published>
<updated>2003-12-13T18:30:02Z</updated>
</entry>
</item>
</publish>
</pubsub>
S: <stream:error>
<unsupported-stanza-type
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h5"><a class="selflink" id="section-4.9.3.25" href="#section-4.9.3.25">4.9.3.25</a>. unsupported-version</span>
The 'version' attribute provided by the initiating entity in the
stream header specifies a version of XMPP that is not supported by
the server.
C: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='11.0'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<span class="grey">Saint-Andre Standards Track [Page 66]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-67" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<stream:error>
<unsupported-version
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
<span class="h4"><a class="selflink" id="section-4.9.4" href="#section-4.9.4">4.9.4</a>. Application-Specific Conditions</span>
As noted, an application MAY provide application-specific stream
error information by including a properly namespaced child in the
error element. The application-specific element SHOULD supplement or
further qualify a defined element. Thus, the <error/> element will
contain two or three child elements.
C: <message>
<body>
My keyboard layout is:
QWERTYUIOP{}|
ASDFGHJKL:"
ZXCVBNM<>?
</body>
</message>
S: <stream:error>
<not-well-formed
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
<text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>
Some special application diagnostic information!
</text>
<escape-your-data xmlns='http://example.org/ns'/>
</stream:error>
</stream:stream>
<span class="grey">Saint-Andre Standards Track [Page 67]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-68" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-4.10" href="#section-4.10">4.10</a>. Simplified Stream Examples</span>
This section contains two highly simplified examples of a stream-
based connection between a client and a server; these examples are
included for the purpose of illustrating the concepts introduced thus
far, but the reader needs to be aware that these examples elide many
details (see <a href="#section-9">Section 9</a> for more complete examples).
A basic connection:
C: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
[ ... stream negotiation ... ]
C: <message from='juliet@im.example.com/balcony'
to='romeo@example.net'
xml:lang='en'>
<body>Art thou not Romeo, and a Montague?</body>
</message>
S: <message from='romeo@example.net/orchard'
to='juliet@im.example.com/balcony'
xml:lang='en'>
<body>Neither, fair saint, if either thee dislike.</body>
</message>
C: </stream:stream>
S: </stream:stream>
<span class="grey">Saint-Andre Standards Track [Page 68]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-69" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
A connection gone bad:
C: <?xml version='1.0'?>
<stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
S: <?xml version='1.0'?>
<stream:stream
from='im.example.com'
id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
[ ... stream negotiation ... ]
C: <message from='juliet@im.example.com/balcony'
to='romeo@example.net'
xml:lang='en'>
<body>No closing tag!
</message>
S: <stream:error>
<not-well-formed
xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
More detailed examples are provided under <a href="#section-9">Section 9</a>.
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. STARTTLS Negotiation</span>
<span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. Fundamentals</span>
XMPP includes a method for securing the stream from tampering and
eavesdropping. This channel encryption method makes use of the
Transport Layer Security [<a href="#ref-TLS" title=""The Transport Layer Security (TLS) Protocol Version 1.2"">TLS</a>] protocol, specifically a "STARTTLS"
extension that is modeled after similar extensions for the [<a href="#ref-IMAP" title=""INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1"">IMAP</a>],
<span class="grey">Saint-Andre Standards Track [Page 69]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-70" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
[<a href="#ref-POP3" title=""Post Office Protocol - Version 3"">POP3</a>], and [<a href="#ref-ACAP" title=""ACAP -- Application Configuration Access Protocol"">ACAP</a>] protocols as described in [<a href="#ref-USINGTLS" title=""Using TLS with IMAP, POP3 and ACAP"">USINGTLS</a>]. The XML
namespace name for the STARTTLS extension is
'urn:ietf:params:xml:ns:xmpp-tls'.
<span class="h3"><a class="selflink" id="section-5.2" href="#section-5.2">5.2</a>. Support</span>
Support for STARTTLS is REQUIRED in XMPP client and server
implementations. An administrator of a given deployment MAY specify
that TLS is mandatory-to-negotiate for client-to-server
communication, server-to-server communication, or both. An
initiating entity SHOULD use TLS to secure its stream with the
receiving entity before proceeding with SASL authentication.
<span class="h3"><a class="selflink" id="section-5.3" href="#section-5.3">5.3</a>. Stream Negotiation Rules</span>
<span class="h4"><a class="selflink" id="section-5.3.1" href="#section-5.3.1">5.3.1</a>. Mandatory-to-Negotiate</span>
If the receiving entity advertises only the STARTTLS feature or if
the receiving entity includes the <required/> child element as
explained under <a href="#section-5.4.1">Section 5.4.1</a>, the parties MUST consider TLS as
mandatory-to-negotiate. If TLS is mandatory-to-negotiate, the
receiving entity SHOULD NOT advertise support for any stream feature
except STARTTLS during the initial stage of the stream negotiation
process, because further stream features might depend on prior
negotiation of TLS given the order of layers in XMPP (e.g., the
particular SASL mechanisms offered by the receiving entity will
likely depend on whether TLS has been negotiated).
<span class="h4"><a class="selflink" id="section-5.3.2" href="#section-5.3.2">5.3.2</a>. Restart</span>
After TLS negotiation, the parties MUST restart the stream.
<span class="h4"><a class="selflink" id="section-5.3.3" href="#section-5.3.3">5.3.3</a>. Data Formatting</span>
During STARTTLS negotiation, the entities MUST NOT send any
whitespace as separators between XML elements (i.e., from the last
character of the first-level <starttls/> element qualified by the
'urn:ietf:params:xml:ns:xmpp-tls' namespace as sent by the initiating
entity, until the last character of the first-level <proceed/>
element qualified by the 'urn:ietf:params:xml:ns:xmpp-tls' namespace
as sent by the receiving entity). This prohibition helps to ensure
proper security layer byte precision. Any such whitespace shown in
the STARTTLS examples provided in this document is included only for
the sake of readability.
<span class="grey">Saint-Andre Standards Track [Page 70]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-71" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-5.3.4" href="#section-5.3.4">5.3.4</a>. Order of TLS and SASL Negotiations</span>
If the initiating entity chooses to use TLS, STARTTLS negotiation
MUST be completed before proceeding to SASL negotiation (<a href="#section-6">Section 6</a>);
this order of negotiation is necessary to help safeguard
authentication information sent during SASL negotiation, as well as
to make it possible to base the use of the SASL EXTERNAL mechanism on
a certificate (or other credentials) provided during prior TLS
negotiation.
<span class="h4"><a class="selflink" id="section-5.3.5" href="#section-5.3.5">5.3.5</a>. TLS Renegotiation</span>
The TLS protocol allows either party in a TLS-protected channel to
initiate a new handshake that establishes new cryptographic
parameters (see [<a href="#ref-TLS-NEG" title=""Transport Layer Security (TLS) Renegotiation Indication Extension"">TLS-NEG</a>]). The cases most commonly mentioned are:
1. Refreshing encryption keys.
2. Wrapping the TLS sequence number as explained in Section 6.1 of
[<a href="#ref-TLS" title=""The Transport Layer Security (TLS) Protocol Version 1.2"">TLS</a>].
3. Protecting client credentials by completing server authentication
first and then completing client authentication over the
protected channel.
Because it is relatively inexpensive to establish streams in XMPP,
for the first two cases it is preferable to use an XMPP stream reset
(as described under <a href="#section-4.9.3.16">Section 4.9.3.16</a>) instead of performing TLS
renegotiation.
The third case has improved security characteristics when the TLS
client (which might be an XMPP server) presents credentials to the
TLS server. If communicating such credentials to an unauthenticated
TLS server might leak private information, it can be appropriate to
complete TLS negotiation for the purpose of authenticating the TLS
server to the TLS client and then attempt TLS renegotiation for the
purpose of authenticating the TLS client to the TLS server. However,
this case is extremely rare because the credentials presented by an
XMPP server or XMPP client acting as a TLS client are almost always
public (i.e., a PKIX certificate), and therefore providing those
credentials before authenticating the XMPP server acting as a TLS
server would not in general leak private information.
As a result, implementers are encouraged to carefully weigh the costs
and benefits of TLS renegotiation before supporting it in their
software, and XMPP entities that act as TLS clients are discouraged
<span class="grey">Saint-Andre Standards Track [Page 71]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-72" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
from attempting TLS renegotiation unless the certificate (or other
credential information) sent during TLS negotiation is known to be
private.
Support for TLS renegotiation is strictly OPTIONAL. However,
implementations that support TLS renegotiation MUST implement and use
the TLS Renegotiation Extension [<a href="#ref-TLS-NEG" title=""Transport Layer Security (TLS) Renegotiation Indication Extension"">TLS-NEG</a>].
If an entity that does not support TLS renegotiation detects a
renegotiation attempt, then it MUST immediately close the underlying
TCP connection without returning a stream error (since the violation
has occurred at the TLS layer, not the XMPP layer, as described under
<a href="#section-13.3">Section 13.3</a>).
If an entity that supports TLS renegotiation detects a TLS
renegotiation attempt that does not use the TLS Renegotiation
Extension [<a href="#ref-TLS-NEG" title=""Transport Layer Security (TLS) Renegotiation Indication Extension"">TLS-NEG</a>], then it MUST immediately close the underlying
TCP connection without returning a stream error (since the violation
has occurred at the TLS layer, not the XMPP layer as described under
<a href="#section-13.3">Section 13.3</a>).
<span class="h4"><a class="selflink" id="section-5.3.6" href="#section-5.3.6">5.3.6</a>. TLS Extensions</span>
Either party to a stream MAY include any TLS extension during the TLS
negotiation itself. This is a matter for the TLS layer, not the XMPP
layer.
<span class="h3"><a class="selflink" id="section-5.4" href="#section-5.4">5.4</a>. Process</span>
<span class="h4"><a class="selflink" id="section-5.4.1" href="#section-5.4.1">5.4.1</a>. Exchange of Stream Headers and Stream Features</span>
The initiating entity resolves the FQDN of the receiving entity as
specified under <a href="#section-3">Section 3</a>, opens a TCP connection to the advertised
port at the resolved IP address, and sends an initial stream header
to the receiving entity.
I: <stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
The receiving entity MUST send a response stream header to the
initiating entity over the TCP connection opened by the initiating
entity.
<span class="grey">Saint-Andre Standards Track [Page 72]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-73" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
R: <stream:stream
from='im.example.com'
id='t7AMCin9zjMNwQKDnplntZPIDEI='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
The receiving entity then MUST send stream features to the initiating
entity. If the receiving entity supports TLS, the stream features
MUST include an advertisement for support of STARTTLS negotiation,
i.e., a <starttls/> element qualified by the
'urn:ietf:params:xml:ns:xmpp-tls' namespace.
If the receiving entity considers STARTTLS negotiation to be
mandatory-to-negotiate, the <starttls/> element MUST contain an empty
<required/> child element.
R: <stream:features>
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
<required/>
</starttls>
</stream:features>
<span class="h4"><a class="selflink" id="section-5.4.2" href="#section-5.4.2">5.4.2</a>. Initiation of STARTTLS Negotiation</span>
<span class="h5"><a class="selflink" id="section-5.4.2.1" href="#section-5.4.2.1">5.4.2.1</a>. STARTTLS Command</span>
In order to begin the STARTTLS negotiation, the initiating entity
issues the STARTTLS command (i.e., a <starttls/> element qualified by
the 'urn:ietf:params:xml:ns:xmpp-tls' namespace) to instruct the
receiving entity that it wishes to begin a STARTTLS negotiation to
secure the stream.
I: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
The receiving entity MUST reply with either a <proceed/> element
(proceed case) or a <failure/> element (failure case) qualified by
the 'urn:ietf:params:xml:ns:xmpp-tls' namespace.
<span class="h5"><a class="selflink" id="section-5.4.2.2" href="#section-5.4.2.2">5.4.2.2</a>. Failure Case</span>
If the failure case occurs, the receiving entity MUST return a
<failure/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-tls'
namespace, close the XML stream, and terminate the underlying TCP
connection.
<span class="grey">Saint-Andre Standards Track [Page 73]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-74" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
R: </stream:stream>
Causes for the failure case include but are not limited to:
1. The initiating entity has sent a malformed STARTTLS command.
2. The receiving entity did not offer the STARTTLS feature in its
stream features.
3. The receiving entity cannot complete STARTTLS negotiation because
of an internal error.
Informational Note: STARTTLS failure is not triggered by TLS
errors such as bad_certificate or handshake_failure, which are
generated and handled during the TLS negotiation itself as
described in [<a href="#ref-TLS" title=""The Transport Layer Security (TLS) Protocol Version 1.2"">TLS</a>].
If the failure case occurs, the initiating entity MAY attempt to
reconnect as explained under <a href="#section-3.3">Section 3.3</a>.
<span class="h5"><a class="selflink" id="section-5.4.2.3" href="#section-5.4.2.3">5.4.2.3</a>. Proceed Case</span>
If the proceed case occurs, the receiving entity MUST return a
<proceed/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-tls'
namespace.
R: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
The receiving entity MUST consider the TLS negotiation to have begun
immediately after sending the closing '>' character of the <proceed/>
element to the initiating entity. The initiating entity MUST
consider the TLS negotiation to have begun immediately after
receiving the closing '>' character of the <proceed/> element from
the receiving entity.
The entities now proceed to TLS negotiation as explained in the next
section.
<span class="h4"><a class="selflink" id="section-5.4.3" href="#section-5.4.3">5.4.3</a>. TLS Negotiation</span>
<span class="h5"><a class="selflink" id="section-5.4.3.1" href="#section-5.4.3.1">5.4.3.1</a>. Rules</span>
In order to complete TLS negotiation over the TCP connection, the
entities MUST follow the process defined in [<a href="#ref-TLS" title=""The Transport Layer Security (TLS) Protocol Version 1.2"">TLS</a>].
<span class="grey">Saint-Andre Standards Track [Page 74]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-75" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
The following rules apply:
1. The entities MUST NOT send any further XML data until the TLS
negotiation is complete.
2. When using any of the mandatory-to-implement (MTI) ciphersuites
specified under <a href="#section-13.8">Section 13.8</a>, the receiving entity MUST present a
certificate.
3. So that mutual certificate authentication will be possible, the
receiving entity SHOULD send a certificate request to the
initiating entity, and the initiating entity SHOULD send a
certificate to the receiving entity (but for privacy reasons
might opt not to send a certificate until after the receiving
entity has authenticated to the initiating entity).
4. The receiving entity SHOULD choose which certificate to present
based on the domainpart contained in the 'to' attribute of the
initial stream header (in essence, this domainpart is
functionally equivalent to the Server Name Indication defined for
TLS in [<a href="#ref-TLS-EXT" title=""Transport Layer Security (TLS) Extensions: Extension Definitions"">TLS-EXT</a>]).
5. To determine if the TLS negotiation will succeed, the initiating
entity MUST attempt to validate the receiving entity's
certificate in accordance with the certificate validation
procedures specified under <a href="#section-13.7.2">Section 13.7.2</a>.
6. If the initiating entity presents a certificate, the receiving
entity too MUST attempt to validate the initiating entity's
certificate in accordance with the certificate validation
procedures specified under <a href="#section-13.7.2">Section 13.7.2</a>.
7. Following successful TLS negotiation, all further data
transmitted by either party MUST be protected with the negotiated
algorithms, keys, and secrets (i.e., encrypted, integrity-
protected, or both depending on the ciphersuite used).
Security Warning: See <a href="#section-13.8">Section 13.8</a> regarding ciphersuites that
MUST be supported for TLS; naturally, other ciphersuites MAY be
supported as well.
<span class="h5"><a class="selflink" id="section-5.4.3.2" href="#section-5.4.3.2">5.4.3.2</a>. TLS Failure</span>
If the TLS negotiation results in failure, the receiving entity MUST
terminate the TCP connection.
<span class="grey">Saint-Andre Standards Track [Page 75]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-76" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
The receiving entity MUST NOT send a closing </stream> tag before
terminating the TCP connection (since the failure has occurred at the
TLS layer, not the XMPP layer as described under <a href="#section-13.3">Section 13.3</a>).
The initiating entity MAY attempt to reconnect as explained under
<a href="#section-3.3">Section 3.3</a>, with or without attempting TLS negotiation (in
accordance with local service policy, user-configured preferences,
etc.).
<span class="h5"><a class="selflink" id="section-5.4.3.3" href="#section-5.4.3.3">5.4.3.3</a>. TLS Success</span>
If the TLS negotiation is successful, then the entities MUST proceed
as follows.
1. The initiating entity MUST discard any information transmitted in
layers above TCP that it obtained from the receiving entity in an
insecure manner before TLS took effect (e.g., the receiving
entity's 'from' address or the stream ID and stream features
received from the receiving entity).
2. The receiving entity MUST discard any information transmitted in
layers above TCP that it obtained from the initiating entity in
an insecure manner before TLS took effect (e.g., the initiating
entity's 'from' address).
3. The initiating entity MUST send a new initial stream header to
the receiving entity over the encrypted connection (as specified
under <a href="#section-4.3.3">Section 4.3.3</a>, the initiating entity MUST NOT send a
closing </stream> tag before sending the new initial stream
header, since the receiving entity and initiating entity MUST
consider the original stream to be replaced upon success of the
TLS negotiation).
I: <stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
4. The receiving entity MUST respond with a new response stream
header over the encrypted connection (for which it MUST generate
a new stream ID instead of reusing the old stream ID).
<span class="grey">Saint-Andre Standards Track [Page 76]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-77" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
R: <stream:stream
from='im.example.com'
id='vgKi/bkYME8OAj4rlXMkpucAqe4='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
5. The receiving entity also MUST send stream features to the
initiating entity, which MUST NOT include the STARTTLS feature
but which SHOULD include the SASL stream feature as described
under <a href="#section-6">Section 6</a> (see especially <a href="#section-6.4.1">Section 6.4.1</a> regarding the few
reasons why the SASL stream feature would not be offered here).
R: <stream:features>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>EXTERNAL</mechanism>
<mechanism>SCRAM-SHA-1-PLUS</mechanism>
<mechanism>SCRAM-SHA-1</mechanism>
<mechanism>PLAIN</mechanism>
</mechanisms>
</stream:features>
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. SASL Negotiation</span>
<span class="h3"><a class="selflink" id="section-6.1" href="#section-6.1">6.1</a>. Fundamentals</span>
XMPP includes a method for authenticating a stream by means of an
XMPP-specific profile of the Simple Authentication and Security Layer
protocol (see [<a href="#ref-SASL" title=""Simple Authentication and Security Layer (SASL)"">SASL</a>]). SASL provides a generalized method for adding
authentication support to connection-based protocols, and XMPP uses
an XML namespace profile of SASL that conforms to the profiling
requirements of [<a href="#ref-SASL" title=""Simple Authentication and Security Layer (SASL)"">SASL</a>]. The XML namespace name for the SASL
extension is 'urn:ietf:params:xml:ns:xmpp-sasl'.
<span class="h3"><a class="selflink" id="section-6.2" href="#section-6.2">6.2</a>. Support</span>
Support for SASL negotiation is REQUIRED in XMPP client and server
implementations.
<span class="h3"><a class="selflink" id="section-6.3" href="#section-6.3">6.3</a>. Stream Negotiation Rules</span>
<span class="h4"><a class="selflink" id="section-6.3.1" href="#section-6.3.1">6.3.1</a>. Mandatory-to-Negotiate</span>
The parties to a stream MUST consider SASL as mandatory-to-negotiate.
<span class="grey">Saint-Andre Standards Track [Page 77]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-78" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-6.3.2" href="#section-6.3.2">6.3.2</a>. Restart</span>
After SASL negotiation, the parties MUST restart the stream.
<span class="h4"><a class="selflink" id="section-6.3.3" href="#section-6.3.3">6.3.3</a>. Mechanism Preferences</span>
Any entity that will act as a SASL client or a SASL server MUST
maintain an ordered list of its preferred SASL mechanisms according
to the client or server, where the list is ordered according to local
policy or user configuration (which SHOULD be in order of perceived
strength to enable the strongest authentication possible). The
initiating entity MUST maintain its own preference order independent
of the preference order of the receiving entity. A client MUST try
SASL mechanisms in its preference order. For example, if the server
offers the ordered list "PLAIN SCRAM-SHA-1 GSSAPI" or "SCRAM-SHA-1
GSSAPI PLAIN" but the client's ordered list is "GSSAPI SCRAM-SHA-1",
the client MUST try GSSAPI first and then SCRAM-SHA-1 but MUST NOT
try PLAIN (since PLAIN is not on its list).
<span class="h4"><a class="selflink" id="section-6.3.4" href="#section-6.3.4">6.3.4</a>. Mechanism Offers</span>
If the receiving entity considers TLS negotiation (<a href="#section-5">Section 5</a>) to be
mandatory-to-negotiate before it will accept authentication with a
particular SASL mechanism, it MUST NOT advertise that mechanism in
its list of available SASL mechanisms before TLS negotiation has been
completed.
The receiving entity SHOULD offer the SASL EXTERNAL mechanism if both
of the following conditions hold:
1. During TLS negotiation the initiating entity presented a
certificate that is acceptable to the receiving entity for
purposes of strong identity verification in accordance with local
service policies (e.g., because said certificate is unexpired, is
unrevoked, and is anchored to a root trusted by the receiving
entity).
2. The receiving entity expects that the initiating entity will be
able to authenticate and authorize as the identity provided in
the certificate; in the case of a server-to-server stream, the
receiving entity might have such an expectation because a DNS
domain name presented in the initiating entity's certificate
matches the domain referenced in the 'from' attribute of the
initial stream header, where the matching rules of [<a href="#ref-TLS-CERTS" title=""Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)"">TLS-CERTS</a>]
apply; in the case of a client-to-server stream, the receiving
entity might have such an expectation because the bare JID
presented in the initiating entity's certificate matches a user
account that is registered with the server or because other
<span class="grey">Saint-Andre Standards Track [Page 78]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-79" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
information contained in the initiating entity's certificate
matches that of an entity that has permission to use the server
for access to an XMPP network.
However, the receiving entity MAY offer the SASL EXTERNAL mechanism
under other circumstances, as well.
When the receiving entity offers the SASL EXTERNAL mechanism, the
receiving entity SHOULD list the EXTERNAL mechanism first among its
offered SASL mechanisms and the initiating entity SHOULD attempt SASL
negotiation using the EXTERNAL mechanism first (this preference will
tend to increase the likelihood that the parties can negotiate mutual
certificate authentication).
<a href="#section-13.8">Section 13.8</a> specifies SASL mechanisms that MUST be supported;
naturally, other SASL mechanisms MAY be supported as well.
Informational Note: Best practices for the use of SASL in the
context of XMPP are described in [<a href="#ref-XEP-0175" title=""Best Practices for Use of SASL ANONYMOUS"">XEP-0175</a>] for the ANONYMOUS
mechanism and in [<a href="#ref-XEP-0178" title=""Best Practices for Use of SASL EXTERNAL with Certificates"">XEP-0178</a>] for the EXTERNAL mechanism.
<span class="h4"><a class="selflink" id="section-6.3.5" href="#section-6.3.5">6.3.5</a>. Data Formatting</span>
The following data formatting rules apply to the SASL negotiation:
1. During SASL negotiation, the entities MUST NOT send any
whitespace as separators between XML elements (i.e., from the
last character of the first-level <auth/> element qualified by
the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace as sent by the
initiating entity, until the last character of the first-level
<success/> element qualified by the
'urn:ietf:params:xml:ns:xmpp-sasl' namespace as sent by the
receiving entity). This prohibition helps to ensure proper
security layer byte precision. Any such whitespace shown in the
SASL examples provided in this document is included only for the
sake of readability.
2. Any XML character data contained within the XML elements MUST be
encoded using base 64, where the encoding adheres to the
definition in Section 4 of [<a href="#ref-BASE64" title=""The Base16, Base32, and Base64 Data Encodings"">BASE64</a>] and where the padding bits
are set to zero.
3. As formally specified in the XML schema for the
'urn:ietf:params:xml:ns:xmpp-sasl' namespace under <a href="#appendix-A.4">Appendix A.4</a>,
the receiving entity MAY include one or more application-specific
child elements inside the <mechanisms/> element to provide
information that might be needed by the initiating entity in
order to complete successful SASL negotiation using one or more
<span class="grey">Saint-Andre Standards Track [Page 79]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-80" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
of the offered mechanisms; however, the syntax and semantics of
all such elements are out of scope for this specification (see
[<a href="#ref-XEP-0233" title=""Domain-Based Service Names in XMPP SASL Negotiation"">XEP-0233</a>] for one example).
<span class="h4"><a class="selflink" id="section-6.3.6" href="#section-6.3.6">6.3.6</a>. Security Layers</span>
Upon successful SASL negotiation that involves negotiation of a
security layer, both the initiating entity and the receiving entity
MUST discard any application-layer state (i.e, state from the XMPP
layer, excluding state from the TLS negotiation or SASL negotiation).
<span class="h4"><a class="selflink" id="section-6.3.7" href="#section-6.3.7">6.3.7</a>. Simple User Name</span>
Some SASL mechanisms (e.g., CRAM-MD5, DIGEST-MD5, and SCRAM) specify
that the authentication identity used in the context of such
mechanisms is a "simple user name" (see Section 2 of [<a href="#ref-SASL" title=""Simple Authentication and Security Layer (SASL)"">SASL</a>] as well
as [<a href="#ref-SASLPREP" title=""SASLprep: Stringprep Profile for User Names and Passwords"">SASLPREP</a>]). The exact form of the simple user name in any
particular mechanism or deployment thereof is a local matter, and a
simple user name does not necessarily map to an application
identifier such as a JID or JID component (e.g., a localpart).
However, in the absence of local information provided by the server,
an XMPP client SHOULD assume that the authentication identity for
such a SASL mechanism is a simple user name equal to the localpart of
the user's JID.
<span class="h4"><a class="selflink" id="section-6.3.8" href="#section-6.3.8">6.3.8</a>. Authorization Identity</span>
An authorization identity is an OPTIONAL identity included by the
initiating entity to specify an identity to act as (see Section 2 of
[<a href="#ref-SASL" title=""Simple Authentication and Security Layer (SASL)"">SASL</a>]). In client-to-server streams, it would most likely be used
by an administrator to perform some management task on behalf of
another user, whereas in server-to-server streams it would most
likely be used to specify a particular add-on service at an XMPP
service (e.g., a multi-user chat server at conference.example.com
that is hosted by the example.com XMPP service). If the initiating
entity wishes to act on behalf of another entity and the selected
SASL mechanism supports transmission of an authorization identity,
the initiating entity MUST provide an authorization identity during
SASL negotiation. If the initiating entity does not wish to act on
behalf of another entity, it MUST NOT provide an authorization
identity.
In the case of client-to-server communication, the value of an
authorization identity MUST be a bare JID (<localpart@domainpart>)
rather than a full JID (<localpart@domainpart/resourcepart>).
In the case of server-to-server communication, the value of an
authorization identity MUST be a domainpart only (<domainpart>).
<span class="grey">Saint-Andre Standards Track [Page 80]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-81" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
If the initiating entity provides an authorization identity during
SASL negotiation, the receiving entity is responsible for verifying
that the initiating entity is in fact allowed to assume the specified
authorization identity; if not, the receiving entity MUST return an
<invalid-authzid/> SASL error as described under <a href="#section-6.5.6">Section 6.5.6</a>.
<span class="h4"><a class="selflink" id="section-6.3.9" href="#section-6.3.9">6.3.9</a>. Realms</span>
The receiving entity MAY include a realm when negotiating certain
SASL mechanisms (e.g., both the GSSAPI and DIGEST-MD5 mechanisms
allow the authentication exchange to include a realm, though in
different ways, whereas the EXTERNAL, SCRAM, and PLAIN mechanisms do
not). If the receiving entity does not communicate a realm, the
initiating entity MUST NOT assume that any realm exists. The realm
MUST be used only for the purpose of authentication; in particular,
an initiating entity MUST NOT attempt to derive an XMPP domainpart
from the realm information provided by the receiving entity.
<span class="h4"><a class="selflink" id="section-6.3.10" href="#section-6.3.10">6.3.10</a>. Round Trips</span>
[<a id="ref-SASL">SASL</a>] specifies that a using protocol such as XMPP can define two
methods by which the protocol can save round trips where allowed for
the SASL mechanism:
1. When the SASL client (the XMPP "initiating entity") requests an
authentication exchange, it can include "initial response" data
with its request if appropriate for the SASL mechanism in use.
In XMPP, this is done by including the initial response as the
XML character data of the <auth/> element.
2. At the end of the authentication exchange, the SASL server (the
XMPP "receiving entity") can include "additional data with
success" if appropriate for the SASL mechanism in use. In XMPP,
this is done by including the additional data as the XML
character data of the <success/> element.
For the sake of protocol efficiency, it is REQUIRED for clients and
servers to support these methods and RECOMMENDED to use them;
however, clients and servers MUST support the less efficient modes as
well.
<span class="grey">Saint-Andre Standards Track [Page 81]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-82" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-6.4" href="#section-6.4">6.4</a>. Process</span>
The process for SASL negotiation is as follows.
<span class="h4"><a class="selflink" id="section-6.4.1" href="#section-6.4.1">6.4.1</a>. Exchange of Stream Headers and Stream Features</span>
If SASL negotiation follows successful STARTTLS negotiation
(<a href="#section-5">Section 5</a>), then the SASL negotiation occurs over the protected
stream that has already been negotiated. If not, the initiating
entity resolves the FQDN of the receiving entity as specified under
<a href="#section-3">Section 3</a>, opens a TCP connection to the advertised port at the
resolved IP address, and sends an initial stream header to the
receiving entity. In either case, the receiving entity will receive
an initial stream from the initiating entity.
I: <stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
When the receiving entity processes an initial stream header from the
initiating entity, it MUST send a response stream header to the
initiating entity (for which it MUST generate a unique stream ID. If
TLS negotiation has already succeeded, then this stream ID MUST be
different from the stream ID sent before TLS negotiation succeeded).
R: <stream:stream
from='im.example.com'
id='vgKi/bkYME8OAj4rlXMkpucAqe4='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
The receiving entity also MUST send stream features to the initiating
entity. The stream features SHOULD include an advertisement for
support of SASL negotiation, i.e., a <mechanisms/> element qualified
by the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace. Typically there
are only three cases in which support for SASL negotiation would not
be advertised here:
<span class="grey">Saint-Andre Standards Track [Page 82]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-83" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
o TLS negotiation needs to happen before SASL can be offered (i.e.,
TLS is required and the receiving entity is responding to the very
first initial stream header it has received for this connection
attempt).
o SASL negotiation is impossible for a server-to-server connection
(i.e., the initiating server has not provided a certificate that
would enable strong authentication and therefore the receiving
server is falling back to weak identity verification using the
Server Dialback protocol [<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>]).
o SASL has already been negotiated (i.e., the receiving entity is
responding to an initial stream header sent as a stream restart
after successful SASL negotiation).
The <mechanisms/> element MUST contain one <mechanism/> child element
for each authentication mechanism the receiving entity offers to the
initiating entity. As noted, the order of <mechanism/> elements in
the XML indicates the preference order of the SASL mechanisms
according to the receiving entity (which is not necessarily the
preference order according to the initiating entity).
R: <stream:features>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>EXTERNAL</mechanism>
<mechanism>SCRAM-SHA-1-PLUS</mechanism>
<mechanism>SCRAM-SHA-1</mechanism>
<mechanism>PLAIN</mechanism>
</mechanisms>
</stream:features>
<span class="h4"><a class="selflink" id="section-6.4.2" href="#section-6.4.2">6.4.2</a>. Initiation</span>
In order to begin the SASL negotiation, the initiating entity sends
an <auth/> element qualified by the
'urn:ietf:params:xml:ns:xmpp-sasl' namespace and includes an
appropriate value for the 'mechanism' attribute, thus starting the
handshake for that particular authentication mechanism. This element
MAY contain XML character data (in SASL terminology, the "initial
response") if the mechanism supports or requires it. If the
initiating entity needs to send a zero-length initial response, it
MUST transmit the response as a single equals sign character ("="),
which indicates that the response is present but contains no data.
I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
<span class="grey">Saint-Andre Standards Track [Page 83]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-84" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
If the initiating entity subsequently sends another <auth/> element
and the ongoing authentication handshake has not yet completed, the
receiving entity MUST discard the ongoing handshake and MUST process
a new handshake for the subsequently requested SASL mechanism.
<span class="h4"><a class="selflink" id="section-6.4.3" href="#section-6.4.3">6.4.3</a>. Challenge-Response Sequence</span>
If necessary, the receiving entity challenges the initiating entity
by sending a <challenge/> element qualified by the
'urn:ietf:params:xml:ns:xmpp-sasl' namespace; this element MAY
contain XML character data (which MUST be generated in accordance
with the definition of the SASL mechanism chosen by the initiating
entity).
The initiating entity responds to the challenge by sending a
<response/> element qualified by the
'urn:ietf:params:xml:ns:xmpp-sasl' namespace; this element MAY
contain XML character data (which MUST be generated in accordance
with the definition of the SASL mechanism chosen by the initiating
entity).
If necessary, the receiving entity sends more challenges and the
initiating entity sends more responses.
This series of challenge/response pairs continues until one of three
things happens:
o The initiating entity aborts the handshake for this authentication
mechanism.
o The receiving entity reports failure of the handshake.
o The receiving entity reports success of the handshake.
These scenarios are described in the following sections.
<span class="h4"><a class="selflink" id="section-6.4.4" href="#section-6.4.4">6.4.4</a>. Abort</span>
The initiating entity aborts the handshake for this authentication
mechanism by sending an <abort/> element qualified by the
'urn:ietf:params:xml:ns:xmpp-sasl' namespace.
I: <abort xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
Upon receiving an <abort/> element, the receiving entity MUST return
a <failure/> element qualified by the
'urn:ietf:params:xml:ns:xmpp-sasl' namespace and containing an
<aborted/> child element.
<span class="grey">Saint-Andre Standards Track [Page 84]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-85" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<aborted/>
</failure>
<span class="h4"><a class="selflink" id="section-6.4.5" href="#section-6.4.5">6.4.5</a>. SASL Failure</span>
The receiving entity reports failure of the handshake for this
authentication mechanism by sending a <failure/> element qualified by
the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace (the particular
cause of failure MUST be communicated in an appropriate child element
of the <failure/> element as defined under <a href="#section-6.5">Section 6.5</a>).
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<not-authorized/>
</failure>
Where appropriate for the chosen SASL mechanism, the receiving entity
SHOULD allow a configurable but reasonable number of retries (at
least 2 and no more than 5); this enables the initiating entity
(e.g., an end-user client) to tolerate incorrectly provided
credentials (e.g., a mistyped password) without being forced to
reconnect (which it would if the receiving entity immediately
returned a SASL failure and closed the stream).
If the initiating entity attempts a reasonable number of retries with
the same SASL mechanism and all attempts fail, it MAY fall back to
the next mechanism in its ordered list by sending a new <auth/>
request to the receiving entity, thus starting a new handshake for
that authentication mechanism. If all handshakes fail and there are
no remaining mechanisms in the initiating entity's list of supported
and acceptable mechanisms, the initiating entity SHOULD simply close
the stream as described under <a href="#section-4.4">Section 4.4</a> (instead of waiting for the
stream to time out).
If the initiating entity exceeds the number of retries, the receiving
entity MUST close the stream with a stream error, which SHOULD be
<policy-violation/> (<a href="#section-4.9.3.14">Section 4.9.3.14</a>), although some existing
implementations send <not-authorized/> (<a href="#section-4.9.3.12">Section 4.9.3.12</a>) instead.
Implementation Note: For server-to-server streams, if the
receiving entity cannot offer the SASL EXTERNAL mechanism or any
other SASL mechanism based on the security context established
during TLS negotiation, the receiving entity MAY attempt to
complete weak identity verification using the Server Dialback
protocol [<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>]; however, if according to local service
policies weak identity verification is insufficient then the
<span class="grey">Saint-Andre Standards Track [Page 85]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-86" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
receiving entity SHOULD instead close the stream with a <policy-
violation/> stream error (<a href="#section-4.9.3.14">Section 4.9.3.14</a>) instead of waiting for
the stream to time out.
<span class="h4"><a class="selflink" id="section-6.4.6" href="#section-6.4.6">6.4.6</a>. SASL Success</span>
Before considering the SASL handshake to be a success, if the
initiating entity provided a 'from' attribute on an initial stream
header whose confidentiality and integrity were protected via TLS or
an equivalent security layer (such as the SASL GSSAPI mechanism) then
the receiving entity SHOULD correlate the authentication identity
resulting from the SASL negotiation with that 'from' address; if the
two identities do not match then the receiving entity SHOULD
terminate the connection attempt (however, the receiving entity might
have legitimate reasons not to terminate the connection attempt, for
example, because it has overridden a connecting client's address to
correct the JID format or assign a JID based on information presented
in an end-user certificate).
The receiving entity reports success of the handshake by sending a
<success/> element qualified by the
'urn:ietf:params:xml:ns:xmpp-sasl' namespace; this element MAY
contain XML character data (in SASL terminology, "additional data
with success") if the chosen SASL mechanism supports or requires it.
If the receiving entity needs to send additional data of zero length,
it MUST transmit the data as a single equals sign character ("=").
R: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
Informational Note: For client-to-server streams, the
authorization identity communicated during SASL negotiation is
used to determine the canonical address for the initiating client
according to the receiving server, as described under
<a href="#section-4.3.6">Section 4.3.6</a>.
Upon receiving the <success/> element, the initiating entity MUST
initiate a new stream over the existing TCP connection by sending a
new initial stream header to the receiving entity (as specified under
<a href="#section-4.3.3">Section 4.3.3</a>, the initiating entity MUST NOT send a closing
</stream> tag before sending the new initial stream header, since the
receiving entity and initiating entity MUST consider the original
stream to be replaced upon success of the SASL negotiation).
<span class="grey">Saint-Andre Standards Track [Page 86]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-87" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
I: <stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
Upon receiving the new initial stream header from the initiating
entity, the receiving entity MUST respond by sending a new response
stream header to the initiating entity (for which it MUST generate a
new stream ID instead of reusing the old stream ID).
R: <stream:stream
from='im.example.com'
id='gPybzaOzBmaADgxKXu9UClbprp0='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
The receiving entity MUST also send stream features, containing any
further available features or containing no features (via an empty
<features/> element).
R: <stream:features>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
</stream:features>
<span class="h3"><a class="selflink" id="section-6.5" href="#section-6.5">6.5</a>. SASL Errors</span>
The syntax of SASL errors is as follows, where the XML data shown
within the square brackets '[' and ']' is OPTIONAL.
<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<defined-condition/>
[<text xml:lang='langcode'>
OPTIONAL descriptive text
</text>]
</failure>
The "defined-condition" MUST be one of the SASL-related error
conditions defined in the following sections. However, because
additional error conditions might be defined in the future, if an
entity receives a SASL error condition that it does not understand
then it MUST treat the unknown condition as a generic authentication
failure, i.e., as equivalent to <not-authorized/> (<a href="#section-6.5.10">Section 6.5.10</a>).
<span class="grey">Saint-Andre Standards Track [Page 87]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-88" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Inclusion of the <text/> element is OPTIONAL, and can be used to
provide application-specific information about the error condition,
which information MAY be displayed to a human but only as a
supplement to the defined condition.
Because XMPP itself defines an application profile of SASL and there
is no expectation that more specialized XMPP applications will be
built on top of SASL, the SASL error format does not provide
extensibility for application-specific error conditions as is done
for XML streams (<a href="#section-4.9.4">Section 4.9.4</a>) and XML stanzas (<a href="#section-8.3.4">Section 8.3.4</a>).
<span class="h4"><a class="selflink" id="section-6.5.1" href="#section-6.5.1">6.5.1</a>. aborted</span>
The receiving entity acknowledges that the authentication handshake
has been aborted by the initiating entity; sent in reply to the
<abort/> element.
I: <abort xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<aborted/>
</failure>
<span class="h4"><a class="selflink" id="section-6.5.2" href="#section-6.5.2">6.5.2</a>. account-disabled</span>
The account of the initiating entity has been temporarily disabled;
sent in reply to an <auth/> element (with or without initial response
data) or a <response/> element.
I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<account-disabled/>
<text xml:lang='en'>Call 212-555-1212 for assistance.</text>
</failure>
<span class="h4"><a class="selflink" id="section-6.5.3" href="#section-6.5.3">6.5.3</a>. credentials-expired</span>
The authentication failed because the initiating entity provided
credentials that have expired; sent in reply to a <response/> element
or an <auth/> element with initial response data.
I: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
[ ... ]
</response>
<span class="grey">Saint-Andre Standards Track [Page 88]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-89" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<credentials-expired/>
</failure>
<span class="h4"><a class="selflink" id="section-6.5.4" href="#section-6.5.4">6.5.4</a>. encryption-required</span>
The mechanism requested by the initiating entity cannot be used
unless the confidentiality and integrity of the underlying stream are
protected (typically via TLS); sent in reply to an <auth/> element
(with or without initial response data).
I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<encryption-required/>
</failure>
<span class="h4"><a class="selflink" id="section-6.5.5" href="#section-6.5.5">6.5.5</a>. incorrect-encoding</span>
The data provided by the initiating entity could not be processed
because the base 64 encoding is incorrect (e.g., because the encoding
does not adhere to the definition in Section 4 of [<a href="#ref-BASE64" title=""The Base16, Base32, and Base64 Data Encodings"">BASE64</a>]); sent in
reply to a <response/> element or an <auth/> element with initial
response data.
I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='DIGEST-MD5'>[ ... ]</auth>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<incorrect-encoding/>
</failure>
<span class="h4"><a class="selflink" id="section-6.5.6" href="#section-6.5.6">6.5.6</a>. invalid-authzid</span>
The authzid provided by the initiating entity is invalid, either
because it is incorrectly formatted or because the initiating entity
does not have permissions to authorize that ID; sent in reply to a
<response/> element or an <auth/> element with initial response data.
I: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
[ ... ]
</response>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<invalid-authzid/>
</failure>
<span class="grey">Saint-Andre Standards Track [Page 89]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-90" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-6.5.7" href="#section-6.5.7">6.5.7</a>. invalid-mechanism</span>
The initiating entity did not specify a mechanism, or requested a
mechanism that is not supported by the receiving entity; sent in
reply to an <auth/> element.
I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='CRAM-MD5'/>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<invalid-mechanism/>
</failure>
<span class="h4"><a class="selflink" id="section-6.5.8" href="#section-6.5.8">6.5.8</a>. malformed-request</span>
The request is malformed (e.g., the <auth/> element includes initial
response data but the mechanism does not allow that, or the data sent
violates the syntax for the specified SASL mechanism); sent in reply
to an <abort/>, <auth/>, <challenge/>, or <response/> element.
(In the following example, the XML character data of the <auth/>
element contains more than 255 UTF-8-encoded Unicode characters and
therefore violates the "token" production for the SASL ANONYMOUS
mechanism as specified in [<a href="#ref-ANONYMOUS" title=""Anonymous Simple Authentication and Security Layer (SASL) Mechanism"">ANONYMOUS</a>].)
I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='ANONYMOUS'>[ ... some-long-token ... ]</auth>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<malformed-request/>
</failure>
<span class="h4"><a class="selflink" id="section-6.5.9" href="#section-6.5.9">6.5.9</a>. mechanism-too-weak</span>
The mechanism requested by the initiating entity is weaker than
server policy permits for that initiating entity; sent in reply to an
<auth/> element (with or without initial response data).
I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism-too-weak/>
</failure>
<span class="grey">Saint-Andre Standards Track [Page 90]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-91" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-6.5.10" href="#section-6.5.10">6.5.10</a>. not-authorized</span>
The authentication failed because the initiating entity did not
provide proper credentials, or because some generic authentication
failure has occurred but the receiving entity does not wish to
disclose specific information about the cause of the failure; sent in
reply to a <response/> element or an <auth/> element with initial
response data.
I: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
[ ... ]
</response>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<not-authorized/>
</failure>
Security Warning: This error condition includes but is not limited
to the case of incorrect credentials or a nonexistent username.
In order to discourage directory harvest attacks, no
differentiation is made between incorrect credentials and a
nonexistent username.
<span class="h4"><a class="selflink" id="section-6.5.11" href="#section-6.5.11">6.5.11</a>. temporary-auth-failure</span>
The authentication failed because of a temporary error condition
within the receiving entity, and it is advisable for the initiating
entity to try again later; sent in reply to an <auth/> element or a
<response/> element.
I: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
[ ... ]
</response>
R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<temporary-auth-failure/>
</failure>
<span class="h3"><a class="selflink" id="section-6.6" href="#section-6.6">6.6</a>. SASL Definition</span>
The profiling requirements of [<a href="#ref-SASL" title=""Simple Authentication and Security Layer (SASL)"">SASL</a>] require that the following
information be supplied by the definition of a using protocol.
service name: "xmpp"
initiation sequence: After the initiating entity provides an opening
XML stream header and the receiving entity replies in kind, the
receiving entity provides a list of acceptable authentication
<span class="grey">Saint-Andre Standards Track [Page 91]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-92" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
methods. The initiating entity chooses one method from the list
and sends it to the receiving entity as the value of the
'mechanism' attribute possessed by an <auth/> element, optionally
including an initial response to avoid a round trip.
exchange sequence: Challenges and responses are carried through the
exchange of <challenge/> elements from receiving entity to
initiating entity and <response/> elements from initiating entity
to receiving entity. The receiving entity reports failure by
sending a <failure/> element and success by sending a <success/>
element; the initiating entity aborts the exchange by sending an
<abort/> element. Upon successful negotiation, both sides
consider the original XML stream to be closed and new stream
headers are sent by both entities.
security layer negotiation: The security layer takes effect
immediately after sending the closing '>' character of the
<success/> element for the receiving entity, and immediately after
receiving the closing '>' character of the <success/> element for
the initiating entity. The order of layers is first [<a href="#ref-TCP" title=""Transmission Control Protocol"">TCP</a>], then
[<a href="#ref-TLS" title=""The Transport Layer Security (TLS) Protocol Version 1.2"">TLS</a>], then [<a href="#ref-SASL" title=""Simple Authentication and Security Layer (SASL)"">SASL</a>], then XMPP.
use of the authorization identity: The authorization identity can be
used in XMPP to denote the non-default <localpart@domainpart> of a
client; an empty string is equivalent to an absent authorization
identity.
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Resource Binding</span>
<span class="h3"><a class="selflink" id="section-7.1" href="#section-7.1">7.1</a>. Fundamentals</span>
After a client authenticates with a server, it MUST bind a specific
resource to the stream so that the server can properly address the
client. That is, there MUST be an XMPP resource associated with the
bare JID (<localpart@domainpart>) of the client, so that the address
for use over that stream is a full JID of the form
<localpart@domainpart/resource> (including the resourcepart). This
ensures that the server can deliver XML stanzas to and receive XML
stanzas from the client in relation to entities other than the server
itself or the client's account, as explained under <a href="#section-10">Section 10</a>.
Informational Note: The client could exchange stanzas with the
server itself or the client's account before binding a resource
since the full JID is needed only for addressing outside the
context of the stream negotiated between the client and the
server, but this is not commonly done.
<span class="grey">Saint-Andre Standards Track [Page 92]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-93" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
After a client has bound a resource to the stream, it is referred to
as a "connected resource". A server SHOULD allow an entity to
maintain multiple connected resources simultaneously, where each
connected resource is associated with a distinct XML stream and is
differentiated from the other connected resources by a distinct
resourcepart.
Security Warning: A server SHOULD enable the administrator of an
XMPP service to limit the number of connected resources in order
to prevent certain denial-of-service attacks as described under
<a href="#section-13.12">Section 13.12</a>.
If, before completing the resource binding step, the client attempts
to send an XML stanza to an entity other than the server itself or
the client's account, the server MUST NOT process the stanza and MUST
close the stream with a <not-authorized/> stream error
(<a href="#section-4.9.3.12">Section 4.9.3.12</a>).
The XML namespace name for the resource binding extension is
'urn:ietf:params:xml:ns:xmpp-bind'.
<span class="h3"><a class="selflink" id="section-7.2" href="#section-7.2">7.2</a>. Support</span>
Support for resource binding is REQUIRED in XMPP client and server
implementations.
<span class="h3"><a class="selflink" id="section-7.3" href="#section-7.3">7.3</a>. Stream Negotiation Rules</span>
<span class="h4"><a class="selflink" id="section-7.3.1" href="#section-7.3.1">7.3.1</a>. Mandatory-to-Negotiate</span>
The parties to a stream MUST consider resource binding as mandatory-
to-negotiate.
<span class="h4"><a class="selflink" id="section-7.3.2" href="#section-7.3.2">7.3.2</a>. Restart</span>
After resource binding, the parties MUST NOT restart the stream.
<span class="h3"><a class="selflink" id="section-7.4" href="#section-7.4">7.4</a>. Advertising Support</span>
Upon sending a new response stream header to the client after
successful SASL negotiation, the server MUST include a <bind/>
element qualified by the 'urn:ietf:params:xml:ns:xmpp-bind' namespace
in the stream features it presents to the client.
The server MUST NOT include the resource binding stream feature until
after the client has authenticated, typically by means of successful
SASL negotiation.
<span class="grey">Saint-Andre Standards Track [Page 93]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-94" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S: <stream:stream
from='im.example.com'
id='gPybzaOzBmaADgxKXu9UClbprp0='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
S: <stream:features>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
</stream:features>
Upon being informed that resource binding is mandatory-to-negotiate,
the client MUST bind a resource to the stream as described in the
following sections.
<span class="h3"><a class="selflink" id="section-7.5" href="#section-7.5">7.5</a>. Generation of Resource Identifiers</span>
A resourcepart MUST at a minimum be unique among the connected
resources for that <localpart@domainpart>. Enforcement of this
policy is the responsibility of the server.
Security Warning: A resourcepart can be security-critical. For
example, if a malicious entity can guess a client's resourcepart
then it might be able to determine if the client (and therefore
the controlling principal) is online or offline, thus resulting in
a presence leak as described under <a href="#section-13.10.2">Section 13.10.2</a>. To prevent
that possibility, a client can either (1) generate a random
resourcepart on its own or (2) ask the server to generate a
resourcepart on its behalf. One method for ensuring that the
resourcepart is random is to generate a Universally Unique
Identifier (UUID) as specified in [<a href="#ref-UUID" title=""A Universally Unique IDentifier (UUID) URN Namespace"">UUID</a>].
<span class="h3"><a class="selflink" id="section-7.6" href="#section-7.6">7.6</a>. Server-Generated Resource Identifier</span>
A server MUST be able to generate an XMPP resourcepart on behalf of a
client. The resourcepart generated by the server MUST be random (see
[<a href="#ref-RANDOM" title=""Randomness Requirements for Security"">RANDOM</a>]).
<span class="h4"><a class="selflink" id="section-7.6.1" href="#section-7.6.1">7.6.1</a>. Success Case</span>
A client requests a server-generated resourcepart by sending an IQ
stanza of type "set" (see <a href="#section-8.2.3">Section 8.2.3</a>) containing an empty <bind/>
element qualified by the 'urn:ietf:params:xml:ns:xmpp-bind'
namespace.
<span class="grey">Saint-Andre Standards Track [Page 94]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-95" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
C: <iq id='tn281v37' type='set'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
</iq>
Once the server has generated an XMPP resourcepart for the client, it
MUST return an IQ stanza of type "result" to the client, which MUST
include a <jid/> child element that specifies the full JID for the
connected resource as determined by the server.
S: <iq id='tn281v37' type='result'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>
juliet@im.example.com/4db06f06-1ea4-11dc-aca3-000bcd821bfb
</jid>
</bind>
</iq>
<span class="h4"><a class="selflink" id="section-7.6.2" href="#section-7.6.2">7.6.2</a>. Error Cases</span>
When a client asks the server to generate a resourcepart during
resource binding, the following stanza error conditions are defined:
o The account has reached a limit on the number of simultaneous
connected resources allowed.
o The client is otherwise not allowed to bind a resource to the
stream.
Naturally, it is possible that error conditions not specified here
might occur, as described under <a href="#section-8.3">Section 8.3</a>.
<span class="h5"><a class="selflink" id="section-7.6.2.1" href="#section-7.6.2.1">7.6.2.1</a>. Resource Constraint</span>
If the account has reached a limit on the number of simultaneous
connected resources allowed, the server MUST return a <resource-
constraint/> stanza error (<a href="#section-8.3.3.18">Section 8.3.3.18</a>).
S: <iq id='tn281v37' type='error'>
<error type='wait'>
<resource-constraint
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
<span class="grey">Saint-Andre Standards Track [Page 95]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-96" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h5"><a class="selflink" id="section-7.6.2.2" href="#section-7.6.2.2">7.6.2.2</a>. Not Allowed</span>
If the client is otherwise not allowed to bind a resource to the
stream, the server MUST return a <not-allowed/> stanza error
(<a href="#section-8.3.3.10">Section 8.3.3.10</a>).
S: <iq id='tn281v37' type='error'>
<error type='cancel'>
<not-allowed
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
<span class="h3"><a class="selflink" id="section-7.7" href="#section-7.7">7.7</a>. Client-Submitted Resource Identifier</span>
Instead of asking the server to generate a resourcepart on its
behalf, a client MAY attempt to submit a resourcepart that it has
generated or that the controlling user has provided.
<span class="h4"><a class="selflink" id="section-7.7.1" href="#section-7.7.1">7.7.1</a>. Success Case</span>
A client asks its server to accept a client-submitted resourcepart by
sending an IQ stanza of type "set" containing a <bind/> element with
a child <resource/> element containing non-zero-length XML character
data.
C: <iq id='wy2xa82b4' type='set'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>balcony</resource>
</bind>
</iq>
The server SHOULD accept the client-submitted resourcepart. It does
so by returning an IQ stanza of type "result" to the client,
including a <jid/> child element that specifies the full JID for the
connected resource and contains without modification the client-
submitted text.
S: <iq id='wy2xa82b4' type='result'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>juliet@im.example.com/balcony</jid>
</bind>
</iq>
Alternatively, in accordance with local service policies the server
MAY refuse the client-submitted resourcepart and override it with a
resourcepart that the server generates.
<span class="grey">Saint-Andre Standards Track [Page 96]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-97" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S: <iq id='wy2xa82b4' type='result'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>
juliet@im.example.com/balcony 4db06f06-1ea4-11dc-aca3-000bcd821bfb
</jid>
</bind>
</iq>
<span class="h4"><a class="selflink" id="section-7.7.2" href="#section-7.7.2">7.7.2</a>. Error Cases</span>
When a client attempts to submit its own XMPP resourcepart during
resource binding, the following stanza error conditions are defined
in addition to those described under <a href="#section-7.6.2">Section 7.6.2</a>:
o The provided resourcepart cannot be processed by the server.
o The provided resourcepart is already in use.
Naturally, it is possible that error conditions not specified here
might occur, as described under <a href="#section-8.3">Section 8.3</a>.
<span class="h5"><a class="selflink" id="section-7.7.2.1" href="#section-7.7.2.1">7.7.2.1</a>. Bad Request</span>
If the provided resourcepart cannot be processed by the server (e.g.,
because it is of zero length or because it otherwise violates the
rules for resourceparts specified in [<a href="#ref-XMPP-ADDR" title=""Extensible Messaging and Presence Protocol (XMPP): Address Format"">XMPP-ADDR</a>]), the server can
return a <bad-request/> stanza error (<a href="#section-8.3.3.1">Section 8.3.3.1</a>) but SHOULD
instead process the resourcepart so that it is in conformance.
S: <iq id='wy2xa82b4' type='error'>
<error type='modify'>
<bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
<span class="h5"><a class="selflink" id="section-7.7.2.2" href="#section-7.7.2.2">7.7.2.2</a>. Conflict</span>
If there is a currently connected client whose session has the
resourcepart being requested by the newly connecting client, the
server MUST do one of the following (which of these the server does
is a matter for implementation or local service policy, although
suggestions are provided below).
1. Override the resourcepart provided by the newly connecting client
with a server-generated resourcepart. This behavior is
encouraged, because it simplifies the resource binding process
for client implementations.
<span class="grey">Saint-Andre Standards Track [Page 97]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-98" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
2. Disallow the resource binding attempt of the newly connecting
client and maintain the session of the currently connected
client. This behavior is neither encouraged nor discouraged,
despite the fact that it was implicitly encouraged in <a href="./rfc3920">RFC 3920</a>;
however, note that handling of the <conflict/> error is unevenly
supported among existing client implementations, which often
treat it as an authentication error and have been observed to
discard cached credentials when receiving it.
3. Terminate the session of the currently connected client and allow
the resource binding attempt of the newly connecting client.
Although this was the traditional behavior of early XMPP server
implementations, it is now discouraged because it can lead to a
never-ending cycle of two clients effectively disconnecting each
other; however, note that this behavior can be appropriate in
some deployment scenarios or if the server knows that the
currently connected client has a dead connection or broken stream
as described under <a href="#section-4.6">Section 4.6</a>.
If the server follows behavior #1, it returns an <iq/> stanza of type
"result" to the newly connecting client, where the <jid/> child of
the <bind/> element contains XML character data that indicates the
full JID of the client, including the resourcepart that was generated
by the server.
S: <iq id='wy2xa82b4' type='result'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>
juliet@im.example.com/balcony 4db06f06-1ea4-11dc-aca3-000bcd821bfb
</jid>
</bind>
</iq>
If the server follows behavior #2, it sends a <conflict/> stanza
error (<a href="#section-8.3.3.2">Section 8.3.3.2</a>) in response to the resource binding attempt
of the newly connecting client but maintains the XML stream so that
the newly connecting client has an opportunity to negotiate a non-
conflicting resourcepart (i.e., the newly connecting client needs to
choose a different resourcepart before making another attempt to bind
a resource).
S: <iq id='wy2xa82b4' type='error'>
<error type='modify'>
<conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
<span class="grey">Saint-Andre Standards Track [Page 98]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-99" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
If the server follows behavior #3, it returns a <conflict/> stream
error (<a href="#section-4.9.3.3">Section 4.9.3.3</a>) to the currently connected client (as
described under <a href="#section-4.9.3.3">Section 4.9.3.3</a>) and returns an IQ stanza of type
"result" (indicating success) in response to the resource binding
attempt of the newly connecting client.
S: <iq id='wy2xa82b4' type='result'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>
juliet@im.example.com/balcony
</jid>
</bind>
</iq>
<span class="h4"><a class="selflink" id="section-7.7.3" href="#section-7.7.3">7.7.3</a>. Retries</span>
If an error occurs when a client submits a resourcepart, the server
SHOULD allow a configurable but reasonable number of retries (at
least 5 and no more than 10); this enables the client to tolerate
incorrectly provided resourceparts (e.g., bad data formats or
duplicate text strings) without being forced to reconnect.
After the client has reached the retry limit, the server MUST close
the stream with a <policy-violation/> stream error
(<a href="#section-4.9.3.14">Section 4.9.3.14</a>).
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. XML Stanzas</span>
After a client and a server (or two servers) have completed stream
negotiation, either party can send XML stanzas. Three kinds of XML
stanza are defined for the 'jabber:client' and 'jabber:server'
namespaces: <message/>, <presence/>, and <iq/>. In addition, there
are five common attributes for these stanza types. These common
attributes, as well as the basic semantics of the three stanza types,
are defined in this specification; more detailed information
regarding the syntax of XML stanzas for instant messaging and
presence applications is provided in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>], and for other
applications in the relevant XMPP extension specifications.
Support for the XML stanza syntax and semantics defined in this
specification is REQUIRED in XMPP client and server implementations.
Security Warning: A server MUST NOT process a partial stanza and
MUST NOT attach meaning to the transmission timing of any part of
a stanza (before receipt of the closing tag).
<span class="grey">Saint-Andre Standards Track [Page 99]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-100" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-8.1" href="#section-8.1">8.1</a>. Common Attributes</span>
The following five attributes are common to message, presence, and IQ
stanzas.
<span class="h4"><a class="selflink" id="section-8.1.1" href="#section-8.1.1">8.1.1</a>. to</span>
The 'to' attribute specifies the JID of the intended recipient for
the stanza.
<message to='romeo@example.net'>
<body>Art thou not Romeo, and a Montague?</body>
</message>
For information about server processing of inbound and outbound XML
stanzas based on the 'to' address, refer to <a href="#section-10">Section 10</a>.
<span class="h5"><a class="selflink" id="section-8.1.1.1" href="#section-8.1.1.1">8.1.1.1</a>. Client-to-Server Streams</span>
The following rules apply to inclusion of the 'to' attribute in
stanzas sent from a connected client to its server over an XML stream
qualified by the 'jabber:client' namespace.
1. A stanza with a specific intended recipient (e.g., a conversation
partner, a remote service, the server itself, even another
resource associated with the user's bare JID) MUST possess a 'to'
attribute whose value is an XMPP address.
2. A stanza sent from a client to a server for direct processing by
the server (e.g., roster processing as described in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>] or
presence sent to the server for broadcasting to other entities)
MUST NOT possess a 'to' attribute.
The following rules apply to inclusion of the 'to' attribute in
stanzas sent from a server to a connected client over an XML stream
qualified by the 'jabber:client' namespace.
1. If the server has received the stanza from another connected
client or from a peer server, the server MUST NOT modify the 'to'
address before delivering the stanza to the client.
2. If the server has itself generated the stanza (e.g., a response
to an IQ stanza of type "get" or "set", even if the stanza did
not include a 'to' address), the stanza MAY include a 'to'
address, which MUST be the full JID of the client; however, if
the stanza does not include a 'to' address then the client MUST
treat it as if the 'to' address were included with a value of the
client's full JID.
<span class="grey">Saint-Andre Standards Track [Page 100]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-101" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Implementation Note: It is the server's responsibility to deliver
only stanzas that are addressed to the client's full JID or the
user's bare JID; thus, there is no need for the client to check
the 'to' address of incoming stanzas. However, if the client does
check the 'to' address then it is suggested to check at most the
bare JID portion (not the full JID), since the 'to' address might
be the user's bare JID, the client's current full JID, or even a
full JID with a different resourcepart (e.g., in the case of so-
called "offline messages" as described in [<a href="#ref-XEP-0160" title=""Best Practices for Handling Offline Messages"">XEP-0160</a>]).
<span class="h5"><a class="selflink" id="section-8.1.1.2" href="#section-8.1.1.2">8.1.1.2</a>. Server-to-Server Streams</span>
The following rules apply to inclusion of the 'to' attribute in the
context of XML streams qualified by the 'jabber:server' namespace
(i.e., server-to-server streams).
1. A stanza MUST possess a 'to' attribute whose value is an XMPP
address; if a server receives a stanza that does not meet this
restriction, it MUST close the stream with an <improper-
addressing/> stream error (<a href="#section-4.9.3.7">Section 4.9.3.7</a>).
2. The domainpart of the JID contained in the stanza's 'to'
attribute MUST match the FQDN of the receiving server (or any
validated domain thereof) as communicated via SASL negotiation
(see <a href="#section-6">Section 6</a>), Server Dialback (see [<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>]), or similar
means; if a server receives a stanza that does not meet this
restriction, it MUST close the stream with a <host-unknown/>
stream error (<a href="#section-4.9.3.6">Section 4.9.3.6</a>) or a <host-gone/> stream error
(<a href="#section-4.9.3.5">Section 4.9.3.5</a>).
<span class="h4"><a class="selflink" id="section-8.1.2" href="#section-8.1.2">8.1.2</a>. from</span>
The 'from' attribute specifies the JID of the sender.
<message from='juliet@im.example.com/balcony'
to='romeo@example.net'>
<body>Art thou not Romeo, and a Montague?</body>
</message>
<span class="h5"><a class="selflink" id="section-8.1.2.1" href="#section-8.1.2.1">8.1.2.1</a>. Client-to-Server Streams</span>
The following rules apply to the 'from' attribute in the context of
XML streams qualified by the 'jabber:client' namespace (i.e., client-
to-server streams).
1. When a server receives an XML stanza from a connected client, the
server MUST add a 'from' attribute to the stanza or override the
'from' attribute specified by the client, where the value of the
<span class="grey">Saint-Andre Standards Track [Page 101]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-102" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
'from' attribute MUST be the full JID
(<localpart@domainpart/resource>) determined by the server for
the connected resource that generated the stanza (see
<a href="#section-4.3.6">Section 4.3.6</a>), or the bare JID (<localpart@domainpart>) in the
case of subscription-related presence stanzas (see [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]).
2. When the server generates a stanza on its own behalf for delivery
to the client from the server itself, the stanza MUST include a
'from' attribute whose value is the bare JID (i.e., <domainpart>)
of the server as agreed upon during stream negotiation (e.g.,
based on the 'to' attribute of the initial stream header).
3. When the server generates a stanza from the server for delivery
to the client on behalf of the account of the connected client
(e.g., in the context of data storage services provided by the
server on behalf of the client), the stanza MUST either (a) not
include a 'from' attribute or (b) include a 'from' attribute
whose value is the account's bare JID (<localpart@domainpart>).
4. A server MUST NOT send to the client a stanza without a 'from'
attribute if the stanza was not generated by the server on its
own behalf (e.g., if it was generated by another client or a peer
server and the server is merely delivering it to the client on
behalf of some other entity); therefore, when a client receives a
stanza that does not include a 'from' attribute, it MUST assume
that the stanza is from the user's account on the server.
<span class="h5"><a class="selflink" id="section-8.1.2.2" href="#section-8.1.2.2">8.1.2.2</a>. Server-to-Server Streams</span>
The following rules apply to the 'from' attribute in the context of
XML streams qualified by the 'jabber:server' namespace (i.e., server-
to-server streams).
1. A stanza MUST possess a 'from' attribute whose value is an XMPP
address; if a server receives a stanza that does not meet this
restriction, it MUST close the stream with an <improper-
addressing/> stream error (<a href="#section-4.9.3.7">Section 4.9.3.7</a>).
2. The domainpart of the JID contained in the stanza's 'from'
attribute MUST match the FQDN of the sending server (or any
validated domain thereof) as communicated via SASL negotiation
(see <a href="#section-6">Section 6</a>), Server Dialback (see [<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>]), or similar
means; if a server receives a stanza that does not meet this
restriction, it MUST close the stream with an <invalid-from/>
stream error (<a href="#section-4.9.3.9">Section 4.9.3.9</a>).
Enforcement of these rules helps to prevent certain denial-of-service
attacks as described under <a href="#section-13.12">Section 13.12</a>.
<span class="grey">Saint-Andre Standards Track [Page 102]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-103" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-8.1.3" href="#section-8.1.3">8.1.3</a>. id</span>
The 'id' attribute is used by the originating entity to track any
response or error stanza that it might receive in relation to the
generated stanza from another entity (such as an intermediate server
or the intended recipient).
It is up to the originating entity whether the value of the 'id'
attribute is unique only within its current stream or unique
globally.
For <message/> and <presence/> stanzas, it is RECOMMENDED for the
originating entity to include an 'id' attribute; for <iq/> stanzas,
it is REQUIRED.
If the generated stanza includes an 'id' attribute then it is
REQUIRED for the response or error stanza to also include an 'id'
attribute, where the value of the 'id' attribute MUST match that of
the generated stanza.
The semantics of IQ stanzas impose additional restrictions as
described under <a href="#section-8.2.3">Section 8.2.3</a>.
<span class="h4"><a class="selflink" id="section-8.1.4" href="#section-8.1.4">8.1.4</a>. type</span>
The 'type' attribute specifies the purpose or context of the message,
presence, or IQ stanza. The particular allowable values for the
'type' attribute vary depending on whether the stanza is a message,
presence, or IQ stanza. The defined values for message and presence
stanzas are specific to instant messaging and presence applications
and therefore are defined in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>], whereas the values for IQ
stanzas specify the part of the semantics for all structured request-
response exchanges (no matter what the payload) and therefore are
specified under <a href="#section-8.2.3">Section 8.2.3</a>. The only 'type' value common to all
three kinds of stanzas is "error" as described under <a href="#section-8.3">Section 8.3</a>.
<span class="h4"><a class="selflink" id="section-8.1.5" href="#section-8.1.5">8.1.5</a>. xml:lang</span>
A stanza SHOULD possess an 'xml:lang' attribute (as defined in
Section 2.12 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>]) if the stanza contains XML character data that
is intended to be presented to a human user (as explained in
[<a href="#ref-CHARSETS" title=""IETF Policy on Character Sets and Languages"">CHARSETS</a>], "internationalization is for humans"). The value of the
'xml:lang' attribute specifies the default language of any such
human-readable XML character data.
<span class="grey">Saint-Andre Standards Track [Page 103]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-104" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<presence from='romeo@example.net/orchard' xml:lang='en'>
<show>dnd</show>
<status>Wooing Juliet</status>
</presence>
The value of the 'xml:lang' attribute MAY be overridden by the 'xml:
lang' attribute of a specific child element.
<presence from='romeo@example.net/orchard' xml:lang='en'>
<show>dnd</show>
<status>Wooing Juliet</status>
<status xml:lang='cs'>Dvo&#x0159;&#x00ED;m se Julii</status>
</presence>
If an outbound stanza generated by a client does not possess an 'xml:
lang' attribute, the client's server SHOULD add an 'xml:lang'
attribute whose value is that specified for the client's output
stream as defined under <a href="#section-4.7.4">Section 4.7.4</a>.
C: <presence from='romeo@example.net/orchard'>
<show>dnd</show>
<status>Wooing Juliet</status>
</presence>
S: <presence from='romeo@example.net/orchard'
to='juliet@im.example.com'
xml:lang='en'>
<show>dnd</show>
<status>Wooing Juliet</status>
</presence>
If an inbound stanza received by a client or server does not possess
an 'xml:lang' attribute, an implementation MUST assume that the
default language is that specified for the entity's input stream as
defined under <a href="#section-4.7.4">Section 4.7.4</a>.
The value of the 'xml:lang' attribute MUST conform to the NMTOKEN
datatype (as defined in Section 2.3 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>]) and MUST conform to the
format defined in [<a href="#ref-LANGTAGS" title=""Tags for Identifying Languages"">LANGTAGS</a>].
A server MUST NOT modify or delete 'xml:lang' attributes on stanzas
it receives from other entities.
<span class="grey">Saint-Andre Standards Track [Page 104]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-105" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-8.2" href="#section-8.2">8.2</a>. Basic Semantics</span>
<span class="h4"><a class="selflink" id="section-8.2.1" href="#section-8.2.1">8.2.1</a>. Message Semantics</span>
The <message/> stanza is a "push" mechanism whereby one entity pushes
information to another entity, similar to the communications that
occur in a system such as email. All message stanzas will possess a
'to' attribute that specifies the intended recipient of the message
(see <a href="#section-8.1.1">Section 8.1.1</a> and <a href="#section-10.3">Section 10.3</a>), unless the message is being
sent to the bare JID of a connected client's account. Upon receiving
a message stanza with a 'to' address, a server SHOULD attempt to
route or deliver it to the intended recipient (see <a href="#section-10">Section 10</a> for
general routing and delivery rules related to XML stanzas).
<span class="h4"><a class="selflink" id="section-8.2.2" href="#section-8.2.2">8.2.2</a>. Presence Semantics</span>
The <presence/> stanza is a specialized "broadcast" or "publish-
subscribe" mechanism, whereby multiple entities receive information
(in this case, network availability information) about an entity to
which they have subscribed. In general, a publishing client SHOULD
send a presence stanza with no 'to' attribute, in which case the
server to which the client is connected will broadcast that stanza to
all subscribed entities. However, a publishing client MAY also send
a presence stanza with a 'to' attribute, in which case the server
will route or deliver that stanza to the intended recipient.
Although the <presence/> stanza is most often used by XMPP clients,
it can also be used by servers, add-on services, and any other kind
of XMPP entity. See <a href="#section-10">Section 10</a> for general routing and delivery
rules related to XML stanzas, and [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>] for rules specific to
presence applications.
<span class="h4"><a class="selflink" id="section-8.2.3" href="#section-8.2.3">8.2.3</a>. IQ Semantics</span>
Info/Query, or IQ, is a "request-response" mechanism, similar in some
ways to the Hypertext Transfer Protocol [<a href="#ref-HTTP" title=""Hypertext Transfer Protocol -- HTTP/1.1"">HTTP</a>]. The semantics of IQ
enable an entity to make a request of, and receive a response from,
another entity. The data content of the request and response is
defined by the schema or other structural definition associated with
the XML namespace that qualifies the direct child element of the IQ
element (see <a href="#section-8.4">Section 8.4</a>), and the interaction is tracked by the
requesting entity through use of the 'id' attribute. Thus, IQ
interactions follow a common pattern of structured data exchange such
as get/result or set/result (although an error can be returned in
reply to a request if appropriate):
<span class="grey">Saint-Andre Standards Track [Page 105]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-106" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Requesting Responding
Entity Entity
---------- ----------
| |
| <iq id='1' type='get'> |
| [ ... payload ... ] |
| </iq> |
| -------------------------> |
| |
| <iq id='1' type='result'> |
| [ ... payload ... ] |
| </iq> |
| <------------------------- |
| |
| <iq id='2' type='set'> |
| [ ... payload ... ] |
| </iq> |
| -------------------------> |
| |
| <iq id='2' type='error'> |
| [ ... condition ... ] |
| </iq> |
| <------------------------- |
| |
Figure 5: Semantics of IQ Stanzas
To enforce these semantics, the following rules apply:
1. The 'id' attribute is REQUIRED for IQ stanzas.
2. The 'type' attribute is REQUIRED for IQ stanzas. The value MUST
be one of the following; if not, the recipient or an intermediate
router MUST return a <bad-request/> stanza error
(<a href="#section-8.3.3.1">Section 8.3.3.1</a>).
* get -- The stanza requests information, inquires about what
data is needed in order to complete further operations, etc.
* set -- The stanza provides data that is needed for an
operation to be completed, sets new values, replaces existing
values, etc.
* result -- The stanza is a response to a successful get or set
request.
<span class="grey">Saint-Andre Standards Track [Page 106]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-107" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
* error -- The stanza reports an error that has occurred
regarding processing or delivery of a get or set request (see
<a href="#section-8.3">Section 8.3</a>).
3. An entity that receives an IQ request of type "get" or "set" MUST
reply with an IQ response of type "result" or "error". The
response MUST preserve the 'id' attribute of the request (or be
empty if the generated stanza did not include an 'id' attribute).
4. An entity that receives a stanza of type "result" or "error" MUST
NOT respond to the stanza by sending a further IQ response of
type "result" or "error"; however, the requesting entity MAY send
another request (e.g., an IQ of type "set" to provide obligatory
information discovered through a get/result pair).
5. An IQ stanza of type "get" or "set" MUST contain exactly one
child element, which specifies the semantics of the particular
request.
6. An IQ stanza of type "result" MUST include zero or one child
elements.
7. An IQ stanza of type "error" MAY include the child element
contained in the associated "get" or "set" and MUST include an
<error/> child; for details, see <a href="#section-8.3">Section 8.3</a>.
<span class="h3"><a class="selflink" id="section-8.3" href="#section-8.3">8.3</a>. Stanza Errors</span>
Stanza-related errors are handled in a manner similar to stream
errors (<a href="#section-4.9">Section 4.9</a>). Unlike stream errors, stanza errors are
recoverable; therefore, they do not result in termination of the XML
stream and underlying TCP connection. Instead, the entity that
discovers the error condition returns an error stanza, which is a
stanza that:
o is of the same kind (message, presence, or IQ) as the generated
stanza that triggered the error
o has a 'type' attribute set to a value of "error"
o typically swaps the 'from' and 'to' addresses of the generated
stanza
o mirrors the 'id' attribute (if any) of the generated stanza that
triggered the error
<span class="grey">Saint-Andre Standards Track [Page 107]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-108" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
o contains an <error/> child element that specifies the error
condition and therefore provides a hint regarding actions that the
sender might be able to take in an effort to remedy the error
(however, it is not always possible to remedy the error)
<span class="h4"><a class="selflink" id="section-8.3.1" href="#section-8.3.1">8.3.1</a>. Rules</span>
The following rules apply to stanza errors:
1. The receiving or processing entity that detects an error
condition in relation to a stanza SHOULD return an error stanza
(and MUST do so for IQ stanzas).
2. The error stanza SHOULD simply swap the 'from' and 'to' addresses
from the generated stanza, unless doing so would (1) result in an
information leak (see under <a href="#section-13.10">Section 13.10</a>) or other breach of
security, or (2) force the sender of the error stanza to include
a malformed JID in the 'from' or 'to' address of the error
stanza.
3. If the generated stanza was <message/> or <presence/> and
included an 'id' attribute then it is REQUIRED for the error
stanza to also include an 'id' attribute. If the generated
stanza was <iq/> then the error stanza MUST include an 'id'
attribute. In all cases, the value of the 'id' attribute MUST
match that of the generated stanza (or be empty if the generated
stanza did not include an 'id' attribute).
4. An error stanza MUST contain an <error/> child element.
5. The entity that returns an error stanza MAY pass along its JID to
the sender of the generated stanza (e.g., for diagnostic or
tracking purposes) through the addition of a 'by' attribute to
the <error/> child element.
6. The entity that returns an error stanza MAY include the original
XML sent so that the sender can inspect and, if necessary,
correct the XML before attempting to resend (however, this is a
courtesy only and the originating entity MUST NOT depend on
receiving the original payload). Naturally, the entity MUST NOT
include the original data if it not well-formed XML, violates the
XML restrictions of XMPP (see under <a href="#section-11.1">Section 11.1</a>), or is
otherwise harmful (e.g., exceeds a size limit).
7. An <error/> child MUST NOT be included if the 'type' attribute
has a value other than "error" (or if there is no 'type'
attribute).
<span class="grey">Saint-Andre Standards Track [Page 108]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-109" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
8. An entity that receives an error stanza MUST NOT respond to the
stanza with a further error stanza; this helps to prevent
looping.
<span class="h4"><a class="selflink" id="section-8.3.2" href="#section-8.3.2">8.3.2</a>. Syntax</span>
The syntax for stanza-related errors is as follows, where XML data
shown within the square brackets '[' and ']' is OPTIONAL, 'intended-
recipient' is the JID of the entity to which the original stanza was
addressed, 'sender' is the JID of the originating entity, and 'error-
generator' is the entity that detects the fact that an error has
occurred and thus returns an error stanza.
<stanza-kind from='intended-recipient' to='sender' type='error'>
[OPTIONAL to include sender XML here]
<error [by='error-generator']
type='error-type'>
<defined-condition xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
[<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'
xml:lang='langcode'>
OPTIONAL descriptive text
</text>]
[OPTIONAL application-specific condition element]
</error>
</stanza-kind>
The "stanza-kind" MUST be one of message, presence, or iq.
The "error-type" MUST be one of the following:
o auth -- retry after providing credentials
o cancel -- do not retry (the error cannot be remedied)
o continue -- proceed (the condition was only a warning)
o modify -- retry after changing the data sent
o wait -- retry after waiting (the error is temporary)
The "defined-condition" MUST correspond to one of the stanza error
conditions defined under <a href="#section-8.3.3">Section 8.3.3</a>. However, because additional
error conditions might be defined in the future, if an entity
receives a stanza error condition that it does not understand then it
MUST treat the unknown condition as equivalent to <undefined-
condition/> (<a href="#section-8.3.3.21">Section 8.3.3.21</a>). If the designers of an XMPP protocol
extension or the developers of an XMPP implementation need to
communicate a stanza error condition that is not defined in this
<span class="grey">Saint-Andre Standards Track [Page 109]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-110" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
specification, they can do so by defining an application-specific
error condition element qualified by an application-specific
namespace.
The <error/> element:
o MUST contain a defined condition element.
o MAY contain a <text/> child element containing XML character data
that describes the error in more detail; this element MUST be
qualified by the 'urn:ietf:params:xml:ns:xmpp-stanzas' namespace
and SHOULD possess an 'xml:lang' attribute specifying the natural
language of the XML character data.
o MAY contain a child element for an application-specific error
condition; this element MUST be qualified by an application-
specific namespace that defines the syntax and semantics of the
element.
The <text/> element is OPTIONAL. If included, it is to be used only
to provide descriptive or diagnostic information that supplements the
meaning of a defined condition or application-specific condition. It
MUST NOT be interpreted programmatically by an application. It
SHOULD NOT be used as the error message presented to a human user,
but MAY be shown in addition to the error message associated with the
defined condition element (and, optionally, the application-specific
condition element).
Interoperability Note: The syntax defined in [<a href="./rfc3920" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">RFC3920</a>] included a
legacy 'code' attribute, whose semantics have been replaced by the
defined condition elements; information about mapping defined
condition elements to values of the legacy 'code' attribute can be
found in [<a href="#ref-XEP-0086" title=""Error Condition Mappings"">XEP-0086</a>].
<span class="h4"><a class="selflink" id="section-8.3.3" href="#section-8.3.3">8.3.3</a>. Defined Conditions</span>
The following conditions are defined for use in stanza errors.
The error-type value that is RECOMMENDED for each defined condition
is the usual expected type; however, in some circumstances a
different type might be more appropriate.
<span class="h5"><a class="selflink" id="section-8.3.3.1" href="#section-8.3.3.1">8.3.3.1</a>. bad-request</span>
The sender has sent a stanza containing XML that does not conform to
the appropriate schema or that cannot be processed (e.g., an IQ
stanza that includes an unrecognized value of the 'type' attribute,
<span class="grey">Saint-Andre Standards Track [Page 110]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-111" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
or an element that is qualified by a recognized namespace but that
violates the defined syntax for the element); the associated error
type SHOULD be "modify".
C: <iq from='juliet@im.example.com/balcony'
id='zj3v142b'
to='im.example.com'
type='subscribe'>
<ping xmlns='urn:xmpp:ping'/>
</iq>
S: <iq from='im.example.com'
id='zj3v142b'
to='juliet@im.example.com/balcony'
type='error'>
<error type='modify'>
<bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
<span class="h5"><a class="selflink" id="section-8.3.3.2" href="#section-8.3.3.2">8.3.3.2</a>. conflict</span>
Access cannot be granted because an existing resource exists with the
same name or address; the associated error type SHOULD be "cancel".
C: <iq id='wy2xa82b4' type='set'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>balcony</resource>
</bind>
</iq>
S: <iq id='wy2xa82b4' type='error'>
<error type='cancel'>
<conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
<span class="h5"><a class="selflink" id="section-8.3.3.3" href="#section-8.3.3.3">8.3.3.3</a>. feature-not-implemented</span>
The feature represented in the XML stanza is not implemented by the
intended recipient or an intermediate server and therefore the stanza
cannot be processed (e.g., the entity understands the namespace but
does not recognize the element name); the associated error type
SHOULD be "cancel" or "modify".
<span class="grey">Saint-Andre Standards Track [Page 111]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-112" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
C: <iq from='juliet@im.example.com/balcony'
id='9u2bax16'
to='pubsub.example.com'
type='get'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscriptions/>
</pubsub>
</iq>
E: <iq from='pubsub.example.com'
id='9u2bax16'
to='juliet@im.example.com/balcony'
type='error'>
<error type='cancel'>
<feature-not-implemented
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<unsupported
xmlns='http://jabber.org/protocol/pubsub#errors'
feature='retrieve-subscriptions'/>
</error>
</iq>
<span class="h5"><a class="selflink" id="section-8.3.3.4" href="#section-8.3.3.4">8.3.3.4</a>. forbidden</span>
The requesting entity does not possess the necessary permissions to
perform an action that only certain authorized roles or individuals
are allowed to complete (i.e., it typically relates to authorization
rather than authentication); the associated error type SHOULD be
"auth".
C: <presence
from='juliet@im.example.com/balcony'
id='y2bs71v4'
to='characters@muc.example.com/JulieC'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
E: <presence
from='characters@muc.example.com/JulieC'
id='y2bs71v4'
to='juliet@im.example.com/balcony'
type='error'>
<error type='auth'>
<forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</presence>
<span class="grey">Saint-Andre Standards Track [Page 112]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-113" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h5"><a class="selflink" id="section-8.3.3.5" href="#section-8.3.3.5">8.3.3.5</a>. gone</span>
The recipient or server can no longer be contacted at this address,
typically on a permanent basis (as opposed to the <redirect/> error
condition, which is used for temporary addressing failures); the
associated error type SHOULD be "cancel" and the error stanza SHOULD
include a new address (if available) as the XML character data of the
<gone/> element (which MUST be a Uniform Resource Identifier [<a href="#ref-URI" title=""Uniform Resource Identifier (URI): Generic Syntax"">URI</a>] or
Internationalized Resource Identifier [<a href="#ref-IRI" title=""Internationalized Resource Identifiers (IRIs)"">IRI</a>] at which the entity can
be contacted, typically an XMPP IRI as specified in [<a href="#ref-XMPP-URI" title=""Internationalized Resource Identifiers (IRIs) and Uniform Resource Identifiers (URIs) for the Extensible Messaging and Presence Protocol (XMPP)"">XMPP-URI</a>]).
C: <message
from='juliet@im.example.com/churchyard'
id='sj2b371v'
to='romeo@example.net'
type='chat'>
<body>Thy lips are warm.</body>
</message>
S: <message
from='romeo@example.net'
id='sj2b371v'
to='juliet@im.example.com/churchyard'
type='error'>
<error by='example.net'
type='cancel'>
<gone xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
xmpp:romeo@afterlife.example.net
</gone>
</error>
</message>
<span class="h5"><a class="selflink" id="section-8.3.3.6" href="#section-8.3.3.6">8.3.3.6</a>. internal-server-error</span>
The server has experienced a misconfiguration or other internal error
that prevents it from processing the stanza; the associated error
type SHOULD be "cancel".
C: <presence
from='juliet@im.example.com/balcony'
id='y2bs71v4'
to='characters@muc.example.com/JulieC'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
<span class="grey">Saint-Andre Standards Track [Page 113]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-114" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
E: <presence
from='characters@muc.example.com/JulieC'
id='y2bs71v4'
to='juliet@im.example.com/balcony'
type='error'>
<error type='cancel'>
<internal-server-error
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</presence>
<span class="h5"><a class="selflink" id="section-8.3.3.7" href="#section-8.3.3.7">8.3.3.7</a>. item-not-found</span>
The addressed JID or item requested cannot be found; the associated
error type SHOULD be "cancel".
C: <presence from='userfoo@example.com/bar'
id='pwb2n78i'
to='nosuchroom@conference.example.org/foo'/>
S: <presence from='nosuchroom@conference.example.org/foo'
id='pwb2n78i'
to='userfoo@example.com/bar'
type='error'>
<error type='cancel'>
<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</presence>
Security Warning: An application MUST NOT return this error if
doing so would provide information about the intended recipient's
network availability to an entity that is not authorized to know
such information (for a more detailed discussion of presence
authorization, refer to the discussion of presence subscriptions
in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]); instead it MUST return a <service-unavailable/>
stanza error (<a href="#section-8.3.3.19">Section 8.3.3.19</a>).
<span class="h5"><a class="selflink" id="section-8.3.3.8" href="#section-8.3.3.8">8.3.3.8</a>. jid-malformed</span>
The sending entity has provided (e.g., during resource binding) or
communicated (e.g., in the 'to' address of a stanza) an XMPP address
or aspect thereof that violates the rules defined in [<a href="#ref-XMPP-ADDR" title=""Extensible Messaging and Presence Protocol (XMPP): Address Format"">XMPP-ADDR</a>]; the
associated error type SHOULD be "modify".
<span class="grey">Saint-Andre Standards Track [Page 114]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-115" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
C: <presence
from='juliet@im.example.com/balcony'
id='y2bs71v4'
to='ch@r@cters@muc.example.com/JulieC'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
E: <presence
from='ch@r@cters@muc.example.com/JulieC'
id='y2bs71v4'
to='juliet@im.example.com/balcony'
type='error'>
<error by='muc.example.com'
type='modify'>
<jid-malformed
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</presence>
Implementation Note: Enforcement of the format for XMPP localparts
is primarily the responsibility of the service at which the
associated account or entity is located (e.g., the example.com
service is responsible for returning <jid-malformed/> errors
related to all JIDs of the form <localpart@example.com>), whereas
enforcement of the format for XMPP domainparts is primarily the
responsibility of the service that seeks to route a stanza to the
service identified by that domainpart (e.g., the example.org
service is responsible for returning <jid-malformed/> errors
related to stanzas that users of that service have to tried send
to JIDs of the form <localpart@example.com>). However, any entity
that detects a malformed JID MAY return this error.
<span class="h5"><a class="selflink" id="section-8.3.3.9" href="#section-8.3.3.9">8.3.3.9</a>. not-acceptable</span>
The recipient or server understands the request but cannot process it
because the request does not meet criteria defined by the recipient
or server (e.g., a request to subscribe to information that does not
simultaneously include configuration parameters needed by the
recipient); the associated error type SHOULD be "modify".
C: <message to='juliet@im.example.com' id='yt2vs71m'>
<body>[ ... the-emacs-manual ... ]</body>
</message>
<span class="grey">Saint-Andre Standards Track [Page 115]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-116" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S: <message from='juliet@im.example.com' id='yt2vs71m'>
<error type='modify'>
<not-acceptable
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>
<span class="h5"><a class="selflink" id="section-8.3.3.10" href="#section-8.3.3.10">8.3.3.10</a>. not-allowed</span>
The recipient or server does not allow any entity to perform the
action (e.g., sending to entities at a blacklisted domain); the
associated error type SHOULD be "cancel".
C: <presence
from='juliet@im.example.com/balcony'
id='y2bs71v4'
to='characters@muc.example.com/JulieC'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
E: <presence
from='characters@muc.example.com/JulieC'
id='y2bs71v4'
to='juliet@im.example.com/balcony'
type='error'>
<error type='cancel'>
<not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</presence>
<span class="h5"><a class="selflink" id="section-8.3.3.11" href="#section-8.3.3.11">8.3.3.11</a>. not-authorized</span>
The sender needs to provide credentials before being allowed to
perform the action, or has provided improper credentials (the name
"not-authorized", which was borrowed from the "401 Unauthorized"
error of [<a href="#ref-HTTP" title=""Hypertext Transfer Protocol -- HTTP/1.1"">HTTP</a>], might lead the reader to think that this condition
relates to authorization, but instead it is typically used in
relation to authentication); the associated error type SHOULD be
"auth".
C: <presence
from='juliet@im.example.com/balcony'
id='y2bs71v4'
to='characters@muc.example.com/JulieC'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
<span class="grey">Saint-Andre Standards Track [Page 116]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-117" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
E: <presence
from='characters@muc.example.com/JulieC'
id='y2bs71v4'
to='juliet@im.example.com/balcony'>
<error type='auth'>
<not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</presence>
<span class="h5"><a class="selflink" id="section-8.3.3.12" href="#section-8.3.3.12">8.3.3.12</a>. policy-violation</span>
The entity has violated some local service policy (e.g., a message
contains words that are prohibited by the service) and the server MAY
choose to specify the policy in the <text/> element or in an
application-specific condition element; the associated error type
SHOULD be "modify" or "wait" depending on the policy being violated.
(In the following example, the client sends an XMPP message
containing words that are forbidden according to the server's local
service policy.)
C: <message from='romeo@example.net/foo'
to='bill@im.example.com'
id='vq71f4nb'>
<body>%#&@^!!!</body>
</message>
S: <message from='bill@im.example.com'
id='vq71f4nb'
to='romeo@example.net/foo'>
<error by='example.net' type='modify'>
<policy-violation
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>
<span class="h5"><a class="selflink" id="section-8.3.3.13" href="#section-8.3.3.13">8.3.3.13</a>. recipient-unavailable</span>
The intended recipient is temporarily unavailable, undergoing
maintenance, etc.; the associated error type SHOULD be "wait".
C: <presence
from='juliet@im.example.com/balcony'
id='y2bs71v4'
to='characters@muc.example.com/JulieC'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
<span class="grey">Saint-Andre Standards Track [Page 117]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-118" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
E: <presence
from='characters@muc.example.com/JulieC'
id='y2bs71v4'
to='juliet@im.example.com/balcony'>
<error type='wait'>
<recipient-unavailable
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</presence>
Security Warning: An application MUST NOT return this error if
doing so would provide information about the intended recipient's
network availability to an entity that is not authorized to know
such information (for a more detailed discussion of presence
authorization, refer to the discussion of presence subscriptions
in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]); instead it MUST return a <service-unavailable/>
stanza error (<a href="#section-8.3.3.19">Section 8.3.3.19</a>).
<span class="h5"><a class="selflink" id="section-8.3.3.14" href="#section-8.3.3.14">8.3.3.14</a>. redirect</span>
The recipient or server is redirecting requests for this information
to another entity, typically in a temporary fashion (as opposed to
the <gone/> error condition, which is used for permanent addressing
failures); the associated error type SHOULD be "modify" and the error
stanza SHOULD contain the alternate address in the XML character data
of the <redirect/> element (which MUST be a URI or IRI with which the
sender can communicate, typically an XMPP IRI as specified in
[<a href="#ref-XMPP-URI" title=""Internationalized Resource Identifiers (IRIs) and Uniform Resource Identifiers (URIs) for the Extensible Messaging and Presence Protocol (XMPP)"">XMPP-URI</a>]).
C: <presence
from='juliet@im.example.com/balcony'
id='y2bs71v4'
to='characters@muc.example.com/JulieC'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
E: <presence
from='characters@muc.example.com/JulieC'
id='y2bs71v4'
to='juliet@im.example.com/balcony'
type='error'>
<error type='modify'>
<redirect xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
xmpp:characters@conference.example.org
</redirect>
</error>
</presence>
<span class="grey">Saint-Andre Standards Track [Page 118]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-119" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Security Warning: An application receiving a stanza-level redirect
SHOULD warn a human user of the redirection attempt and request
approval before proceeding to communicate with the entity whose
address is contained in the XML character data of the <redirect/>
element, because that entity might have a different identity or
might enforce different security policies. The end-to-end
authentication or signing of XMPP stanzas could help to mitigate
this risk, since it would enable the sender to determine if the
entity to which it has been redirected has the same identity as
the entity it originally attempted to contact. An application MAY
have a policy of following redirects only if it has authenticated
the receiving entity. In addition, an application SHOULD abort
the communication attempt after a certain number of successive
redirects (e.g., at least 2 but no more than 5).
<span class="h5"><a class="selflink" id="section-8.3.3.15" href="#section-8.3.3.15">8.3.3.15</a>. registration-required</span>
The requesting entity is not authorized to access the requested
service because prior registration is necessary (examples of prior
registration include members-only rooms in XMPP multi-user chat
[<a href="#ref-XEP-0045" title=""Multi-User Chat"">XEP-0045</a>] and gateways to non-XMPP instant messaging services, which
traditionally required registration in order to use the gateway
[<a href="#ref-XEP-0100" title=""Gateway Interaction"">XEP-0100</a>]); the associated error type SHOULD be "auth".
C: <presence
from='juliet@im.example.com/balcony'
id='y2bs71v4'
to='characters@muc.example.com/JulieC'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
E: <presence
from='characters@muc.example.com/JulieC'
id='y2bs71v4'
to='juliet@im.example.com/balcony'>
<error type='auth'>
<registration-required
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</presence>
<span class="h5"><a class="selflink" id="section-8.3.3.16" href="#section-8.3.3.16">8.3.3.16</a>. remote-server-not-found</span>
A remote server or service specified as part or all of the JID of the
intended recipient does not exist or cannot be resolved (e.g., there
is no _xmpp-server._tcp DNS SRV record, the A or AAAA fallback
<span class="grey">Saint-Andre Standards Track [Page 119]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-120" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
resolution fails, or A/AAAA lookups succeed but there is no response
on the IANA-registered port 5269); the associated error type SHOULD
be "cancel".
C: <message
from='romeo@example.net/home'
id='ud7n1f4h'
to='bar@example.org'
type='chat'>
<body>yt?</body>
</message>
E: <message
from='bar@example.org'
id='ud7n1f4h'
to='romeo@example.net/home'
type='error'>
<error type='cancel'>
<remote-server-not-found
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>
<span class="h5"><a class="selflink" id="section-8.3.3.17" href="#section-8.3.3.17">8.3.3.17</a>. remote-server-timeout</span>
A remote server or service specified as part or all of the JID of the
intended recipient (or needed to fulfill a request) was resolved but
communications could not be established within a reasonable amount of
time (e.g., an XML stream cannot be established at the resolved IP
address and port, or an XML stream can be established but stream
negotiation fails because of problems with TLS, SASL, Server
Dialback, etc.); the associated error type SHOULD be "wait" (unless
the error is of a more permanent nature, e.g., the remote server is
found but it cannot be authenticated or it violates security
policies).
C: <message
from='romeo@example.net/home'
id='ud7n1f4h'
to='bar@example.org'
type='chat'>
<body>yt?</body>
</message>
<span class="grey">Saint-Andre Standards Track [Page 120]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-121" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
E: <message
from='bar@example.org'
id='ud7n1f4h'
to='romeo@example.net/home'
type='error'>
<error type='wait'>
<remote-server-timeout
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>
<span class="h5"><a class="selflink" id="section-8.3.3.18" href="#section-8.3.3.18">8.3.3.18</a>. resource-constraint</span>
The server or recipient is busy or lacks the system resources
necessary to service the request; the associated error type SHOULD be
"wait".
C: <iq from='romeo@example.net/foo'
id='kj4vz31m'
to='pubsub.example.com'
type='get'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='my_musings'/>
</pubsub>
</iq>
E: <iq from='pubsub.example.com'
id='kj4vz31m'
to='romeo@example.net/foo'
type='error'>
<error type='wait'>
<resource-constraint
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
<span class="h5"><a class="selflink" id="section-8.3.3.19" href="#section-8.3.3.19">8.3.3.19</a>. service-unavailable</span>
The server or recipient does not currently provide the requested
service; the associated error type SHOULD be "cancel".
C: <message from='romeo@example.net/foo'
to='juliet@im.example.com'>
<body>Hello?</body>
</message>
<span class="grey">Saint-Andre Standards Track [Page 121]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-122" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S: <message from='juliet@im.example.com/foo'
to='romeo@example.net'>
<error type='cancel'>
<service-unavailable
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>
Security Warning: An application MUST return a <service-
unavailable/> stanza error (<a href="#section-8.3.3.19">Section 8.3.3.19</a>) instead of <item-
not-found/> (<a href="#section-8.3.3.7">Section 8.3.3.7</a>) or <recipient-unavailable/>
(<a href="#section-8.3.3.13">Section 8.3.3.13</a>) if sending one of the latter errors would
provide information about the intended recipient's network
availability to an entity that is not authorized to know such
information (for a more detailed discussion of presence
authorization, refer to [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]).
<span class="h5"><a class="selflink" id="section-8.3.3.20" href="#section-8.3.3.20">8.3.3.20</a>. subscription-required</span>
The requesting entity is not authorized to access the requested
service because a prior subscription is necessary (examples of prior
subscription include authorization to receive presence information as
defined in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>] and opt-in data feeds for XMPP publish-subscribe
as defined in [<a href="#ref-XEP-0060" title=""Publish-Subscribe"">XEP-0060</a>]); the associated error type SHOULD be
"auth".
C: <message
from='romeo@example.net/orchard'
id='pa73b4n7'
to='playwright@shakespeare.example.com'
type='chat'>
<subject>ACT II, SCENE II</subject>
<body>help, I forgot my lines!</body>
</message>
E: <message
from='playwright@shakespeare.example.com'
id='pa73b4n7'
to='romeo@example.net/orchard'
type='error'>
<error type='auth'>
<subscription-required
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>
<span class="grey">Saint-Andre Standards Track [Page 122]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-123" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h5"><a class="selflink" id="section-8.3.3.21" href="#section-8.3.3.21">8.3.3.21</a>. undefined-condition</span>
The error condition is not one of those defined by the other
conditions in this list; any error type can be associated with this
condition, and it SHOULD NOT be used except in conjunction with an
application-specific condition.
C: <message
from='northumberland@shakespeare.example'
id='richard2-4.1.247'
to='kingrichard@royalty.england.example'>
<body>My lord, dispatch; read o'er these articles.</body>
<amp xmlns='http://jabber.org/protocol/amp'>
<rule action='notify'
condition='deliver'
value='stored'/>
</amp>
</message>
S: <message from='example.org'
id='amp1'
to='northumberland@example.net/field'
type='error'>
<amp xmlns='http://jabber.org/protocol/amp'
from='kingrichard@example.org'
status='error'
to='northumberland@example.net/field'>
<rule action='error'
condition='deliver'
value='stored'/>
</amp>
<error type='modify'>
<undefined-condition
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<failed-rules xmlns='http://jabber.org/protocol/amp#errors'>
<rule action='error'
condition='deliver'
value='stored'/>
</failed-rules>
</error>
</message>
<span class="h5"><a class="selflink" id="section-8.3.3.22" href="#section-8.3.3.22">8.3.3.22</a>. unexpected-request</span>
The recipient or server understood the request but was not expecting
it at this time (e.g., the request was out of order); the associated
error type SHOULD be "wait" or "modify".
<span class="grey">Saint-Andre Standards Track [Page 123]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-124" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
C: <iq from='romeo@example.net/foo'
id='o6hsv25z'
to='pubsub.example.com'
type='set'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<unsubscribe
node='my_musings'
jid='romeo@example.net'/>
</pubsub>
</iq>
E: <iq from='pubsub.example.com'
id='o6hsv25z'
to='romeo@example.net/foo'
type='error'>
<error type='modify'>
<unexpected-request
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<not-subscribed
xmlns='http://jabber.org/protocol/pubsub#errors'/>
</error>
</iq>
<span class="h4"><a class="selflink" id="section-8.3.4" href="#section-8.3.4">8.3.4</a>. Application-Specific Conditions</span>
As noted, an application MAY provide application-specific stanza
error information by including a properly namespaced child within the
error element. Typically, the application-specific element
supplements or further qualifies a defined element. Thus, the
<error/> element will contain two or three child elements.
<iq id='ixc3v1b9' type='error'>
<error type='modify'>
<bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<too-many-parameters xmlns='http://example.org/ns'/>
</error>
</iq>
<span class="grey">Saint-Andre Standards Track [Page 124]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-125" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<message type='error' id='7h3baci9'>
<error type='modify'>
<undefined-condition
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xml:lang='en'
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
[ ... application-specific information ... ]
</text>
<too-many-parameters xmlns='http://example.org/ns'/>
</error>
</message>
An entity that receives an application-specific error condition it
does not understand MUST ignore that condition but appropriately
process the rest of the error stanza.
<span class="h3"><a class="selflink" id="section-8.4" href="#section-8.4">8.4</a>. Extended Content</span>
Although the message, presence, and IQ stanzas provide basic
semantics for messaging, availability, and request-response
interactions, XMPP uses XML namespaces (see [<a href="#ref-XML-NAMES" title=""Namespaces in XML 1.0 (Third Edition)"">XML-NAMES</a>]) to extend
the basic stanza syntax for the purpose of providing additional
functionality.
A message or presence stanza MAY contain one or more optional child
elements specifying content that extends the meaning of the message
(e.g., an XHTML-formatted version of the message body as described in
[<a href="#ref-XEP-0071" title=""XHTML-IM"">XEP-0071</a>]), and an IQ stanza of type "get" or "set" MUST contain one
such child element. Such a child element MAY have any name and MUST
possess a namespace declaration (other than "jabber:client", "jabber:
server", or "<a href="http://etherx.jabber.org/streams">http://etherx.jabber.org/streams</a>") that defines the data
contained within the child element. Such a child element is called
an "extension element". An extension element can be included either
at the direct child level of the stanza or in any mix of levels.
Similarly, "extension attributes" are allowed. That is: a stanza
itself (i.e., an <iq/>, <message/>, or <presence/> element qualified
by the "jabber:client" or "jabber:server" content namespace) or any
child element of such a stanza (whether an extension element or a
child element qualified by the content namespace) MAY also include
one or more attributes qualified by XML namespaces other than the
content namespace or the reserved
"<a href="http://www.w3.org/XML/1998/namespace">http://www.w3.org/XML/1998/namespace</a>" namespace (including the so-
called "empty namespace" if the attribute is not prefixed as
described under [<a href="#ref-XML-NAMES" title=""Namespaces in XML 1.0 (Third Edition)"">XML-NAMES</a>]).
<span class="grey">Saint-Andre Standards Track [Page 125]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-126" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Interoperability Note: For the sake of backward compatibility and
maximum interoperability, an entity that generates a stanza SHOULD
NOT include such attributes in the stanza itself or in child
elements of the stanza that are qualified by the content
namespaces "jabber:client" or "jabber:server" (e.g., the <body/>
child of the <message/> stanza).
An extension element or extension attribute is said to be "extended
content" and the qualifying namespace for such an element or
attribute is said to be an "extended namespace".
Informational Note: Although extended namespaces for XMPP are
commonly defined by the XMPP Standards Foundation (XSF) and by the
IETF, no specification or IETF standards action is necessary to
define extended namespaces, and any individual or organization is
free to define XMPP extensions.
To illustrate these concepts, several examples follow.
The following stanza contains one direct child element whose extended
namespace is 'jabber:iq:roster':
<iq from='juliet@capulet.com/balcony'
id='h83vxa4c'
type='get'>
<query xmlns='jabber:iq:roster'/>
</iq>
The following stanza contains two direct child elements with two
different extended namespaces.
<presence from='juliet@capulet.com/balcony'>
<c xmlns='http://jabber.org/protocol/caps'
hash='sha-1'
node='http://code.google.com/p/exodus'
ver='QgayPKawpkPSDYmwT/WM94uAlu0='/>
<x xmlns='vcard-temp:x:update'>
<photo>sha1-hash-of-image</photo>
</x>
</presence>
The following stanza contains two child elements, one of which is
qualified by the "jabber:client" or "jabber:server" content namespace
and one of which is qualified by an extended namespace; the extension
element in turn contains a child element that is qualified by a
different extended namespace.
<span class="grey">Saint-Andre Standards Track [Page 126]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-127" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<message to='juliet@capulet.com'>
<body>Hello?</body>
<html xmlns='http://jabber.org/protocol/xhtml-im'>
<body xmlns='http://www.w3.org/1999/xhtml'>
<p style='font-weight:bold'>Hello?</p>
</body>
</html>
</message>
It is conventional in the XMPP community for implementations to not
generate namespace prefixes for elements that are qualified by
extended namespaces (in the XML community, this convention is
sometimes called "prefix-free canonicalization"). However, if an
implementation generates such namespace prefixes then it MUST include
the namespace declaration in the stanza itself or a child element of
the stanza, not in the stream header (see <a href="#section-4.8.4">Section 4.8.4</a>).
Routing entities (typically servers) SHOULD try to maintain prefixes
when serializing XML stanzas for processing, but receiving entities
MUST NOT depend on the prefix strings to have any particular value
(the allowance for the 'stream' prefix, described under
<a href="#section-4.8.5">Section 4.8.5</a>, is an exception to this rule, albeit for streams
rather than stanzas).
Support for any given extended namespace is OPTIONAL on the part of
any implementation. If an entity does not understand such a
namespace, the entity's expected behavior depends on whether the
entity is (1) the recipient or (2) a server that is routing or
delivering the stanza to the recipient.
If a recipient receives a stanza that contains an element or
attribute it does not understand, it MUST NOT attempt to process that
XML data and instead MUST proceed as follows.
o If an intended recipient receives a message stanza whose only
child element is qualified by a namespace it does not understand,
then depending on the XMPP application it MUST either ignore the
entire stanza or return a stanza error, which SHOULD be <service-
unavailable/> (<a href="#section-8.3.3.19">Section 8.3.3.19</a>).
o If an intended recipient receives a presence stanza whose only
child element is qualified by a namespace it does not understand,
then it MUST ignore the child element by treating the presence
stanza as if it contained no child element.
<span class="grey">Saint-Andre Standards Track [Page 127]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-128" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
o If an intended recipient receives a message or presence stanza
that contains XML data qualified by a namespace it does not
understand, then it MUST ignore the portion of the stanza
qualified by the unknown namespace.
o If an intended recipient receives an IQ stanza of type "get" or
"set" containing a child element qualified by a namespace it does
not understand, then the entity MUST return an IQ stanza of type
"error" with an error condition of <service-unavailable/>.
If a server handles a stanza that is intended for delivery to another
entity and that contains a child element it does not understand, it
MUST route the stanza unmodified to a remote server or deliver the
stanza unmodified to a connected client associated with a local
account.
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. Detailed Examples</span>
The detailed examples in this section further illustrate the
protocols defined in this specification.
<span class="h3"><a class="selflink" id="section-9.1" href="#section-9.1">9.1</a>. Client-to-Server Examples</span>
The following examples show the XMPP data flow for a client
negotiating an XML stream with a server, exchanging XML stanzas, and
closing the negotiated stream. The server is "im.example.com", the
server requires use of TLS, the client authenticates via the SASL
SCRAM-SHA-1 mechanism as <juliet@im.example.com> with a password of
"r0m30myr0m30", and the client binds a client-submitted resource to
the stream. It is assumed that before sending the initial stream
header, the client has already resolved an SRV record of
_xmpp-client._tcp.im.example.com and has opened a TCP connection to
the advertised port at the resolved IP address.
<span class="h4"><a class="selflink" id="section-9.1.1" href="#section-9.1.1">9.1.1</a>. TLS</span>
Step 1: Client initiates stream to server:
C: <stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<span class="grey">Saint-Andre Standards Track [Page 128]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-129" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Step 2: Server responds by sending a response stream header to
client:
S: <stream:stream
from='im.example.com'
id='t7AMCin9zjMNwQKDnplntZPIDEI='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
Step 3: Server sends stream features to client (only the STARTTLS
extension at this point, which is mandatory-to-negotiate):
S: <stream:features>
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
<required/>
</starttls>
</stream:features>
Step 4: Client sends STARTTLS command to server:
C: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
Step 5: Server informs client that it is allowed to proceed:
S: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
Step 5 (alt): Server informs client that STARTTLS negotiation has
failed, closes the XML stream, and terminates the TCP connection
(thus, the stream negotiation process ends unsuccessfully and the
parties do not move on to the next step):
S: <failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
</stream:stream>
Step 6: Client and server attempt to complete TLS negotiation over
the existing TCP connection (see [<a href="#ref-TLS" title=""The Transport Layer Security (TLS) Protocol Version 1.2"">TLS</a>] for details).
<span class="grey">Saint-Andre Standards Track [Page 129]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-130" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Step 7: If TLS negotiation is successful, client initiates a new
stream to server over the TLS-protected TCP connection:
C: <stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
Step 7 (alt): If TLS negotiation is unsuccessful, server closes TCP
connection (thus, the stream negotiation process ends unsuccessfully
and the parties do not move on to the next step):
<span class="h4"><a class="selflink" id="section-9.1.2" href="#section-9.1.2">9.1.2</a>. SASL</span>
Step 8: Server responds by sending a stream header to client along
with any available stream features:
S: <stream:stream
from='im.example.com'
id='vgKi/bkYME8OAj4rlXMkpucAqe4='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
S: <stream:features>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>SCRAM-SHA-1-PLUS</mechanism>
<mechanism>SCRAM-SHA-1</mechanism>
<mechanism>PLAIN</mechanism>
</mechanisms>
</stream:features>
Step 9: Client selects an authentication mechanism (in this case,
SCRAM-SHA-1), including initial response data:
C: <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl"
mechanism="SCRAM-SHA-1">
biwsbj1qdWxpZXQscj1vTXNUQUF3QUFBQU1BQUFBTlAwVEFBQUFBQUJQVTBBQQ==
</auth>
The decoded base 64 data is
"n,,n=juliet,r=oMsTAAwAAAAMAAAANP0TAAAAAABPU0AA".
<span class="grey">Saint-Andre Standards Track [Page 130]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-131" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Step 10: Server sends a challenge:
S: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
cj1vTXNUQUF3QUFBQU1BQUFBTlAwVEFBQUFBQUJQVTBBQWUxMjQ2OTViLTY5Y
TktNGRlNi05YzMwLWI1MWIzODA4YzU5ZSxzPU5qaGtZVE0wTURndE5HWTBaaT
AwTmpkbUxUa3hNbVV0TkRsbU5UTm1ORE5rTURNeixpPTQwOTY=
</challenge>
The decoded base 64 data is "r=oMsTAAwAAAAMAAAANP0TAAAAAABPU0AAe12469
5b-69a9-4de6-9c30-
b51b3808c59e,s=NjhkYTM0MDgtNGY0Zi00NjdmLTkxMmUtNDlmNTNmNDNkMDMz,i=409
6" (line breaks not included in actual data).
Step 11: Client sends a response:
C: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
Yz1iaXdzLHI9b01zVEFBd0FBQUFNQUFBQU5QMFRBQUFBQUFCUFUwQUFlMTI0N
jk1Yi02OWE5LTRkZTYtOWMzMC1iNTFiMzgwOGM1OWUscD1VQTU3dE0vU3ZwQV
RCa0gyRlhzMFdEWHZKWXc9
</response>
The decoded base 64 data is "c=biws,r=oMsTAAwAAAAMAAAANP0TAAAAAABPU0
AAe124695b-69a9-4de6-9c30-b51b3808c59e,p=UA57tM/
SvpATBkH2FXs0WDXvJYw=" (line breaks not included in actual data).
Step 12: Server informs client of success, including additional data
with success:
S: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
dj1wTk5ERlZFUXh1WHhDb1NFaVc4R0VaKzFSU289
</success>
The decoded base 64 data is "v=pNNDFVEQxuXxCoSEiW8GEZ+1RSo=".
Step 12 (alt): Server returns a SASL error to client (thus, the
stream negotiation process ends unsuccessfully and the parties do not
move on to the next step):
S: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<not-authorized/>
</failure>
</stream>
<span class="grey">Saint-Andre Standards Track [Page 131]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-132" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Step 13: Client initiates a new stream to server:
C: <stream:stream
from='juliet@im.example.com'
to='im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
<span class="h4"><a class="selflink" id="section-9.1.3" href="#section-9.1.3">9.1.3</a>. Resource Binding</span>
Step 14: Server responds by sending a stream header to client along
with supported features (in this case, resource binding):
S: <stream:stream
from='im.example.com'
id='gPybzaOzBmaADgxKXu9UClbprp0='
to='juliet@im.example.com'
version='1.0'
xml:lang='en'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'>
S: <stream:features>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
</stream:features>
Upon being informed that resource binding is mandatory-to-negotiate,
the client needs to bind a resource to the stream; here we assume
that the client submits a human-readable text string.
Step 15: Client binds a resource:
C: <iq id='yhc13a95' type='set'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>balcony</resource>
</bind>
</iq>
<span class="grey">Saint-Andre Standards Track [Page 132]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-133" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Step 16: Server accepts submitted resourcepart and informs client of
successful resource binding:
S: <iq id='yhc13a95' type='result'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>
juliet@im.example.com/balcony
</jid>
</bind>
</iq>
Step 16 (alt): Server returns error to client (thus, the stream
negotiation process ends unsuccessfully and the parties do not move
on to the next step):
S: <iq id='yhc13a95' type='error'>
<error type='cancel'>
<conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
<span class="h4"><a class="selflink" id="section-9.1.4" href="#section-9.1.4">9.1.4</a>. Stanza Exchange</span>
Now the client is allowed to send XML stanzas over the negotiated
stream.
C: <message from='juliet@im.example.com/balcony'
id='ju2ba41c'
to='romeo@example.net'
type='chat'
xml:lang='en'>
<body>Art thou not Romeo, and a Montague?</body>
</message>
If necessary, sender's server negotiates XML streams with intended
recipient's server (see <a href="#section-9.2">Section 9.2</a>).
The intended recipient replies, and the message is delivered to the
client.
E: <message from='romeo@example.net/orchard'
id='ju2ba41c'
to='juliet@im.example.com/balcony'
type='chat'
xml:lang='en'>
<body>Neither, fair saint, if either thee dislike.</body>
</message>
<span class="grey">Saint-Andre Standards Track [Page 133]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-134" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
The client can subsequently send and receive an unbounded number of
subsequent XML stanzas over the stream.
<span class="h4"><a class="selflink" id="section-9.1.5" href="#section-9.1.5">9.1.5</a>. Close</span>
Desiring to send no further messages, the client closes its stream to
the server but waits for incoming data from the server.
C: </stream:stream>
Consistent with <a href="#section-4.4">Section 4.4</a>, the server might send additional data to
the client and then closes its stream to the client.
S: </stream:stream>
The client now sends a TLS close_notify alert, receives a responding
close_notify alert from the server, and then terminates the
underlying TCP connection.
<span class="h3"><a class="selflink" id="section-9.2" href="#section-9.2">9.2</a>. Server-to-Server Examples</span>
The following examples show the data flow for a server negotiating an
XML stream with a peer server, exchanging XML stanzas, and closing
the negotiated stream. The initiating server ("Server1") is
im.example.com; the receiving server ("Server2") is example.net and
it requires use of TLS; im.example.com presents a certificate and
authenticates via the SASL EXTERNAL mechanism. It is assumed that
before sending the initial stream header, Server1 has already
resolved an SRV record of _xmpp-server._tcp.example.net and has
opened a TCP connection to the advertised port at the resolved IP
address. Note how Server1 declares the content namespace "jabber:
server" as the default namespace and uses prefixes for stream-related
elements, whereas Server2 uses prefix-free canonicalization.
<span class="h4"><a class="selflink" id="section-9.2.1" href="#section-9.2.1">9.2.1</a>. TLS</span>
Step 1: Server1 initiates stream to Server2:
S1: <stream:stream
from='im.example.com'
to='example.net'
version='1.0'
xmlns='jabber:server'
xmlns:stream='http://etherx.jabber.org/streams'>
<span class="grey">Saint-Andre Standards Track [Page 134]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-135" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Step 2: Server2 responds by sending a response stream header to
Server1:
S2: <stream
from='example.net'
id='hTiXkW+ih9k2SqdGkk/AZi0OJ/Q='
to='im.example.com'
version='1.0'
xmlns='http://etherx.jabber.org/streams'>
Step 3: Server2 sends stream features to Server1 (only the STARTTLS
extension at this point, which is mandatory-to-negotiate):
S2: <features xmlns='http://etherx.jabber.org/streams'>
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
<required/>
</starttls>
</features>
Step 4: Server1 sends the STARTTLS command to Server2:
S1: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
Step 5: Server2 informs Server1 that it is allowed to proceed:
S2: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
Step 5 (alt): Server2 informs Server1 that STARTTLS negotiation has
failed, closes the stream, and terminates the TCP connection (thus,
the stream negotiation process ends unsuccessfully and the parties do
not move on to the next step):
S2: <failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
</stream>
Step 6: Server1 and Server2 attempt to complete TLS negotiation via
TCP (see [<a href="#ref-TLS" title=""The Transport Layer Security (TLS) Protocol Version 1.2"">TLS</a>] for details).
Step 7: If TLS negotiation is successful, Server1 initiates a new
stream to Server2 over the TLS-protected TCP connection:
S1: <stream:stream
from='im.example.com'
to='example.net'
version='1.0'
xmlns='jabber:server'
xmlns:stream='http://etherx.jabber.org/streams'>
<span class="grey">Saint-Andre Standards Track [Page 135]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-136" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Step 7 (alt): If TLS negotiation is unsuccessful, Server2 closes the
TCP connection (thus, the stream negotiation process ends
unsuccessfully and the parties do not move on to the next step).
<span class="h4"><a class="selflink" id="section-9.2.2" href="#section-9.2.2">9.2.2</a>. SASL</span>
Step 8: Server2 sends a response stream header to Server1 along with
available stream features (including a preference for the SASL
EXTERNAL mechanism):
S2: <stream
from='example.net'
id='RChdjlgj/TIBcbT9Keu31zDihH4='
to='im.example.com'
version='1.0'
xmlns='http://etherx.jabber.org/streams'>
S2: <features xmlns='http://etherx.jabber.org/streams'>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>EXTERNAL</mechanism>
</mechanisms>
</features>
Step 9: Server1 selects the EXTERNAL mechanism (including an empty
response of "="):
S1: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='EXTERNAL'>=</auth>
Step 10: Server2 returns success:
S2: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
Step 10 (alt): Server2 informs Server1 of failed authentication
(thus, the stream negotiation process ends unsuccessfully and the
parties do not move on to the next step):
S2: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<not-authorized/>
</failure>
</stream>
<span class="grey">Saint-Andre Standards Track [Page 136]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-137" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Step 11: Server1 initiates a new stream to Server2:
S1: <stream:stream
from='im.example.com'
to='example.net'
version='1.0'
xmlns='jabber:server'
xmlns:stream='http://etherx.jabber.org/streams'>
Step 12: Server2 responds by sending a stream header to Server1 along
with any additional features (or, in this case, an empty features
element):
S2: <stream
from='example.net'
id='MbbV2FeojySpUIP6J91qaa+TWHM='
to='im.example.com'
version='1.0'
xmlns='http://etherx.jabber.org/streams'>
S2: <features xmlns='http://etherx.jabber.org/streams'/>
<span class="h4"><a class="selflink" id="section-9.2.3" href="#section-9.2.3">9.2.3</a>. Stanza Exchange</span>
Now Server1 is allowed to send XML stanzas to Server2 over the
negotiated stream from im.example.com to example.net; here we assume
that the transferred stanzas are those shown earlier for client-to-
server communication, albeit over a server-to-server stream qualified
by the 'jabber:server' namespace.
Server1 sends XML stanza to Server2:
S1: <message from='juliet@im.example.com/balcony'
id='ju2ba41c'
to='romeo@example.net'
type='chat'
xml:lang='en'>
<body>Art thou not Romeo, and a Montague?</body>
</message>
<span class="h4"><a class="selflink" id="section-9.2.4" href="#section-9.2.4">9.2.4</a>. Close</span>
Desiring to send no further messages, Server1 closes its stream to
Server2 but waits for incoming data from Server2. (In practice, the
stream would most likely remain open for some time, since Server1 and
Server2 do not immediately know if the stream will be needed for
further communication.)
<span class="grey">Saint-Andre Standards Track [Page 137]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-138" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
S1: </stream:stream>
Consistent with the recommended stream closing handshake, Server2
closes the stream as well:
S2: </stream>
Server1 now sends a TLS close_notify alert, receives a responding
close_notify alert from Server2, and then terminates the underlying
TCP connection.
<span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>. Server Rules for Processing XML Stanzas</span>
Each server implementation will contain its own logic for processing
stanzas it receives. Such logic determines whether the server needs
to route a given stanza to another domain, deliver it to a local
entity (typically a connected client associated with a local
account), or handle it directly within the server itself. This
section provides general rules for processing XML stanzas. However,
particular XMPP applications MAY specify delivery rules that modify
or supplement the following rules (e.g., a set of delivery rules for
instant messaging and presence applications is defined in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]).
<span class="h3"><a class="selflink" id="section-10.1" href="#section-10.1">10.1</a>. In-Order Processing</span>
An XMPP server MUST ensure in-order processing of the stanzas and
other XML elements it receives over a given input stream from a
connected client or remote server.
In-order processing applies (a) to any XML elements used to negotiate
and manage XML streams, and (b) to all uses of XML stanzas, including
but not limited to the following:
1. Stanzas sent by a client to its server or to its own bare JID for
direct processing by the server (e.g., in-order processing of a
roster get and initial presence as described in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]).
2. Stanzas sent by a connected client and intended for delivery to
another entity associated with the server (e.g., stanzas
addressed from <juliet@im.example.com> to
<nurse@im.example.com>). The server MUST ensure that it delivers
stanzas addressed to the intended recipient in the order it
receives them over the input stream from the sending client,
treating stanzas addressed to the bare JID and the full JID of
the intended recipient as equivalent for delivery purposes.
<span class="grey">Saint-Andre Standards Track [Page 138]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-139" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
3. Stanzas sent by a connected client and intended for delivery to
an entity located at a remote domain (e.g., stanzas addressed
from <juliet@im.example.com> to <romeo@example.net>). The
routing server MUST ensure that it routes stanzas addressed to
the intended recipient in the order it receives them over the
input stream from the sending client, treating stanzas addressed
to the bare JID and the full JID of the intended recipient as
equivalent for routing purposes. To help ensure in-order
processing, the routing server MUST route such stanzas over a
single output stream to the remote domain, rather than sending
some stanzas over one server-to-server stream and other stanzas
over another server-to-server stream.
4. Stanzas routed from one server to another server for delivery to
an entity associated with the remote domain (e.g., stanzas
addressed from <juliet@im.example.com> to <romeo@example.net> and
routed by <im.example.com> over a server-to-server stream to
<example.net>). The delivering server MUST ensure that it
delivers stanzas to the intended recipient in the order it
receives them over the input stream from the routing server,
treating stanzas addressed to the bare JID and the full JID of
the intended recipient as equivalent for delivery purposes.
5. Stanzas sent by one server to another server for direct
processing by the server that is hosting the remote domain (e.g.,
stanzas addressed from <im.example.com> to <example.net>).
If the server's processing of a particular request could have an
effect on its processing of subsequent data it might receive over
that input stream (e.g., enforcement of communication policies), it
MUST suspend processing of subsequent data until it has processed the
request.
In-order processing applies only to a single input stream.
Therefore, a server is not responsible for ensuring the coherence of
data it receives across multiple input streams associated with the
same local account (e.g., stanzas received over two different input
streams from <juliet@im.example.com/balcony> and
<juliet@im.example.com/chamber>) or the same remote domain (e.g., two
different input streams negotiated by a remote domain; however, a
server MAY close the stream with a <conflict/> stream error
(<a href="#section-4.9.3.3">Section 4.9.3.3</a>) if a remote server attempts to negotiate more than
one stream, as described under <a href="#section-4.9.3.3">Section 4.9.3.3</a>).
<span class="grey">Saint-Andre Standards Track [Page 139]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-140" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-10.2" href="#section-10.2">10.2</a>. General Considerations</span>
At high level, there are three primary considerations at play in
server processing of XML stanzas, which sometimes are at odds but
need to be managed in a consistent way:
1. It is good to deliver a stanza to the intended recipient if
possible.
2. If a stanza cannot be delivered, it is helpful to inform the
sender.
3. It is bad to facilitate directory harvesting attacks
(<a href="#section-13.11">Section 13.11</a>) and presence leaks (<a href="#section-13.10.2">Section 13.10.2</a>).
With regard to possible delivery-related attacks, the following
points need to be kept in mind:
1. From the perspective of an attacker, there is little if any
effective difference between the server's (i) delivering the
stanza or storing it offline for later delivery (see [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>])
and (ii) silently ignoring it (because an error is not returned
immediately in any of those cases); therefore, in scenarios where
a server delivers a stanza or places the stanza into offline
storage for later delivery, it needs to silently ignore the
stanza if that account does not exist.
2. How a server processes stanzas sent to the bare JID
<localpart@domainpart> has implications for directory harvesting,
because an attacker could determine whether an account exists if
the server responds differently depending on whether there is an
account for a given bare JID.
3. How a server processes stanzas sent to a full JID has
implications for presence leaks, because an attacker could send
requests to multiple full JIDs and receive different replies
depending on whether the user has a device currently online at
that full JID. The use of randomized resourceparts (whether
generated by the client or the server as described under
<a href="#section-7">Section 7</a>) significantly helps to mitigate this attack, so it is
of somewhat lesser concern than the directory harvesting attack.
Naturally, presence is not leaked if the entity to which a user's
server returns an error already knows the user's presence or is
authorized to do so (e.g., by means of a presence subscription or
directed presence), and a server does not enable a directory
<span class="grey">Saint-Andre Standards Track [Page 140]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-141" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
harvesting attack if it returns an error to an entity that already
knows if a user exists (e.g., because the entity is in the user's
contact list); these matters are discussed more fully in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>].
<span class="h3"><a class="selflink" id="section-10.3" href="#section-10.3">10.3</a>. No 'to' Address</span>
If the stanza possesses no 'to' attribute, the server MUST handle it
directly on behalf of the entity that sent it, where the meaning of
"handle it directly" depends on whether the stanza is message,
presence, or IQ. Because all stanzas received from other servers
MUST possess a 'to' attribute, this rule applies only to stanzas
received from a local entity (typically a client) that is connected
to the server.
<span class="h4"><a class="selflink" id="section-10.3.1" href="#section-10.3.1">10.3.1</a>. Message</span>
If the server receives a message stanza with no 'to' attribute, it
MUST treat the message as if the 'to' address were the bare JID
<localpart@domainpart> of the sending entity.
<span class="h4"><a class="selflink" id="section-10.3.2" href="#section-10.3.2">10.3.2</a>. Presence</span>
If the server receives a presence stanza with no 'to' attribute, it
MUST broadcast it to the entities that are subscribed to the sending
entity's presence, if applicable ([<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>] defines the semantics of
such broadcasting for presence applications).
<span class="h4"><a class="selflink" id="section-10.3.3" href="#section-10.3.3">10.3.3</a>. IQ</span>
If the server receives an IQ stanza with no 'to' attribute, it MUST
process the stanza on behalf of the account from which received the
stanza, as follows:
1. If the IQ stanza is of type "get" or "set" and the server
understands the namespace that qualifies the payload, the server
MUST handle the stanza on behalf of the sending entity or return
an appropriate error to the sending entity. Although the meaning
of "handle" is determined by the semantics of the qualifying
namespace, in general the server will respond to the IQ stanza of
type "get" or "set" by returning an appropriate IQ stanza of type
"result" or "error", responding as if the server were the bare
JID of the sending entity. As an example, if the sending entity
sends an IQ stanza of type "get" where the payload is qualified
by the 'jabber:iq:roster' namespace (as described in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]),
then the server will return the roster associated with the
sending entity's bare JID to the particular resource of the
sending entity that requested the roster.
<span class="grey">Saint-Andre Standards Track [Page 141]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-142" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
2. If the IQ stanza is of type "get" or "set" and the server does
not understand the namespace that qualifies the payload, the
server MUST return an error to the sending entity, which MUST be
<service-unavailable/>.
3. If the IQ stanza is of type "error" or "result", the server MUST
handle the error or result in accordance with the payload of the
associated IQ stanza or type "get" or "set" (if there is no such
associated stanza, the server MUST ignore the error or result
stanza).
<span class="h3"><a class="selflink" id="section-10.4" href="#section-10.4">10.4</a>. Remote Domain</span>
If the domainpart of the JID contained in the 'to' attribute does not
match one of the configured FQDNs of the server, the server SHOULD
attempt to route the stanza to the remote domain (subject to local
service provisioning and security policies regarding inter-domain
communication, since such communication is OPTIONAL for any given
deployment). As described in the following sections, there are two
possible cases.
Security Warning: These rules apply only client-to-server streams.
As described under <a href="#section-8.1.1.2">Section 8.1.1.2</a>, a server MUST NOT accept a
stanza over a server-to-server stream if the domainpart of the JID
in the 'to' attribute does not match an FQDN serviced by the
receiving server.
<span class="h4"><a class="selflink" id="section-10.4.1" href="#section-10.4.1">10.4.1</a>. Existing Stream</span>
If a server-to-server stream already exists between the two domains,
the sender's server SHOULD attempt to route the stanza to the
authoritative server for the remote domain over the existing stream.
<span class="h4"><a class="selflink" id="section-10.4.2" href="#section-10.4.2">10.4.2</a>. No Existing Stream</span>
If there exists no server-to-server stream between the two domains,
the sender's server will proceed as follows:
1. Resolve the FQDN of the remote domain (as described under
<a href="#section-13.9.2">Section 13.9.2</a>).
2. Negotiate a server-to-server stream between the two domains (as
defined under <a href="#section-5">Section 5</a> and <a href="#section-6">Section 6</a>).
3. Route the stanza to the authoritative server for the remote
domain over the newly established stream.
<span class="grey">Saint-Andre Standards Track [Page 142]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-143" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-10.4.3" href="#section-10.4.3">10.4.3</a>. Error Handling</span>
If routing of a stanza to the intended recipient's server is
unsuccessful, the sender's server MUST return an error to the sender.
If resolution of the remote domain is unsuccessful, the stanza error
MUST be <remote-server-not-found/> (<a href="#section-8.3.3.16">Section 8.3.3.16</a>). If resolution
succeeds but streams cannot be negotiated, the stanza error MUST be
<remote-server-timeout/> (<a href="#section-8.3.3.17">Section 8.3.3.17</a>).
If stream negotiation with the intended recipient's server is
successful but the remote server cannot deliver the stanza to the
recipient, the remote server MUST return an appropriate error to the
sender by way of the sender's server.
<span class="h3"><a class="selflink" id="section-10.5" href="#section-10.5">10.5</a>. Local Domain</span>
If the domainpart of the JID contained in the 'to' attribute matches
one of the configured FQDNs of the server, the server MUST first
determine if the FQDN is serviced by the server itself or by a
specialized local service. If the latter, the server MUST route the
stanza to that service. If the former, the server MUST proceed as
follows. However, the server MUST NOT route or "forward" the stanza
to another domain, because it is the server's responsibility to
process all stanzas for which the domainpart of the 'to' address
matches one of the configured FQDNs of the server (among other
things, this helps to prevent looping).
<span class="h4"><a class="selflink" id="section-10.5.1" href="#section-10.5.1">10.5.1</a>. domainpart</span>
If the JID contained in the 'to' attribute is of the form
<domainpart>, then the server MUST either (a) handle the stanza as
appropriate for the stanza kind or (b) return an error stanza to the
sender.
<span class="h4"><a class="selflink" id="section-10.5.2" href="#section-10.5.2">10.5.2</a>. domainpart/resourcepart</span>
If the JID contained in the 'to' attribute is of the form
<domainpart/resourcepart>, then the server MUST either (a) handle the
stanza as appropriate for the stanza kind or (b) return an error
stanza to the sender.
<span class="h4"><a class="selflink" id="section-10.5.3" href="#section-10.5.3">10.5.3</a>. localpart@domainpart</span>
An address of this type is normally associated with an account on the
server. The following rules provide some general guidelines; more
detailed rules in the context of instant messaging and presence
applications are provided in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>].
<span class="grey">Saint-Andre Standards Track [Page 143]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-144" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h5"><a class="selflink" id="section-10.5.3.1" href="#section-10.5.3.1">10.5.3.1</a>. No Such User</span>
If there is no local account associated with the
<localpart@domainpart>, how the stanza is processed depends on the
stanza type.
o For a message stanza, the server MUST either (a) silently ignore
the stanza or (b) return a <service-unavailable/> stanza error
(<a href="#section-8.3.3.19">Section 8.3.3.19</a>) to the sender.
o For a presence stanza, the server SHOULD ignore the stanza (or
behave as described in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]).
o For an IQ stanza, the server MUST return a <service-unavailable/>
stanza error (<a href="#section-8.3.3.19">Section 8.3.3.19</a>) to the sender.
<span class="h5"><a class="selflink" id="section-10.5.3.2" href="#section-10.5.3.2">10.5.3.2</a>. User Exists</span>
If the JID contained in the 'to' attribute is of the form
<localpart@domainpart>, how the stanza is processed depends on the
stanza type.
o For a message stanza, if there exists at least one connected
resource for the account then the server SHOULD deliver it to at
least one of the connected resources. If there exists no
connected resource then the server MUST either (a) store the
message offline for delivery when the account next has a connected
resource or (b) return a <service-unavailable/> stanza error
(<a href="#section-8.3.3.19">Section 8.3.3.19</a>).
o For a presence stanza, if there exists at least one connected
resource that has sent initial presence (i.e., has a "presence
session" as defined in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]) then the server SHOULD deliver
it to such resources. If there exists no connected resource then
the server SHOULD ignore the stanza (or behave as described in
[<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>]).
o For an IQ stanza, the server MUST handle it directly on behalf of
the intended recipient.
<span class="h4"><a class="selflink" id="section-10.5.4" href="#section-10.5.4">10.5.4</a>. localpart@domainpart/resourcepart</span>
If the JID contained in the 'to' attribute is of the form
<localpart@domainpart/resourcepart> and the user exists but there is
no connected resource that exactly matches the full JID, the stanza
SHOULD be processed as if the JID were of the form
<localpart@domainpart> as described under <a href="#section-10.5.3.2">Section 10.5.3.2</a>.
<span class="grey">Saint-Andre Standards Track [Page 144]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-145" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
If the JID contained in the 'to' attribute is of the form
<localpart@domainpart/resourcepart>, the user exists, and there is a
connected resource that exactly matches the full JID, the server MUST
deliver the stanza to that connected resource.
<span class="h2"><a class="selflink" id="section-11" href="#section-11">11</a>. XML Usage</span>
<span class="h3"><a class="selflink" id="section-11.1" href="#section-11.1">11.1</a>. XML Restrictions</span>
XMPP defines a class of data objects called XML streams as well as
the behavior of computer programs that process XML streams. XMPP is
an application profile or restricted form of the Extensible Markup
Language [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>], and a complete XML stream (including start and end
stream tags) is a conforming XML document.
However, XMPP does not deal with XML documents but with XML streams.
Because XMPP does not require the parsing of arbitrary and complete
XML documents, there is no requirement that XMPP needs to support the
full feature set of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>]. Furthermore, XMPP uses XML to define
protocol data structures and extensions for the purpose of structured
interactions between network entities and therefore adheres to the
recommendations provided in [<a href="#ref-XML-GUIDE" title=""Guidelines for the Use of Extensible Markup Language (XML) within IETF Protocols"">XML-GUIDE</a>] regarding restrictions on the
use of XML in IETF protocols. As a result, the following features of
XML are prohibited in XMPP:
o comments (as defined in Section 2.5 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>])
o processing instructions (<a href="#section-2.6">Section 2.6</a> therein)
o internal or external DTD subsets (<a href="#section-2.8">Section 2.8</a> therein)
o internal or external entity references (<a href="#section-4.2">Section 4.2</a> therein) with
the exception of the predefined entities (<a href="#section-4.6">Section 4.6</a> therein)
An XMPP implementation MUST behave as follows with regard to these
features:
1. An XMPP implementation MUST NOT inject characters matching such
features into an XML stream.
2. If an XMPP implementation receives characters matching such
features over an XML stream, it MUST close the stream with a
stream error, which SHOULD be <restricted-xml/>
(<a href="#section-4.9.3.18">Section 4.9.3.18</a>), although some existing implementations send
<bad-format/> (<a href="#section-4.9.3.1">Section 4.9.3.1</a>) instead.
<span class="grey">Saint-Andre Standards Track [Page 145]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-146" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-11.2" href="#section-11.2">11.2</a>. XML Namespace Names and Prefixes</span>
XML namespaces (see [<a href="#ref-XML-NAMES" title=""Namespaces in XML 1.0 (Third Edition)"">XML-NAMES</a>]) are used within XMPP streams to
create strict boundaries of data ownership. The basic function of
namespaces is to separate different vocabularies of XML elements that
are structurally mixed together. Ensuring that XMPP streams are
namespace-aware enables any allowable XML to be structurally mixed
with any data element within XMPP. XMPP-specific rules for XML
namespace names and prefixes are defined under <a href="#section-4.8">Section 4.8</a> for XML
streams and <a href="#section-8.4">Section 8.4</a> for XML stanzas.
<span class="h3"><a class="selflink" id="section-11.3" href="#section-11.3">11.3</a>. Well-Formedness</span>
In XML, there are two varieties of well-formedness:
o "XML-well-formedness" in accordance with the definition of "well-
formed" from Section 2.1 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>].
o "Namespace-well-formedness" in accordance with the definition of
"namespace-well-formed" from Section 7 of [<a href="#ref-XML-NAMES" title=""Namespaces in XML 1.0 (Third Edition)"">XML-NAMES</a>].
The following rules apply:
1. An XMPP entity MUST NOT generate data that is not XML-well-
formed.
2. An XMPP entity MUST NOT accept data that is not XML-well-formed;
instead it MUST close the stream over which the data was received
with a <not-well-formed/> stream error (<a href="#section-4.9.3.13">Section 4.9.3.13</a>).
3. An XMPP entity MUST NOT generate data that is not namespace-well-
formed.
4. An XMPP entity MUST NOT accept data that is not namespace-well-
formed (in particular, an XMPP server MUST NOT route or deliver
data that is not namespace-well-formed); instead it MUST return
either a <not-acceptable/> stanza error (<a href="#section-8.3.3.9">Section 8.3.3.9</a>) or
close the stream with a <not-well-formed/> stream error
(<a href="#section-4.9.3.13">Section 4.9.3.13</a>), where it is preferable to close the stream
with a stream error because accepting such data can open an
entity to certain denial-of-service attacks.
Interoperability Note: Because these restrictions were
underspecified in [<a href="./rfc3920" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">RFC3920</a>], it is possible that implementations
based on that specification will send data that does not comply
with these restrictions.
<span class="grey">Saint-Andre Standards Track [Page 146]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-147" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-11.4" href="#section-11.4">11.4</a>. Validation</span>
A server is not responsible for ensuring that XML data delivered to a
connected client or routed to a peer server is valid, in accordance
with the definition of "valid" provided in Section 2.8 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>]. An
implementation MAY choose to accept or send only data that has been
explicitly validated against the schemas provided in this document,
but such behavior is OPTIONAL. Clients are advised not to rely on
the ability to send data that does not conform to the schemas, and
SHOULD ignore any non-conformant elements or attributes on the
incoming XML stream.
Informational Note: The terms "valid" and "well-formed" are
distinct in XML.
<span class="h3"><a class="selflink" id="section-11.5" href="#section-11.5">11.5</a>. Inclusion of XML Declaration</span>
Before sending a stream header, an implementation SHOULD send an XML
declaration (matching the "XMLDecl" production from [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>]).
Applications MUST follow the rules provided in [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>] regarding the
format of the XML declaration and the circumstances under which the
XML declaration is included.
Because external markup declarations are prohibited in XMPP (as
described under <a href="#section-11.1">Section 11.1</a>), the standalone document declaration
(matching the "SDDecl" production from [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>]) would have no meaning
and therefore MUST NOT be included in an XML declaration sent over an
XML stream. If an XMPP entity receives an XML declaration containing
a standalone document declaration set to a value of "no", the entity
MUST either ignore the standalone document declaration or close the
stream with a stream error, which SHOULD be <restricted-xml/>
(<a href="#section-4.9.3.18">Section 4.9.3.18</a>).
<span class="h3"><a class="selflink" id="section-11.6" href="#section-11.6">11.6</a>. Character Encoding</span>
Implementations MUST support the UTF-8 transformation of Universal
Character Set [<a href="#ref-UCS2" title=""Information Technology - Universal Multiple-octet coded Character Set (UCS) - Amendment 2: UCS Transformation Format 8 (UTF-8)"">UCS2</a>] characters, as needed for conformance with
[<a href="#ref-CHARSETS" title=""IETF Policy on Character Sets and Languages"">CHARSETS</a>] and as defined in [<a href="#ref-UTF-8" title=""UTF-8, a transformation format of ISO 10646"">UTF-8</a>]. Implementations MUST NOT
attempt to use any other encoding. If one party to an XML stream
detects that the other party has attempted to send XML data with an
encoding other than UTF-8, it MUST close the stream with a stream
error, which SHOULD be <unsupported-encoding/> (<a href="#section-4.9.3.22">Section 4.9.3.22</a>),
although some existing implementations send <bad-format/>
(<a href="#section-4.9.3.1">Section 4.9.3.1</a>) instead.
Because it is mandatory for an XMPP implementation to support all and
only the UTF-8 encoding and because UTF-8 always has the same byte
order, an implementation MUST NOT send a byte order mark ("BOM") at
<span class="grey">Saint-Andre Standards Track [Page 147]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-148" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
the beginning of the data stream. If an entity receives the
[<a href="#ref-UNICODE" title=""The Unicode Standard, Version 6.0"">UNICODE</a>] character U+FEFF anywhere in an XML stream (including as
the first character of the stream), it MUST interpret that character
as a zero width no-break space, not as a byte order mark.
<span class="h3"><a class="selflink" id="section-11.7" href="#section-11.7">11.7</a>. Whitespace</span>
Except where explicitly disallowed (e.g., during TLS negotiation
(<a href="#section-5">Section 5</a>) and SASL negotiation (<a href="#section-6">Section 6</a>)), either entity MAY send
whitespace as separators between XML stanzas or between any other
first-level elements sent over the stream. One common use for
sending such whitespace is explained under <a href="#section-4.4">Section 4.4</a>.
<span class="h3"><a class="selflink" id="section-11.8" href="#section-11.8">11.8</a>. XML Versions</span>
XMPP is an application profile of XML 1.0. A future version of XMPP
might be defined in terms of higher versions of XML, but this
specification defines XMPP only in terms of XML 1.0.
<span class="h2"><a class="selflink" id="section-12" href="#section-12">12</a>. Internationalization Considerations</span>
As specified under <a href="#section-11.6">Section 11.6</a>, XML streams MUST be encoded in
UTF-8.
As specified under <a href="#section-4.7">Section 4.7</a>, an XML stream SHOULD include an 'xml:
lang' attribute specifying the default language for any XML character
data that is intended to be presented to a human user. As specified
under <a href="#section-8.1.5">Section 8.1.5</a>, an XML stanza SHOULD include an 'xml:lang'
attribute if the stanza contains XML character data that is intended
to be presented to a human user. A server SHOULD apply the default
'xml:lang' attribute to stanzas it routes or delivers on behalf of
connected entities, and MUST NOT modify or delete 'xml:lang'
attributes on stanzas it receives from other entities.
Internationalization of XMPP addresses is specified in [<a href="#ref-XMPP-ADDR" title=""Extensible Messaging and Presence Protocol (XMPP): Address Format"">XMPP-ADDR</a>].
<span class="h2"><a class="selflink" id="section-13" href="#section-13">13</a>. Security Considerations</span>
<span class="h3"><a class="selflink" id="section-13.1" href="#section-13.1">13.1</a>. Fundamentals</span>
XMPP technologies are typically deployed using a decentralized
client-server architecture. As a result, several paths are possible
when two XMPP entities need to communicate:
1. Both entities are servers. In this case, the entities can
establish a direct server-to-server stream between themselves.
<span class="grey">Saint-Andre Standards Track [Page 148]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-149" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
2. One entity is a server and the other entity is a client whose
account is hosted on that server. In this case, the entities can
establish a direct client-to-server stream between themselves.
3. Both entities are clients whose accounts are hosted on the same
server. In this case, the entities cannot establish a direct
stream between themselves, but there is only one intermediate
entity between them, whose policies they might understand and in
which they might have some level of trust (e.g., the server might
require the use of Transport Layer Security for all client
connections).
4. Both entities are clients but their accounts are hosted on
different servers. In this case, the entities cannot establish a
direct stream between themselves and there are two intermediate
entities between them; each client might have some trust in the
server that hosts its account but might know nothing about the
policies of the server to which the other client connects.
This specification covers only the security of a direct XML stream
between two servers or between a client and a server (cases #1 and
#2), where each stream can be considered a single "hop" along a
communication path. The goal of security for a multi-hop path (cases
#3 and #4), although very desirable, is out of scope for this
specification.
In accordance with [<a href="#ref-SEC-GUIDE" title=""Guidelines for Writing RFC Text on Security Considerations"">SEC-GUIDE</a>], this specification covers
communication security (confidentiality, data integrity, and peer
entity authentication), non-repudiation, and systems security
(unauthorized usage, inappropriate usage, and denial of service). We
also discuss common security issues such as information leaks,
firewalls, and directory harvesting, as well as best practices
related to the reuse of technologies such as base 64, DNS,
cryptographic hash functions, SASL, TLS, UTF-8, and XML.
<span class="h3"><a class="selflink" id="section-13.2" href="#section-13.2">13.2</a>. Threat Model</span>
The threat model for XMPP is in essence the standard "Internet Threat
Model" described in [<a href="#ref-SEC-GUIDE" title=""Guidelines for Writing RFC Text on Security Considerations"">SEC-GUIDE</a>]. Attackers are assumed to be
interested in and capable of launching the following attacks against
unprotected XMPP systems:
o Eavesdropping
o Sniffing passwords
o Breaking passwords through dictionary attacks
<span class="grey">Saint-Andre Standards Track [Page 149]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-150" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
o Discovering usernames through directory harvesting attacks
o Replaying, inserting, deleting, or modifying stanzas
o Spoofing users
o Gaining unauthorized entry to a server or account
o Using a server or account inappropriately
o Denying service to other entities
o Subverting communication streams through man-in-the-middle attacks
o Gaining control over on-path servers
Where appropriate, the following sections describe methods for
protecting against these threats.
<span class="h3"><a class="selflink" id="section-13.3" href="#section-13.3">13.3</a>. Order of Layers</span>
The order of layers in which protocols MUST be stacked is as follows:
1. TCP
2. TLS
3. SASL
4. XMPP
This order has important security implications, as described
throughout these security considerations.
Within XMPP, XML stanzas are further ordered on top of XML streams,
as described under <a href="#section-4">Section 4</a>.
<span class="h3"><a class="selflink" id="section-13.4" href="#section-13.4">13.4</a>. Confidentiality and Integrity</span>
The use of Transport Layer Security (TLS) with appropriate
ciphersuites provides a reliable mechanism to ensure the
confidentiality and integrity of data exchanged between a client and
a server or between two servers. Therefore, TLS can help to protect
against eavesdropping, password sniffing, man-in-the-middle attacks,
and stanza replays, insertion, deletion, and modification over an XML
stream. XMPP clients and servers MUST support TLS as defined under
<a href="#section-5">Section 5</a>.
<span class="grey">Saint-Andre Standards Track [Page 150]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-151" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Informational Note: The confidentiality and integrity of a stream
can be protected by methods other than TLS, e.g., by means of a
SASL mechanism that involves negotiation of a security layer.
Security Warning: The use of TLS in XMPP applies to a single
stream. Because XMPP is typically deployed using a distributed
client-server architecture (as explained under <a href="#section-2.5">Section 2.5</a>), a
stanza might traverse multiple streams, and not all of those
streams might be TLS-protected. For example, a stanza sent from a
client with a session at one server (e.g.,
<romeo@example.net/orchard>) and intended for delivery to a client
with a session at another server (e.g.,
<juliet@example.com/balcony>) will traverse three streams: (1) the
stream from the sender's client to its server, (2) the stream from
the sender's server to the recipient's server, and (3) the stream
from the recipient's server to the recipient's client.
Furthermore, the stanza will be processed as cleartext within the
sender's server and the recipient's server. Therefore, even if
the stream from the sender's client to its server is protected,
the confidentiality and integrity of a stanza sent over that
protected stream cannot be guaranteed when the stanza is processed
by the sender's server, sent from the sender's server to the
recipient's server, processed by the recipient's server, or sent
from the recipient's server to the recipient's client. Only a
robust technology for end-to-end encryption could ensure the
confidentiality and integrity of a stanza as it traverses all of
the "hops" along a communication path (e.g., a technology that
meets the requirements defined in [<a href="#ref-E2E-REQS" title=""Requirements for End-to-End Encryption in the Extensible Messaging and Presence Protocol (XMPP)"">E2E-REQS</a>]). Unfortunately, the
XMPP community has so far failed to produce an end-to-end
encryption technology that might be suitable for widespread
implementation and deployment, and definition of such a technology
is out of scope for this document.
<span class="h3"><a class="selflink" id="section-13.5" href="#section-13.5">13.5</a>. Peer Entity Authentication</span>
The use of the Simple Authentication and Security Layer (SASL) for
authentication provides a reliable mechanism for peer entity
authentication. Therefore, SASL helps to protect against user
spoofing, unauthorized usage, and man-in-the middle attacks. XMPP
clients and servers MUST support SASL as defined under <a href="#section-6">Section 6</a>.
<span class="h3"><a class="selflink" id="section-13.6" href="#section-13.6">13.6</a>. Strong Security</span>
[<a id="ref-STRONGSEC">STRONGSEC</a>] defines "strong security" and its importance to
communication over the Internet. For the purpose of XMPP
communication over client-to-server and server-to-server streams, the
term "strong security" refers to the use of security technologies
<span class="grey">Saint-Andre Standards Track [Page 151]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-152" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
that provide both mutual authentication and integrity checking (e.g.,
a combination of TLS encryption and SASL authentication using
appropriate SASL mechanisms).
Implementations MUST support strong security. Service provisioning
SHOULD use strong security.
An implementation SHOULD make it possible for an end user or service
administrator to provision a deployment with specific trust anchors
for the certificate presented by a connecting entity (either client
or server); when an application is thus provisioned, it MUST NOT use
a generic PKI trust store to authenticate the connecting entity.
More detailed rules and guidelines regarding certificate validation
are provided in the next section.
The initial stream and the response stream MUST be secured
separately, although security in both directions MAY be established
via mechanisms that provide mutual authentication.
<span class="h3"><a class="selflink" id="section-13.7" href="#section-13.7">13.7</a>. Certificates</span>
Channel encryption of an XML stream using Transport Layer Security as
described under <a href="#section-5">Section 5</a>, and in some cases also authentication as
described under <a href="#section-6">Section 6</a>, is commonly based on a PKIX certificate
presented by the receiving entity (or, in the case of mutual
certificate authentication, both the receiving entity and the
initiating entity). This section describes best practices regarding
the generation of PKIX certificates to be presented by XMPP entities
and the verification of PKIX certificates presented by XMPP entities.
In general, the following sections rely on and extend the rules and
guidelines provided in the [<a href="#ref-PKIX" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">PKIX</a>] profile of [<a href="#ref-X509" title=""Information technology - Open Systems Interconnection - The Directory: Public-key and attribute certificate frameworks"">X509</a>], and in
[<a href="#ref-TLS-CERTS" title=""Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)"">TLS-CERTS</a>]. The reader is referred to those specifications for a
detailed understanding of PKIX certificates and their use in TLS.
<span class="h4"><a class="selflink" id="section-13.7.1" href="#section-13.7.1">13.7.1</a>. Certificate Generation</span>
<span class="h5"><a class="selflink" id="section-13.7.1.1" href="#section-13.7.1.1">13.7.1.1</a>. General Considerations</span>
The following rules apply to end entity public key certificates that
are issued to XMPP servers or clients:
1. The certificate MUST conform to [<a href="#ref-PKIX" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">PKIX</a>].
2. The certificate MUST NOT contain a basicConstraints extension
with the cA boolean set to TRUE.
3. The subject field MUST NOT be null.
<span class="grey">Saint-Andre Standards Track [Page 152]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-153" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
4. The signatureAlgorithm SHOULD be the PKCS #1 version 1.5
signature algorithm with SHA-256 as defined by [<a href="#ref-PKIX-ALGO" title=""Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography Specifications Version 2.1"">PKIX-ALGO</a>], or a
stronger algorithm if available.
5. The certificate SHOULD include an Authority Information Access
(AIA) extension that specifies the address of an Online
Certificate Status Protocol [<a href="#ref-OCSP" title=""X.509 Internet Public Key Infrastructure Online Certificate Status Protocol - OCSP"">OCSP</a>] responder (if not, a relying
party would need to fall back on the use of Certificate
Revocation Lists (CRLs) as described in [<a href="#ref-PKIX" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">PKIX</a>]).
The following rules apply to certification authority (CA)
certificates that are used by issuers of XMPP end entity
certificates:
1. The certificate MUST conform to [<a href="#ref-PKIX" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">PKIX</a>].
2. The certificate MUST contain a keyUsage extension with the
digitalSignature bit set.
3. The subject field MUST NOT be null.
4. The signatureAlgorithm SHOULD be the PKCS #1 version 1.5
signature algorithm with SHA-256 as defined by [<a href="#ref-PKIX-ALGO" title=""Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography Specifications Version 2.1"">PKIX-ALGO</a>], or a
stronger algorithm if available.
5. For issuers of public key certificates, the issuer's certificate
MUST contain a basicConstraints extension with the cA boolean set
to TRUE.
<span class="h5"><a class="selflink" id="section-13.7.1.2" href="#section-13.7.1.2">13.7.1.2</a>. Server Certificates</span>
<span class="h6"><a class="selflink" id="section-13.7.1.2.1" href="#section-13.7.1.2.1">13.7.1.2.1</a>. Rules</span>
In a PKIX certificate to be presented by an XMPP server (i.e., a
"server certificate"), the certificate SHOULD include one or more
XMPP addresses (i.e., domainparts) associated with XMPP services
hosted at the server. The rules and guidelines defined in
[<a href="#ref-TLS-CERTS" title=""Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)"">TLS-CERTS</a>] apply to XMPP server certificates, with the following
XMPP-specific considerations:
o Support for the DNS-ID identifier type [<a href="#ref-PKIX" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">PKIX</a>] is REQUIRED in XMPP
client and server software implementations. Certification
authorities that issue XMPP-specific certificates MUST support the
DNS-ID identifier type. XMPP service providers SHOULD include the
DNS-ID identifier type in certificate requests.
<span class="grey">Saint-Andre Standards Track [Page 153]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-154" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
o Support for the SRV-ID identifier type [<a href="#ref-PKIX-SRV" title=""Internet X.509 Public Key Infrastructure Subject Alternative Name for Expression of Service Name"">PKIX-SRV</a>] is REQUIRED for
XMPP client and server software implementations (for verification
purposes XMPP client implementations need to support only the
"_xmpp-client" service type, whereas XMPP server implementations
need to support both the "_xmpp-client" and "_xmpp-server" service
types). Certification authorities that issue XMPP-specific
certificates SHOULD support the SRV-ID identifier type. XMPP
service providers SHOULD include the SRV-ID identifier type in
certificate requests.
o Support for the XmppAddr identifier type (specified under
<a href="#section-13.7.1.4">Section 13.7.1.4</a>) is encouraged in XMPP client and server software
implementations for the sake of backward-compatibility, but is no
longer encouraged in certificates issued by certification
authorities or requested by XMPP service providers.
o DNS domain names in server certificates MAY contain the wildcard
character '*' as the complete left-most label within the
identifier.
<span class="h6"><a class="selflink" id="section-13.7.1.2.2" href="#section-13.7.1.2.2">13.7.1.2.2</a>. Examples</span>
For our first (relatively simple) example, consider a company called
"Example Products, Inc." It hosts an XMPP service at
"im.example.com" (i.e., user addresses at the service are of the form
"user@im.example.com"), and SRV lookups for the xmpp-client and xmpp-
server services at "im.example.com" yield one machine, called
"x.example.com", as follows:
_xmpp-client._tcp.im.example.com. 400 IN SRV 20 0 5222 x.example.com
_xmpp-server._tcp.im.example.com. 400 IN SRV 20 0 5269 x.example.com
The certificate presented by x.example.com contains the following
representations:
o An otherName type of SRVName (id-on-dnsSRV) containing an
IA5String (ASCII) string of "_xmpp-client.im.example.com"
o An otherName type of SRVName (id-on-dnsSRV) containing an
IA5String (ASCII) string of "_xmpp-server.im.example.com"
o A dNSName containing an ASCII string of "im.example.com"
o An otherName type of XmppAddr (id-on-xmppAddr) containing a UTF-8
string of "im.example.com"
o A CN containing an ASCII string of "Example Products, Inc."
<span class="grey">Saint-Andre Standards Track [Page 154]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-155" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
For our second (more complex) example, consider an ISP called
"Example Internet Services". It hosts an XMPP service at
"example.net" (i.e., user addresses at the service are of the form
"user@example.net"), but SRV lookups for the xmpp-client and xmpp-
server services at "example.net" yield two machines ("x1.example.net"
and "x2.example.net"), as follows:
_xmpp-client._tcp.example.net. 68400 IN SRV 20 0 5222 x1.example.net.
_xmpp-client._tcp.example.net. 68400 IN SRV 20 0 5222 x2.example.net.
_xmpp-server._tcp.example.net. 68400 IN SRV 20 0 5269 x1.example.net.
_xmpp-server._tcp.example.net. 68400 IN SRV 20 0 5269 x2.example.net.
Example Internet Services also hosts chatrooms at chat.example.net,
and provides an xmpp-server SRV record for that service as well (thus
enabling entities from remote domains to access that service). It
also might provide other such services in the future, so it wishes to
represent a wildcard in its certificate to handle such growth.
The certificate presented by either x1.example.net or x2.example.net
contains the following representations:
o An otherName type of SRVName (id-on-dnsSRV) containing an
IA5String (ASCII) string of "_xmpp-client.example.net"
o An otherName type of SRVName (id-on-dnsSRV) containing an
IA5String (ASCII) string of "_xmpp-server.example.net"
o An otherName type of SRVName (id-on-dnsSRV) containing an
IA5String (ASCII) string of "_xmpp-server.chat.example.net"
o A dNSName containing an ASCII string of "example.net"
o A dNSName containing an ASCII string of "*.example.net"
o An otherName type of XmppAddr (id-on-xmppAddr) containing a UTF-8
string of "example.net"
o An otherName type of XmppAddr (id-on-xmppAddr) containing a UTF-8
string of "chat.example.net"
o A CN containing an ASCII string of "Example Internet Services"
<span class="grey">Saint-Andre Standards Track [Page 155]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-156" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h5"><a class="selflink" id="section-13.7.1.3" href="#section-13.7.1.3">13.7.1.3</a>. Client Certificates</span>
In a PKIX certificate to be presented by an XMPP client controlled by
a human user (i.e., a "client certificate"), it is RECOMMENDED for
the certificate to include one or more JIDs associated with an XMPP
user. If included, a JID MUST be represented as an XmppAddr as
specified under <a href="#section-13.7.1.4">Section 13.7.1.4</a>.
<span class="h5"><a class="selflink" id="section-13.7.1.4" href="#section-13.7.1.4">13.7.1.4</a>. XmppAddr Identifier Type</span>
The XmppAddr identifier type is a UTF8String within an otherName
entity inside the subjectAltName, using the [<a href="#ref-ASN.1" title=""Recommendation X.208: Specification of Abstract Syntax Notation One (ASN.1)"">ASN.1</a>] Object Identifier
"id-on-xmppAddr" specified below.
id-pkix OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
dod(6) internet(1) security(5) mechanisms(5) pkix(7) }
id-on OBJECT IDENTIFIER ::= { id-pkix 8 } -- other name forms
id-on-xmppAddr OBJECT IDENTIFIER ::= { id-on 5 }
XmppAddr ::= UTF8String
As an alternative to the "id-on-xmppAddr" notation, this Object
Identifier MAY be represented in dotted display format (i.e.,
"1.3.6.1.5.5.7.8.5") or in the Uniform Resource Name notation
specified in [<a href="#ref-URN-OID" title=""A URN Namespace of Object Identifiers"">URN-OID</a>] (i.e., "urn:oid:1.3.6.1.5.5.7.8.5").
Thus for example the JID <juliet@im.example.com> as included in a
certificate could be formatted in any of the following three ways:
id-on-xmppAddr:
subjectAltName=otherName:id-on-xmppAddr;UTF8:juliet@im.example.com
dotted display format: subjectAltName=otherName:
1.3.6.1.5.5.7.8.5;UTF8:juliet@im.example.com
URN notation: subjectAltName=otherName:urn:oid:
1.3.6.1.5.5.7.8.5;UTF8:juliet@im.example.com
Use of the "id-on-xmppAddr" format is RECOMMENDED in the generation
of certificates, but all three formats MUST be supported for the
purpose of certificate validation.
The "id-on-xmppAddr" object identifier MAY be used in conjunction
with the extended key usage extension specified in Section 4.2.1.12
of [<a href="#ref-PKIX" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">PKIX</a>] in order to explicitly define and limit the intended use of
a certificate to the XMPP network.
<span class="grey">Saint-Andre Standards Track [Page 156]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-157" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-13.7.2" href="#section-13.7.2">13.7.2</a>. Certificate Validation</span>
When an XMPP entity is presented with a server certificate or client
certificate by a peer for the purpose of encryption or authentication
of XML streams as described under <a href="#section-5">Section 5</a> and <a href="#section-6">Section 6</a>, the entity
MUST attempt to validate the certificate to determine if the
certificate will be considered a "trusted certificate", i.e., a
certificate that is acceptable for encryption and/or authentication
in accordance with the XMPP entity's local service policies or
configured settings.
For both server certificates and client certificates, the validating
entity MUST do the following:
1. Attempt to verify the integrity of the certificate.
2. Attempt to verify that the certificate has been properly signed
by the issuing Certificate Authority.
3. Attempt to validate the full certification path.
4. Check the rules for end entity public key certificates and
certification authority certificates specified under
<a href="#section-13.7.1.1">Section 13.7.1.1</a> for the general case and under either
<a href="#section-13.7.1.2">Section 13.7.1.2</a> or <a href="#section-13.7.1.3">Section 13.7.1.3</a> for XMPP server or client
certificates, respectively.
5. Check certificate revocation messages via Certificate Revocation
Lists (CRLs), the Online Certificate Status Protocol [<a href="#ref-OCSP" title=""X.509 Internet Public Key Infrastructure Online Certificate Status Protocol - OCSP"">OCSP</a>], or
both.
If any of those validation attempts fail, the validating entity MUST
unilaterally terminate the session.
The following sections describe the additional identity verification
rules that apply to server-to-server and client-to-server streams.
Once the identity of the stream peer has been validated, the
validating entity SHOULD also correlate the validated identity with
the 'from' address (if any) of the stream header it received from the
peer. If the two identities do not match, the validating entity
SHOULD terminate the connection attempt (however, there might be good
reasons why the identities do not match, as described under
<a href="#section-4.7.1">Section 4.7.1</a>).
<span class="grey">Saint-Andre Standards Track [Page 157]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-158" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h5"><a class="selflink" id="section-13.7.2.1" href="#section-13.7.2.1">13.7.2.1</a>. Server Certificates</span>
For server certificates, the rules and guidelines defined in
[<a href="#ref-TLS-CERTS" title=""Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)"">TLS-CERTS</a>] apply, with the proviso that the XmppAddr identifier
specified under <a href="#section-13.7.1.4">Section 13.7.1.4</a> is allowed as a reference
identifier.
The identities to be checked are set as follows:
o The initiating entity sets the source domain of its reference
identifiers to the 'to' address it communicates in the initial
stream header; i.e., this is the identity it expects the receiving
entity to provide in a PKIX certificate.
o The receiving entity sets the source domain of its reference
identifiers to the 'from' address communicated by the initiating
entity in the initial stream header; i.e., this is the identity
that the initiating entity is trying to assert.
In the case of server-to-server communication, the matching procedure
described in [<a href="#ref-TLS-CERTS" title=""Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)"">TLS-CERTS</a>] can be performed by an application server
(receiving entity) when verifying an incoming server-to-server
connection from a peer server (initiating entity). In this case, the
receiving entity verifies the identity of the initiating entity and
uses as the source domain of its reference identifiers the DNS domain
name asserted by the initiating entity in the 'from' attribute of the
initial stream header. However, the matching procedure described in
[<a href="#ref-TLS-CERTS" title=""Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)"">TLS-CERTS</a>] remains unchanged and is applied in the same way.
<span class="h5"><a class="selflink" id="section-13.7.2.2" href="#section-13.7.2.2">13.7.2.2</a>. Client Certificates</span>
When an XMPP server validates a certificate presented by a client,
there are three possible cases, as discussed in the following
sections.
The identities to be checked are set as follows:
o The client sets the source domain of its reference identifiers to
the 'to' address it communicates in the initial stream header;
i.e., this is the identity it expects the server to provide in a
PKIX certificate.
o The server sets the bare JID of its reference identifiers to the
'from' address communicated by the initiating entity in the
initial stream header; i.e., this is the identity that the client
is trying to assert.
<span class="grey">Saint-Andre Standards Track [Page 158]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-159" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h6"><a class="selflink" id="section-13.7.2.2.1" href="#section-13.7.2.2.1">13.7.2.2.1</a>. Case #1</span>
If the client certificate appears to be certified by a certification
path terminating in a trust anchor (as described in Section 6.1 of
[<a href="#ref-PKIX" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">PKIX</a>]), the server MUST check the certificate for any instances of
the XmppAddr as described under <a href="#section-13.7.1.4">Section 13.7.1.4</a>. There are three
possible sub-cases:
Sub-Case #1: The server finds one XmppAddr for which the domainpart
of the represented JID matches one of the configured FQDNs of the
server; the server SHOULD use this represented JID as the
validated identity of the client.
Sub-Case #2: The server finds more than one XmppAddr for which the
domainpart of the represented JID matches one of the configured
FQDNs of the server; the server SHOULD use one of these
represented JIDs as the validated identity of the client, choosing
among them based on the bare JID contained in the 'from' address
of the initial stream header (if any), based on the domainpart
contained in the 'to' address of the initial stream header, or in
accordance with local service policies (such as a lookup in a user
database based on other information contained in the client
certificate).
Sub-Case #3: The server finds no XmppAddrs, or finds at least one
XmppAddr but the domainpart of the represented JID does not match
one of the configured FQDNs of the server; the server MUST NOT use
the represented JID (if any) as the validated identity of the
client but instead MUST validate the identity of the client using
other means in accordance with local service policies (such as a
lookup in a user database based on other information contained in
the client certificate). If the identity cannot be so validated,
the server MAY abort the validation process and terminate the TLS
negotiation.
<span class="h6"><a class="selflink" id="section-13.7.2.2.2" href="#section-13.7.2.2.2">13.7.2.2.2</a>. Case #2</span>
If the client certificate is certified by a Certificate Authority not
known to the server, the server MUST proceed as under Case #1, Sub-
Case #3.
<span class="h6"><a class="selflink" id="section-13.7.2.2.3" href="#section-13.7.2.2.3">13.7.2.2.3</a>. Case #3</span>
If the client certificate is self-signed, the server MUST proceed as
under Case #1, Sub-Case #3.
<span class="grey">Saint-Andre Standards Track [Page 159]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-160" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h5"><a class="selflink" id="section-13.7.2.3" href="#section-13.7.2.3">13.7.2.3</a>. Checking of Certificates in Long-Lived Streams</span>
Because XMPP uses long-lived XML streams, it is possible that a
certificate presented during stream negotiation might expire or be
revoked while the stream is still live (this is especially relevant
in the context of server-to-server streams). Therefore, each party
to a long-lived stream SHOULD:
1. Cache the expiration date of the certificate presented by the
other party and any certificates on which that certificate
depends (such as a root or intermediate certificate for a
certification authority), and close the stream when any such
certificate expires, with a stream error of <reset/>
(<a href="#section-4.9.3.16">Section 4.9.3.16</a>).
2. Periodically query the Online Certificate Status Protocol [<a href="#ref-OCSP" title=""X.509 Internet Public Key Infrastructure Online Certificate Status Protocol - OCSP"">OCSP</a>]
responder listed in the Authority Information Access (AIA)
extension of the certificate presented by the other party and any
certificates on which that certificate depends (such as a root or
intermediate certificate for a certification authority), and
close the stream if any such certificate has been revoked, with a
stream error of <reset/> (<a href="#section-4.9.3.16">Section 4.9.3.16</a>). It is RECOMMENDED
to query the OSCP responder at or near the time communicated via
the nextUpdate field received in the OCSP response or, if the
nextUpdate field is not set, to query every 24 hours.
After the stream is closed, the initiating entity from the closed
stream will need to reconnect and the receiving entity will need to
authenticate the initiating entity based on whatever certificate it
presents during negotiation of the new stream.
<span class="h5"><a class="selflink" id="section-13.7.2.4" href="#section-13.7.2.4">13.7.2.4</a>. Use of Certificates in XMPP Extensions</span>
Certificates MAY be used in extensions to XMPP for the purpose of
application-layer encryption or authentication above the level of XML
streams (e.g., for end-to-end encryption). Such extensions will
define their own certificate handling rules. At a minimum, such
extensions are encouraged to remain consistent with the rules defined
in this specification, specifying additional rules only when
necessary.
<span class="h3"><a class="selflink" id="section-13.8" href="#section-13.8">13.8</a>. Mandatory-to-Implement TLS and SASL Technologies</span>
The following TLS ciphersuites and SASL mechanisms are mandatory-to-
implement (naturally, implementations MAY support other ciphersuites
and mechanisms as well). For security considerations related to TLS
ciphersuites, see <a href="#section-13.9.4">Section 13.9.4</a> and [<a href="#ref-TLS" title=""The Transport Layer Security (TLS) Protocol Version 1.2"">TLS</a>]. For security
<span class="grey">Saint-Andre Standards Track [Page 160]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-161" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
considerations related to SASL mechanisms, see <a href="#section-13.9.4">Section 13.9.4</a>,
[<a href="#ref-SASL" title=""Simple Authentication and Security Layer (SASL)"">SASL</a>], and specifications for particular SASL mechanisms such as
[<a href="#ref-SCRAM" title=""Salted Challenge Response Authentication Mechanism (SCRAM) SASL and GSS-API Mechanisms"">SCRAM</a>], [<a href="#ref-DIGEST-MD5" title=""Using Digest Authentication as a SASL Mechanism"">DIGEST-MD5</a>], and [<a href="#ref-PLAIN" title=""The PLAIN Simple Authentication and Security Layer (SASL) Mechanism"">PLAIN</a>].
<span class="h4"><a class="selflink" id="section-13.8.1" href="#section-13.8.1">13.8.1</a>. For Authentication Only</span>
For authentication only, servers and clients MUST support the SASL
Salted Challenge Response Authentication Mechanism [<a href="#ref-SCRAM" title=""Salted Challenge Response Authentication Mechanism (SCRAM) SASL and GSS-API Mechanisms"">SCRAM</a>] -- in
particular, the SCRAM-SHA-1 and SCRAM-SHA-1-PLUS variants.
Security Warning: Even though it is possible to complete
authentication only without confidentiality, it is RECOMMENDED for
servers and clients to protect the stream with TLS before
attempting authentication with SASL, both to help protect the
information exchanged during SASL negotiation and to help prevent
certain downgrade attacks as described under <a href="#section-13.9.4">Section 13.9.4</a> and
<a href="#section-13.9.5">Section 13.9.5</a>. Even if TLS is used, implementations SHOULD also
enforce channel binding as described under <a href="#section-13.9.4">Section 13.9.4</a>.
Interoperability Note: The SCRAM-SHA-1 or SASL-SCRAM-SHA-1-PLUS
variants of the SCRAM mechanism replace the SASL DIGEST-MD5
mechanism as XMPP's mandatory-to-implement password-based method
for authentication only. For backward-compatibility with existing
deployed infrastructure, implementations are encouraged to
continue supporting the DIGEST-MD5 mechanism as specified in
[<a href="#ref-DIGEST-MD5" title=""Using Digest Authentication as a SASL Mechanism"">DIGEST-MD5</a>]; however, there are known interoperability issues
with DIGEST-MD5 that make it impractical in the long term.
<span class="h4"><a class="selflink" id="section-13.8.2" href="#section-13.8.2">13.8.2</a>. For Confidentiality Only</span>
For confidentiality only, servers MUST support TLS with the
TLS_RSA_WITH_AES_128_CBC_SHA ciphersuite.
Security Warning: Because a connection with confidentiality only
has weaker security properties than a connection with both
confidentiality and authentication, it is RECOMMENDED for servers
and clients to prefer connections with both qualities (e.g., by
protecting the stream with TLS before attempting authentication
with SASL). In practice, confidentiality only is employed merely
for server-to-server connections when the peer server does not
present a trusted certificate and the servers use Server Dialback
[<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>] for weak identity verification, but TLS with
confidentiality only is still desirable to protect the connection
against casual eavesdropping.
<span class="grey">Saint-Andre Standards Track [Page 161]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-162" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-13.8.3" href="#section-13.8.3">13.8.3</a>. For Confidentiality and Authentication with Passwords</span>
For both confidentiality and authentication with passwords, servers
and clients MUST implement TLS with the TLS_RSA_WITH_AES_128_CBC_SHA
ciphersuite plus SASL SCRAM, in particular the SCRAM-SHA-1 and
SCRAM-SHA-1-PLUS variants (with SCRAM-SHA1-PLUS being preferred, as
described under <a href="#section-13.9.4">Section 13.9.4</a>).
As further explained in the following Security Warning, in certain
circumstances a server MAY offer TLS with the
TLS_RSA_WITH_AES_128_CBC_SHA ciphersuite plus SASL PLAIN when it is
not possible to offer more secure alternatives; in addition, clients
SHOULD implement PLAIN over TLS in order to maximize interoperability
with servers that are not able to deploy more secure alternatives.
Security Warning: In practice, many servers offer, and many
clients use, TLS plus SASL PLAIN. The SCRAM-SHA-1 and especially
SCRAM-SHA-1-PLUS variants of the SCRAM mechanism are strongly
preferred over the PLAIN mechanism because of their superior
security properties (including for SCRAM-SHA-1-PLUS the ability to
enforce channel binding as described under <a href="#section-13.9.4">Section 13.9.4</a>). A
client SHOULD treat TLS plus SASL PLAIN as a technology of last
resort to be used only when interacting with a server that does
not offer SCRAM (or other alternatives that are more secure than
TLS plus SASL PLAIN), MUST prefer more secure mechanisms (e.g.,
EXTERNAL, SCRAM-SHA-1-PLUS, SCRAM-SHA-1, or the older DIGEST-MD5
mechanism) to the PLAIN mechanism, and MUST NOT use the PLAIN
mechanism if the stream does not at a minimum have confidentiality
and integrity protection via TLS with full certificate validation
as described under <a href="#section-13.7.2.1">Section 13.7.2.1</a>. A server MUST NOT offer SASL
PLAIN if the confidentiality and integrity of the stream are not
protected via TLS or an equivalent security layer. A server
SHOULD NOT offer TLS plus SASL PLAIN unless it is unable to offer
some variant of SASL SCRAM (or other alternatives that are more
secure than TLS plus SASL PLAIN), e.g., because the XMPP service
depends for authentication purposes on a database or directory
that is not under the control of the XMPP administrators, such as
Pluggable Authentication Modules (PAM), an Lightweight Directory
Access Protocol (LDAP) directory [<a href="#ref-LDAP" title=""Lightweight Directory Access Protocol (LDAP): Technical Specification Road Map"">LDAP</a>], or an Authentication,
Authorization, and Accounting (AAA) key management protocol (for
guidance, refer to [<a href="#ref-AAA" title=""Guidance for Authentication, Authorization, and Accounting (AAA) Key Management"">AAA</a>]). However, offering TLS plus SASL PLAIN
even when the server supports more secure alternatives might be
appropriate if the server needs to enable interoperability with an
installed base of clients that do not yet support SCRAM or other
alternatives that are more secure than TLS plus SASL PLAIN.
<span class="grey">Saint-Andre Standards Track [Page 162]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-163" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-13.8.4" href="#section-13.8.4">13.8.4</a>. For Confidentiality and Authentication without Passwords</span>
For both confidentiality and authentication without passwords,
servers MUST and clients SHOULD implement TLS with the
TLS_RSA_WITH_AES_128_CBC_SHA ciphersuite plus the SASL EXTERNAL
mechanism (see <a href="#appendix-A">Appendix A</a> of [<a href="#ref-SASL" title=""Simple Authentication and Security Layer (SASL)"">SASL</a>]) with PKIX certificates.
<span class="h3"><a class="selflink" id="section-13.9" href="#section-13.9">13.9</a>. Technology Reuse</span>
<span class="h4"><a class="selflink" id="section-13.9.1" href="#section-13.9.1">13.9.1</a>. Use of Base 64 in SASL</span>
Both the client and the server MUST verify any base 64 data received
during SASL negotiation (<a href="#section-6">Section 6</a>). An implementation MUST reject
(not ignore) any characters that are not explicitly allowed by the
base 64 alphabet; this helps to guard against creation of a covert
channel that could be used to "leak" information.
An implementation MUST NOT break on invalid input and MUST reject any
sequence of base 64 characters containing the pad ('=') character if
that character is included as something other than the last character
of the data (e.g., "=AAA" or "BBBB=CCC"); this helps to guard against
buffer overflow attacks and other attacks on the implementation.
While base 64 encoding visually hides otherwise easily recognized
information (such as passwords), it does not provide any
computational confidentiality.
All uses of base 64 encoding MUST follow the definition in Section 4
of [<a href="#ref-BASE64" title=""The Base16, Base32, and Base64 Data Encodings"">BASE64</a>] and padding bits MUST be set to zero.
<span class="h4"><a class="selflink" id="section-13.9.2" href="#section-13.9.2">13.9.2</a>. Use of DNS</span>
XMPP typically relies on the Domain Name System (specifically
[<a href="#ref-DNS-SRV" title=""A DNS RR for specifying the location of services (DNS SRV)"">DNS-SRV</a>] records) to resolve a fully qualified domain name to an IP
address before a client connects to a server or before a peer server
connects to another server. Before attempting to negotiate an XML
stream, the initiating entity MUST NOT proceed until it has resolved
the DNS domain name of the receiving entity as specified under
<a href="#section-3">Section 3</a> (although it is not necessary to resolve the DNS domain
name before each connection attempt, because DNS resolution results
can be temporarily cached in accordance with time-to-live values).
However, in the absence of a secure DNS option (e.g., as provided by
[<a href="#ref-DNSSEC" title=""DNS Security Introduction and Requirements"">DNSSEC</a>]), a malicious attacker with access to the DNS server data,
or able to cause spoofed answers to be cached in a recursive
resolver, can potentially cause the initiating entity to connect to
any XMPP server chosen by the attacker. Deployment and validation of
server certificates help to prevent such attacks.
<span class="grey">Saint-Andre Standards Track [Page 163]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-164" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-13.9.3" href="#section-13.9.3">13.9.3</a>. Use of Hash Functions</span>
XMPP itself does not directly mandate the use of any particular
cryptographic hash function. However, technologies on which XMPP
depends (e.g., TLS and particular SASL mechanisms), as well as
various XMPP extensions, might make use of cryptographic hash
functions. Those who implement XMPP technologies or who develop XMPP
extensions are advised to closely monitor the state of the art
regarding attacks against cryptographic hash functions in Internet
protocols as they relate to XMPP. For helpful guidance, refer to
[<a href="#ref-HASHES" title=""Attacks on Cryptographic Hashes in Internet Protocols"">HASHES</a>].
<span class="h4"><a class="selflink" id="section-13.9.4" href="#section-13.9.4">13.9.4</a>. Use of SASL</span>
Because the initiating entity chooses an acceptable SASL mechanism
from the list presented by the receiving entity, the initiating
entity depends on the receiving entity's list for authentication.
This dependency introduces the possibility of a downgrade attack if
an attacker can gain control of the channel and therefore present a
weak list of mechanisms. To mitigate this attack, the parties SHOULD
protect the channel using TLS before attempting SASL negotiation and
either perform full certificate validation as described under
<a href="#section-13.7.2.1">Section 13.7.2.1</a> or use a SASL mechanism that provides channel
bindings, such as SCRAM-SHA-1-PLUS. (Protecting the channel via TLS
with full certificate validation can help to ensure the
confidentiality and integrity of the information exchanged during
SASL negotiation.)
The SASL framework itself does not provide a method for binding SASL
authentication to a security layer providing confidentiality and
integrity protection that was negotiated at a lower layer (e.g.,
TLS). Such a binding is known as a "channel binding" (see
[<a href="#ref-CHANNEL" title=""On the Use of Channel Bindings to Secure Channels"">CHANNEL</a>]). Some SASL mechanisms provide channel bindings, which in
the case of XMPP would typically be a binding to TLS (see
[<a href="#ref-CHANNEL-TLS" title=""Channel Bindings for TLS"">CHANNEL-TLS</a>]). If a SASL mechanism provides a channel binding
(e.g., this is true of [<a href="#ref-SCRAM" title=""Salted Challenge Response Authentication Mechanism (SCRAM) SASL and GSS-API Mechanisms"">SCRAM</a>]), then XMPP entities using that
mechanism SHOULD prefer the channel binding variant (e.g., preferring
"SCRAM-SHA-1-PLUS" over "SCRAM-SHA-1"). If a SASL mechanism does not
provide a channel binding, then the mechanism cannot provide a way to
verify that the source and destination end points to which the lower
layer's security is bound are equivalent to the end points that SASL
is authenticating; furthermore, if the end points are not identical,
then the lower layer's security cannot be trusted to protect data
transmitted between the SASL-authenticated entities. In such a
situation, a SASL security layer SHOULD be negotiated that
effectively ignores the presence of the lower-layer security.
<span class="grey">Saint-Andre Standards Track [Page 164]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-165" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Many deployed XMPP services authenticate client connections by means
of passwords. It is well known that most human users choose
relatively weak passwords. Although service provisioning is out of
scope for this document, XMPP servers that allow password-based
authentication SHOULD enforce minimal criteria for password strength
to help prevent dictionary attacks. Because all password-based
authentication mechanisms are susceptible to password guessing
attacks, XMPP servers MUST limit the number of retries allowed during
SASL authentication, as described under <a href="#section-6.4.5">Section 6.4.5</a>.
Some SASL mechanisms (e.g., [<a href="#ref-ANONYMOUS" title=""Anonymous Simple Authentication and Security Layer (SASL) Mechanism"">ANONYMOUS</a>]) do not provide strong peer
entity authentication of the client to the server. Service
administrators are advised to enable such mechanisms with caution.
Best practices for the use of the SASL ANONYMOUS mechanism in XMPP
are described in [<a href="#ref-XEP-0175" title=""Best Practices for Use of SASL ANONYMOUS"">XEP-0175</a>].
<span class="h4"><a class="selflink" id="section-13.9.5" href="#section-13.9.5">13.9.5</a>. Use of TLS</span>
Implementations of TLS typically support multiple versions of the
Transport Layer Security protocol as well as the older Secure Sockets
Layer (SSL) protocol. Because of known security vulnerabilities,
XMPP servers and clients MUST NOT request, offer, or use SSL 2.0.
For further details, see <a href="#appendix-E.2">Appendix E.2</a> of [<a href="#ref-TLS" title=""The Transport Layer Security (TLS) Protocol Version 1.2"">TLS</a>] along with [<a href="#ref-TLS-SSL2" title=""Prohibiting Secure Sockets Layer (SSL) Version 2.0"">TLS-SSL2</a>].
To prevent man-in-the-middle attacks, the TLS client (which might be
an XMPP client or an XMPP server) MUST verify the certificate of the
TLS server and MUST check its understanding of the server FQDN
against the server's identity as presented in the TLS Certificate
message as described under <a href="#section-13.7.2.1">Section 13.7.2.1</a> (for further details, see
[<a href="#ref-TLS-CERTS" title=""Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)"">TLS-CERTS</a>].
Support for TLS renegotiation is strictly OPTIONAL. However,
implementations that support TLS renegotiation MUST implement and use
the TLS Renegotiation Extension [<a href="#ref-TLS-NEG" title=""Transport Layer Security (TLS) Renegotiation Indication Extension"">TLS-NEG</a>]. Further details are
provided under <a href="#section-5.3.5">Section 5.3.5</a>.
<span class="h4"><a class="selflink" id="section-13.9.6" href="#section-13.9.6">13.9.6</a>. Use of UTF-8</span>
The use of UTF-8 makes it possible to transport non-ASCII characters,
and thus enables character "spoofing" scenarios, in which a displayed
value appears to be something other than it is. Furthermore, there
are known attack scenarios related to the decoding of UTF-8 data. On
both of these points, refer to [<a href="#ref-UTF-8" title=""UTF-8, a transformation format of ISO 10646"">UTF-8</a>] for more information.
<span class="grey">Saint-Andre Standards Track [Page 165]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-166" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h4"><a class="selflink" id="section-13.9.7" href="#section-13.9.7">13.9.7</a>. Use of XML</span>
Because XMPP is an application profile of the Extensible Markup
Language [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>], many of the security considerations described in
[<a href="#ref-XML-MEDIA" title=""XML Media Types"">XML-MEDIA</a>] and [<a href="#ref-XML-GUIDE" title=""Guidelines for the Use of Extensible Markup Language (XML) within IETF Protocols"">XML-GUIDE</a>] also apply to XMPP. Several aspects of
XMPP mitigate the risks described there, such as the prohibitions
specified under <a href="#section-11.1">Section 11.1</a> and the lack of external references to
style sheets or transformations, but these mitigating factors are by
no means comprehensive.
<span class="h3"><a class="selflink" id="section-13.10" href="#section-13.10">13.10</a>. Information Leaks</span>
<span class="h4"><a class="selflink" id="section-13.10.1" href="#section-13.10.1">13.10.1</a>. IP Addresses</span>
A client's IP address and method of access MUST NOT be made public by
a server (e.g., as typically occurs in [<a href="#ref-IRC" title=""Internet Relay Chat: Architecture"">IRC</a>]).
<span class="h4"><a class="selflink" id="section-13.10.2" href="#section-13.10.2">13.10.2</a>. Presence Information</span>
One of the core aspects of XMPP is presence: information about the
network availability of an XMPP entity (i.e., whether the entity is
currently online or offline). A "presence leak" occurs when an
entity's network availability is inadvertently and involuntarily
revealed to a second entity that is not authorized to know the first
entity's network availability.
Although presence is discussed more fully in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence"">XMPP-IM</a>], it is
important to note that an XMPP server MUST NOT leak presence. In
particular at the core XMPP level, real-time addressing and network
availability is associated with a specific connected resource;
therefore, any disclosure of a connected resource's full JID
comprises a presence leak. To help prevent such a presence leak, a
server MUST NOT return different stanza errors depending on whether a
potential attacker sends XML stanzas to the entity's bare JID
(<localpart@domainpart>) or full JID
(<localpart@domainpart/resourcepart>).
<span class="h3"><a class="selflink" id="section-13.11" href="#section-13.11">13.11</a>. Directory Harvesting</span>
If a server generates an error stanza in response to receiving a
stanza for a user account that does not exist, using the <service-
unavailable/> stanza error condition (<a href="#section-8.3.3.19">Section 8.3.3.19</a>) can help
protect against directory harvesting attacks, since this is the same
error condition that is returned if, for instance, the namespace of
an IQ child element is not understood, or if "offline message
storage" ([<a href="#ref-XEP-0160" title=""Best Practices for Handling Offline Messages"">XEP-0160</a>]) or message forwarding is not enabled for a
domain. However, subtle differences in the exact XML of error
stanzas, as well as in the timing with which such errors are
<span class="grey">Saint-Andre Standards Track [Page 166]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-167" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
returned, can enable an attacker to determine the network presence of
a user when more advanced blocking technologies are not used (see for
instance [<a href="#ref-XEP-0016" title=""Privacy Lists"">XEP-0016</a>] and [<a href="#ref-XEP-0191" title=""Simple Communications Blocking"">XEP-0191</a>]). Therefore, a server that
exercises a higher level of caution might not return any error at all
in response to certain kinds of received stanzas, so that a non-
existent user appears to behave like a user that has no interest in
conversing with the sender.
<span class="h3"><a class="selflink" id="section-13.12" href="#section-13.12">13.12</a>. Denial of Service</span>
[<a id="ref-DOS">DOS</a>] defines denial of service as follows:
A denial-of-service (DoS) attack is an attack in which one or more
machines target a victim and attempt to prevent the victim from
doing useful work. The victim can be a network server, client or
router, a network link or an entire network, an individual
Internet user or a company doing business using the Internet, an
Internet Service Provider (ISP), country, or any combination of or
variant on these.
Some considerations discussed in this document help to prevent
denial-of-service attacks (e.g., the mandate that a server MUST NOT
process XML stanzas from clients that have not yet provided
appropriate authentication credentials and MUST NOT process XML
stanzas from peer servers whose identity it has not either
authenticated via SASL or weakly verified via Server Dialback).
In addition, [<a href="#ref-XEP-0205" title=""Best Practices to Discourage Denial of Service Attacks"">XEP-0205</a>] provides a detailed discussion of potential
denial-of-service attacks against XMPP systems along with best
practices for preventing such attacks. The recommendations include:
1. A server implementation SHOULD enable a server administrator to
limit the number of TCP connections that it will accept from a
given IP address at any one time. If an entity attempts to
connect but the maximum number of TCP connections has been
reached, the receiving server MUST NOT allow the new connection
to proceed.
2. A server implementation SHOULD enable a server administrator to
limit the number of TCP connection attempts that it will accept
from a given IP address in a given time period. If an entity
attempts to connect but the maximum number of connection attempts
has been reached, the receiving server MUST NOT allow the new
connection to proceed.
3. A server implementation SHOULD enable a server administrator to
limit the number of connected resources it will allow an account
to bind at any one time. If a client attempts to bind a resource
<span class="grey">Saint-Andre Standards Track [Page 167]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-168" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
but it has already reached the configured number of allowable
resources, the receiving server MUST return a <resource-
constraint/> stanza error (<a href="#section-8.3.3.18">Section 8.3.3.18</a>).
4. A server implementation SHOULD enable a server administrator to
limit the size of stanzas it will accept from a connected client
or peer server (where "size" is inclusive of all XML markup as
defined in Section 2.4 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (Fifth Edition)"">XML</a>], from the opening "<" character
of the stanza to the closing ">" character). A deployed server's
maximum stanza size MUST NOT be smaller than 10000 bytes, which
reflects a reasonable compromise between the benefits of
expressiveness for originating entities and the costs of stanza
processing for servers. A server implementation SHOULD NOT
blindly set 10000 bytes as the value for all deployments but
instead SHOULD enable server administrators to set their own
limits. If a connected resource or peer server sends a stanza
that violates the upper limit, the receiving server MUST either
return a <policy-violation/> stanza error (<a href="#section-8.3.3.12">Section 8.3.3.12</a>),
thus allowing the sender to recover, or close the stream with a
<policy-violation/> stream error (<a href="#section-4.9.3.14">Section 4.9.3.14</a>).
5. A server implementation SHOULD enable a server administrator to
limit the number of XML stanzas that a connected client is
allowed to send to distinct recipients within a given time
period. If a connected client sends too many stanzas to distinct
recipients in a given time period, the receiving server SHOULD
NOT process the stanza and instead SHOULD return a <policy-
violation/> stanza error (<a href="#section-8.3.3.12">Section 8.3.3.12</a>).
6. A server implementation SHOULD enable a server administrator to
limit the amount of bandwidth it will allow a connected client or
peer server to use in a given time period.
7. A server implementation MAY enable a server administrator to
limit the types of stanzas (based on the extended content
"payload") that it will allow a connected resource or peer server
send over an active connection. Such limits and restrictions are
a matter of deployment policy.
8. A server implementation MAY refuse to route or deliver any stanza
that it considers to be abusive, with or without returning an
error to the sender.
For more detailed recommendations regarding denial-of-service attacks
in XMPP systems, refer to [<a href="#ref-XEP-0205" title=""Best Practices to Discourage Denial of Service Attacks"">XEP-0205</a>].
<span class="grey">Saint-Andre Standards Track [Page 168]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-169" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-13.13" href="#section-13.13">13.13</a>. Firewalls</span>
Although DNS SRV records can instruct connecting entities to use TCP
ports other than 5222 (client-to-server) and 5269 (server-to-server),
communication using XMPP typically occurs over those ports, which are
registered with the IANA (see <a href="#section-14">Section 14</a>). Use of these well-known
ports allows administrators to easily enable or disable XMPP activity
through existing and commonly deployed firewalls.
<span class="h3"><a class="selflink" id="section-13.14" href="#section-13.14">13.14</a>. Interdomain Federation</span>
The term "federation" is commonly used to describe communication
between two servers.
Because service provisioning is a matter of policy, it is OPTIONAL
for any given server to support federation. If a particular server
enables federation, it SHOULD enable strong security as previously
described to ensure both authentication and confidentiality;
compliant implementations SHOULD support TLS and SASL for this
purpose.
Before <a href="./rfc3920">RFC 3920</a> defined TLS plus SASL EXTERNAL with certificates for
encryption and authentication of server-to-server streams, the only
method for weak identity verification of a peer server was Server
Dialback as defined in [<a href="#ref-XEP-0220" title=""Server Dialback"">XEP-0220</a>]. Even when [<a href="#ref-DNSSEC" title=""DNS Security Introduction and Requirements"">DNSSEC</a>] is used,
Server Dialback provides only weak identity verification and provides
no confidentiality or integrity. At the time of writing, Server
Dialback is still the most widely used technique for some level of
assurance over server-to-server streams. This reality introduces the
possibility of a downgrade attack from TLS + SASL EXTERNAL to Server
Dialback if an attacker can gain control of the channel and therefore
convince the initiating server that the receiving server does not
support TLS or does not have an appropriate certificate. To help
prevent this attack, the parties SHOULD protect the channel using TLS
before proceeding, even if the presented certificates are self-signed
or otherwise untrusted.
<span class="h3"><a class="selflink" id="section-13.15" href="#section-13.15">13.15</a>. Non-Repudiation</span>
Systems that provide both peer entity authentication and data
integrity have the potential to enable an entity to prove to a third
party that another entity intended to send particular data. Although
XMPP systems can provide both peer entity authentication and data
integrity, XMPP was never designed to provide non-repudiation.
<span class="grey">Saint-Andre Standards Track [Page 169]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-170" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h2"><a class="selflink" id="section-14" href="#section-14">14</a>. IANA Considerations</span>
The following subsections update the registrations provided in
[<a href="./rfc3920" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">RFC3920</a>]. This section is to be interpreted according to
[<a href="#ref-IANA-GUIDE" title="">IANA-GUIDE</a>].
<span class="h3"><a class="selflink" id="section-14.1" href="#section-14.1">14.1</a>. XML Namespace Name for TLS Data</span>
A URN sub-namespace for STARTTLS negotiation data in the Extensible
Messaging and Presence Protocol (XMPP) is defined as follows. (This
namespace name adheres to the format defined in [<a href="#ref-XML-REG" title=""The IETF XML Registry"">XML-REG</a>].)
URI: urn:ietf:params:xml:ns:xmpp-tls
Specification: <a href="./rfc6120">RFC 6120</a>
Description: This is the XML namespace name for STARTTLS negotiation
data in the Extensible Messaging and Presence Protocol (XMPP) as
defined by <a href="./rfc6120">RFC 6120</a>.
Registrant Contact: IESG <iesg@ietf.org>
<span class="h3"><a class="selflink" id="section-14.2" href="#section-14.2">14.2</a>. XML Namespace Name for SASL Data</span>
A URN sub-namespace for SASL negotiation data in the Extensible
Messaging and Presence Protocol (XMPP) is defined as follows. (This
namespace name adheres to the format defined in [<a href="#ref-XML-REG" title=""The IETF XML Registry"">XML-REG</a>].)
URI: urn:ietf:params:xml:ns:xmpp-sasl
Specification: <a href="./rfc6120">RFC 6120</a>
Description: This is the XML namespace name for SASL negotiation
data in the Extensible Messaging and Presence Protocol (XMPP) as
defined by <a href="./rfc6120">RFC 6120</a>.
Registrant Contact: IESG <iesg@ietf.org>
<span class="h3"><a class="selflink" id="section-14.3" href="#section-14.3">14.3</a>. XML Namespace Name for Stream Errors</span>
A URN sub-namespace for stream error data in the Extensible Messaging
and Presence Protocol (XMPP) is defined as follows. (This namespace
name adheres to the format defined in [<a href="#ref-XML-REG" title=""The IETF XML Registry"">XML-REG</a>].)
URI: urn:ietf:params:xml:ns:xmpp-streams
Specification: <a href="./rfc6120">RFC 6120</a>
Description: This is the XML namespace name for stream error data in
the Extensible Messaging and Presence Protocol (XMPP) as defined
by <a href="./rfc6120">RFC 6120</a>.
Registrant Contact: IESG <iesg@ietf.org>
<span class="grey">Saint-Andre Standards Track [Page 170]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-171" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="section-14.4" href="#section-14.4">14.4</a>. XML Namespace Name for Resource Binding</span>
A URN sub-namespace for resource binding in the Extensible Messaging
and Presence Protocol (XMPP) is defined as follows. (This namespace
name adheres to the format defined in [<a href="#ref-XML-REG" title=""The IETF XML Registry"">XML-REG</a>].)
URI: urn:ietf:params:xml:ns:xmpp-bind
Specification: <a href="./rfc6120">RFC 6120</a>
Description: This is the XML namespace name for resource binding in
the Extensible Messaging and Presence Protocol (XMPP) as defined
by <a href="./rfc6120">RFC 6120</a>.
Registrant Contact: IESG <iesg@ietf.org>
<span class="h3"><a class="selflink" id="section-14.5" href="#section-14.5">14.5</a>. XML Namespace Name for Stanza Errors</span>
A URN sub-namespace for stanza error data in the Extensible Messaging
and Presence Protocol (XMPP) is defined as follows. (This namespace
name adheres to the format defined in [<a href="#ref-XML-REG" title=""The IETF XML Registry"">XML-REG</a>].)
URI: urn:ietf:params:xml:ns:xmpp-stanzas
Specification: <a href="./rfc6120">RFC 6120</a>
Description: This is the XML namespace name for stanza error data in
the Extensible Messaging and Presence Protocol (XMPP) as defined
by <a href="./rfc6120">RFC 6120</a>.
Registrant Contact: IESG <iesg@ietf.org>
<span class="h3"><a class="selflink" id="section-14.6" href="#section-14.6">14.6</a>. GSSAPI Service Name</span>
The IANA has registered "xmpp" as a [<a href="#ref-GSS-API" title=""Generic Security Service Application Program Interface Version 2, Update 1"">GSS-API</a>] service name, as
defined under <a href="#section-6.6">Section 6.6</a>.
<span class="h3"><a class="selflink" id="section-14.7" href="#section-14.7">14.7</a>. Port Numbers and Service Names</span>
The IANA has registered "xmpp-client" and "xmpp-server" as keywords
for [<a href="#ref-TCP" title=""Transmission Control Protocol"">TCP</a>] ports 5222 and 5269, respectively. In accordance with
[<a href="#ref-IANA-PORTS" title=""Internet Assigned Numbers Authority (IANA) Procedures for the Management of the Transport Protocol Port Number and Service Name Registry"">IANA-PORTS</a>], this document updates the existing registration, as
follows.
Service Name: xmpp-client
Transport Protocol: TCP
Description: A service offering support for connections by XMPP
client applications
Registrant: IETF XMPP Working Group
Contact: IESG <iesg@ietf.org>
Reference: <a href="./rfc6120">RFC 6120</a>
Port Number: 5222
<span class="grey">Saint-Andre Standards Track [Page 171]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-172" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Service Name: xmpp-server
Transport Protocol: TCP
Description: A service offering support for connections by XMPP
server applications
Registrant: IETF XMPP Working Group
Contact: IESG <iesg@ietf.org>
Reference: <a href="./rfc6120">RFC 6120</a>
Port Number: 5269
<span class="h2"><a class="selflink" id="section-15" href="#section-15">15</a>. Conformance Requirements</span>
This section describes a protocol feature set that summarizes the
conformance requirements of this specification. This feature set is
appropriate for use in software certification, interoperability
testing, and implementation reports. For each feature, this section
provides the following information:
o A human-readable name
o An informational description
o A reference to the particular section of this document that
normatively defines the feature
o Whether the feature applies to the Client role, the Server role,
or both (where "N/A" signifies that the feature is not applicable
to the specified role)
o Whether the feature MUST or SHOULD be implemented, where the
capitalized terms are to be understood as described in [<a href="#ref-KEYWORDS" title=""Key words for use in RFCs to Indicate Requirement Levels"">KEYWORDS</a>]
The feature set specified here attempts to adhere to the concepts and
formats proposed by Larry Masinter within the IETF's NEWTRK Working
Group in 2005, as captured in [<a href="#ref-INTEROP" title=""Formalizing IETF Interoperability Reporting"">INTEROP</a>]. Although this feature set
is more detailed than called for by [<a href="#ref-REPORTS" title=""Guidance on Interoperation and Implementation Reports for Advancement to Draft Standard"">REPORTS</a>], it provides a suitable
basis for the generation of implementation reports to be submitted in
support of advancing this specification from Proposed Standard to
Draft Standard in accordance with [<a href="#ref-PROCESS" title=""The Internet Standards Process -- Revision 3"">PROCESS</a>].
Feature: bind-gen
Description: Generate a random resource on demand.
Section: <a href="#section-7.6">Section 7.6</a>
Roles: Client N/A, Server MUST.
Feature: bind-mtn
Description: Consider resource binding as mandatory-to-negotiate.
Section: <a href="#section-7.3.1">Section 7.3.1</a>
Roles: Client MUST, Server MUST.
<span class="grey">Saint-Andre Standards Track [Page 172]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-173" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Feature: bind-restart
Description: Do not restart the stream after negotiation of resource
binding.
Section: <a href="#section-7.3.2">Section 7.3.2</a>
Roles: Client MUST, Server MUST.
Feature: bind-support
Description: Support binding of client resources to an authenticated
stream.
Section: <a href="#section-7">Section 7</a>
Roles: Client MUST, Server MUST.
Feature: sasl-correlate
Description: When authenticating a stream peer using SASL, correlate
the authentication identifier resulting from SASL negotiation with
the 'from' address (if any) of the stream header it received from
the peer.
Section: <a href="#section-6.4.6">Section 6.4.6</a>
Roles: Client SHOULD, Server SHOULD.
Feature: sasl-errors
Description: Support SASL errors during the negotiation process.
Section: <a href="#section-6.5">Section 6.5</a>
Roles: Client MUST, Server MUST.
Feature: sasl-mtn
Description: Consider SASL as mandatory-to-negotiate.
Section: <a href="#section-6.3.1">Section 6.3.1</a>
Roles: Client MUST, Server MUST.
Feature: sasl-restart
Description: Initiate or handle a stream restart after SASL
negotiation.
Section: <a href="#section-6.3.2">Section 6.3.2</a>
Roles: Client MUST, Server MUST.
Feature: sasl-support
Description: Support the Simple Authentication and Security Layer
for stream authentication.
Section: <a href="#section-6">Section 6</a>
Roles: Client MUST, Server MUST.
Feature: security-mti-auth-scram
Description: Support the SASL SCRAM mechanism for authentication
only (this implies support for both the SCRAM-SHA-1 and
SCRAM-SHA-1-PLUS variants).
Section: <a href="#section-13.8">Section 13.8</a>
Roles: Client MUST, Server MUST.
<span class="grey">Saint-Andre Standards Track [Page 173]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-174" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Feature: security-mti-both-external
Description: Support TLS with SASL EXTERNAL for confidentiality and
authentication.
Section: <a href="#section-13.8">Section 13.8</a>
Roles: Client SHOULD, Server MUST.
Feature: security-mti-both-plain
Description: Support TLS using the TLS_RSA_WITH_AES_128_CBC_SHA
ciphersuite plus the SASL PLAIN mechanism for confidentiality and
authentication.
Section: <a href="#section-13.8">Section 13.8</a>
Roles: Client SHOULD, Server MAY.
Feature: security-mti-both-scram
Description: Support TLS using the TLS_RSA_WITH_AES_128_CBC_SHA
ciphersuite plus the SCRAM-SHA-1 and SCRAM-SHA-1-PLUS variants of
the SASL SCRAM mechanism for confidentiality and authentication.
Section: <a href="#section-13.8">Section 13.8</a>
Roles: Client MUST, Server MUST.
Feature: security-mti-confidentiality
Description: Support TLS using the TLS_RSA_WITH_AES_128_CBC_SHA
ciphersuite for confidentiality only.
Section: <a href="#section-13.8">Section 13.8</a>
Roles: Client N/A, Server SHOULD.
Feature: stanza-attribute-from
Description: Support the common 'from' attribute for all stanza
kinds.
Section: <a href="#section-8.1.2">Section 8.1.2</a>
Roles: Client MUST, Server MUST.
Feature: stanza-attribute-from-stamp
Description: Stamp or rewrite the 'from' address of all stanzas
received from connected clients.
Section: <a href="#section-8.1.2.1">Section 8.1.2.1</a>
Roles: Client N/A, Server MUST.
Feature: stanza-attribute-from-validate
Description: Validate the 'from' address of all stanzas received
from peer servers.
Section: <a href="#section-8.1.2.2">Section 8.1.2.2</a>
Roles: Client N/A, Server MUST.
Feature: stanza-attribute-id
Description: Support the common 'id' attribute for all stanza kinds.
Section: <a href="#section-8.1.3">Section 8.1.3</a>
Roles: Client MUST, Server MUST.
<span class="grey">Saint-Andre Standards Track [Page 174]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-175" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Feature: stanza-attribute-to
Description: Support the common 'to' attribute for all stanza kinds.
Section: <a href="#section-8.1.1">Section 8.1.1</a>
Roles: Client MUST, Server MUST.
Feature: stanza-attribute-to-validate
Description: Ensure that all stanzas received from peer servers
include a 'to' address.
Section: <a href="#section-8.1.1">Section 8.1.1</a>
Roles: Client N/A, Server MUST.
Feature: stanza-attribute-type
Description: Support the common 'type' attribute for all stanza
kinds.
Section: <a href="#section-8.1.4">Section 8.1.4</a>
Roles: Client MUST, Server MUST.
Feature: stanza-attribute-xmllang
Description: Support the common 'xml:lang' attribute for all stanza
kinds.
Section: <a href="#section-8.1.5">Section 8.1.5</a>
Roles: Client MUST, Server MUST.
Feature: stanza-error
Description: Generate and handle stanzas of type "error" for all
stanza kinds.
Section: <a href="#section-8.3">Section 8.3</a>
Roles: Client MUST, Server MUST.
Feature: stanza-error-child
Description: Ensure that stanzas of type "error" include an <error/>
child element.
Section: <a href="#section-8.3">Section 8.3</a>
Roles: Client MUST, Server MUST.
Feature: stanza-error-id
Description: Ensure that stanzas of type "error" preserve the 'id'
provided in the triggering stanza.
Section: <a href="#section-8.3">Section 8.3</a>
Roles: Client MUST, Server MUST.
Feature: stanza-error-reply
Description: Do not reply to a stanza of type "error" with another
stanza of type "error".
Section: <a href="#section-8.3">Section 8.3</a>
Roles: Client MUST, Server MUST.
<span class="grey">Saint-Andre Standards Track [Page 175]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-176" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Feature: stanza-extension
Description: Correctly process XML data qualified by an unsupported
XML namespace, where "correctly process" means to ignore that
portion of the stanza in the case of a message or presence stanza
and return an error in the case of an IQ stanza (for the intended
recipient), and to route or deliver the stanza (for a routing
entity such as a server).
Section: <a href="#section-8.4">Section 8.4</a>
Roles: Client MUST, Server MUST.
Feature: stanza-iq-child
Description: Include exactly one child element in an <iq/> stanza of
type "get" or "set", zero or one child elements in an <iq/> stanza
of type "result", and one or two child elements in an <iq/> stanza
of type "error".
Section: <a href="#section-8.2.3">Section 8.2.3</a>
Roles: Client MUST, Server MUST.
Feature: stanza-iq-id
Description: Ensure that all <iq/> stanzas include an 'id'
attribute.
Section: <a href="#section-8.2.3">Section 8.2.3</a>
Roles: Client MUST, Server MUST.
Feature: stanza-iq-reply
Description: Reply to an <iq/> stanza of type "get" or "set" with an
<iq/> stanza of type "result" or "error".
Section: <a href="#section-8.2.3">Section 8.2.3</a>
Roles: Client MUST, Server MUST.
Feature: stanza-iq-type
Description: Ensure that all <iq/> stanzas include a 'type'
attribute whose value is "get", "set", "result", or "error".
Section: <a href="#section-8.2.3">Section 8.2.3</a>
Roles: Client MUST, Server MUST.
Feature: stanza-kind-iq
Description: Support the <iq/> stanza.
Section: <a href="#section-8.2.3">Section 8.2.3</a>
Roles: Client MUST, Server MUST.
Feature: stanza-kind-message
Description: Support the <message/> stanza.
Section: <a href="#section-8.2.1">Section 8.2.1</a>
Roles: Client MUST, Server MUST.
<span class="grey">Saint-Andre Standards Track [Page 176]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-177" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Feature: stanza-kind-presence
Description: Support the <presence/> stanza.
Section: <a href="#section-8.2.2">Section 8.2.2</a>
Roles: Client MUST, Server MUST.
Feature: stream-attribute-initial-from
Description: Include a 'from' attribute in the initial stream
header.
Section: <a href="#section-4.7.1">Section 4.7.1</a>
Roles: Client SHOULD, Server MUST.
Feature: stream-attribute-initial-lang
Description: Include an 'xml:lang' attribute in the initial stream
header.
Section: <a href="#section-4.7.4">Section 4.7.4</a>
Roles: Client SHOULD, Server SHOULD.
Feature: stream-attribute-initial-to
Description: Include a 'to' attribute in the initial stream header.
Section: <a href="#section-4.7.2">Section 4.7.2</a>
Roles: Client MUST, Server MUST.
Feature: stream-attribute-response-from
Description: Include a 'from' attribute in the response stream
header.
Section: <a href="#section-4.7.1">Section 4.7.1</a>
Roles: Client N/A, Server MUST.
Feature: stream-attribute-response-id
Description: Include an 'id' attribute in the response stream
header.
Section: <a href="#section-4.7.3">Section 4.7.3</a>
Roles: Client N/A, Server MUST.
Feature: stream-attribute-response-id-unique
Description: Ensure that the 'id' attribute in the response stream
header is unique within the context of the receiving entity.
Section: <a href="#section-4.7.3">Section 4.7.3</a>
Roles: Client N/A, Server MUST.
Feature: stream-attribute-response-to
Description: Include a 'to' attribute in the response stream header.
Section: <a href="#section-4.7.2">Section 4.7.2</a>
Roles: Client N/A, Server SHOULD.
<span class="grey">Saint-Andre Standards Track [Page 177]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-178" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Feature: stream-error-generate
Description: Generate a stream error (followed by a closing stream
tag and termination of the TCP connection) upon detecting a
stream-related error condition.
Section: <a href="#section-4.9">Section 4.9</a>
Roles: Client MUST, Server MUST.
Feature: stream-fqdn-resolution
Description: Resolve FQDNs before opening a TCP connection to the
receiving entity.
Section: <a href="#section-3.2">Section 3.2</a>
Roles: Client MUST, Server MUST.
Feature: stream-negotiation-complete
Description: Do not consider the stream negotiation process to be
complete until the receiving entity sends a stream features
advertisement that is empty or that contains only voluntary-to-
negotiate features.
Section: <a href="#section-4.3.5">Section 4.3.5</a>
Roles: Client MUST, Server MUST.
Feature: stream-negotiation-features
Description: Send stream features after sending a response stream
header.
Section: <a href="#section-4.3.2">Section 4.3.2</a>
Roles: Client N/A, Server MUST.
Feature: stream-negotiation-restart
Description: Consider the previous stream to be replaced upon
negotiation of a stream feature that necessitates a stream
restart, and send or receive a new initial stream header after
negotiation of such a stream feature.
Section: <a href="#section-4.3.3">Section 4.3.3</a>
Roles: Client MUST, Server MUST.
Feature: stream-reconnect
Description: Reconnect with exponential backoff if a TCP connection
is terminated unexpectedly.
Section: <a href="#section-3.3">Section 3.3</a>
Roles: Client MUST, Server MUST.
Feature: stream-tcp-binding
Description: Bind an XML stream to a TCP connection.
Section: <a href="#section-3">Section 3</a>
Roles: Client MUST, Server MUST.
<span class="grey">Saint-Andre Standards Track [Page 178]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-179" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Feature: tls-certs
Description: Check the identity specified in a certificate that is
presented during TLS negotiation.
Section: <a href="#section-13.7.2">Section 13.7.2</a>
Roles: Client MUST, Server MUST.
Feature: tls-mtn
Description: Consider TLS as mandatory-to-negotiate if STARTTLS is
the only feature advertised or if the STARTTLS feature
advertisement includes an empty <required/> element.
Section: <a href="#section-5.3.1">Section 5.3.1</a>
Roles: Client MUST, Server MUST.
Feature: tls-restart
Description: Initiate or handle a stream restart after TLS
negotiation.
Section: <a href="#section-5.3.2">Section 5.3.2</a>
Roles: Client MUST, Server MUST.
Feature: tls-support
Description: Support Transport Layer Security for stream encryption.
Section: <a href="#section-5">Section 5</a>
Roles: Client MUST, Server MUST.
Feature: tls-correlate
Description: When validating a certificate presented by a stream
peer during TLS negotiation, correlate the validated identity with
the 'from' address (if any) of the stream header it received from
the peer.
Section: <a href="#section-13.7.2">Section 13.7.2</a>
Roles: Client SHOULD, Server SHOULD.
Feature: xml-namespace-content-client
Description: Support 'jabber:client' as a content namespace.
Section: <a href="#section-4.8.2">Section 4.8.2</a>
Roles: Client MUST, Server MUST.
Feature: xml-namespace-content-server
Description: Support 'jabber:server' as a content namespace.
Section: <a href="#section-4.8.2">Section 4.8.2</a>
Roles: Client N/A, Server MUST.
Feature: xml-namespace-streams-declaration
Description: Ensure that there is a namespace declaration for the
'http://etherx.jabber.org/streams' namespace.
Section: <a href="#section-4.8.1">Section 4.8.1</a>
Roles: Client MUST, Server MUST.
<span class="grey">Saint-Andre Standards Track [Page 179]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-180" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Feature: xml-namespace-streams-prefix
Description: Ensure that all elements qualified by the
'http://etherx.jabber.org/streams' namespace are prefixed by the
prefix (if any) defined in the namespace declaration.
Section: <a href="#section-4.8.1">Section 4.8.1</a>
Roles: Client MUST, Server MUST.
Feature: xml-restriction-comment
Description: Do not generate or accept XML comments.
Section: <a href="#section-11.1">Section 11.1</a>
Roles: Client MUST, Server MUST.
Feature: xml-restriction-dtd
Description: Do not generate or accept internal or external DTD
subsets.
Section: <a href="#section-11.1">Section 11.1</a>
Roles: Client MUST, Server MUST.
Feature: xml-restriction-pi
Description: Do not generate or accept XML processing instructions.
Section: <a href="#section-11.1">Section 11.1</a>
Roles: Client MUST, Server MUST.
Feature: xml-restriction-ref
Description: Do not generate or accept internal or external entity
references with the exception of the predefined entities.
Section: <a href="#section-11.1">Section 11.1</a>
Roles: Client MUST, Server MUST.
Feature: xml-wellformed-xml
Description: Do not generate or accept data that is not XML-well-
formed.
Section: <a href="#section-11.3">Section 11.3</a>
Roles: Client MUST, Server MUST.
Feature: xml-wellformed-ns
Description: Do not generate or accept data that is not namespace-
well-formed.
Section: <a href="#section-11.3">Section 11.3</a>
Roles: Client MUST, Server MUST.
<span class="grey">Saint-Andre Standards Track [Page 180]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-181" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h2"><a class="selflink" id="section-16" href="#section-16">16</a>. References</span>
<span class="h3"><a class="selflink" id="section-16.1" href="#section-16.1">16.1</a>. Normative References</span>
[<a id="ref-BASE64">BASE64</a>] Josefsson, S., "The Base16, Base32, and Base64 Data
Encodings", <a href="./rfc4648">RFC 4648</a>, October 2006.
[<a id="ref-CHANNEL">CHANNEL</a>] Williams, N., "On the Use of Channel Bindings to
Secure Channels", <a href="./rfc5056">RFC 5056</a>, November 2007.
[<a id="ref-CHANNEL-TLS">CHANNEL-TLS</a>] Altman, J., Williams, N., and L. Zhu, "Channel
Bindings for TLS", <a href="./rfc5929">RFC 5929</a>, July 2010.
[<a id="ref-CHARSETS">CHARSETS</a>] Alvestrand, H., "IETF Policy on Character Sets and
Languages", <a href="https://www.rfc-editor.org/bcp/bcp18">BCP 18</a>, <a href="./rfc2277">RFC 2277</a>, January 1998.
[<a id="ref-DNS-CONCEPTS">DNS-CONCEPTS</a>] Mockapetris, P., "Domain names - concepts and
facilities", STD 13, <a href="./rfc1034">RFC 1034</a>, November 1987.
[<a id="ref-DNS-SRV">DNS-SRV</a>] Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR
for specifying the location of services (DNS SRV)",
<a href="./rfc2782">RFC 2782</a>, February 2000.
[<a id="ref-IPv6-ADDR">IPv6-ADDR</a>] Kawamura, S. and M. Kawashima, "A Recommendation for
IPv6 Address Text Representation", <a href="./rfc5952">RFC 5952</a>,
August 2010.
[<a id="ref-KEYWORDS">KEYWORDS</a>] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997.
[<a id="ref-LANGMATCH">LANGMATCH</a>] Phillips, A. and M. Davis, "Matching of Language
Tags", <a href="https://www.rfc-editor.org/bcp/bcp47">BCP 47</a>, <a href="./rfc4647">RFC 4647</a>, September 2006.
[<a id="ref-LANGTAGS">LANGTAGS</a>] Phillips, A. and M. Davis, "Tags for Identifying
Languages", <a href="https://www.rfc-editor.org/bcp/bcp47">BCP 47</a>, <a href="./rfc5646">RFC 5646</a>, September 2009.
[<a id="ref-OCSP">OCSP</a>] Myers, M., Ankney, R., Malpani, A., Galperin, S., and
C. Adams, "X.509 Internet Public Key Infrastructure
Online Certificate Status Protocol - OCSP", <a href="./rfc2560">RFC 2560</a>,
June 1999.
[<a id="ref-PKIX">PKIX</a>] Cooper, D., Santesson, S., Farrell, S., Boeyen, S.,
Housley, R., and W. Polk, "Internet X.509 Public Key
Infrastructure Certificate and Certificate Revocation
List (CRL) Profile", <a href="./rfc5280">RFC 5280</a>, May 2008.
<span class="grey">Saint-Andre Standards Track [Page 181]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-182" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
[<a id="ref-PKIX-ALGO">PKIX-ALGO</a>] Jonsson, J. and B. Kaliski, "Public-Key Cryptography
Standards (PKCS) #1: RSA Cryptography Specifications
Version 2.1", <a href="./rfc3447">RFC 3447</a>, February 2003.
[<a id="ref-PKIX-SRV">PKIX-SRV</a>] Santesson, S., "Internet X.509 Public Key
Infrastructure Subject Alternative Name for
Expression of Service Name", <a href="./rfc4985">RFC 4985</a>, August 2007.
[<a id="ref-PLAIN">PLAIN</a>] Zeilenga, K., "The PLAIN Simple Authentication and
Security Layer (SASL) Mechanism", <a href="./rfc4616">RFC 4616</a>,
August 2006.
[<a id="ref-RANDOM">RANDOM</a>] Eastlake, D., Schiller, J., and S. Crocker,
"Randomness Requirements for Security", <a href="https://www.rfc-editor.org/bcp/bcp106">BCP 106</a>,
<a href="./rfc4086">RFC 4086</a>, June 2005.
[<a id="ref-SASL">SASL</a>] Melnikov, A. and K. Zeilenga, "Simple Authentication
and Security Layer (SASL)", <a href="./rfc4422">RFC 4422</a>, June 2006.
[<a id="ref-SCRAM">SCRAM</a>] Newman, C., Menon-Sen, A., Melnikov, A., and N.
Williams, "Salted Challenge Response Authentication
Mechanism (SCRAM) SASL and GSS-API Mechanisms",
<a href="./rfc5802">RFC 5802</a>, July 2010.
[<a id="ref-STRONGSEC">STRONGSEC</a>] Schiller, J., "Strong Security Requirements for
Internet Engineering Task Force Standard Protocols",
<a href="https://www.rfc-editor.org/bcp/bcp61">BCP 61</a>, <a href="./rfc3365">RFC 3365</a>, August 2002.
[<a id="ref-TCP">TCP</a>] Postel, J., "Transmission Control Protocol", STD 7,
<a href="./rfc793">RFC 793</a>, September 1981.
[<a id="ref-TLS">TLS</a>] Dierks, T. and E. Rescorla, "The Transport Layer
Security (TLS) Protocol Version 1.2", <a href="./rfc5246">RFC 5246</a>,
August 2008.
[<a id="ref-TLS-CERTS">TLS-CERTS</a>] Saint-Andre, P. and J. Hodges, "Representation and
Verification of Domain-Based Application Service
Identity within Internet Public Key Infrastructure
Using X.509 (PKIX) Certificates in the Context of
Transport Layer Security (TLS)", <a href="./rfc6125">RFC 6125</a>,
March 2011.
[<a id="ref-TLS-NEG">TLS-NEG</a>] Rescorla, E., Ray, M., Dispensa, S., and N. Oskov,
"Transport Layer Security (TLS) Renegotiation
Indication Extension", <a href="./rfc5746">RFC 5746</a>, February 2010.
[<a id="ref-TLS-SSL2">TLS-SSL2</a>] Turner, S. and T. Polk, "Prohibiting Secure Sockets
Layer (SSL) Version 2.0", <a href="./rfc6176">RFC 6176</a>, March 2011.
<span class="grey">Saint-Andre Standards Track [Page 182]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-183" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
[<a id="ref-UCS2">UCS2</a>] International Organization for Standardization,
"Information Technology - Universal Multiple-octet
coded Character Set (UCS) - Amendment 2: UCS
Transformation Format 8 (UTF-8)", ISO Standard
10646-1 Addendum 2, October 1996.
[<a id="ref-UNICODE">UNICODE</a>] The Unicode Consortium, "The Unicode Standard,
Version 6.0", 2010,
<<a href="http://www.unicode.org/versions/Unicode6.0.0/">http://www.unicode.org/versions/Unicode6.0.0/</a>>.
[<a id="ref-UTF-8">UTF-8</a>] Yergeau, F., "UTF-8, a transformation format of ISO
10646", STD 63, <a href="./rfc3629">RFC 3629</a>, November 2003.
[<a id="ref-URI">URI</a>] Berners-Lee, T., Fielding, R., and L. Masinter,
"Uniform Resource Identifier (URI): Generic Syntax",
STD 66, <a href="./rfc3986">RFC 3986</a>, January 2005.
[<a id="ref-X509">X509</a>] International Telecommunications Union, "Information
technology - Open Systems Interconnection - The
Directory: Public-key and attribute certificate
frameworks", ITU-T Recommendation X.509, ISO Standard
9594-8, March 2000.
[<a id="ref-XML">XML</a>] Maler, E., Yergeau, F., Sperberg-McQueen, C., Paoli,
J., and T. Bray, "Extensible Markup Language (XML)
1.0 (Fifth Edition)", World Wide Web Consortium
Recommendation REC-xml-20081126, November 2008,
<<a href="http://www.w3.org/TR/2008/REC-xml-20081126">http://www.w3.org/TR/2008/REC-xml-20081126</a>>.
[<a id="ref-XML-GUIDE">XML-GUIDE</a>] Hollenbeck, S., Rose, M., and L. Masinter,
"Guidelines for the Use of Extensible Markup Language
(XML) within IETF Protocols", <a href="https://www.rfc-editor.org/bcp/bcp70">BCP 70</a>, <a href="./rfc3470">RFC 3470</a>,
January 2003.
[<a id="ref-XML-MEDIA">XML-MEDIA</a>] Murata, M., St. Laurent, S., and D. Kohn, "XML Media
Types", <a href="./rfc3023">RFC 3023</a>, January 2001.
[<a id="ref-XML-NAMES">XML-NAMES</a>] Thompson, H., Hollander, D., Layman, A., Bray, T.,
and R. Tobin, "Namespaces in XML 1.0 (Third
Edition)", World Wide Web Consortium
Recommendation REC-xml-names-20091208, December 2009,
<<a href="http://www.w3.org/TR/2009/REC-xml-names-20091208">http://www.w3.org/TR/2009/REC-xml-names-20091208</a>>.
[<a id="ref-XMPP-ADDR">XMPP-ADDR</a>] Saint-Andre, P., "Extensible Messaging and Presence
Protocol (XMPP): Address Format", <a href="./rfc6122">RFC 6122</a>,
March 2011.
<span class="grey">Saint-Andre Standards Track [Page 183]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-184" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
[<a id="ref-XMPP-IM">XMPP-IM</a>] Saint-Andre, P., "Extensible Messaging and Presence
Protocol (XMPP): Instant Messaging and Presence",
<a href="./rfc6121">RFC 6121</a>, March 2011.
<span class="h3"><a class="selflink" id="section-16.2" href="#section-16.2">16.2</a>. Informative References</span>
[<a id="ref-AAA">AAA</a>] Housley, R. and B. Aboba, "Guidance for
Authentication, Authorization, and Accounting (AAA)
Key Management", <a href="https://www.rfc-editor.org/bcp/bcp132">BCP 132</a>, <a href="./rfc4962">RFC 4962</a>, July 2007.
[<a id="ref-ABNF">ABNF</a>] Crocker, D. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, <a href="./rfc5234">RFC 5234</a>,
January 2008.
[<a id="ref-ACAP">ACAP</a>] Newman, C. and J. Myers, "ACAP -- Application
Configuration Access Protocol", <a href="./rfc2244">RFC 2244</a>,
November 1997.
[<a id="ref-ANONYMOUS">ANONYMOUS</a>] Zeilenga, K., "Anonymous Simple Authentication and
Security Layer (SASL) Mechanism", <a href="./rfc4505">RFC 4505</a>,
June 2006.
[<a id="ref-ASN.1">ASN.1</a>] CCITT, "Recommendation X.208: Specification of
Abstract Syntax Notation One (ASN.1)", 1988.
[<a id="ref-DIGEST-MD5">DIGEST-MD5</a>] Leach, P. and C. Newman, "Using Digest Authentication
as a SASL Mechanism", <a href="./rfc2831">RFC 2831</a>, May 2000.
[<a id="ref-DNSSEC">DNSSEC</a>] Arends, R., Austein, R., Larson, M., Massey, D., and
S. Rose, "DNS Security Introduction and
Requirements", <a href="./rfc4033">RFC 4033</a>, March 2005.
[<a id="ref-DNS-TXT">DNS-TXT</a>] Rosenbaum, R., "Using the Domain Name System To Store
Arbitrary String Attributes", <a href="./rfc1464">RFC 1464</a>, May 1993.
[<a id="ref-DOS">DOS</a>] Handley, M., Rescorla, E., and IAB, "Internet Denial-
of-Service Considerations", <a href="./rfc4732">RFC 4732</a>, December 2006.
[<a id="ref-E2E-REQS">E2E-REQS</a>] Saint-Andre, P., "Requirements for End-to-End
Encryption in the Extensible Messaging and Presence
Protocol (XMPP)", Work in Progress, March 2010.
[<a id="ref-EMAIL-ARCH">EMAIL-ARCH</a>] Crocker, D., "Internet Mail Architecture", <a href="./rfc5598">RFC 5598</a>,
July 2009.
<span class="grey">Saint-Andre Standards Track [Page 184]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-185" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
[<a id="ref-ETHERNET">ETHERNET</a>] "Information technology - Telecommunications and
information exchange between systems - Local and
metropolitan area networks - Specific requirements -
Part 3: Carrier sense multiple access with collision
detection (CSMA/CD) access method and physical layer
specifications", IEEE Standard 802.3, September 1998.
[<a id="ref-GSS-API">GSS-API</a>] Linn, J., "Generic Security Service Application
Program Interface Version 2, Update 1", <a href="./rfc2743">RFC 2743</a>,
January 2000.
[<a id="ref-HASHES">HASHES</a>] Hoffman, P. and B. Schneier, "Attacks on
Cryptographic Hashes in Internet Protocols",
<a href="./rfc4270">RFC 4270</a>, November 2005.
[<a id="ref-HTTP">HTTP</a>] Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
Masinter, L., Leach, P., and T. Berners-Lee,
"Hypertext Transfer Protocol -- HTTP/1.1", <a href="./rfc2616">RFC 2616</a>,
June 1999.
[<a id="ref-IANA-GUIDE">IANA-GUIDE</a>] Narten, T. and H. Alvestrand, "Guidelines for Writing
an IANA Considerations Section in RFCs", <a href="https://www.rfc-editor.org/bcp/bcp26">BCP 26</a>,
<a href="./rfc5226">RFC 5226</a>, May 2008.
[<a id="ref-IANA-PORTS">IANA-PORTS</a>] Cotton, M., Eggert, L., Touch, J., Westerlund, M.,
and S. Cheshire, "Internet Assigned Numbers Authority
(IANA) Procedures for the Management of the Transport
Protocol Port Number and Service Name Registry", Work
in Progress, February 2011.
[<a id="ref-IMAP">IMAP</a>] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL -
VERSION 4rev1", <a href="./rfc3501">RFC 3501</a>, March 2003.
[<a id="ref-IMP-REQS">IMP-REQS</a>] Day, M., Aggarwal, S., and J. Vincent, "Instant
Messaging / Presence Protocol Requirements",
<a href="./rfc2779">RFC 2779</a>, February 2000.
[<a id="ref-INTEROP">INTEROP</a>] Masinter, L., "Formalizing IETF Interoperability
Reporting", Work in Progress, October 2005.
[<a id="ref-IRC">IRC</a>] Kalt, C., "Internet Relay Chat: Architecture",
<a href="./rfc2810">RFC 2810</a>, April 2000.
[<a id="ref-IRI">IRI</a>] Duerst, M. and M. Suignard, "Internationalized
Resource Identifiers (IRIs)", <a href="./rfc3987">RFC 3987</a>, January 2005.
<span class="grey">Saint-Andre Standards Track [Page 185]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-186" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
[<a id="ref-LDAP">LDAP</a>] Zeilenga, K., "Lightweight Directory Access Protocol
(LDAP): Technical Specification Road Map", <a href="./rfc4510">RFC 4510</a>,
June 2006.
[<a id="ref-LINKLOCAL">LINKLOCAL</a>] Cheshire, S., Aboba, B., and E. Guttman, "Dynamic
Configuration of IPv4 Link-Local Addresses",
<a href="./rfc3927">RFC 3927</a>, May 2005.
[<a id="ref-MAILBOXES">MAILBOXES</a>] Crocker, D., "MAILBOX NAMES FOR COMMON SERVICES,
ROLES AND FUNCTIONS", <a href="./rfc2142">RFC 2142</a>, May 1997.
[<a id="ref-POP3">POP3</a>] Myers, J. and M. Rose, "Post Office Protocol -
Version 3", STD 53, <a href="./rfc1939">RFC 1939</a>, May 1996.
[<a id="ref-PROCESS">PROCESS</a>] Bradner, S., "The Internet Standards Process --
Revision 3", <a href="https://www.rfc-editor.org/bcp/bcp9">BCP 9</a>, <a href="./rfc2026">RFC 2026</a>, October 1996.
[<a id="ref-REPORTS">REPORTS</a>] Dusseault, L. and R. Sparks, "Guidance on
Interoperation and Implementation Reports for
Advancement to Draft Standard", <a href="https://www.rfc-editor.org/bcp/bcp9">BCP 9</a>, <a href="./rfc5657">RFC 5657</a>,
September 2009.
[<a id="ref-REST">REST</a>] Fielding, R., "Architectural Styles and the Design of
Network-based Software Architectures", 2000.
[<a id="ref-RFC3920">RFC3920</a>] Saint-Andre, P., Ed., "Extensible Messaging and
Presence Protocol (XMPP): Core", <a href="./rfc3920">RFC 3920</a>,
October 2004.
[<a id="ref-RFC3921">RFC3921</a>] Saint-Andre, P., Ed., "Extensible Messaging and
Presence Protocol (XMPP): Instant Messaging and
Presence", <a href="./rfc3921">RFC 3921</a>, October 2004.
[<a id="ref-SASLPREP">SASLPREP</a>] Zeilenga, K., "SASLprep: Stringprep Profile for User
Names and Passwords", <a href="./rfc4013">RFC 4013</a>, February 2005.
[<a id="ref-SEC-TERMS">SEC-TERMS</a>] Shirey, R., "Internet Security Glossary, Version 2",
<a href="./rfc4949">RFC 4949</a>, August 2007.
[<a id="ref-SMTP">SMTP</a>] Klensin, J., "Simple Mail Transfer Protocol",
<a href="./rfc5321">RFC 5321</a>, October 2008.
[<a id="ref-SEC-GUIDE">SEC-GUIDE</a>] Rescorla, E. and B. Korver, "Guidelines for Writing
RFC Text on Security Considerations", <a href="https://www.rfc-editor.org/bcp/bcp72">BCP 72</a>,
<a href="./rfc3552">RFC 3552</a>, July 2003.
<span class="grey">Saint-Andre Standards Track [Page 186]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-187" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
[<a id="ref-TLS-EXT">TLS-EXT</a>] Eastlake 3rd, D., "Transport Layer Security (TLS)
Extensions: Extension Definitions", <a href="./rfc6066">RFC 6066</a>,
January 2011.
[<a id="ref-TLS-RESUME">TLS-RESUME</a>] Salowey, J., Zhou, H., Eronen, P., and H. Tschofenig,
"Transport Layer Security (TLS) Session Resumption
without Server-Side State", <a href="./rfc5077">RFC 5077</a>, January 2008.
[<a id="ref-URN-OID">URN-OID</a>] Mealling, M., "A URN Namespace of Object
Identifiers", <a href="./rfc3061">RFC 3061</a>, February 2001.
[<a id="ref-USINGTLS">USINGTLS</a>] Newman, C., "Using TLS with IMAP, POP3 and ACAP",
<a href="./rfc2595">RFC 2595</a>, June 1999.
[<a id="ref-UUID">UUID</a>] Leach, P., Mealling, M., and R. Salz, "A Universally
Unique IDentifier (UUID) URN Namespace", <a href="./rfc4122">RFC 4122</a>,
July 2005.
[<a id="ref-XEP-0001">XEP-0001</a>] Saint-Andre, P., "XMPP Extension Protocols", XSF
XEP 0001, March 2010.
[<a id="ref-XEP-0016">XEP-0016</a>] Millard, P. and P. Saint-Andre, "Privacy Lists", XSF
XEP 0016, February 2007.
[<a id="ref-XEP-0045">XEP-0045</a>] Saint-Andre, P., "Multi-User Chat", XSF XEP 0045,
July 2007.
[<a id="ref-XEP-0060">XEP-0060</a>] Millard, P., Saint-Andre, P., and R. Meijer,
"Publish-Subscribe", XSF XEP 0060, July 2010.
[<a id="ref-XEP-0071">XEP-0071</a>] Saint-Andre, P., "XHTML-IM", XSF XEP 0071,
September 2008.
[<a id="ref-XEP-0077">XEP-0077</a>] Saint-Andre, P., "In-Band Registration", XSF
XEP 0077, September 2009.
[<a id="ref-XEP-0086">XEP-0086</a>] Norris, R. and P. Saint-Andre, "Error Condition
Mappings", XSF XEP 0086, February 2004.
[<a id="ref-XEP-0100">XEP-0100</a>] Saint-Andre, P. and D. Smith, "Gateway Interaction",
XSF XEP 0100, October 2005.
[<a id="ref-XEP-0114">XEP-0114</a>] Saint-Andre, P., "Jabber Component Protocol", XSF
XEP 0114, March 2005.
[<a id="ref-XEP-0124">XEP-0124</a>] Paterson, I., Smith, D., and P. Saint-Andre,
"Bidirectional-streams Over Synchronous HTTP (BOSH)",
XSF XEP 0124, July 2010.
<span class="grey">Saint-Andre Standards Track [Page 187]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-188" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
[<a id="ref-XEP-0138">XEP-0138</a>] Hildebrand, J. and P. Saint-Andre, "Stream
Compression", XSF XEP 0138, May 2009.
[<a id="ref-XEP-0156">XEP-0156</a>] Hildebrand, J. and P. Saint-Andre, "Discovering
Alternative XMPP Connection Methods", XSF XEP 0156,
June 2007.
[<a id="ref-XEP-0160">XEP-0160</a>] Saint-Andre, P., "Best Practices for Handling Offline
Messages", XSF XEP 0160, January 2006.
[<a id="ref-XEP-0174">XEP-0174</a>] Saint-Andre, P., "Link-Local Messaging", XSF
XEP 0174, November 2008.
[<a id="ref-XEP-0175">XEP-0175</a>] Saint-Andre, P., "Best Practices for Use of SASL
ANONYMOUS", XSF XEP 0175, September 2009.
[<a id="ref-XEP-0178">XEP-0178</a>] Saint-Andre, P. and P. Millard, "Best Practices for
Use of SASL EXTERNAL with Certificates", XSF
XEP 0178, February 2007.
[<a id="ref-XEP-0191">XEP-0191</a>] Saint-Andre, P., "Simple Communications Blocking",
XSF XEP 0191, February 2007.
[<a id="ref-XEP-0198">XEP-0198</a>] Karneges, J., Hildebrand, J., Saint-Andre, P., Forno,
F., Cridland, D., and M. Wild, "Stream Management",
XSF XEP 0198, February 2011.
[<a id="ref-XEP-0199">XEP-0199</a>] Saint-Andre, P., "XMPP Ping", XSF XEP 0199,
June 2009.
[<a id="ref-XEP-0205">XEP-0205</a>] Saint-Andre, P., "Best Practices to Discourage Denial
of Service Attacks", XSF XEP 0205, January 2009.
[<a id="ref-XEP-0206">XEP-0206</a>] Paterson, I. and P. Saint-Andre, "XMPP Over BOSH",
XSF XEP 0206, July 2010.
[<a id="ref-XEP-0220">XEP-0220</a>] Miller, J., Saint-Andre, P., and P. Hancke, "Server
Dialback", XSF XEP 0220, March 2010.
[<a id="ref-XEP-0225">XEP-0225</a>] Saint-Andre, P., "Component Connections", XSF
XEP 0225, October 2008.
[<a id="ref-XEP-0233">XEP-0233</a>] Miller, M., Saint-Andre, P., and J. Hildebrand,
"Domain-Based Service Names in XMPP SASL
Negotiation", XSF XEP 0233, June 2010.
[<a id="ref-XEP-0288">XEP-0288</a>] Hancke, P. and D. Cridland, "Bidirectional Server-to-
Server Connections", XSF XEP 0288, October 2010.
<span class="grey">Saint-Andre Standards Track [Page 188]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-189" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
[<a id="ref-XML-FRAG">XML-FRAG</a>] Grosso, P. and D. Veillard, "XML Fragment
Interchange", World Wide Web Consortium CR CR-xml-
fragment-20010212, February 2001,
<<a href="http://www.w3.org/TR/2001/CR-xml-fragment-20010212">http://www.w3.org/TR/2001/CR-xml-fragment-20010212</a>>.
[<a id="ref-XML-REG">XML-REG</a>] Mealling, M., "The IETF XML Registry", <a href="https://www.rfc-editor.org/bcp/bcp81">BCP 81</a>,
<a href="./rfc3688">RFC 3688</a>, January 2004.
[<a id="ref-XML-SCHEMA">XML-SCHEMA</a>] Thompson, H., Maloney, M., Mendelsohn, N., and D.
Beech, "XML Schema Part 1: Structures Second
Edition", World Wide Web Consortium
Recommendation REC-xmlschema-1-20041028,
October 2004,
<<a href="http://www.w3.org/TR/2004/REC-xmlschema-1-20041028">http://www.w3.org/TR/2004/REC-xmlschema-1-20041028</a>>.
[<a id="ref-XMPP-URI">XMPP-URI</a>] Saint-Andre, P., "Internationalized Resource
Identifiers (IRIs) and Uniform Resource Identifiers
(URIs) for the Extensible Messaging and Presence
Protocol (XMPP)", <a href="./rfc5122">RFC 5122</a>, February 2008.
<span class="grey">Saint-Andre Standards Track [Page 189]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-190" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. XML Schemas</span>
The following schemas formally define various namespaces used in this
document, in conformance with [<a href="#ref-XML-SCHEMA" title=""XML Schema Part 1: Structures Second Edition"">XML-SCHEMA</a>]. Because validation of
XML streams and stanzas is optional, these schemas are not normative
and are provided for descriptive purposes only.
<span class="h3"><a class="selflink" id="appendix-A.1" href="#appendix-A.1">A.1</a>. Stream Namespace</span>
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='http://etherx.jabber.org/streams'
xmlns='http://etherx.jabber.org/streams'
elementFormDefault='unqualified'>
<xs:import namespace='jabber:client'/>
<xs:import namespace='jabber:server'/>
<xs:import namespace='urn:ietf:params:xml:ns:xmpp-sasl'/>
<xs:import namespace='urn:ietf:params:xml:ns:xmpp-streams'/>
<xs:import namespace='urn:ietf:params:xml:ns:xmpp-tls'/>
<xs:element name='stream'>
<xs:complexType>
<xs:sequence xmlns:client='jabber:client'
xmlns:server='jabber:server'>
<xs:element ref='features'
minOccurs='0'
maxOccurs='1'/>
<xs:any namespace='urn:ietf:params:xml:ns:xmpp-tls'
minOccurs='0'
maxOccurs='1'/>
<xs:any namespace='urn:ietf:params:xml:ns:xmpp-sasl'
minOccurs='0'
maxOccurs='1'/>
<xs:any namespace='##other'
minOccurs='0'
maxOccurs='unbounded'
processContents='lax'/>
<xs:choice minOccurs='0' maxOccurs='1'>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element ref='client:message'/>
<xs:element ref='client:presence'/>
<xs:element ref='client:iq'/>
</xs:choice>
<span class="grey">Saint-Andre Standards Track [Page 190]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-191" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element ref='server:message'/>
<xs:element ref='server:presence'/>
<xs:element ref='server:iq'/>
</xs:choice>
</xs:choice>
<xs:element ref='error' minOccurs='0' maxOccurs='1'/>
</xs:sequence>
<xs:attribute name='from' type='xs:string' use='optional'/>
<xs:attribute name='id' type='xs:string' use='optional'/>
<xs:attribute name='to' type='xs:string' use='optional'/>
<xs:attribute name='version' type='xs:decimal' use='optional'/>
<xs:attribute ref='xml:lang' use='optional'/>
<xs:anyAttribute namespace='##other' processContents='lax'/>
</xs:complexType>
</xs:element>
<xs:element name='features'>
<xs:complexType>
<xs:sequence>
<xs:any namespace='##other'
minOccurs='0'
maxOccurs='unbounded'
processContents='lax'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='error'>
<xs:complexType>
<xs:sequence xmlns:err='urn:ietf:params:xml:ns:xmpp-streams'>
<xs:group ref='err:streamErrorGroup'/>
<xs:element ref='err:text'
minOccurs='0'
maxOccurs='1'/>
<xs:any namespace='##other'
minOccurs='0'
maxOccurs='1'
processContents='lax'/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<span class="grey">Saint-Andre Standards Track [Page 191]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-192" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="appendix-A.2" href="#appendix-A.2">A.2</a>. Stream Error Namespace</span>
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:ietf:params:xml:ns:xmpp-streams'
xmlns='urn:ietf:params:xml:ns:xmpp-streams'
elementFormDefault='qualified'>
<xs:element name='bad-format' type='empty'/>
<xs:element name='bad-namespace-prefix' type='empty'/>
<xs:element name='conflict' type='empty'/>
<xs:element name='connection-timeout' type='empty'/>
<xs:element name='host-gone' type='empty'/>
<xs:element name='host-unknown' type='empty'/>
<xs:element name='improper-addressing' type='empty'/>
<xs:element name='internal-server-error' type='empty'/>
<xs:element name='invalid-from' type='empty'/>
<xs:element name='invalid-id' type='empty'/>
<xs:element name='invalid-namespace' type='empty'/>
<xs:element name='invalid-xml' type='empty'/>
<xs:element name='not-authorized' type='empty'/>
<xs:element name='not-well-formed' type='empty'/>
<xs:element name='policy-violation' type='empty'/>
<xs:element name='remote-connection-failed' type='empty'/>
<xs:element name='reset' type='empty'/>
<xs:element name='resource-constraint' type='empty'/>
<xs:element name='restricted-xml' type='empty'/>
<xs:element name='see-other-host' type='xs:string'/>
<xs:element name='system-shutdown' type='empty'/>
<xs:element name='undefined-condition' type='empty'/>
<xs:element name='unsupported-encoding' type='empty'/>
<xs:element name='unsupported-stanza-type' type='empty'/>
<xs:element name='unsupported-version' type='empty'/>
<xs:group name='streamErrorGroup'>
<xs:choice>
<xs:element ref='bad-format'/>
<xs:element ref='bad-namespace-prefix'/>
<xs:element ref='conflict'/>
<xs:element ref='connection-timeout'/>
<xs:element ref='host-gone'/>
<xs:element ref='host-unknown'/>
<xs:element ref='improper-addressing'/>
<xs:element ref='internal-server-error'/>
<xs:element ref='invalid-from'/>
<xs:element ref='invalid-id'/>
<span class="grey">Saint-Andre Standards Track [Page 192]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-193" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:element ref='invalid-namespace'/>
<xs:element ref='invalid-xml'/>
<xs:element ref='not-authorized'/>
<xs:element ref='not-well-formed'/>
<xs:element ref='policy-violation'/>
<xs:element ref='remote-connection-failed'/>
<xs:element ref='reset'/>
<xs:element ref='resource-constraint'/>
<xs:element ref='restricted-xml'/>
<xs:element ref='see-other-host'/>
<xs:element ref='system-shutdown'/>
<xs:element ref='undefined-condition'/>
<xs:element ref='unsupported-encoding'/>
<xs:element ref='unsupported-stanza-type'/>
<xs:element ref='unsupported-version'/>
</xs:choice>
</xs:group>
<xs:element name='text'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:simpleType name='empty'>
<xs:restriction base='xs:string'>
<xs:enumeration value=''/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
<span class="h3"><a class="selflink" id="appendix-A.3" href="#appendix-A.3">A.3</a>. STARTTLS Namespace</span>
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:ietf:params:xml:ns:xmpp-tls'
xmlns='urn:ietf:params:xml:ns:xmpp-tls'
elementFormDefault='qualified'>
<span class="grey">Saint-Andre Standards Track [Page 193]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-194" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:element name='starttls'>
<xs:complexType>
<xs:choice minOccurs='0' maxOccurs='1'>
<xs:element name='required' type='empty'/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name='proceed' type='empty'/>
<xs:element name='failure' type='empty'/>
<xs:simpleType name='empty'>
<xs:restriction base='xs:string'>
<xs:enumeration value=''/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
<span class="h3"><a class="selflink" id="appendix-A.4" href="#appendix-A.4">A.4</a>. SASL Namespace</span>
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:ietf:params:xml:ns:xmpp-sasl'
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
elementFormDefault='qualified'>
<xs:element name='mechanisms'>
<xs:complexType>
<xs:sequence>
<xs:element name='mechanism'
minOccurs='1'
maxOccurs='unbounded'
type='xs:NMTOKEN'/>
<xs:any namespace='##other'
minOccurs='0'
maxOccurs='unbounded'
processContents='lax'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='abort' type='empty'/>
<span class="grey">Saint-Andre Standards Track [Page 194]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-195" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:element name='auth'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute name='mechanism'
type='xs:NMTOKEN'
use='required'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name='challenge' type='xs:string'/>
<xs:element name='response' type='xs:string'/>
<xs:element name='success' type='xs:string'/>
<xs:element name='failure'>
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs='0'>
<xs:element name='aborted' type='empty'/>
<xs:element name='account-disabled' type='empty'/>
<xs:element name='credentials-expired' type='empty'/>
<xs:element name='encryption-required' type='empty'/>
<xs:element name='incorrect-encoding' type='empty'/>
<xs:element name='invalid-authzid' type='empty'/>
<xs:element name='invalid-mechanism' type='empty'/>
<xs:element name='malformed-request' type='empty'/>
<xs:element name='mechanism-too-weak' type='empty'/>
<xs:element name='not-authorized' type='empty'/>
<xs:element name='temporary-auth-failure' type='empty'/>
</xs:choice>
<xs:element ref='text' minOccurs='0' maxOccurs='1'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='text'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<span class="grey">Saint-Andre Standards Track [Page 195]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-196" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:simpleType name='empty'>
<xs:restriction base='xs:string'>
<xs:enumeration value=''/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
<span class="h3"><a class="selflink" id="appendix-A.5" href="#appendix-A.5">A.5</a>. Client Namespace</span>
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='jabber:client'
xmlns='jabber:client'
elementFormDefault='qualified'>
<xs:import
namespace='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<xs:element name='message'>
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element ref='subject'/>
<xs:element ref='body'/>
<xs:element ref='thread'/>
</xs:choice>
<xs:any namespace='##other'
minOccurs='0'
maxOccurs='unbounded'
processContents='lax'/>
<xs:element ref='error'
minOccurs='0'/>
</xs:sequence>
<xs:attribute name='from'
type='xs:string'
use='optional'/>
<xs:attribute name='id'
type='xs:NMTOKEN'
use='optional'/>
<xs:attribute name='to'
type='xs:string'
use='optional'/>
<xs:attribute name='type'
use='optional'
default='normal'>
<span class="grey">Saint-Andre Standards Track [Page 196]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-197" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:simpleType>
<xs:restriction base='xs:NMTOKEN'>
<xs:enumeration value='chat'/>
<xs:enumeration value='error'/>
<xs:enumeration value='groupchat'/>
<xs:enumeration value='headline'/>
<xs:enumeration value='normal'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:complexType>
</xs:element>
<xs:element name='body'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name='subject'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name='thread'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:NMTOKEN'>
<xs:attribute name='parent'
type='xs:NMTOKEN'
use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<span class="grey">Saint-Andre Standards Track [Page 197]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-198" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:element name='presence'>
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element ref='show'/>
<xs:element ref='status'/>
<xs:element ref='priority'/>
</xs:choice>
<xs:any namespace='##other'
minOccurs='0'
maxOccurs='unbounded'
processContents='lax'/>
<xs:element ref='error'
minOccurs='0'/>
</xs:sequence>
<xs:attribute name='from'
type='xs:string'
use='optional'/>
<xs:attribute name='id'
type='xs:NMTOKEN'
use='optional'/>
<xs:attribute name='to'
type='xs:string'
use='optional'/>
<xs:attribute name='type' use='optional'>
<xs:simpleType>
<xs:restriction base='xs:NMTOKEN'>
<xs:enumeration value='error'/>
<xs:enumeration value='probe'/>
<xs:enumeration value='subscribe'/>
<xs:enumeration value='subscribed'/>
<xs:enumeration value='unavailable'/>
<xs:enumeration value='unsubscribe'/>
<xs:enumeration value='unsubscribed'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:complexType>
</xs:element>
<span class="grey">Saint-Andre Standards Track [Page 198]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-199" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:element name='show'>
<xs:simpleType>
<xs:restriction base='xs:NMTOKEN'>
<xs:enumeration value='away'/>
<xs:enumeration value='chat'/>
<xs:enumeration value='dnd'/>
<xs:enumeration value='xa'/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name='status'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='string1024'>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:simpleType name='string1024'>
<xs:restriction base='xs:string'>
<xs:minLength value='1'/>
<xs:maxLength value='1024'/>
</xs:restriction>
</xs:simpleType>
<xs:element name='priority' type='xs:byte'/>
<xs:element name='iq'>
<xs:complexType>
<xs:sequence>
<xs:any namespace='##other'
minOccurs='0'
maxOccurs='1'
processContents='lax'/>
<xs:element ref='error'
minOccurs='0'/>
</xs:sequence>
<xs:attribute name='from'
type='xs:string'
use='optional'/>
<xs:attribute name='id'
type='xs:NMTOKEN'
use='required'/>
<span class="grey">Saint-Andre Standards Track [Page 199]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-200" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:attribute name='to'
type='xs:string'
use='optional'/>
<xs:attribute name='type' use='required'>
<xs:simpleType>
<xs:restriction base='xs:NMTOKEN'>
<xs:enumeration value='error'/>
<xs:enumeration value='get'/>
<xs:enumeration value='result'/>
<xs:enumeration value='set'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:complexType>
</xs:element>
<xs:element name='error'>
<xs:complexType>
<xs:sequence xmlns:err='urn:ietf:params:xml:ns:xmpp-stanzas'>
<xs:group ref='err:stanzaErrorGroup'/>
<xs:element ref='err:text'
minOccurs='0'/>
</xs:sequence>
<xs:attribute name='by'
type='xs:string'
use='optional'/>
<xs:attribute name='type' use='required'>
<xs:simpleType>
<xs:restriction base='xs:NMTOKEN'>
<xs:enumeration value='auth'/>
<xs:enumeration value='cancel'/>
<xs:enumeration value='continue'/>
<xs:enumeration value='modify'/>
<xs:enumeration value='wait'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
<span class="grey">Saint-Andre Standards Track [Page 200]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-201" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="appendix-A.6" href="#appendix-A.6">A.6</a>. Server Namespace</span>
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='jabber:server'
xmlns='jabber:server'
elementFormDefault='qualified'>
<xs:import
namespace='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<xs:element name='message'>
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element ref='subject'/>
<xs:element ref='body'/>
<xs:element ref='thread'/>
</xs:choice>
<xs:any namespace='##other'
minOccurs='0'
maxOccurs='unbounded'
processContents='lax'/>
<xs:element ref='error'
minOccurs='0'/>
</xs:sequence>
<xs:attribute name='from'
type='xs:string'
use='required'/>
<xs:attribute name='id'
type='xs:NMTOKEN'
use='optional'/>
<xs:attribute name='to'
type='xs:string'
use='required'/>
<xs:attribute name='type'
use='optional'
default='normal'>
<xs:simpleType>
<xs:restriction base='xs:NMTOKEN'>
<xs:enumeration value='chat'/>
<xs:enumeration value='error'/>
<xs:enumeration value='groupchat'/>
<xs:enumeration value='headline'/>
<xs:enumeration value='normal'/>
</xs:restriction>
<span class="grey">Saint-Andre Standards Track [Page 201]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-202" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
</xs:simpleType>
</xs:attribute>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:complexType>
</xs:element>
<xs:element name='body'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name='subject'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name='thread'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:NMTOKEN'>
<xs:attribute name='parent'
type='xs:NMTOKEN'
use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<span class="grey">Saint-Andre Standards Track [Page 202]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-203" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:element name='subject'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:NMTOKEN'>
<xs:attribute name='parent'
type='xs:NMTOKEN'
use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name='presence'>
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element ref='show'/>
<xs:element ref='status'/>
<xs:element ref='priority'/>
</xs:choice>
<xs:any namespace='##other'
minOccurs='0'
maxOccurs='unbounded'
processContents='lax'/>
<xs:element ref='error'
minOccurs='0'/>
</xs:sequence>
<xs:attribute name='from'
type='xs:string'
use='required'/>
<xs:attribute name='id'
type='xs:NMTOKEN'
use='optional'/>
<xs:attribute name='to'
type='xs:string'
use='required'/>
<xs:attribute name='type' use='optional'>
<xs:simpleType>
<xs:restriction base='xs:NMTOKEN'>
<xs:enumeration value='error'/>
<xs:enumeration value='probe'/>
<xs:enumeration value='subscribe'/>
<xs:enumeration value='subscribed'/>
<xs:enumeration value='unavailable'/>
<xs:enumeration value='unsubscribe'/>
<xs:enumeration value='unsubscribed'/>
</xs:restriction>
</xs:simpleType>
<span class="grey">Saint-Andre Standards Track [Page 203]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-204" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
</xs:attribute>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:complexType>
</xs:element>
<xs:element name='show'>
<xs:simpleType>
<xs:restriction base='xs:NMTOKEN'>
<xs:enumeration value='away'/>
<xs:enumeration value='chat'/>
<xs:enumeration value='dnd'/>
<xs:enumeration value='xa'/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name='status'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='string1024'>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:simpleType name='string1024'>
<xs:restriction base='xs:string'>
<xs:minLength value='1'/>
<xs:maxLength value='1024'/>
</xs:restriction>
</xs:simpleType>
<xs:element name='priority' type='xs:byte' default='0'/>
<xs:element name='iq'>
<xs:complexType>
<xs:sequence>
<xs:any namespace='##other'
minOccurs='0'
maxOccurs='1'
processContents='lax'/>
<xs:element ref='error'
minOccurs='0'/>
</xs:sequence>
<xs:attribute name='from'
type='xs:string'
use='required'/>
<span class="grey">Saint-Andre Standards Track [Page 204]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-205" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:attribute name='id'
type='xs:NMTOKEN'
use='required'/>
<xs:attribute name='to'
type='xs:string'
use='required'/>
<xs:attribute name='type' use='required'>
<xs:simpleType>
<xs:restriction base='xs:NMTOKEN'>
<xs:enumeration value='error'/>
<xs:enumeration value='get'/>
<xs:enumeration value='result'/>
<xs:enumeration value='set'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:complexType>
</xs:element>
<xs:element name='error'>
<xs:complexType>
<xs:sequence xmlns:err='urn:ietf:params:xml:ns:xmpp-stanzas'>
<xs:group ref='err:stanzaErrorGroup'/>
<xs:element ref='err:text'
minOccurs='0'/>
</xs:sequence>
<xs:attribute name='by'
type='xs:string'
use='optional'/>
<xs:attribute name='type' use='required'>
<xs:simpleType>
<xs:restriction base='xs:NMTOKEN'>
<xs:enumeration value='auth'/>
<xs:enumeration value='cancel'/>
<xs:enumeration value='continue'/>
<xs:enumeration value='modify'/>
<xs:enumeration value='wait'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
<span class="grey">Saint-Andre Standards Track [Page 205]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-206" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<span class="h3"><a class="selflink" id="appendix-A.7" href="#appendix-A.7">A.7</a>. Resource Binding Namespace</span>
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:ietf:params:xml:ns:xmpp-bind'
xmlns='urn:ietf:params:xml:ns:xmpp-bind'
elementFormDefault='qualified'>
<xs:element name='bind'>
<xs:complexType>
<xs:choice>
<xs:element name='resource' type='resourceType'/>
<xs:element name='jid' type='fullJIDType'/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:simpleType name='fullJIDType'>
<xs:restriction base='xs:string'>
<xs:minLength value='8'/>
<xs:maxLength value='3071'/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name='resourceType'>
<xs:restriction base='xs:string'>
<xs:minLength value='1'/>
<xs:maxLength value='1023'/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
<span class="h3"><a class="selflink" id="appendix-A.8" href="#appendix-A.8">A.8</a>. Stanza Error Namespace</span>
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:ietf:params:xml:ns:xmpp-stanzas'
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'
elementFormDefault='qualified'>
<xs:element name='bad-request' type='empty'/>
<xs:element name='conflict' type='empty'/>
<xs:element name='feature-not-implemented' type='empty'/>
<span class="grey">Saint-Andre Standards Track [Page 206]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-207" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:element name='forbidden' type='empty'/>
<xs:element name='gone' type='xs:string'/>
<xs:element name='internal-server-error' type='empty'/>
<xs:element name='item-not-found' type='empty'/>
<xs:element name='jid-malformed' type='empty'/>
<xs:element name='not-acceptable' type='empty'/>
<xs:element name='not-allowed' type='empty'/>
<xs:element name='not-authorized' type='empty'/>
<xs:element name='policy-violation' type='empty'/>
<xs:element name='recipient-unavailable' type='empty'/>
<xs:element name='redirect' type='xs:string'/>
<xs:element name='registration-required' type='empty'/>
<xs:element name='remote-server-not-found' type='empty'/>
<xs:element name='remote-server-timeout' type='empty'/>
<xs:element name='resource-constraint' type='empty'/>
<xs:element name='service-unavailable' type='empty'/>
<xs:element name='subscription-required' type='empty'/>
<xs:element name='undefined-condition' type='empty'/>
<xs:element name='unexpected-request' type='empty'/>
<xs:group name='stanzaErrorGroup'>
<xs:choice>
<xs:element ref='bad-request'/>
<xs:element ref='conflict'/>
<xs:element ref='feature-not-implemented'/>
<xs:element ref='forbidden'/>
<xs:element ref='gone'/>
<xs:element ref='internal-server-error'/>
<xs:element ref='item-not-found'/>
<xs:element ref='jid-malformed'/>
<xs:element ref='not-acceptable'/>
<xs:element ref='not-authorized'/>
<xs:element ref='not-allowed'/>
<xs:element ref='policy-violation'/>
<xs:element ref='recipient-unavailable'/>
<xs:element ref='redirect'/>
<xs:element ref='registration-required'/>
<xs:element ref='remote-server-not-found'/>
<xs:element ref='remote-server-timeout'/>
<xs:element ref='resource-constraint'/>
<xs:element ref='service-unavailable'/>
<xs:element ref='subscription-required'/>
<xs:element ref='undefined-condition'/>
<xs:element ref='unexpected-request'/>
</xs:choice>
</xs:group>
<span class="grey">Saint-Andre Standards Track [Page 207]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-208" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
<xs:element name='text'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:simpleType name='empty'>
<xs:restriction base='xs:string'>
<xs:enumeration value=''/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
<span class="h2"><a class="selflink" id="appendix-B" href="#appendix-B">Appendix B</a>. Contact Addresses</span>
Consistent with [<a href="#ref-MAILBOXES" title=""MAILBOX NAMES FOR COMMON SERVICES, ROLES AND FUNCTIONS"">MAILBOXES</a>], organization that offer XMPP services
are encouraged to provide an Internet mailbox of "XMPP" for inquiries
related to that service, where the host portion of the resulting
mailto URI is the organization's domain, not the domain of the XMPP
service itself (e.g., the XMPP service might be offered at
im.example.com but the Internet mailbox would be <xmpp@example.com>).
<span class="h2"><a class="selflink" id="appendix-C" href="#appendix-C">Appendix C</a>. Account Provisioning</span>
Account provisioning is out of scope for this specification.
Possible methods for account provisioning include account creation by
a server administrator and in-band account registration using the
'jabber:iq:register' namespace as documented in [<a href="#ref-XEP-0077" title=""In-Band Registration"">XEP-0077</a>]. An XMPP
server implementation or administrative function MUST ensure that any
JID assigned during account provisioning (including localpart,
domainpart, resourcepart, and separator characters) conforms to the
canonical format for XMPP addresses defined in [<a href="#ref-XMPP-ADDR" title=""Extensible Messaging and Presence Protocol (XMPP): Address Format"">XMPP-ADDR</a>].
<span class="h2"><a class="selflink" id="appendix-D" href="#appendix-D">Appendix D</a>. Differences from <a href="./rfc3920">RFC 3920</a></span>
Based on consensus derived from implementation and deployment
experience as well as formal interoperability testing, the following
substantive modifications were made from <a href="./rfc3920">RFC 3920</a> (in addition to
numerous changes of an editorial nature).
o Moved specification of the XMPP address format to a separate
document.
<span class="grey">Saint-Andre Standards Track [Page 208]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-209" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
o Recommended or mandated use of the 'from' and 'to' attributes on
stream headers.
o More fully specified the stream closing handshake.
o Specified the recommended stream reconnection algorithm.
o Changed the name of the <xml-not-well-formed/> stream error
condition to <not-well-formed/> for compliance with the XML
specification.
o Removed the unnecessary and unused <invalid-id/> stream error (see
<a href="./rfc3920">RFC 3920</a> for historical documentation).
o Specified return of the <restricted-xml/> stream error in response
to receipt of prohibited XML features.
o More completely specified the format and handling of the <see-
other-host/> stream error, including consistency with <a href="./rfc3986">RFC 3986</a> and
<a href="./rfc5952">RFC 5952</a> with regard to IPv6 addresses (e.g., enclosing the IPv6
address in square brackets '[' and ']').
o Specified that the SASL SCRAM mechanism is a mandatory-to-
implement technology for client-to-server streams.
o Specified that TLS plus the SASL PLAIN mechanism is a mandatory-
to-implement technology for client-to-server streams.
o Specified that support for the SASL EXTERNAL mechanism is required
for servers but only recommended for clients (since end-user X.509
certificates are difficult to obtain and not yet widely deployed).
o Removed the hard two-connection rule for server-to-server streams.
o More clearly specified the certificate profile for both public key
certificates and issuer certificates.
o Added the <reset/> stream error (<a href="#section-4.9.3.16">Section 4.9.3.16</a>) condition to
handle expired/revoked certificates or the addition of security-
critical features to an existing stream.
o Added the <account-disabled/>, <credentials-expired/>,
<encryption-required/>, and <malformed-request/> SASL error
conditions to handle error flows mistakenly left out of <a href="./rfc3920">RFC 3920</a>
or discussed in <a href="./rfc4422">RFC 4422</a> but not in <a href="./rfc2222">RFC 2222</a>.
o Removed the unused <payment-required/> stanza error.
<span class="grey">Saint-Andre Standards Track [Page 209]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-210" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
o Removed the unnecessary requirement for escaping of characters
that map to certain predefined entities, since they do not need to
be escaped in XML.
o Clarified the process of DNS SRV lookups and fallbacks.
o Clarified the handling of SASL security layers.
o Clarified that a SASL simple user name is the localpart, not the
bare JID.
o Clarified the stream negotiation process and associated flow
chart.
o Clarified the handling of stream features.
o Added a 'by' attribute to the <error/> element for stanza errors
so that the entity that has detected the error can include its JID
for diagnostic or tracking purposes.
o Clarified the handling of data that violates the well-formedness
definitions for XML 1.0 and XML namespaces.
o Specified the security considerations in more detail, especially
with regard to presence leaks and denial-of-service attacks.
o Moved documentation of the Server Dialback protocol from this
specification to a separate specification maintained by the XMPP
Standards Foundation.
<span class="h2"><a class="selflink" id="appendix-E" href="#appendix-E">Appendix E</a>. Acknowledgements</span>
This document is an update to, and derived from, <a href="./rfc3920">RFC 3920</a>. This
document would have been impossible without the work of the
contributors and commenters acknowledged there.
Hundreds of people have provided implementation feedback, bug
reports, requests for clarification, and suggestions for improvement
since publication of <a href="./rfc3920">RFC 3920</a>. Although the document editor has
endeavored to address all such feedback, he is solely responsible for
any remaining errors and ambiguities.
Special thanks are due to Kevin Smith, Matthew Wild, Dave Cridland,
Philipp Hancke, Waqas Hussain, Florian Zeitz, Ben Campbell, Jehan
Pages, Paul Aurich, Justin Karneges, Kurt Zeilenga, Simon Josefsson,
Ralph Meijer, Curtis King, and others for their comments during
Working Group Last Call.
<span class="grey">Saint-Andre Standards Track [Page 210]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-211" ></span>
<span class="grey"><a href="./rfc6120">RFC 6120</a> XMPP Core March 2011</span>
Thanks also to Yaron Sheffer and Elwyn Davies for their reviews on
behalf of the Security Directorate and the General Area Review Team,
respectively.
The Working Group chairs were Ben Campbell and Joe Hildebrand. The
responsible Area Director was Gonzalo Camarillo.
Author's Address
Peter Saint-Andre
Cisco
1899 Wyknoop Street, Suite 600
Denver, CO 80202
USA
Phone: +1-303-308-3282
EMail: psaintan@cisco.com
Saint-Andre Standards Track [Page 211]
</pre>
|