This file is indexed.

/usr/include/globus/globus_rls_client.h is in libglobus-rls-client-dev 5.2-11.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
/*
 * Copyright 1999-2006 University of Chicago
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _globus_rls_client_h_
#define _globus_rls_client_h_

#include <globus_io.h>
#include <globus_error_string.h>

/**
 * @mainpage
 * The Globus Replica Location Service (RLS) C API provides functions to
 * view and update data in a RLS catalog.  There are 2 types of RLS servers,
 * Local Replica Catalog (LRC) servers, which maintain Logical to Physical
 * File Name mappings (LFN to PFN), and Replica Location Index (RLI) servers,
 * which  maintain LFN to LRC mappings.  Note an RLS server can act as both
 * an LRC and RLI server.
 *
 * Functions are divided into the following groups:
 * - @link globus_rls_client_activation Activation @endlink
 * - @link globus_rls_client_connection Connection Management @endlink
 * - @link globus_rls_client_lrc_operation Operations on an LRC server @endlink
 * - @link globus_rls_client_rli_operation Operations on an RLI server @endlink
 * - @link globus_rls_client_miscellaneous Miscellaneous Types and
 *     Functions @endlink
 * - @link globus_rls_client_queryresult Query Results @endlink
 * - @link globus_rls_client_status Status Codes @endlink
 *
 * Applications using this API should include <B>globus_rls_client.h</B>, and
 * be linked with the library <B>globus_rls_client_FLAVOR</B>.
 */



/**
 * @defgroup globus_rls_client_status Status Codes
 * All of the functions in the API that return status return it
 * in a globus_result_t structure.  Prior to version 2.0.0 an integer
 * status was returned.  The globus_result_t structure includes an
 * integer "type" which is set to one of the status codes defined below (the
 * same values that were returned by earlier versions of the API).
 * The function globus_rls_client_error_info() may be used to extract
 * the status code and/or error message from a globus_result_t.  GLOBUS_SUCCESS
 * is returned when the operation was successful.
 */

/**
 * Operation succeeded.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_SUCCESS		0
/**
 * An error was returned by the Globus I/O module.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_GLOBUSERR		1
/**
 * The ::globus_rls_handle_t handle is invalid.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_INVHANDLE		2
/**
 * The URL could not be parsed.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_BADURL		3
/**
 * Out of memory.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_NOMEMORY		4
/**
 * A result was too large to fit in buffer.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_OVERFLOW		5
/**
 * Bad argument (eg NULL where string pointer expected).
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_BADARG		6
/**
 * Client does not have permission for requested action.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_PERM			7
/**
 * RPC error, invalid method name sent to server.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_BADMETHOD		8
/**
 * LRC request made to RLI server or vice versa.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_INVSERVER		9
/**
 * LFN,PFN (LRC) or LFN,LRC (RLI) mapping doesn't exist.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_MAPPING_NEXIST	10
/**
 * LFN already exists in LRC or RLI database.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_LFN_EXIST		11
/**
 * LFN doesn't exist in LRC or RLI database.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_LFN_NEXIST		12
/**
 * PFN already exists in LRC database.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_PFN_EXIST		13
/**
 * PFN doesn't exist in LRC database.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_PFN_NEXIST		14
/**
 * LRC already exists in LRC or RLI database.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_LRC_EXIST		15
/**
 * LRC doesn't exist in RLI database.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_LRC_NEXIST		16
/**
 * Database error.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_DBERROR		17
/**
 * RLI already exists in LRC database.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_RLI_EXIST		18
/**
 * RLI doesn't exist in LRC.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_RLI_NEXIST		19
/**
 * LFN,PFN (LRC) or LFN,LRC (RLI) mapping already exists.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_MAPPING_EXIST	20
/**
 * Invalid attribute type, see globus_rls_attr_type_t.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_INV_ATTR_TYPE	21
/**
 * Attribute already exists.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_ATTR_EXIST		22
/**
 * Attribute doesn't exist.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_ATTR_NEXIST		23
/**
 * Invalid object type, see globus_rls_obj_type_t.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_INV_OBJ_TYPE		24
/**
 * Invalid attribute search operator, see globus_rls_attr_op_t.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_INV_ATTR_OP		25
/**
 * Operation is unsupported.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_UNSUPPORTED		26
/**
 * IO timeout.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_TIMEOUT		27
/**
 * Too many connections.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_TOO_MANY_CONNECTIONS	28

/**
 * Attribute with specified value not found.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_ATTR_VALUE_NEXIST	29

/**
 * Attribute in use by some object, can't be deleted.
 * @ingroup globus_rls_client_status
 */
#define GLOBUS_RLS_ATTR_INUSE		30

/* Globus LRC server is in the process of starting up. You can issue queries
but cannot update the database. */

#define GLOBUS_RLS_INITIALIZING          31

/**
 * @defgroup globus_rls_client_miscellaneous Miscellaneous
 * Miscellaneous functions and types.
 */

/**
 * Wildcard character style.
 * @ingroup globus_rls_client_miscellaneous
 */
typedef enum {
  rls_pattern_unix,	/**< Unix file globbing chars (*, ?)	*/
  rls_pattern_sql	/**< SQL "like" wildcards (%, _)	*/
} globus_rls_pattern_t;

/* Obsolete, use globus_rls_pattern_t */
#define globus_rls_pattern_type	globus_rls_pattern_t;

#define BUFLEN	1024

/**
 * Attribute Value Types
 * @ingroup globus_rls_client_miscellaneous
 */
typedef enum {
  globus_rls_attr_type_date,	/**< Date (time_t). */
  globus_rls_attr_type_flt,	/**< Floating point (double). */
  globus_rls_attr_type_int,	/**< Integer (int). */
  globus_rls_attr_type_str	/**< String (char *). */
} globus_rls_attr_type_t;

/*
 * Obsolete names for attribute value types, please use enum above.
 */
#define GLOBUS_RLS_ATTR_TYPE_DATE	globus_rls_attr_type_date
#define GLOBUS_RLS_ATTR_TYPE_FLT	globus_rls_attr_type_flt
#define GLOBUS_RLS_ATTR_TYPE_INT	globus_rls_attr_type_int
#define GLOBUS_RLS_ATTR_TYPE_STR	globus_rls_attr_type_str

/**
 * Object types in LRC and RLI databases.
 * @ingroup globus_rls_client_miscellaneous
 */
typedef enum {
  globus_rls_obj_lrc_lfn,	/**< LRC Logical File Name. */
  globus_rls_obj_lrc_pfn,	/**< LRC Physical File Name. */
  globus_rls_obj_rli_lfn,	/**< RLI Logical File Name. */
  globus_rls_obj_rli_lrc	/**< RLI LRC URL. */
} globus_rls_obj_type_t;

/*
 * The following are obsolete, please use the enum above.
 */
#define GLOBUS_RLS_CLIENT_LRC_OBJ_LFN	globus_rls_obj_lrc_lfn
#define GLOBUS_RLS_CLIENT_LRC_OBJ_PFN	globus_rls_obj_lrc_pfn
#define GLOBUS_RLS_CLIENT_RLI_OBJ_LFN	globus_rls_obj_rli_lfn
#define GLOBUS_RLS_CLIENT_RLI_OBJ_LRC	globus_rls_obj_rli_lrc

/**
 * Object (LFN or PFN) attribute type.
 * @ingroup globus_rls_client_miscellaneous
 */
typedef struct {
  char			*name;		/**< Attribute name. */
  globus_rls_obj_type_t	objtype;	/**< Object type. */
  globus_rls_attr_type_t type;		/**< Attribute value type. */ 
  /** Value of attribute (depends on type). */
  union {
    time_t	t;	/**< Date value (unix time). */
    double	d;	/**< Floating point value. */
    int		i;	/**< Integer value. */
    char	*s;	/**< String value. */
  }			val;
} globus_rls_attribute_t;

/**
 * globus_rls_client_lrc_attr_search() returns a list of these structures
 * which include the object name (LFN or PFN) and attribute value found
 * by the query.
 * @ingroup globus_rls_client_queryresult
 */
typedef struct {
  /** Attribute value. */
  globus_rls_attribute_t	attr;
  /** LFN or PFN. */
  char				*key;
  /** Result code, only used in bulk query. */
  int				rc;
} globus_rls_attribute_object_t;

/**
 * Attribute Value Query Operators
 * @ingroup globus_rls_client_miscellaneous
 */
typedef enum {
  globus_rls_attr_op_all,	/**< All values returned.		*/
  globus_rls_attr_op_eq,	/**< Values matching operand 1 returned.*/
  globus_rls_attr_op_ne,	/**< Values not matching operand 1.	*/
  globus_rls_attr_op_gt,	/**< Values greater than operand 1.	*/
  globus_rls_attr_op_ge,	/**< Values greater than or equal to op1*/
  globus_rls_attr_op_lt,	/**< Values less than operand 1.	*/
  globus_rls_attr_op_le,	/**< Values less than or equal to op1.	*/
  globus_rls_attr_op_btw,	/**< Values between operand1 and 2.	*/
  globus_rls_attr_op_like	/**< Strings "like" operand1 (SQL like)	*/
} globus_rls_attr_op_t;

/*
 * Following are obsolete, please use enum above.
 */
#define GLOBUS_RLS_CLIENT_ATTR_OP_ALL globus_rls_attr_op_all
#define GLOBUS_RLS_CLIENT_ATTR_OP_EQ globus_rls_attr_op_eq
#define GLOBUS_RLS_CLIENT_ATTR_OP_NE globus_rls_attr_op_ne
#define GLOBUS_RLS_CLIENT_ATTR_OP_GT globus_rls_attr_op_gt
#define GLOBUS_RLS_CLIENT_ATTR_OP_GE globus_rls_attr_op_ge
#define GLOBUS_RLS_CLIENT_ATTR_OP_LT globus_rls_attr_op_lt
#define GLOBUS_RLS_CLIENT_ATTR_OP_LE globus_rls_attr_op_le
#define GLOBUS_RLS_CLIENT_ATTR_OP_BTW globus_rls_attr_op_btw
#define GLOBUS_RLS_CLIENT_ATTR_OP_LIKE globus_rls_attr_op_like




/**
 * @defgroup globus_rls_client_queryresult Query Results
 * List results are returned as globus_list_t's, list datums depend
 * on the type of query (eg globus_rls_string2_t, globus_rls_attribute_t,
 * etc).  A list result should be freed with globus_rls_client_free_list() when
 * it's no longer needed.  RLS supports limiting the number of results
 * returned by a single query using an offset and reslimit.  The offset
 * specifies which result to begin with, reslimit specifies how many results
 * to return.  Offset should begin at 0 to retrieve all records.  If reslimit
 * is 0 then all results are returned at once, unless the server has
 * a limit on results configured.  If NULL is passed as the offset argument
 * then the API will repeatedly call the query function until are results
 * are retrieved.  The following are equivalent examples of how to
 * print the lfn,pfn pairs returned by globus_rls_client_lrc_get_lfn():
 *
 * @verbatim
   globus_list_t *str2_list;
   globus_list_t *p;
   globus_rls_string2_t *str2;

   // Retrieve all results, API will handle looping through partial results
   // if the server has a limit configured.  Error handling has been omitted.
   globus_rls_client_lrc_get_lfn(h, "somepfn", NULL, 0, &str2_list);
   for (p = str2_list; p; p = globus_list_rest(p)) {
     str2 = (globus_rls_string2_t *) globus_list_first(p);
     printf("lfn: %s pfn:%s\n", str2->s1, str2->s2);
   }
   globus_rls_client_free_list(str2_list);

   // This code fragment retrieves results 5 at a time.  Note offset is set
   // to -1 when the server has no more results to return.
   int offset = 0;

   while (globus_rls_client_lrc_get_lfn(h, "somepfn", &offset, 5, &str2_list) == GLOBUS_SUCCESS) {
     for (p = str2_list; p; p = globus_list_rest(p)) {
       str2 = (globus_rls_string2_t *) globus_list_first(p);
       printf("lfn: %s pfn:%s\n", str2->s1, str2->s2);
     }
     globus_rls_client_free_list(str2_list);
     if (offset == -1)
       break;
   }
   @endverbatim
 */

/**
 * @ingroup globus_rls_client_queryresult
 * String pair result.  Many of the query functions use this to return
 * pairs of strings (eg LFN,PFN or LFN,LRC).
 */
typedef struct {
  char	*s1;	/**< First string in pair (eg LFN). */
  char	*s2;	/**< Second string in pair (eg PFN or LRC). */
} globus_rls_string2_t;

/**
 * @ingroup globus_rls_client_queryresult
 * String pair result with return code, returned by bulk query operations.
 */
typedef struct {
  int			rc;
  globus_rls_string2_t	str2;
} globus_rls_string2_bulk_t;

/**
 * Free result list returned by one of the query functions.
 * @ingroup globus_rls_client_queryresult
 *
 * @param list
 *	List returned by one of the query functions.
 *
 * @retval GLOBUS_SUCCESS
 *	List and contents successfully freed.
 */
extern globus_result_t globus_rls_client_free_list(
  globus_list_t                         *list);



/**
 * @defgroup globus_rls_client_activation Activation
 * This module must be activated before any functions in this API may
 * be used.  This module depends on other Globus modules GLOBUS_COMMON_MODULE
 * and GLOBUS_IO_MODULE, which should be activated first:
 * @verbatim
   globus_module_activate(GLOBUS_COMMON_MODULE);
   globus_module_activate(GLOBUS_IO_MODULE);
   globus_module_activate(GLOBUS_RLS_CLIENT_MODULE);
   @endverbatim
 * When finished modules should be deactivated in reverse order.
 */

/*@{*/
/**
 * RLS module.
 * @ingroup globus_rls_client_activation
 */
extern globus_module_descriptor_t	globus_rls_client_module;
/**
 * RLS Module Name.
 */
#define GLOBUS_RLS_CLIENT_MODULE	(&globus_rls_client_module)
/*@}*/




/**
 * @defgroup globus_rls_client_connection Connection Management
 * Functions to open and close connections to an RLS server.
 */

/**
 * URL scheme to use when connecting to RLS server.
 * @ingroup globus_rls_client_connection
 */
#define GLOBUS_RLS_URL_SCHEME		"rls"
/**
 * URL scheme when connecting to RLS server without authentication.
 * @ingroup globus_rls_client_connection
 */
#define GLOBUS_RLS_URL_SCHEME_NOAUTH	"rlsn"
/**
 * Default port number that RLS server listens on.
 * @ingroup globus_rls_client_connection
 */
#define GLOBUS_RLS_SERVER_DEFPORT	39281
/**
 * Maximum length of error messages returned by server.
 * @ingroup globus_rls_client_connection
 */
#define MAXERRMSG	1024

/**
 * RLS Client Handle.
 */
typedef struct {
  globus_url_t		url; /**< URL of RLS server (RLS://host[:port]). */
  globus_io_handle_t	handle; /**< Globus IO handle. */
  int			flags; /**< See FH_xxx flags below. */
} globus_rls_handle_t;
#define FH_IOERROR	0x1	/* If set don't send "close" to server */
#define FH_CLOSED	0x2	/* Globus handle closed (set when	*/
				/* retrying failed IO operation)	*/

/**
 * Set certificate used in authentication.  Sets environment variables
 * X509_USER_CERT, X509_USER_KEY, and clears X509_USER_PROXY.
 * @ingroup globus_rls_client_connection
 *
 * @param certfile
 *	Name of X509 certificate file.
 *
 * @param keyfile
 *	Name of X509 key file.
 */
void
globus_rls_client_certificate(
  char					*certfile,
  char					*keyfile);

/**
 * Set X509_USER_PROXY environment variable to specified file.
 * @ingroup globus_rls_client_connection
 *
 * @param proxy
 *	Name of X509 proxy certificate file.  If NULL clears X509_USER_PROXY.
 */
void
globus_rls_client_proxy_certificate(
  char					*proxy);

/**
 * Open connection to RLS server.
 * @ingroup globus_rls_client_connection
 *
 * @param url
 *	URL of server to connect to.  URL scheme should be <B>RLS</B> or
 *	<B>RLSN</B>, eg <B>RLS://my.host</B>.
 *	If the URL scheme is <B>RLSN</B> then no authentication is performed
 *	(the RLS server must be started with authentication disabled as well,
 *	this option is primarily intended for testing).
 *
 * @param h
 *	If the connection is successful @a *h will be set to the connection
 *	handle.  This handle is required by all other functions in the API.
 *
 * @retval GLOBUS_SUCCESS
 *	Handle @a h now connected to RLS server identified by @a url.
 */
extern globus_result_t globus_rls_client_connect(
  char					*url,
  globus_rls_handle_t			**h);

/**
 * Close connection to RLS server.
 * @ingroup globus_rls_client_connection
 *
 * @param h
 *	Connection handle to be closed, previously allocated by
 *	globus_rls_client_connect().
 *
 * @retval GLOBUS_SUCCESS
 *	Connection closed, @a h is no longer valid.
 */
extern globus_result_t globus_rls_client_close(
  globus_rls_handle_t		*h);

/**
 * Get timeout for IO calls to RLS server.  If 0 IO calls do not timeout.
 * The default is 30 seconds.
 * @ingroup globus_rls_client_connection
 *
 * @retval timeout
 *	Seconds to wait before timing out an IO operation.
 */
extern int globus_rls_client_get_timeout();

/**
 * Set timeout for IO calls to RLS server.
 * @ingroup globus_rls_client_connection
 *
 * @param seconds
 *	Seconds to wait before timing out an IO operation.  If 0 IO calls do
 *	not timeout.  The default is 30 seconds.
 */
extern void globus_rls_client_set_timeout(
  int				seconds);



/**
 * @defgroup globus_rls_client_lrc_operation LRC Operations
 * Functions to view and update data managed by a LRC server.
 */

/**
 * Add an attribute to an object in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param key
 *	Logical or Physical File Name (LFN or PFN) that identifies object
 *	attribute should be added to.
 *
 * @param attr
 *	Attribute to be added to object.  @link globus_rls_attribute_t name,
 *	objtype, type and val @endlink should be set in @a attr.
 *
 * @retval GLOBUS_SUCCESS
 *	Attribute successfully associated with object.
 */
extern globus_result_t globus_rls_client_lrc_attr_add(
  globus_rls_handle_t		*h,
  char				*key,
  globus_rls_attribute_t	*attr);

/**
 * Bulk add attributes to objects in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param attr_obj_list
 *	List of object names (LFN or PFN) and attributes to be added.  Each
 *	list datum should be of type globus_rls_attribute_object_t.
 *
 * @param str2bulk_list
 *	List of failed updates.  Each list datum is a
 *	globus_rls_string2_bulk_t structure.  <B>str2.s1</B> will
 *	be the oject name, <B>str2.s2</B> the attribute name, and
 *	<B>rc</B> will be the result code from the failed update.  Only
 *	failed updates will be returned.
 */
extern globus_result_t globus_rls_client_lrc_attr_add_bulk(
  globus_rls_handle_t		*h,
  globus_list_t			*attr_obj_list,
  globus_list_t			**str2bulk_list);

/**
 * Define new attribute in LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an LRC server.
 *
 * @param name
 *	Name of attribute.
 *
 * @param objtype
 *	Object (LFN or PFN) type that attribute applies to.
 *
 * @param type
 *	Type of attribute value.
 *
 * @retval GLOBUS_SUCCESS
 *	Attribute successfully created.
 */
extern globus_result_t globus_rls_client_lrc_attr_create(
  globus_rls_handle_t		*h,
  char				*name,
  globus_rls_obj_type_t		objtype,
  globus_rls_attr_type_t	type);

/**
 * Undefine attribute in LRC database, previously created with
 * globus_rls_client_lrc_attr_create().
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an LRC server.
 *
 * @param name
 *	Name of attribute.
 *
 * @param objtype
 *	Object (LFN or PFN) type that attribute applies to.
 *
 * @param clearvalues
 *	If GLOBUS_TRUE then any any values for this attribute are first
 *	removed from the objects they're associated with.  If GLOBUS_FALSE
 *	and any values exist then ::GLOBUS_RLS_ATTR_EXIST is returned.
 *
 * @retval GLOBUS_SUCCESS
 *	Attribute successfully removed.
 */
extern globus_result_t globus_rls_client_lrc_attr_delete(
  globus_rls_handle_t		*h,
  char				*name,
  globus_rls_obj_type_t		objtype,
  globus_bool_t			clearvalues);

/**
 * Return definitions of attributes in LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param name
 *	Name of attribute.  If name is NULL all attributes of the specified
 *	@a objtype are returned.
 *
 * @param objtype
 *	Object (LFN or PFN) type that attribute applies to.
 *
 * @param attr_list
 *	Any attribute definitions found will be returned as a list of
 *	globus_rls_attribute_t structures.
 *
 * @retval GLOBUS_SUCCESS
 *	Attribute definitions successfully retrieved.  @a attr_list
 *	should be freed with globus_rls_client_free_list() when it is
 *	no longer needed.
 */
extern globus_result_t globus_rls_client_lrc_attr_get(
  globus_rls_handle_t		*h,
  char				*name,
  globus_rls_obj_type_t		objtype,
  globus_list_t			**attr_list);

/**
 * Modify an attribute value.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param key
 *	Name of object (LFN or PFN).
 *
 * @param attr
 *	Attribute to be modified.  The @link globus_rls_attribute_t
 *	objtype @endlink, @link globus_rls_attribute_t name @endlink
 *	and @link globus_rls_attribute_t type @endlink
 *	fields should be set in @a attr to identify the attribute, the
 *	@link globus_rls_attribute_t val @endlink field should be the
 *	new value.
 *
 * @retval GLOBUS_SUCCESS
 *	Attribute successfully modified.
 */
extern globus_result_t globus_rls_client_lrc_attr_modify(
  globus_rls_handle_t		*h,
  char				*key,
  globus_rls_attribute_t	*attr);

/**
 * Remove an attribute from an object (LFN or PFN) in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param key
 *	Name of object (LFN or PFN).
 *
 * @param attr
 *	Attribute to be removed.  The @link globus_rls_attribute_t
 *	objtype @endlink and @link globus_rls_attribute_t name @endlink
 *	fields should be set in @a attr to identify the attribute.
 *
 * @retval GLOBUS_SUCCESS
 *	Attribute successfully removed.
 */
extern globus_result_t globus_rls_client_lrc_attr_remove(
  globus_rls_handle_t		*h,
  char				*key,
  globus_rls_attribute_t	*attr);
  
/**
 * Bulk remove attributes from objects in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param attr_obj_list
 *	List of object names (LFN or PFN) and attributes to be removed.
 *	It is not necessary to set the attribute type or value.  Each list
 *	datum should be of type globus_rls_attribute_object_t.
 *
 * @param str2bulk_list
 *	List of failed updates.  Each list datum is a
 *	globus_rls_string2_bulk_t structure.  <B>str2.s1</B> will
 *	be the oject name, <B>str2.s2</B> the attribute name, and
 *	<B>rc</B> will be the result code from the failed update.  Only
 *	failed updates will be returned.
 */
extern globus_result_t globus_rls_client_lrc_attr_remove_bulk(
  globus_rls_handle_t		*h,
  globus_list_t			*attr_obj_list,
  globus_list_t			**str2bulk_list);

/**
 * Search for objects (LFNs or PFNs) in a LRC database that have
 * the specified attribute whose value matches a boolean expression.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param name
 *	Name of attribute.
 *
 * @param objtype
 *	Object (LFN or PFN) type that attribute applies to.
 *
 * @param op
 *	Operator to be used in searching for values.
 *
 * @param operand1
 *	First operand in boolean expression.  @link globus_rls_attribute_t type
 *	@endlink and @link globus_rls_attribute_t val @endlink should be
 *	set in globus_rls_attribute_t.
 *
 * @param operand2
 *	Second operand in boolean expression, only used when @a op is
 *	globus_rls_client_attr_op_btw.  @link globus_rls_attribute_t type
 *	@endlink and @link globus_rls_attribute_t val @endlink should be
 *	set in globus_rls_attribute_t.
 *
 * @param offset
 *	Offset into result list.  Used in conjunction with @a reslimit
 *	to retrieve results a few at a time.  Use 0 to begin with first
 *	result.  If NULL then API will handle accumulating partial results
 *	transparently.
 *
 * @param reslimit
 *	Maximum number of results to return.  Used in conjunction with
 *	@a offset to retrieve results a few at a time.  Use 0 to retrieve
 *	all results.
 *
 * @param attr_obj_list
 *	Any objects with the specified attribute will be returned, with
 *	the attribute value, in a list of globus_rls_attribute_object_t
 *	structures.
 *
 * @retval GLOBUS_SUCCESS
 *	Objects with specified attribute returned in @a attr_obj_list.
 *	@a attr_obj_list should be freed with globus_rls_client_free_list()
 *	when it is no longer needed.  See @ref globus_rls_client_queryresult.
 */
extern globus_result_t globus_rls_client_lrc_attr_search(
  globus_rls_handle_t		*h,
  char				*name,
  globus_rls_obj_type_t		objtype,
  globus_rls_attr_op_t		op,
  globus_rls_attribute_t	*operand1,
  globus_rls_attribute_t	*operand2,
  int				*offset,
  int				reslimit,
  globus_list_t			**attr_obj_list);

/**
 * Return attributes in LRC database for specified object (LFN or PFN).
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param key
 *	Logical or Physical File Name (LFN or PFN) that identifies object
 *	attributes should be retrieved for.
 *
 * @param name
 *	Name of attribute to retrieve.  If NULL all attributes for
 *	@a key, @a objtype are returned.
 *
 * @param objtype
 *	Object (LFN or PFN) type that attribute applies to.
 *
 * @param attr_list
 *	Any attributes found will be returned in this list
 *	of globus_rls_attribute_t structures.
 *
 * @retval GLOBUS_SUCCESS
 *	Attributes successfully retrieved.  @a attr_list
 *	should be freed with globus_rls_client_free_list() when it is
 *	no longer needed.
 */
extern globus_result_t globus_rls_client_lrc_attr_value_get(
  globus_rls_handle_t		*h,
  char				*key,
  char				*name,
  globus_rls_obj_type_t		objtype,
  globus_list_t			**attr_list);

/**
 * Return attributes in LRC database for specified objects (LFN or PFN).
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param keylist
 *	Logical or Physical File Names (LFNs or PFNs) that identify object
 *	attributes should be retrieved for.  Each list datum should be a string
 *	containing the LFN or PFN.
 *
 * @param name
 *	Name of attribute to retrieve.  If NULL all attributes for
 *	@a key, @a objtype are returned.
 *
 * @param objtype
 *	Object (LFN or PFN) type that attribute applies to.
 *
 * @param attr_obj_list
 *	Any attributes found will be returned in this list
 *	of globus_rls_attribute_object_t structures.
 *
 * @retval GLOBUS_SUCCESS
 *	Attributes successfully retrieved.  @a attr_obj_list
 *	should be freed with globus_rls_client_free_list() when it is
 *	no longer needed.
 */
extern globus_result_t globus_rls_client_lrc_attr_value_get_bulk(
  globus_rls_handle_t		*h,
  globus_list_t			*keylist,
  char				*name,
  globus_rls_obj_type_t		objtype,
  globus_list_t			**attr_obj_list);

/**
 * Add mapping to PFN to an existing LFN.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param lfn
 *	LFN to add @a pfn mapping to, should already exist.
 *
 * @param pfn
 *	PFN that @a lfn should map to.
 *
 * @retval GLOBUS_SUCCESS
 *	New mapping created.
 */
extern globus_result_t globus_rls_client_lrc_add(
  globus_rls_handle_t		*h,
  char				*lfn,
  char				*pfn);

/**
 * Bulk add LFN,PFN mappings in LRC database.  LFNs must already exist.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param str2_list
 *	LFN,PFN pairs to add mappings.
 *
 * @param str2bulk_list
 *	List of failed updates.  Each list datum is a
 *	globus_rls_string2_bulk_t structure.  <B>str2.s1</B> will
 *	be the LFN, and <B>str2.s2</B> the PFN it maps to, and
 *	<B>rc</B> will be the result code from the failed update.  Only
 *	failed updates will be returned.
 */
extern globus_result_t globus_rls_client_lrc_add_bulk(
  globus_rls_handle_t			*h,
  globus_list_t				*str2_list,
  globus_list_t				**str2bulk_list);

/**
 * Clear all mappings from LRC database.  User needs both ADMIN and LRCUPDATE
 * privileges to perform this operation.  Note that if the LRC is cleared
 * this will not be reflected in any RLI servers updated by the LRC until
 * the next softstate update, even if immediate updates are enabled.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @retval GLOBUS_SUCCESS
 *	Mappings cleared.
 */
extern globus_result_t globus_rls_client_lrc_clear(
  globus_rls_handle_t		*h);

/**
 * Create mapping between a LFN and PFN.  LFN should not exist yet.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param lfn
 *	LFN to add @a pfn mapping to, should not already exist.
 *
 * @param pfn
 *	PFN that @a lfn should map to.
 *
 * @retval GLOBUS_SUCCESS
 *	New mapping created.
 */
extern globus_result_t globus_rls_client_lrc_create(
  globus_rls_handle_t		*h,
  char				*lfn,
  char				*pfn);

/**
 * Bulk create LFN,PFN mappings in LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param str2_list
 *	LFN,PFN pairs to create mappings for.
 *
 * @param str2bulk_list
 *	List of failed updates.  Each list datum is a
 *	globus_rls_string2_bulk_t structure.  <B>str2.s1</B> will
 *	be the LFN, and <B>str2.s2</B> the PFN it maps to, and
 *	<B>rc</B> will be the result code from the failed update.  Only
 *	failed updates will be returned.
 */
extern globus_result_t globus_rls_client_lrc_create_bulk(
  globus_rls_handle_t			*h,
  globus_list_t				*str2_list,
  globus_list_t				**str2bulk_list);

/**
 * Delete mapping between LFN and PFN.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param lfn
 *	LFN to remove mapping from.
 *
 * @param pfn
 *	PFN that @a lfn maps to that is being removed.
 *
 * @retval GLOBUS_SUCCESS
 *	Mapping removed.
 */
extern globus_result_t globus_rls_client_lrc_delete(
  globus_rls_handle_t		*h,
  char				*lfn,
  char				*pfn);

/**
 * Bulk delete LFN,PFN mappings in LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param str2_list
 *	LFN,PFN pairs to add mappings.
 *
 * @param str2bulk_list
 *	List of failed updates.  Each list datum is a
 *	globus_rls_string2_bulk_t structure.  <B>str2.s1</B> will
 *	be the LFN, and <B>str2.s2</B> the PFN it maps to, and
 *	<B>rc</B> will be the result code from the failed update.  Only
 *	failed updates will be returned.
 */
extern globus_result_t globus_rls_client_lrc_delete_bulk(
  globus_rls_handle_t			*h,
  globus_list_t				*str2_list,
  globus_list_t				**str2bulk_list);

/**
 * Check if an object exists in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param key
 *	LFN or PFN that identifies object.
 *
 * @param objtype
 *	Type of object @a key refers to (::globus_rls_obj_lrc_lfn or
 *	::globus_rls_obj_lrc_pfn).
 *
 * @retval GLOBUS_SUCCESS
 *	Object exists.
 */
extern globus_result_t globus_rls_client_lrc_exists(
  globus_rls_handle_t		*h,
  char				*key,
  globus_rls_obj_type_t		objtype);

/**
 * Bulk check if objects exist in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param keylist
 *	LFNs or PFNs that identify objects.
 *
 * @param objtype
 *	Type of object @a key refers to (::globus_rls_obj_lrc_lfn or
 *	::globus_rls_obj_lrc_pfn).
 *
 * @param str2bulk_list
 *	Results of existence check.  Each list datum will be a
 *	globus_rls_string2_bulk_t structure.  <B>str2.s1</B> will
 *	be the LFN or PFN, and <B>str2.s2</B> empty, and
 *	<B>rc</B> will be the result code indicating existence.
 */
extern globus_result_t globus_rls_client_lrc_exists_bulk(
  globus_rls_handle_t		*h,
  globus_list_t			*keylist,
  globus_rls_obj_type_t		objtype,
  globus_list_t			**str2bulk_list);

/**
 * Return LFNs mapped to PFN in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param pfn
 *	PFN to search for.
 *
 * @param offset
 *	Offset into result list.  Used in conjunction with @a reslimit
 *	to retrieve results a few at a time.  Use 0 to begin with first
 *	result.  If NULL then API will handle accumulating partial results
 *	transparently.
 *
 * @param reslimit
 *	Maximum number of results to return.  Used in conjunction with
 *	@a offset to retrieve results a few at a time.  Use 0 to retrieve
 *	all results.
 *
 * @param str2_list
 *	List of LFNs that map to @a pfn.  Each list datum will be a
 *	globus_rls_string2_t structure.  <B>s1</B> will
 *	be the LFN, and <B>s2</B> the PFN it maps to.
 *
 * @retval GLOBUS_SUCCESS
 *	List of LFNs that map to @a pfn in @a str2_list.  See
 *	@ref globus_rls_client_queryresult.
 */
extern globus_result_t globus_rls_client_lrc_get_lfn(
  globus_rls_handle_t			*h,
  char					*pfn,
  int					*offset,
  int					reslimit,
  globus_list_t				**str2_list);

/**
 * Bulk return LFNs mapped to PFN in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param pfnlist
 *	PFNs to search for.
 *
 * @param str2bulk_list
 *	Results of queries.  Each list datum will be a
 *	globus_rls_string2_bulk_t structure.  <B>str2.s1</B> will
 *	be the LFN, and <B>str2.s2</B> the PFN it maps to, and
 *	<B>rc</B> will be the result code from the query.
 */
extern globus_result_t globus_rls_client_lrc_get_lfn_bulk(
  globus_rls_handle_t			*h,
  globus_list_t				*pfnlist,
  globus_list_t				**str2bulk_list);

/**
 * Return LFNs mapped to wildcarded PFN in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param pfn_pattern
 *	PFN pattern to search for.
 *
 * @param type
 *	Identifies wildcard characters used in @a pfn_pattern.  Wildcard
 *	chars can be Unix file globbing chars (* matches 0 or more characters,
 *	? matches any single character) or SQL "like" wildcard characters
 *	(% matches 0 or more charactes, _ matches any single character).
 *
 * @param offset
 *	Offset into result list.  Used in conjunction with @a reslimit
 *	to retrieve results a few at a time.  Use 0 to begin with first
 *	result.  If NULL then the API will handle accumulating partial
 *	results transparently.
 *
 * @param reslimit
 *	Maximum number of results to return.  Used in conjunction with
 *	@a offset to retrieve results a few at a time.  Use 0 to retrieve
 *	all results.
 *
 * @param str2_list
 *	List of LFNs that map to @a pfn_pattern.  Each list datum will be a
 *	globus_rls_string2_t structure.  <B>s1</B> will
 *	be the LFN, and <B>s2</B> the PFN it maps to.
 *
 * @retval GLOBUS_SUCCESS
 *	List of LFNs that map to @a pfn_pattern in @a str2_list.  See
 *	@ref globus_rls_client_queryresult.
 */
extern globus_result_t globus_rls_client_lrc_get_lfn_wc(
  globus_rls_handle_t			*h,
  char					*pfn_pattern,
  globus_rls_pattern_t			type,
  int					*offset,
  int					reslimit,
  globus_list_t				**str2_list);

/**
 * Return PFNs mapped to LFN in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param lfn
 *	LFN to search for.
 *
 * @param offset
 *	Offset into result list.  Used in conjunction with @a reslimit
 *	to retrieve results a few at a time.  Use 0 to begin with first
 *	result.
 *
 * @param reslimit
 *	Maximum number of results to return.  Used in conjunction with
 *	@a offset to retrieve results a few at a time.  Use 0 to retrieve
 *	all results.
 *
 * @param str2_list
 *	List of PFNs that map to @a lfn.  Each list datum will be a
 *	globus_rls_string2_t structure.  <B>s1</B> will
 *	be the LFN, and <B>s2</B> the PFN it maps to.
 *
 * @retval GLOBUS_SUCCESS
 *	List of PFNs that map to @a lfn in @a str2_list.
 */
extern globus_result_t globus_rls_client_lrc_get_pfn(
  globus_rls_handle_t			*h,
  char					*lfn,
  int					*offset,
  int					reslimit,
  globus_list_t				**str2_list);

/**
 * Bulk return PFNs mapped to LFN in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param lfnlist
 *	LFNs to search for.
 *
 * @param str2bulk_list
 *	Results of queries.  Each list datum will be a
 *	globus_rls_string2_bulk_t structure.  <B>str2.s1</B> will
 *	be the LFN, and <B>str2.s2</B> the PFN it maps to, and
 *	<B>rc</B> will be the result code from the query.
 */
extern globus_result_t globus_rls_client_lrc_get_pfn_bulk(
  globus_rls_handle_t			*h,
  globus_list_t				*lfnlist,
  globus_list_t				**str2bulk_list);

/**
 * Return PFNs mapped to wildcarded LFN in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param lfn_pattern
 *	LFN pattern to search for.
 *
 * @param type
 *	Identifies wildcard characters used in @a lfn_pattern.  Wildcard
 *	chars can be Unix file globbing chars (* matches 0 or more characters,
 *	? matches any single character) or SQL "like" wildcard characters
 *	(% matches 0 or more charactes, _ matches any single character).
 *
 * @param offset
 *	Offset into result list.  Used in conjunction with @a reslimit
 *	to retrieve results a few at a time.  Use 0 to begin with first
 *	result.
 *
 * @param reslimit
 *	Maximum number of results to return.  Used in conjunction with
 *	@a offset to retrieve results a few at a time.  Use 0 to retrieve
 *	all results.
 *
 * @param str2_list
 *	List of PFNs that map to @a lfn_pattern.  Each list datum will be a
 *	globus_rls_string2_t structure.  <B>s1</B> will
 *	be the LFN, and <B>s2</B> the PFN it maps to.
 *
 * @retval GLOBUS_SUCCESS
 *	List of PFNs that map to @a lfn_pattern in @a str2_list.  See
 *	@ref globus_rls_client_queryresult.
 */
extern globus_result_t globus_rls_client_lrc_get_pfn_wc(
  globus_rls_handle_t			*h,
  char					*lfn_pattern,
  globus_rls_pattern_t			type,
  int					*offset,
  int					reslimit,
  globus_list_t				**str2_list);

/**
 * Check if a mapping exists in the LRC database.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param lfn
 *	LFN of mapping.
 *
 * @param pfn
 *	PFN of mapping.
 *
 * @retval GLOBUS_SUCCESS
 *	Object exists.
 */
extern globus_result_t globus_rls_client_lrc_mapping_exists(
  globus_rls_handle_t		*h,
  char				*lfn,
  char				*pfn);

/**
 * Rename LFN. If immediate mode is ON, the LRC will send
 * update messages to associated RLIs.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param oldname
 *	Existing LFN name, to be renamed.
 *
 * @param newname
 *	New LFN name, to replace existing name.
 *
 * @retval GLOBUS_SUCCESS
 *	LFN renamed.
 */
extern globus_result_t globus_rls_client_lrc_renamelfn(
  globus_rls_handle_t		*h,
  char				*oldname,
  char				*newname);

/**
 * Bulk rename LFN names in LRC database.  LFNs must already exist.
 * If immediate mode is ON, the LRC will send update messages to 
 * associated RLIs.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param str2_list
 *	oldname,newname pairs such that newname replaces oldname for LFNs.
 *
 * @param str2bulk_list
 *	List of failed updates.  Each list datum is a
 *	globus_rls_string2_bulk_t structure.  <B>str2.s1</B> will
 *	be the old LFN name, and <B>str2.s2</B> the new LFN name, and
 *	<B>rc</B> will be the result code from the failed update.  Only
 *	failed updates will be returned.
 */
extern globus_result_t globus_rls_client_lrc_renamelfn_bulk(
  globus_rls_handle_t			*h,
  globus_list_t				*str2_list,
  globus_list_t				**str2bulk_list);

/**
 * Rename PFN.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param oldname
 *	Exisintg PFN name, to be renamed.
 *
 * @param newname
 *	New PFN name, to replace existing name.
 *
 * @retval GLOBUS_SUCCESS
 *	PFN renamed.
 */
extern globus_result_t globus_rls_client_lrc_renamepfn(
  globus_rls_handle_t		*h,
  char				*oldname,
  char				*newname);

/**
 * Bulk rename PFN names in LRC database.  PFNs must already exist.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param str2_list
 *	oldname,newname pairs such that newname replaces oldname for PFNs.
 *
 * @param str2bulk_list
 *	List of failed updates.  Each list datum is a
 *	globus_rls_string2_bulk_t structure.  <B>str2.s1</B> will
 *	be the old PFN name, and <B>str2.s2</B> the new PFN name, and
 *	<B>rc</B> will be the result code from the failed update.  Only
 *	failed updates will be returned.
 */
extern globus_result_t globus_rls_client_lrc_renamepfn_bulk(
  globus_rls_handle_t			*h,
  globus_list_t				*str2_list,
  globus_list_t				**str2bulk_list);

/**
 * LRC servers send information about LFNs in their database to the
 * the list of RLI servers in the database, added with the following
 * function.  Updates may be partitioned amongst multiple RLIs by
 * specifying one or more patterns for an RLI.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param rli_url
 *	URL of RLI server that LRC should send updates to.
 *
 * @param flags
 *	Should be zero or ::FRLI_BLOOMFILTER.
 *
 * @param pattern
 *	If not NULL used to filter which LFNs are sent to @a rli_url.
 *	Standard Unix wildcard characters (*, ?) may be used to do wildcard
 *	matches.
 *
 * @retval GLOBUS_SUCCESS
 *	RLI (with pattern if not NULL) added to LRC database.
 */
extern globus_result_t globus_rls_client_lrc_rli_add(
  globus_rls_handle_t		*h,
  char				*rli_url,
  int				flags,
  char				*pattern);
/**
 * Update RLI using bloom filters (see globus_rls_client_lrc_rli_add()).
 * @ingroup globus_rls_client_lrc_operation
 */
#define FRLI_BLOOMFILTER	0x1
#define FRLI_RLI		0x2	/* Internal use only	*/

/**
 * Delete an entry from the LRC rli/partition tables.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param rli_url
 *	URL of RLI server to remove from LRC partition table.
 *
 * @param pattern
 *	If not NULL then only the specific @a rli_url/pattern is removed,
 *	else all partition information for @a rli_url is removed.
 *
 * @retval GLOBUS_SUCCESS
 *	RLI and pattern (if specified) removed from LRC partition table.
 */
extern globus_result_t globus_rls_client_lrc_rli_delete(
  globus_rls_handle_t		*h,
  char				*rli_url,
  char				*pattern);

/**
 * Get RLI update partitions from LRC server.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param rli_url
 *	If not NULL identifies RLI that partition data will be retrieved for.
 *	If NULL then all RLIs are retrieved.
 *
 * @param pattern
 *	If not NULL returns only partitions with matching patterns,
 *	otherwise all patterns are retrieved.
 *
 * @param str2_list
 *	Results added to list.  Datums in @a str2_list are of type
 *	globus_rls_string2_t structure.  <B>s1</B> will be the rli url,
 *	<B>s2</B> an  empty string or the pattern used to partition
 *	updates.  See @ref globus_rls_client_queryresult.
 *
 * @retval GLOBUS_SUCCESS
 *	Partition data retrieved from server, written to @a str2_list.
 */
extern globus_result_t globus_rls_client_lrc_rli_get_part(
  globus_rls_handle_t			*h,
  char					*rli_url,
  char					*pattern,
  globus_list_t				**str2_list);

/**
 * Maximum length of URL string.
 * @ingroup globus_rls_client_lrc_operation
 */
#define MAXURL	256

/**
 * Information about RLI server, returned by globus_rls_client_lrc_rli_info()
 * and globus_rls_client_lrc_rli_list().
 * @ingroup globus_rls_client_lrc_operation
 */
typedef struct {
  char		url[MAXURL];	/**< URL of server.			*/
  int		updateinterval;	/**< Interval between softstate updates.*/
  int		flags;		/**< RLI flags (see ::FRLI_BLOOMFILTER).*/
  time_t	lastupdate;	/**< Time of last softstate update.	*/
} globus_rls_rli_info_t;

/**
 * Information about server sending updates to an rli, returned by
 * globus_rls_client_rli_sender_list().
 * @ingroup globus_rls_client_rli_operation
 */
typedef struct {
  char		url[MAXURL];	/**< URL of server.			*/
  time_t	lastupdate;	/**< Time of last softstate update.	*/
} globus_rls_sender_info_t;

#define globus_rls_lrc_info_t	globus_rls_sender_info_t


/**
 * Get info about RLI server updated by an LRC server.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param rli_url
 *	URL of RLI server to retrieve info for.
 *
 * @param info
 *	Data about RLI server will be written here.
 *
 * @retval GLOBUS_SUCCESS
 *	Info about RLI server successfully retrieved.
 */
extern globus_result_t globus_rls_client_lrc_rli_info(
  globus_rls_handle_t			*h,
  char					*rli_url,
  globus_rls_rli_info_t			*info);

/**
 * Return URLs of RLIs that LRC sends updates to.
 * @ingroup globus_rls_client_lrc_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param rliinfo_list
 *	List of RLIs updated by this LRC returned in this list.  Each
 *	list datum is of type globus_rls_rli_info_t.  @a rliinfo_list
 *	should be freed with globus_rls_client_free_list() when no longer
 *	needed.
 *
 * @retval GLOBUS_SUCCESS
 *	List of RLIs updated by this LRC returned in @a rliinfo_list.
 */
extern globus_result_t globus_rls_client_lrc_rli_list(
  globus_rls_handle_t			*h,
  globus_list_t				**rliinfo_list);


/**
 * @defgroup globus_rls_client_rli_operation RLI Operations
 * Functions to view and update data managed by a RLI server.
 */

/**
 * Check if an object exists in the RLI database.
 * @ingroup globus_rls_client_rli_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param key
 *	LFN or LRC that identifies object.
 *
 * @param objtype
 *	Type of object @a key refers to (::globus_rls_obj_rli_lfn or
 *	::globus_rls_obj_rli_lrc).
 *
 * @retval GLOBUS_SUCCESS
 *	Object exists.
 */
extern globus_result_t globus_rls_client_rli_exists(
  globus_rls_handle_t		*h,
  char				*key,
  globus_rls_obj_type_t		objtype);

/**
 * Bulk check if objects exist in the RLI database.
 * @ingroup globus_rls_client_rli_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param keylist
 *	LFNs or LRCs that identify objects.
 *
 * @param objtype
 *	Type of object @a key refers to (::globus_rls_obj_rli_lfn or
 *	::globus_rls_obj_rli_lrc).
 *
 * @param str2bulk_list
 *	Results of existence check.  Each list datum will be a
 *	globus_rls_string2_bulk_t structure.  <B>str2.s1</B> will
 *	be the LFN or LRC, and <B>str2.s2</B> empty, and
 *	<B>rc</B> will be the result code indicating existence.
 */
extern globus_result_t globus_rls_client_rli_exists_bulk(
  globus_rls_handle_t		*h,
  globus_list_t			*keylist,
  globus_rls_obj_type_t		objtype,
  globus_list_t			**str2bulk_list);

/**
 * Return LRCs mapped to LFN in the RLI database.
 * @ingroup globus_rls_client_rli_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param lfn
 *	LFN whose list of LRCs is desired.
 *
 * @param offset
 *	Offset into result list.  Used in conjunction with @a reslimit
 *	to retrieve results a few at a time.  Use 0 to begin with first
 *	result.
 *
 * @param reslimit
 *	Maximum number of results to return.  Used in conjunction with
 *	@a offset to retrieve results a few at a time.  Use 0 to retrieve
 *	all results.
 *
 * @param str2_list
 *	List of LRCs that @a lfn maps to.  Each list datum will be a
 *	globus_rls_string2_t structure.  <B>s1</B> will
 *	be the LFN, and <B>s2</B> the LRC it maps to.  @a str2_list
 *	should be freed with globus_rls_client_free_list().
 *
 * @retval GLOBUS_SUCCESS
 *	List of LRCs that map to @a lfn in @a str2_list.  See
 *	@ref globus_rls_client_queryresult.
 */
extern globus_result_t globus_rls_client_rli_get_lrc(
  globus_rls_handle_t			*h,
  char					*lfn,
  int					*offset,
  int					reslimit,
  globus_list_t				**str2_list);

/**
 * Bulk return LRCs mapped to LFN in the RLI database.
 * @ingroup globus_rls_client_rli_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param lfnlist
 *	LFNs to search for.
 *
 * @param str2bulk_list
 *	Results of queries.  Each list datum will be a
 *	globus_rls_string2_bulk_t structure.  <B>str2.s1</B> will
 *	be the LFN, and <B>str2.s2</B> the LRC it maps to, and
 *	<B>rc</B> will be the result code from the query.
 */
extern globus_result_t globus_rls_client_rli_get_lrc_bulk(
  globus_rls_handle_t			*h,
  globus_list_t				*lfnlist,
  globus_list_t				**str2bulk_list);

/**
 * Return LRCs mapped to wildcarded LFN in the RLI database.
 * @ingroup globus_rls_client_rli_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param lfn_pattern
 *	LFN pattern to search for.
 *
 * @param type
 *	Identifies wildcard characters used in @a lfn_pattern.  Wildcard
 *	chars can be Unix file globbing chars (* matches 0 or more characters,
 *	? matches any single character) or SQL "like" wildcard characters
 *	(% matches 0 or more charactes, _ matches any single character).
 *
 * @param offset
 *	Offset into result list.  Used in conjunction with @a reslimit
 *	to retrieve results a few at a time.  Use 0 to begin with first
 *	result.
 *
 * @param reslimit
 *	Maximum number of results to return.  Used in conjunction with
 *	@a offset to retrieve results a few at a time.  Use 0 to retrieve
 *	all results.
 *
 * @param str2_list
 *	List of LRCs that map to @a lfn_pattern.  Each list datum will be a
 *	globus_rls_string2_t.  <B>s1</B> will
 *	be the LFN, and <B>s2</B> the LRC it maps to.  @a str2_list
 *	should be freed with globus_rls_client_free_list().
 *
 * @retval GLOBUS_SUCCESS
 *	List of LRCs that map to @a lfn_pattern in @a str2_list.  See
 *	@ref globus_rls_client_queryresult.
 */
extern globus_result_t globus_rls_client_rli_get_lrc_wc(
  globus_rls_handle_t			*h,
  char					*lfn_pattern,
  globus_rls_pattern_t			type,
  int					*offset,
  int					reslimit,
  globus_list_t				**str2_list);

/**
 * Get list of servers updating this RLI server.  Similar to
 * globus_rls_client_rli_get_part() except no partition information is
 * returned.
 * @ingroup globus_rls_client_rli_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param senderinfo_list
 *	Datums in senderinfo_list will be of type globus_rls_sender_info_t.
 *	@a senderinfo_list should be freed with globus_rls_client_free_list().
 *
 * @retval GLOBUS_SUCCESS
 *	List of LRCs updating RLI added to @a senderinfo_list.
 */
extern globus_result_t globus_rls_client_rli_sender_list(
  globus_rls_handle_t			*h,
  globus_list_t				**senderinfo_list);

/**
 * Deprecated, use globus_rls_client_rli_sender_list().
 * @ingroup globus_rls_client_rli_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param lrcinfo_list
 *	Datums in lrcinfo_list will be of type globus_rls_lrc_info_t.
 *	@a lrcinfo_list should be freed with globus_rls_client_free_list().
 *
 * @retval GLOBUS_SUCCESS
 *	List of LRCs updating RLI added to @a lrcinfo_list.
 */
extern globus_result_t globus_rls_client_rli_lrc_list(
  globus_rls_handle_t			*h,
  globus_list_t				**lrcinfo_list);

/**
 * Check if a mapping exists in the RLI database.
 * @ingroup globus_rls_client_rli_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param lfn
 *	LFN of mapping.
 *
 * @param lrc
 *	LRC of mapping.
 *
 * @retval GLOBUS_SUCCESS
 *	Mapping exists.
 */
extern globus_result_t globus_rls_client_rli_mapping_exists(
  globus_rls_handle_t		*h,
  char				*lfn,
  char				*lrc);

/**
 * RLI servers send information about LFNs in their database to the
 * the list of RLI servers in the database, added with the following
 * function.  Updates may be partitioned amongst multiple RLIs by
 * specifying one or more patterns for an RLI.
 * @ingroup globus_rls_client_rli_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param rli_url
 *	URL of RLI server that LRC should send updates to.
 *
 * @param pattern
 *	If not NULL used to filter which LFNs are sent to @a rli_url.
 *	Standard Unix wildcard characters (*, ?) may be used to do wildcard
 *	matches.
 *
 * @retval GLOBUS_SUCCESS
 *	RLI (with pattern if not NULL) added to RLI database.
 */
extern globus_result_t globus_rls_client_rli_rli_add(
  globus_rls_handle_t		*h,
  char				*rli_url,
  char				*pattern);

/**
 * Delete an entry from the RLI rli/partition tables.
 * @ingroup globus_rls_client_rli_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param rli_url
 *	URL of RLI server to remove from RLI partition table.
 *
 * @param pattern
 *	If not NULL then only the specific @a rli_url/pattern is removed,
 *	else all partition information for @a rli_url is removed.
 *
 * @retval GLOBUS_SUCCESS
 *	RLI and pattern (if specified) removed from LRC partition table.
 */
extern globus_result_t globus_rls_client_rli_rli_delete(
  globus_rls_handle_t		*h,
  char				*rli_url,
  char				*pattern);

/**
 * Get RLI update partitions from RLI server.
 * @ingroup globus_rls_client_rli_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param rli_url
 *	If not NULL identifies RLI that partition data will be retrieved for.
 *	If NULL then all RLIs are retrieved.
 *
 * @param pattern
 *	If not NULL returns only partitions with matching patterns,
 *	otherwise all patterns are retrieved.
 *
 * @param str2_list
 *	Results added to list.  Datums in @a str2_list are of type
 *	globus_rls_string2_t structure.  <B>s1</B> will be the rli url,
 *	<B>s2</B> an  empty string or the pattern used to partition
 *	updates.  See @ref globus_rls_client_queryresult.
 *
 * @retval GLOBUS_SUCCESS
 *	Partition data retrieved from server, written to @a str2_list.
 */
extern globus_result_t globus_rls_client_rli_rli_get_part(
  globus_rls_handle_t			*h,
  char					*rli_url,
  char					*pattern,
  globus_list_t				**str2_list);

/**
 * Return URLs of RLIs that RLI sends updates to.
 * @ingroup globus_rls_client_rli_operation
 *
 * @param h
 *	Handle connected to an RLS server.
 *
 * @param rliinfo_list
 *	List of RLIs updated by this RLI returned in this list.  Each
 *	list datum is of type globus_rls_rli_info_t.  @a rliinfo_list
 *	should be freed with globus_rls_client_free_list() when no longer
 *	needed.
 *
 * @retval GLOBUS_SUCCESS
 *	List of RLIs updated by this LRC returned in @a rliinfo_list.
 */
extern globus_result_t globus_rls_client_rli_rli_list(
  globus_rls_handle_t			*h,
  globus_list_t				**rliinfo_list);

/**
 * globus_rls_client_admin() commands.
 * @ingroup globus_rls_client_miscellaneous
 */
typedef enum {
  globus_rls_admin_cmd_ping,	/**< Verify RLS server responding.	*/
  globus_rls_admin_cmd_quit,	/**< Tell RLS server to exit.		*/
  globus_rls_admin_cmd_ssu	/**< Tell LRC server to do softstate update.*/
} globus_rls_admin_cmd_t;

/*
 * The following are obsolete, please use enum above.
 */
#define GLOBUS_RLS_ADMIN_PING	globus_rls_admin_ping
#define GLOBUS_RLS_ADMIN_QUIT	globus_rls_admin_quit
#define GLOBUS_RLS_ADMIN_SSU	globus_rls_admin_ssu

#define MAXVERSION 16
/**
 * Various configuration options and statistics about an RLS server
 * returned in the following structures by globus_rls_client_stats().
 * See ::RLS_LRCSERVER for possible flags values.
 * @ingroup globus_rls_client_miscellaneous
 */
typedef struct {
  char		version[MAXVERSION];
  time_t	uptime;
  int		flags;		/**< See ::RLS_LRCSERVER.	*/
  int		lrc_bloomfilterui;
  int		lrc_lfnlistui;
  int		lrc_numlfn;
  int		lrc_numpfn;
  int		lrc_nummap;
  int		rli_numlfn;
  int		rli_numlrc;
  int		rli_numsender;
  int		rli_nummap;
} globus_rls_stats_t;

/**
 * Server is LRC server.
 * @ingroup globus_rls_client_miscellaneous
 */
#define RLS_LRCSERVER		 0x1
/**
 * Server is RLI server.
 * @ingroup globus_rls_client_miscellaneous
 */
#define RLS_RLISERVER		 0x2
/**
 * RLI accepts LFN list updates.
 * @ingroup globus_rls_client_miscellaneous
 */
#define RLS_RCVLFNLIST		 0x4
/**
 * RLI accepts Bloom filter updates.
 * @ingroup globus_rls_client_miscellaneous
 */
#define RLS_RCVBLOOMFILTER	 0x8
/**
 * LRC sends LFN list updates.
 * @ingroup globus_rls_client_miscellaneous
 */
#define RLS_SNDLFNLIST		0x10
/**
 * LRC sends Bloom filter updates.
 * @ingroup globus_rls_client_miscellaneous
 */
#define RLS_SNDBLOOMFILTER	0x20
/**
 * RLC is fully initialized.
 * @ingroup globus_rls_client_miscellaneous
 */
#define RLS_INITIALIZED		0x40

/**
 * Miscellaneous administrative operations.  Most operations require the
 * admin privilege.
 * @ingroup globus_rls_client_miscellaneous
 *
 * @param h
 *	Handle connected to RLS server.
 *
 * @param cmd
 * 	Command to be sent to RLS server.
 *
 * @retval GLOBUS_SUCCESS
 *	Command succeeded.
 */
extern globus_result_t globus_rls_client_admin(
  globus_rls_handle_t		*h,
  globus_rls_admin_cmd_t	cmd);


/**
 * Get server configuration.  Client needs admin privilege.
 * @ingroup globus_rls_client_miscellaneous
 *
 * @param h
 *	Handle connected to RLS server.
 *
 * @param option
 *	Configuration option to get.  If NULL all options are retrieved.
 *
 * @retval conf_list
 *	List of configuration options.
 *
 * @retval GLOBUS_SUCCESS
 *	List of retrieved config options returned in @a conf_list, each datum
 *	is of type globus_rls_string2_t.  @a conf_list should be freed
 *	with globus_rls_client_free_list().  There may be multiple
 *	"acl" entries in the list, since the access control list can
 *	include more than one entry.  Each acl configuration value is
 *	consists of a regular expression (matched against grid-mapfile
 *	users or DNs), a colon, and space separated list of permissions
 *	the matching users are granted.
 */
extern globus_result_t globus_rls_client_get_configuration(
  globus_rls_handle_t		*h,
  char				*option,
  globus_list_t			**conf_list);

/**
 * Set server configuration option.  Client needs admin privilege.
 * @ingroup globus_rls_client_miscellaneous
 *
 * @param h
 *	Handle connected to RLS server.
 *
 * @param option
 *	Configuration option to set.
 *
 * @param value
 *	New value for option.
 *
 * @retval GLOBUS_SUCCESS
 *	Option set on server.
 */
extern globus_result_t globus_rls_client_set_configuration(
  globus_rls_handle_t		*h,
  char				*option,
  char				*value);

/**
 * Retrieve various statistics from RLS server.  Requires stats privilege.
 * @ingroup globus_rls_client_miscellaneous
 *
 * @param h
 *	Handle connected to RLS server.
 *
 * @param rlsstats
 *	Stats returned here.
 *
 * @retval GLOBUS_SUCCESS
 *	Stats returned in @a rlsstats.
 */
extern globus_result_t globus_rls_client_stats(
  globus_rls_handle_t		*h,
  globus_rls_stats_t		*rlsstats);

/**
 * Map attribute value to string.
 * @ingroup globus_rls_client_miscellaneous
 *
 * @param attr
 *	Attribute to convert.  If @a attr->type is ::globus_rls_attr_type_date
 *	then the resulting string will be in the format MySQL uses by
 *	default, which is YYYYMMDDHHMMSS.
 *
 * @param buf
 *	Buffer to write string value to.  Note if @a attr->type is
 *	::globus_rls_attr_type_str then @a attr->val.s is returned, and
 *	@a buf is unused.
 *
 * @param buflen
 *	Size of @a buf in bytes.
 *
 * @retval "String Value"
 *	Attribute value converted to a string.
 */
extern char *globus_rls_client_attr2s(
  globus_rls_attribute_t		*attr,
  char					*buf,
  int					buflen);

/**
 * Set globus_rls_attribute_t type and val fields from a type and string value.
 * @ingroup globus_rls_client_miscellaneous
 *
 * @param type
 *	Attribute value type.
 *
 * @param sval
 *	String value to convert to binary.  If type is
 *	::globus_rls_attr_type_date @a sval should be in the form
 *	YYYY-MM-DD HH:MM:SS.
 *
 * @param attr
 *	Attribute whose type and val fields are to be set.
 *
 * @retval GLOBUS_SUCCESS
 *	@a attr->type and @a attr->val successfully set.
 */
extern globus_result_t globus_rls_client_s2attr(
  globus_rls_attr_type_t		type,
  char					*sval,
  globus_rls_attribute_t		*attr);

/**
 * Get error code and message from globus_result_t returned by this API.
 * @ingroup globus_rls_client_miscellaneous
 *
 * @param r
 *	Result returned by RLS API function.  @a r is freed by this call
 *	and should not be referenced again.  If @a preserve is set then a
 *	new globus_result_t is constructed with the same values and
 *	returned as the function value.
 *
 * @param rc
 *	Address to store error code at.  If NULL error code is not returned.
 *
 * @param buf
 *	Address to store error message at.  If NULL error message is not
 *	returned.
 *
 * @param preserve
 *	If GLOBUS_TRUE then a new globus_result_t is contructed with the
 *	same values as the old and returned as the function value.
 *
 * @param buflen
 *	Size of @a buf.
 *
 * @retval globus_result_t
 *	If @a preserve is set a new globus_result_t identical to @a r is
 *	returned, otherwise GLOBUS_SUCCESS.
 */
extern globus_result_t globus_rls_client_error_info(
  globus_result_t		r,
  int				*rc,
  char				*buf,
  int				buflen,
  globus_bool_t			preserve);

/**
 * Compute length of list.  globus_list_size() is implemented using recursion,
 * besides being inefficient it can run out of stack space when the list is
 * large.
 * @ingroup globus_rls_client_miscellaneous
 */
extern int globus_list_len(
  globus_list_t			*len);

/**
 * Map RLS status code to error string.
 * @ingroup globus_rls_client_miscellaneous
 *
 * @param rc
 *	Status code.
 *
 * @param specificmsg
 *	If not NULL prepended (with a colon) to error string.
 *
 * @param buf
 *	Buffer to write error message to.
 *
 * @param buflen
 *	Length of @a buf.  Message will be truncated to fit if too long.
 *
 * @retval char *
 *	Returns @a buf, error message written to @a buf.
 */
extern char *
globus_rls_errmsg(
  int				rc,
  char				*specificmsg,
  char				*buf,
  int				buflen);

extern int
mycftime(
  char	*s,
  int	len,
  char	*fmt,
  time_t clock);
#endif