/usr/include/globus/globus_gridftp_server.h is in libglobus-gridftp-server-dev 7.11-1.
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 | /*
* 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.
*/
/* Header file for globus_gridftp_server modules.
*
* If you are interested in writing a module for this server and want to
* discuss it's design, or are already writing one and would like support,
* please subscribe to gridftp-dev@globus.org:
* https://lists.globus.org/mailman/listinfo/gridftp-dev
* In fact, we'd like to hear from you even if you don't need any assistance.
*/
#ifndef GLOBUS_GRIDFTP_SERVER_H
#define GLOBUS_GRIDFTP_SERVER_H
#include "globus_common.h"
#include "globus_gridftp_server_control.h"
#ifdef TARGET_ARCH_WIN32
#ifdef interface
#undef interface
#endif
#endif
#ifndef TARGET_ARCH_WIN32
#include <grp.h>
#endif
#define GLOBUS_MAPPING_STRING ":globus-mapping:"
extern globus_module_descriptor_t globus_i_gfs_module;
#define GLOBUS_GRIDFTP_SERVER_MODULE (&globus_i_gfs_module)
extern globus_extension_registry_t globus_i_gfs_dsi_registry;
#define GLOBUS_GFS_DSI_REGISTRY &globus_i_gfs_dsi_registry
extern globus_extension_registry_t globus_i_gfs_acl_registry;
#define GLOBUS_GFS_ACL_REGISTRY &globus_i_gfs_acl_registry
/*
* globus_gfs_error_type_t
*
*/
typedef enum globus_gfs_error_type_e
{
GLOBUS_GFS_ERROR_MEMORY = 1,
GLOBUS_GFS_ERROR_PARAMETER,
GLOBUS_GFS_ERROR_SYSTEM_ERROR,
GLOBUS_GFS_ERROR_WRAPPED,
GLOBUS_GFS_ERROR_DATA,
GLOBUS_GFS_ERROR_GENERIC
} globus_gfs_error_type_t;
/*
* globus_gfs_operation_type_t
*
* Server operations.
*/
typedef enum globus_gfs_operation_type_e
{
GLOBUS_GFS_OP_FINAL_REPLY = 1,
GLOBUS_GFS_OP_EVENT_REPLY,
GLOBUS_GFS_OP_EVENT,
GLOBUS_GFS_OP_SESSION_START,
GLOBUS_GFS_OP_SESSION_STOP,
GLOBUS_GFS_OP_RECV,
GLOBUS_GFS_OP_SEND,
GLOBUS_GFS_OP_LIST,
GLOBUS_GFS_OP_COMMAND,
GLOBUS_GFS_OP_PASSIVE,
GLOBUS_GFS_OP_ACTIVE,
GLOBUS_GFS_OP_DESTROY,
GLOBUS_GFS_OP_TRANSFER,
GLOBUS_GFS_OP_STAT,
GLOBUS_GFS_OP_BUFFER_SEND,
GLOBUS_GFS_OP_HANDSHAKE,
GLOBUS_GFS_OP_SESSION_START_REPLY,
GLOBUS_GFS_OP_INTERMEDIATE_REPLY
} globus_gfs_operation_type_t;
#define GLOBUS_GFS_OP_STAT_PARTIAL GLOBUS_GFS_OP_INTERMEDIATE_REPLY
/*
* globus_gfs_command_type_t
*
* Command types. Commands are generally simple filesystem operations
* that only return success/failure and at most a single string.
*/
typedef enum globus_gfs_command_type_e
{
GLOBUS_GFS_CMD_MKD = 1,
GLOBUS_GFS_CMD_RMD,
GLOBUS_GFS_CMD_DELE,
GLOBUS_GFS_CMD_SITE_AUTHZ_ASSERT,
GLOBUS_GFS_CMD_SITE_RDEL,
GLOBUS_GFS_CMD_RNTO,
GLOBUS_GFS_CMD_RNFR,
GLOBUS_GFS_CMD_CKSM,
GLOBUS_GFS_CMD_SITE_CHMOD,
GLOBUS_GFS_CMD_SITE_DSI,
GLOBUS_GFS_CMD_SITE_SETNETSTACK,
GLOBUS_GFS_CMD_SITE_SETDISKSTACK,
GLOBUS_GFS_CMD_SITE_CLIENTINFO,
GLOBUS_GFS_CMD_DCSC,
GLOBUS_GFS_CMD_SITE_CHGRP,
GLOBUS_GFS_CMD_SITE_UTIME,
GLOBUS_GFS_CMD_SITE_SYMLINKFROM,
GLOBUS_GFS_CMD_SITE_SYMLINK,
GLOBUS_GFS_CMD_HTTP_PUT,
GLOBUS_GFS_CMD_HTTP_GET,
GLOBUS_GFS_CMD_HTTP_CONFIG,
GLOBUS_GFS_CMD_TRNC,
/* handled internally */
GLOBUS_GFS_CMD_SITE_RESTRICT = 3072,
GLOBUS_GFS_CMD_SITE_CHROOT,
GLOBUS_GFS_CMD_SITE_SHARING,
GLOBUS_GFS_CMD_UPAS,
GLOBUS_GFS_CMD_UPRT,
GLOBUS_GFS_MIN_CUSTOM_CMD = 4096
} globus_gfs_command_type_t;
/*
* globus_gfs_event_type_t
*
* Event types.
*
* [Request] types are passed as parameters to the DSI's
* globus_gfs_storage_trev_t func. Supported events must be specified
* in the event_mask of globus_gridftp_server_begin_transfer().
*
* [Reply] types are passed back via globus_gridftp_server_operation_event()
* with any associated data. globus_gridftp_server_begin_transfer() is a
* convience wrapper which accomplishes the same as
* globus_gridftp_server_operation_event() with an event type of a
* GLOBUS_GFS_EVENT_TRANSFER_BEGIN.
*
* In a multi-node configuration, generally request types must be passed on
* to all nodes (multiplexed), and reply types must be counted and passed
* back as one event (demultiplexed). Some events can be passed back multiple
* times as noted.
*
*/
typedef enum globus_gfs_event_type_e
{
/** [Reply] Data will start to transfer. Only ONE of these events may
* be passed back per globus_gfs_operation_t. */
GLOBUS_GFS_EVENT_TRANSFER_BEGIN = 0x0001,
/** [Request] abort of a transfer that is between BEGIN and COMPLETE. */
GLOBUS_GFS_EVENT_TRANSFER_ABORT = 0x0002,
/** [Request] Requesting side is completely done with transfer and any
* related references have been destroyed. */
GLOBUS_GFS_EVENT_TRANSFER_COMPLETE = 0x0004,
/** [Reply] Data connection has been disconnected. Only ONE of these
* events may be passed forward per globus_gfs_operation_t. */
GLOBUS_GFS_EVENT_DISCONNECTED = 0x0008,
/** [Request] Ask for a 'bytes recieved' transfer update.
* [Reply] Report bytes recieved since last update. This event may be
* passed back multiple times per globus_gfs_operation_t. */
GLOBUS_GFS_EVENT_BYTES_RECVD = 0x0010,
/** [Request] Ask for a 'ranges recieved' transfer update.
* [Reply] Report ranges recieved since last update. This event may be
* passed back multiple times per globus_gfs_operation_t. */
GLOBUS_GFS_EVENT_RANGES_RECVD = 0x0020,
/** [Reply] Data connection to be used for this transfer is
* (or already has been) established. Only ONE of these events may
* be back forward per globus_gfs_operation_t. */
GLOBUS_GFS_EVENT_TRANSFER_CONNECTED = 0x0040,
/** unused */
GLOBUS_GFS_EVENT_PARTIAL_EOF_COUNT = 0x0100,
/** unused */
GLOBUS_GFS_EVENT_FINAL_EOF_COUNT = 0x0200,
/** bitmask catchall */
GLOBUS_GFS_EVENT_ALL = 0xFFFF
} globus_gfs_event_type_t;
/*
* globus_gfs_buffer_type_t
*
*/
typedef enum globus_gfs_buffer_type_e
{
GLOBUS_GFS_BUFFER_EOF_INFO = 0x0001,
GLOBUS_GFS_BUFFER_SERVER_DEFINED = 0xFFFF
/* user defined types will start at 0x00010000 */
} globus_gfs_buffer_type_t;
/*
* globus_gfs_layout_type_t
*
* Striped layout types.
*/
typedef enum globus_gfs_layout_type_e
{
GLOBUS_GFS_LAYOUT_PARTITIONED = 1,
GLOBUS_GFS_LAYOUT_BLOCKED
} globus_gfs_layout_type_t;
/*
* globus_gfs_stat_t
*
* Similar to a posix struct stat. Defined in the server-lib.
*
* (this comment should not be relied upon, so check the
* definition in globus_gridftp_server_control.h to be sure)
*
* typedef struct globus_gridftp_server_control_stat_s
* {
* int mode;
* int nlink;
* char * name;
* char * symlink_target;
* uid_t uid;
* gid_t gid;
* globus_off_t size;
* globus_time_t atime;
* globus_time_t ctime;
* globus_time_t mtime;
* int dev;
* int ino;
* } globus_gridftp_server_control_stat_t;
*/
typedef globus_gridftp_server_control_stat_t globus_gfs_stat_t;
/*
* globus_gfs_operation_info_t
*
* Internal operation info. This handle is passed with the info structs
* Its data should not be accessed.
*/
typedef struct globus_i_gfs_op_info_s * globus_gfs_op_info_t;
/*
* globus_gfs_data_finished_info_t
*
* Contains specific result info for an active or passive data connection.
* Note that in most cases this info will simply be passed.
*/
typedef struct globus_gfs_data_finished_info_s
{
/** unique key for the data_handle */
void * data_arg;
/** false if the direction of data flow is restricted */
globus_bool_t bi_directional;
/** is the connection using ipv6? */
globus_bool_t ipv6;
/** number of contact strings */
int cs_count;
/** array of contact strings */
const char ** contact_strings;
} globus_gfs_data_finished_info_t;
/*
* globus_gfs_cmd_finshed_info_t
*
* Contains specific result info for commands.
*/
typedef struct globus_gfs_cmd_finshed_info_s
{
/** type of command that has finished */
globus_gfs_command_type_t command;
/** checksum string, for CKSM only */
char * checksum;
/** full path of the created directory, for MKD only */
char * created_dir;
} globus_gfs_cmd_finshed_info_t;
/*
* globus_gfs_stat_finished_info_t
*
* Contains specific result info for a stat.
*/
typedef struct globus_gfs_stat_finished_info_s
{
/** uid of the user that performed the stat */
int uid;
/** count of gids in gid_array */
int gid_count;
/** array of gids of which user that performed the stat is a member */
int * gid_array;
/** number of stat objects in the array */
int stat_count;
/** array of stat objects */
globus_gfs_stat_t * stat_array;
} globus_gfs_stat_finished_info_t;
/*
* globus_gfs_session_finished_info_t
*
* Contains specific result info for a stat.
*/
typedef struct globus_gfs_session_finished_info_s
{
/** arg to pass back with each request */
void * session_arg;
/** local username of authenticated user */
char * username;
/** home directory of authenticated user */
char * home_dir;
} globus_gfs_session_finished_info_t;
/*
* globus_gfs_session_finished_info_t
*
* Contains specific result info for a stat.
*/
typedef struct globus_gfs_transfer_finished_info_s
{
/* total bytes transferred for this operation */
globus_off_t bytes_transferred;
} globus_gfs_transfer_finished_info_t;
/*
* globus_gfs_finished_info_t
*
* Final result info for an operation.
*/
typedef struct globus_gfs_finished_info_s
{
/** type of operation that has completed */
globus_gfs_operation_type_t type;
/** unique key for the op */
int id;
/** result code for success or failure of the op */
int code;
/** additional message to be appended to the control channel
** response or sent over the ipc when result is success. */
char * msg;
/** result_t */
globus_result_t result;
union
{
globus_gfs_session_finished_info_t session;
globus_gfs_data_finished_info_t data;
globus_gfs_cmd_finshed_info_t command;
globus_gfs_stat_finished_info_t stat;
globus_gfs_transfer_finished_info_t transfer;
} info;
/** op info */
globus_gfs_op_info_t op_info;
} globus_gfs_finished_info_t;
/*
* globus_gfs_event_info_t
*
* Event info.
*/
typedef struct globus_gfs_event_info_s
{
/** type of event */
globus_gfs_event_type_t type;
/** arg supplied with the BEGIN_TRANSFER event,
will be passed back with each transfer event */
void * event_arg;
/* reply data */
/** node that event is from */
int node_ndx;
/** unique key of transfer request that event is related to */
int id;
/** mask of events that should be passed in */
int event_mask;
/** number of bytes received for current transfer */
globus_off_t recvd_bytes;
/** ranges of bytes received for current transfer */
globus_range_list_t recvd_ranges;
/** arg representing data handle that event is related to */
void * data_arg;
/* request data */
/** array of eof counts */
int * eof_count;
/** number of nodes (size of eof_count array) */
int node_count;
/** op info */
globus_gfs_op_info_t op_info;
} globus_gfs_event_info_t;
/*
* globus_gfs_transfer_info_t
*
* Info needed for transfer operations (list, send, recv).
*/
typedef struct globus_gfs_transfer_info_s
{
/** pathname being transferred or listed */
char * pathname;
/** module name and arguments */
char * module_name;
char * module_args;
/** type of list requested */
char * list_type;
/** offset of partial transfer */
globus_off_t partial_offset;
/** length of partial transfer */
globus_off_t partial_length;
/** list or ranges for a restart */
globus_range_list_t range_list;
/** length of partial transfer */
globus_bool_t truncate;
/** unique key that identifies the associated data_handle */
void * data_arg;
/** number of eof that sender should send xxx might need to be array here */
int eof_count;
/** total number of local stripes that will be involved */
int stripe_count;
/** total number of nodes that will be involved */
int node_count;
/** node index */
int node_ndx;
/** client requested storage space size */
globus_off_t alloc_size;
/** expected checksum */
char * expected_checksum;
/** expected checksum algorithm */
char * expected_checksum_alg;
/** levels to descend for listing (0 = no descent) */
int list_depth;
/** directory traversal options */
int traversal_options;
/** op info */
globus_gfs_op_info_t op_info;
} globus_gfs_transfer_info_t;
/*
* maintain backward source compatibility after member rename
*/
#define rnfr_pathname from_pathname
/*
* globus_gfs_command_info_t
*
* Info needed for a command operation.
*/
typedef struct globus_gfs_command_info_s
{
/** command type requested */
globus_gfs_command_type_t command;
/** pathname to execute the command on */
char * pathname;
/** offset for cksm command */
globus_off_t cksm_offset;
/** length of data to read for cksm command -1 means full file */
globus_off_t cksm_length;
/** checksum algorithm requested (md5 only currently) */
char * cksm_alg;
/** mode argument to the chmod command */
int chmod_mode;
/** pathname to rename from (to the above pathname) OR
* pathname to link to */
char * from_pathname;
/** Authorization assertion */
char * authz_assert;
/** group argument to the chgrp command */
char * chgrp_group;
/** time argument to the utime command */
time_t utime_time;
/** op info */
globus_gfs_op_info_t op_info;
} globus_gfs_command_info_t;
/*
* globus_gfs_data_info_t
*
* Info needed for data operations (active, passive).
*/
typedef struct globus_gfs_data_info_s
{
/** should this be ipv6? */
globus_bool_t ipv6;
/** number of parallel streams */
int nstreams;
/** data channel mode */
char mode;
/** data channel type */
char type;
/** tcp buffersize to use */
globus_size_t tcp_bufsize;
/** blocksize to use */
globus_size_t blocksize;
/** blocksize to use for stripe layout */
globus_size_t stripe_blocksize;
/** stripe layout to use */
int stripe_layout;
/** protection mode */
char prot;
/** dcau mode */
char dcau;
/** client DN */
char * subject;
/** pathname that will be transferred (or NULL if not delayed PASV) */
char * pathname;
/** max number of contact strings to return (for PASV) */
int max_cs;
/** number of contact strings (PORT) */
int cs_count;
/** array of contact strings (PORT) */
const char ** contact_strings;
/** interface that should be used for data connections */
char * interface;
/* if this is set, the data channel will use it instead
of the default session credential */
gss_cred_id_t del_cred;
/** op info */
globus_gfs_op_info_t op_info;
} globus_gfs_data_info_t;
/*
* globus_gfs_stat_info_t
*
* Info needed for a stat operation.
*/
typedef struct globus_gfs_stat_info_s
{
/** if pathname is a directory, should stat report its info or its contents */
globus_bool_t file_only;
/** this stat is requested internally -- bypasses authorization checks */
globus_bool_t internal;
/** pathname to stat */
char * pathname;
/** whether to return symbolic link info or target info */
globus_bool_t use_symlink_info;
/** if pathname is a directory, should its stat info be included? */
globus_bool_t include_path_stat;
/** op info */
globus_gfs_op_info_t op_info;
} globus_gfs_stat_info_t;
typedef struct globus_gfs_session_info_s
{
gss_cred_id_t del_cred;
globus_bool_t free_cred;
globus_bool_t map_user;
char * username;
char * password;
char * subject;
char * cookie;
char * host_id;
/** op info */
globus_gfs_op_info_t op_info;
} globus_gfs_session_info_t;
typedef enum globus_gfs_brain_reason_e
{
GLOBUS_GFS_BRAIN_REASON_ERROR = 1,
GLOBUS_GFS_BRAIN_REASON_COMPLETE
} globus_gfs_brain_reason_t;
typedef struct globus_i_gfs_brain_node_s
{
char * host_id;
char * repo_name;
void * brain_arg;
int max_connection;
int current_connection;
float load;
} globus_i_gfs_brain_node_t;
/**************************************************************************
* Storage Module API
*
* The storage module API is made up of the interface definition,
* notification functions, and helper functions below.
*************************************************************************/
/*
* globus_gfs_operation_t
*
* Operation handle. This handle is passed to and from the storage
* module. Its internal data should not be used.
*/
typedef struct globus_l_gfs_data_operation_s * globus_gfs_operation_t;
/**
* Interface Definition
**/
/*
* init/destroy
*
* This will be called upon a new client session. Any persistent
* data that will be needed should be initialized and stored in a
* user-defined object which should be assigned to out_user_arg. This
* object pointer will then be passed back to the module with any other
* interface call.
*/
typedef void
(*globus_gfs_storage_init_t)(
globus_gfs_operation_t op,
globus_gfs_session_info_t * session_info);
/*
* This will be called when the client session ends. Final cleanup
* should be done here.
*/
typedef void
(*globus_gfs_storage_destroy_t)(
void * user_arg);
/*
* transfer
*
* This defines the functions that will be called for list, send, and recv.
*/
typedef void
(*globus_gfs_storage_transfer_t)(
globus_gfs_operation_t op,
globus_gfs_transfer_info_t * transfer_info,
void * user_arg);
/*
* command
*
* This defines the function that will be called for commands. The type
* member of command_info specifies which command to carry out.
*/
typedef void
(*globus_gfs_storage_command_t)(
globus_gfs_operation_t op,
globus_gfs_command_info_t * command_info,
void * user_arg);
/*
* stat
*
* This defines the function that will be called for a stat lookup.
*/
typedef void
(*globus_gfs_storage_stat_t)(
globus_gfs_operation_t op,
globus_gfs_stat_info_t * stat_info,
void * user_arg);
/*
* data connection
*
* This defines the functions that will be called for active and passive
* data connection creation.
*/
typedef void
(*globus_gfs_storage_data_t)(
globus_gfs_operation_t op,
globus_gfs_data_info_t * data_info,
void * user_arg);
/*
* data_destroy
*
* This defines the function that will be called to signal that a data
* connection should be destroyed. Note that there is no corresponding
* finished notification for data destroy requests.
*/
typedef void
(*globus_gfs_storage_data_destroy_t)(
void * data_arg,
void * user_arg);
/*
* data_destroy
*
* This defines the function that will be called to signal that a transfer
* event should occur. Note that there is no corresponding finished
* notification for transfer event requests.
*/
typedef void
(*globus_gfs_storage_trev_t)(
globus_gfs_event_info_t * event_info,
void * user_arg);
/*
* set cred
*
* This defines the function that will be called to pass delegated credentials.
* XXX more here later XXX
*/
typedef void
(*globus_gfs_storage_set_cred_t)(
gss_cred_id_t del_cred,
void * user_arg);
/*
* send user buffer
*
* This defines the function that will be called to send a user defined buffer.
* XXX more here later XXX
*/
typedef void
(*globus_gfs_storage_buffer_send_t)(
int buffer_type,
globus_byte_t * buffer,
globus_size_t buffer_len,
void * user_arg);
/*
* realpath
*
* This defines the function that will be called to determine a true path
* free of symlinks or other obsfucation.
* if you implement this, add GLOBUS_GFS_DSI_DESCRIPTOR_HAS_REALPATH to your
* globus_gfs_storage_iface_t interface definition.
*/
typedef globus_result_t
(*globus_gfs_storage_realpath_t)(
const char * in_path,
char ** out_realpath,
void * user_arg);
#define GLOBUS_GFS_DSI_DESCRIPTOR_SENDER 0x01
#define GLOBUS_GFS_DSI_DESCRIPTOR_BLOCKING 0x02
#define GLOBUS_GFS_DSI_DESCRIPTOR_HAS_REALPATH 0x04
/*
* globus_gfs_storage_iface_t
*
* Storage interface function pointers. Only define functions that are
* implemented. If a function is not defined, the server will either fail
* for that particular operation, or in the case of list, data, cred, and
* trev funcs, the server will act on those operations itself.
*/
typedef struct globus_gfs_storage_iface_s
{
int descriptor;
/* session initiating functions */
globus_gfs_storage_init_t init_func;
globus_gfs_storage_destroy_t destroy_func;
/* transfer functions */
globus_gfs_storage_transfer_t list_func;
globus_gfs_storage_transfer_t send_func;
globus_gfs_storage_transfer_t recv_func;
globus_gfs_storage_trev_t trev_func;
/* data conn funcs */
globus_gfs_storage_data_t active_func;
globus_gfs_storage_data_t passive_func;
globus_gfs_storage_data_destroy_t data_destroy_func;
globus_gfs_storage_command_t command_func;
globus_gfs_storage_stat_t stat_func;
globus_gfs_storage_set_cred_t set_cred_func;
globus_gfs_storage_buffer_send_t buffer_send_func;
globus_gfs_storage_realpath_t realpath_func;
} globus_gfs_storage_iface_t;
/**
* Notification Functions
**/
/*
* operation finished
*
* This is a generic finished notification function. Either this *or* a
* specific finished function below must be called upon completion of an
* operation with the appropriate data set in the finished_info struct,
* including error info if the operation failed.
*/
void
globus_gridftp_server_operation_finished(
globus_gfs_operation_t op,
globus_result_t result,
globus_gfs_finished_info_t * finished_info);
/*
* operation event
*
* This is a generic event notification function. Either this *or* a
* specific event function below must be called upon completion of an
* operation with the appropriate event data set in the event_info struct.
*/
void
globus_gridftp_server_operation_event(
globus_gfs_operation_t op,
globus_result_t result,
globus_gfs_event_info_t * event_info);
/*
* begin transfer event
*
* Speficic event notification for the start of a transfer.
*/
void
globus_gridftp_server_begin_transfer(
globus_gfs_operation_t op,
int event_mask,
void * event_arg);
/*
* finished transfer
*
* Speficic finished notification for completion of a transfer.
*/
void
globus_gridftp_server_finished_transfer(
globus_gfs_operation_t op,
globus_result_t result);
/*
* finished session_start
*
* Specific finished notification for session start completion.
*
*/
void
globus_gridftp_server_finished_session_start(
globus_gfs_operation_t op,
globus_result_t result,
void * session_arg,
char * username,
char * home_dir);
/*
* finished command
*
* Speficic finished notification for completion of a command.
* command_response should be NULL if not used (currently only
* used in MKD and CKSM)
*/
void
globus_gridftp_server_finished_command(
globus_gfs_operation_t op,
globus_result_t result,
char * command_response);
void
globus_gridftp_server_intermediate_command(
globus_gfs_operation_t op,
globus_result_t result,
char * command_response);
/*
* finished stat
*
* Speficic finished notification for completion of a stat.
*/
void
globus_gridftp_server_finished_stat(
globus_gfs_operation_t op,
globus_result_t result,
globus_gfs_stat_t * stat_array,
int stat_count);
void
globus_gridftp_server_finished_stat_partial(
globus_gfs_operation_t op,
globus_result_t result,
globus_gfs_stat_t * stat_array,
int stat_count);
void
globus_gridftp_server_finished_stat_custom_list(
globus_gfs_operation_t op,
globus_result_t result,
globus_byte_t * list_response,
globus_size_t list_response_len,
globus_bool_t free_buffer);
/*
* finished active data
*
* Speficic finished notification for completion of a active data creation.
*/
void
globus_gridftp_server_finished_active_data(
globus_gfs_operation_t op,
globus_result_t result,
void * data_arg,
globus_bool_t bi_directional);
/*
* finished passive data
*
* Speficic finished notification for completion of a passive data creation.
*/
void
globus_gridftp_server_finished_passive_data(
globus_gfs_operation_t op,
globus_result_t result,
void * data_arg,
globus_bool_t bi_directional,
const char ** contact_strings,
int cs_count);
/**
* Data Read and Write Functions
**/
/*
* write
*
* Register a write of specified buffer to the server. You should use
* globus_gridftp_server_get_block_size()
* and globus_gridftp_server_get_optimal_concurrency() to determine the
* buffer size of each write and the number of writes you should have
* pending at all times. (pending meaning you are waiting for the callback).
*/
typedef void
(*globus_gridftp_server_write_cb_t)(
globus_gfs_operation_t op,
globus_result_t result,
globus_byte_t * buffer,
globus_size_t nbytes,
void * user_arg);
globus_result_t
globus_gridftp_server_register_write(
globus_gfs_operation_t op,
globus_byte_t * buffer,
globus_size_t length,
globus_off_t offset,
int stripe_ndx,
globus_gridftp_server_write_cb_t callback,
void * user_arg);
/*
* read
*
* Register a read of data from the server. You should use
* globus_gridftp_server_get_block_size()
* and globus_gridftp_server_get_optimal_concurrency() to determine the
* buffer size you should use and the number of reads you should have
* pending at all times. (pending meaning you are waiting for the callback).
*/
typedef void
(*globus_gridftp_server_read_cb_t)(
globus_gfs_operation_t op,
globus_result_t result,
globus_byte_t * buffer,
globus_size_t nbytes,
globus_off_t offset,
globus_bool_t eof,
void * user_arg);
globus_result_t
globus_gridftp_server_register_read(
globus_gfs_operation_t op,
globus_byte_t * buffer,
globus_size_t length,
globus_gridftp_server_read_cb_t callback,
void * user_arg);
/*
* register a custom command
*
* This must be called during the DSI session_start_func() function.
* When a command is triggered, command_func() will be called with a
* command_info->command equal to cmd_id. Responses are handled as with
* any other command. Call globus_gridftp_server_finished_command() with
* a valid FTP response string in 'command_response' to customize your response
* i.e. "250 The command was successful\r\n"
*
* cmd_id must be >= GLOBUS_GFS_MIN_CUSTOM_CMD.
*
* If a command takes a pathname, it must be the final argument, and has_pathname
* must be set to GLOBUS_TRUE. commands should not take multiple pathnames.
*
* If the command takes a pathname, set access_type to an globus_gfs_acl_action_t
* like one of: GFS_ACL_ACTION_READ, GFS_ACL_ACTION_WRITE,
* GFS_ACL_ACTION_CREATE, GFS_ACL_ACTION_DELETE, GFS_ACL_ACTION_LOOKUP.
*
* The last argument will always be passed in command_info->pathname, whether
* it is a pathname or not.
* Other args can be obtained by querying command_info->op_info for
* GLOBUS_GFS_OP_INFO_CMD_ARGS. See globus_gridftp_server_query_op_info().
*
* Note for min_args and max_args, that the command itself counts as a argument
* (or 2, in the case of SITE commands).
*
* A non-SITE command name must be exactly 4 characters long,
* A SITE command (command name = "SITE SOMETHING") can be any length
*
* help_string should be of the form "COMMAND <sp> arg1 <sp> arg2 <sp> pathname"
*
*/
globus_result_t
globus_gridftp_server_add_command(
globus_gfs_operation_t op,
const char * command_name,
int cmd_id,
int min_args,
int max_args,
const char * help_string,
globus_bool_t has_pathname,
int access_type);
/**
* Helper Functions
**/
typedef enum
{
/* return argv and argc for the current command. usually called when
* handling custom commands.
*
* char *** argv,
* int * argc
*/
GLOBUS_GFS_OP_INFO_CMD_ARGS = 1
} globus_gfs_op_info_param_t;
/* query op_info for parameters
* query paramters listed in the globus_gfs_op_info_param_t enum.
* the varargs should be populated with variables of the correct type to hold
* the returning paramters for the requested param type.
*
*/
globus_result_t
globus_gridftp_server_query_op_info(
globus_gfs_operation_t op,
globus_gfs_op_info_t op_info,
globus_gfs_op_info_param_t param,
...);
/*
* update bytes
*
* This should be called during a recv(), after each successful write
* to the storage system.
*/
void
globus_gridftp_server_update_bytes_written(
globus_gfs_operation_t op,
globus_off_t offset,
globus_off_t length);
/*
* get concurrency
*
* This should be called during a recv() and send() in order to know the
* number of pending reads or writes you should have at once.
*/
void
globus_gridftp_server_get_optimal_concurrency(
globus_gfs_operation_t op,
int * count);
/*
* get blocksize
*
* This should be called during a recv() and send() in order to know the
* size of buffers that you should be passing to the server for reads and
* writes.
*/
void
globus_gridftp_server_get_block_size(
globus_gfs_operation_t op,
globus_size_t * block_size);
/*
* get stripe blocksize
*
* This can be called during a recv() and send() in modules that wish to
* deal with striping.
*/
void
globus_gridftp_server_get_stripe_block_size(
globus_gfs_operation_t op,
globus_size_t * stripe_block_size);
/*
* get session username
*
* This should can be called to get the username that the process is running
* under, which may be different from the username supplied in the
* session_start call in some cases.
*/
void
globus_gridftp_server_get_session_username(
globus_gfs_operation_t op,
char ** username);
/*
* get delegated cred
*
* This can can be called to get the delegated credential. This may be called
* with any op after session_start() and and the credential pointer will be
* valid until at least session_stop. del_cred will be NULL if it is not
* available.
*/
void
globus_gridftp_server_get_delegated_cred(
globus_gfs_operation_t op,
gss_cred_id_t * del_cred);
/*
* get security context (unsupported)
*
* This can can be called to get the gssapi security context of the client
* connection. This may be called with any op after session_start() and
* the context pointer will be valid until at least session_stop. context
* will be NULL if it is not available. This is needed for accessing proxy
* extensions or other gssapi operations where the delegated credential is
* not sufficient. The caller should not attempt operations that modify the
* context without fully understanding the effects.
*/
void
globus_gridftp_server_get_sec_context(
globus_gfs_operation_t op,
gss_ctx_id_t * context);
/*
* get config string
*
* This can be called to get the dsi specific configuration string
* that is defined in the global configuration.
*/
void
globus_gridftp_server_get_config_string(
globus_gfs_operation_t op,
char ** config_string);
void
globus_gfs_data_get_file_stack_list(
globus_gfs_operation_t in_op,
globus_list_t ** out_list);
void
globus_gridftp_server_get_update_interval(
globus_gfs_operation_t op,
int * interval);
/*
* get read_range
*
* This should be called during send() in order to know the specific
* offset and length of the file to read from the storage system
* You should continue calling this and transferring the speficied data
* until it returns a length of 0.
*/
void
globus_gridftp_server_get_read_range(
globus_gfs_operation_t op,
globus_off_t * offset,
globus_off_t * length);
/*
* get write_range
*
* This could be called during recv() in order to get hints on the specific
* offset and length that the data will be expected to come from
* globus_gridftp_server_register_read() callbacks. Note that this is
* only a hint, and not necessarily the exact data ranges that will come.
* You would continue calling this until it returns a length of 0.
*/
void
globus_gridftp_server_get_write_range(
globus_gfs_operation_t op,
globus_off_t * offset,
globus_off_t * length);
/* END Storage Interface API */
typedef enum
{
GLOBUS_GFS_LOG_ERR = 0x01,
GLOBUS_GFS_LOG_WARN = 0x02,
GLOBUS_GFS_LOG_TRANSFER = 0x04,
GLOBUS_GFS_LOG_INFO = 0x08,
GLOBUS_GFS_LOG_DUMP = 0x10,
GLOBUS_GFS_LOG_ALL = 0xFF
} globus_gfs_log_type_t;
void
globus_gfs_log_message(
globus_gfs_log_type_t type,
const char * format,
...);
void
globus_gfs_log_result(
globus_gfs_log_type_t type,
const char * lead,
globus_result_t result);
/** Error and result object helper macros */
enum
{
GLOBUS_GFS_DEBUG_TRACE = 8,
GLOBUS_GFS_DEBUG_INFO = 16,
GLOBUS_GFS_DEBUG_STATE = 32
};
#ifdef __GNUC__
#define GlobusGFSName(func) static const char * _gfs_name __attribute__((__unused__)) = #func
#else
#define GlobusGFSName(func) static const char * _gfs_name = #func
#endif
GlobusDebugDeclare(GLOBUS_GRIDFTP_SERVER);
#define GlobusGFSDebugPrintf(level, message) \
GlobusDebugPrintf(GLOBUS_GRIDFTP_SERVER, level, message)
#define GlobusGFSDebugInfo(_msg) \
GlobusGFSDebugPrintf( \
GLOBUS_GFS_DEBUG_INFO, \
("[%s] %s\n", _gfs_name, _msg))
#define GlobusGFSDebugEnter() \
GlobusGFSDebugPrintf( \
GLOBUS_GFS_DEBUG_TRACE, \
("[%s] Entering\n", _gfs_name))
#define GlobusGFSDebugExit() \
GlobusGFSDebugPrintf( \
GLOBUS_GFS_DEBUG_TRACE, \
("[%s] Exiting\n", _gfs_name))
#define GlobusGFSDebugState(_state) \
GlobusGFSDebugPrintf( \
GLOBUS_GFS_DEBUG_INFO, \
("[%s] State: %d\n", _gfs_name, _state))
#define GlobusGFSDebugExitWithError() \
GlobusGFSDebugPrintf( \
GLOBUS_GFS_DEBUG_TRACE, \
("[%s] Exiting with error\n", _gfs_name))
#define GlobusGFSErrorMemory(mem_name) \
globus_error_put(GlobusGFSErrorObjMemory(mem_name))
#define GlobusGFSErrorParameter(mem_name) \
globus_error_put(GlobusGFSErrorObjParameter(mem_name))
#define GlobusGFSErrorIPC() \
globus_error_put(GlobusGFSErrorObjIPC())
#define GlobusGFSErrorObjIPC() \
globus_error_construct_error( \
GLOBUS_NULL, \
GLOBUS_NULL, \
GLOBUS_GFS_ERROR_MEMORY, \
__FILE__, \
_gfs_name, \
__LINE__, \
"IPC Communication error.")
#define GlobusGFSErrorObjMemory(mem_name) \
globus_error_construct_error( \
GLOBUS_NULL, \
GLOBUS_NULL, \
GLOBUS_GFS_ERROR_MEMORY, \
__FILE__, \
_gfs_name, \
__LINE__, \
"Memory allocation failed on %s", \
(mem_name))
#define GlobusGFSErrorObjParameter(param_name) \
globus_error_construct_error( \
GLOBUS_NULL, \
GLOBUS_NULL, \
GLOBUS_GFS_ERROR_PARAMETER, \
__FILE__, \
_gfs_name, \
__LINE__, \
"invalid parameter: %s", \
(param_name))
#define GlobusGFSErrorSystemError(system_func, _errno) \
globus_error_put( \
globus_error_wrap_errno_error( \
GLOBUS_NULL, \
(_errno), \
GLOBUS_GFS_ERROR_SYSTEM_ERROR, \
__FILE__, \
_gfs_name, \
__LINE__, \
"System error in %s", \
(system_func)))
#define GlobusGFSErrorWrapFailed(failed_func, result) \
globus_error_put(GlobusGFSErrorObjWrapFailed(failed_func, result))
#define GlobusGFSErrorObjWrapFailed(failed_func, result) \
globus_error_construct_error( \
GLOBUS_NULL, \
globus_error_get((result)), \
GLOBUS_GFS_ERROR_WRAPPED, \
__FILE__, \
_gfs_name, \
__LINE__, \
"%s failed.", \
(failed_func))
#define GlobusGFSErrorData(reason) \
globus_error_put(GlobusGFSErrorObjData(reason))
#define GlobusGFSErrorObjData(reason) \
globus_error_construct_error( \
GLOBUS_NULL, \
GLOBUS_NULL, \
GLOBUS_GFS_ERROR_DATA, \
__FILE__, \
_gfs_name, \
__LINE__, \
"%s", \
(reason))
#define GlobusGFSErrorGeneric(reason) \
globus_error_put(GlobusGFSErrorObjGeneric(reason))
#define GlobusGFSErrorObjGeneric(reason) \
globus_error_construct_error( \
GLOBUS_NULL, \
GLOBUS_NULL, \
GLOBUS_GFS_ERROR_GENERIC, \
__FILE__, \
_gfs_name, \
__LINE__, \
"%s", \
(reason))
/*
*
* IPC
*
*/
typedef struct globus_i_gfs_ipc_handle_s * globus_gfs_ipc_handle_t;
/*
* callbacks
*
* all functions have the same callback, they examine the
* globus_gfs_finished_info_t() structure for their specific info
*
* error_cb
* can be called at anytime. typically means the ipc connection broke
* in an irrecoverable way. Even tho this is called all outstanding
* callbacks will still be called (but with an error)
*/
/*
* replying
*
* every comman requires a reply and comes with a reply id. to reply
* the requested side must fill in the globus_gfs_finished_info_t
* structure and then pass it
* to the function: globus_gfs_ipc_reply(); That call will result in
* the ipc communication that will untilimately call the callback
* on the callers side.
*/
typedef void
(*globus_gfs_ipc_callback_t)(
globus_gfs_ipc_handle_t ipc_handle,
globus_result_t result,
globus_gfs_finished_info_t * reply,
void * user_arg);
typedef void
(*globus_gfs_ipc_event_callback_t)(
globus_gfs_ipc_handle_t ipc_handle,
globus_result_t result,
globus_gfs_event_info_t * reply,
void * user_arg);
typedef void
(*globus_gfs_ipc_close_callback_t)(
globus_gfs_ipc_handle_t ipc_handle,
globus_result_t result,
void * user_arg);
typedef void
(*globus_gfs_ipc_open_callback_t)(
globus_gfs_ipc_handle_t ipc_handle,
globus_result_t result,
globus_gfs_finished_info_t * reply,
void * user_arg);
typedef void
(*globus_gfs_ipc_error_callback_t)(
globus_gfs_ipc_handle_t ipc_handle,
globus_result_t result,
void * user_arg);
globus_result_t
globus_gfs_ipc_reply_finished(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_finished_info_t * reply);
globus_result_t
globus_gfs_ipc_reply_event(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_event_info_t * reply);
globus_result_t
globus_gfs_ipc_reply_session(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_finished_info_t * reply);
/*
* sending
*
* every command has a corresponding iface function. A call to a
* command function results in a call to the correspoding iface
* function on the other side of the channel.
*
* all parmeters are wrapped in a structure corresponding to
* each function call type. those structures are defined below
*/
typedef void
(*globus_i_gfs_ipc_data_callback_t)(
globus_gfs_finished_info_t * reply,
void * user_arg);
typedef void
(*globus_i_gfs_ipc_data_event_callback_t)(
globus_gfs_event_info_t * reply,
void * user_arg);
typedef void
(*globus_i_gfs_ipc_done_callback_t)(
void * user_arg,
globus_result_t result);
/*************************************************************************
* interface function
* ------------------
*
************************************************************************/
/* works with handle get */
typedef void
(*globus_gfs_ipc_iface_session_start_t)(
globus_gfs_ipc_handle_t ipc_handle,
const gss_ctx_id_t context,
globus_gfs_session_info_t * session_info,
globus_i_gfs_ipc_data_callback_t cb,
void * user_arg);
globus_result_t
globus_gfs_ipc_start_session(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_session_info_t * session_info,
globus_gfs_ipc_callback_t cb,
void * user_arg);
/* works with release */
typedef void
(*globus_gfs_ipc_iface_session_stop_t)(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle);
globus_result_t
globus_gfs_ipc_iface_session_stop(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle);
typedef void
(*globus_gfs_ipc_iface_set_cred_t)(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle,
gss_cred_id_t del_cred);
globus_result_t
globus_gfs_ipc_set_cred(
globus_gfs_ipc_handle_t ipc_handle,
gss_cred_id_t del_cred);
typedef void
(*globus_gfs_ipc_iface_buffer_send_t)(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle,
globus_byte_t * buffer,
int buffer_type,
globus_size_t buffer_len);
globus_result_t
globus_gfs_ipc_request_buffer_send(
globus_gfs_ipc_handle_t ipc_handle,
globus_byte_t * buffer,
int buffer_type,
globus_size_t buffer_len);
/*
* receive
*
* tell the remote process to receive a file
*/
typedef void
(*globus_gfs_ipc_iface_recv_t)(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle,
int id,
globus_gfs_transfer_info_t * recv_info,
globus_i_gfs_ipc_data_callback_t cb,
globus_i_gfs_ipc_data_event_callback_t event_cb,
void * user_arg);
globus_result_t
globus_gfs_ipc_request_recv(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_transfer_info_t * recv_info,
globus_gfs_ipc_callback_t cb,
globus_gfs_ipc_event_callback_t event_cb,
void * user_arg);
/*
* send
*
* tell remote process to send a file
*/
typedef void
(*globus_gfs_ipc_iface_send_t)(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle,
int id,
globus_gfs_transfer_info_t * send_info,
globus_i_gfs_ipc_data_callback_t cb,
globus_i_gfs_ipc_data_event_callback_t event_cb,
void * user_arg);
globus_result_t
globus_gfs_ipc_request_send(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_transfer_info_t * send_info,
globus_gfs_ipc_callback_t cb,
globus_gfs_ipc_event_callback_t event_cb,
void * user_arg);
typedef void
(*globus_gfs_ipc_iface_list_t)(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle,
int id,
globus_gfs_transfer_info_t * list_info,
globus_i_gfs_ipc_data_callback_t cb,
globus_i_gfs_ipc_data_event_callback_t event_cb,
void * user_arg);
globus_result_t
globus_gfs_ipc_request_list(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_transfer_info_t * data_info,
globus_gfs_ipc_callback_t cb,
globus_gfs_ipc_event_callback_t event_cb,
void * user_arg);
/*
* command
*
* tell remote side to execute the given command
*/
typedef void
(*globus_gfs_ipc_iface_command_t)(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle,
int id,
globus_gfs_command_info_t * cmd_info,
globus_i_gfs_ipc_data_callback_t cb,
void * user_arg);
globus_result_t
globus_gfs_ipc_request_command(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_command_info_t * cmd_info,
globus_gfs_ipc_callback_t cb,
void * user_arg);
/*
* active data
*
* tell remote side to create an active data connection
*/
typedef void
(*globus_gfs_ipc_iface_active_data_t)(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle,
int id,
globus_gfs_data_info_t * data_info,
globus_i_gfs_ipc_data_callback_t cb,
void * user_arg);
globus_result_t
globus_gfs_ipc_request_active_data(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_data_info_t * data_info,
globus_gfs_ipc_callback_t cb,
void * user_arg);
/*
* passive data
*
* tell remote side to do passive data connection
*/
typedef void
(*globus_gfs_ipc_iface_passive_data_t)(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle,
int id,
globus_gfs_data_info_t * data_info,
globus_i_gfs_ipc_data_callback_t cb,
void * user_arg);
globus_result_t
globus_gfs_ipc_request_passive_data(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_data_info_t * data_info,
globus_gfs_ipc_callback_t cb,
void * user_arg);
/*
* send stat request
*/
typedef void
(*globus_gfs_ipc_iface_stat_t)(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle,
int id,
globus_gfs_stat_info_t * stat_info,
globus_i_gfs_ipc_data_callback_t cb,
void * user_arg);
globus_result_t
globus_gfs_ipc_request_stat(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_stat_info_t * stat_info,
globus_gfs_ipc_callback_t cb,
void * user_arg);
/*
* poke transfer event request
*/
typedef void
(*globus_gfs_ipc_iface_transfer_event_t)(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle,
globus_gfs_event_info_t * event_info);
globus_result_t
globus_gfs_ipc_request_transfer_event(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_event_info_t * event_info);
/*
* destroy a data connection associated with the given ID
*/
typedef void
(*globus_gfs_ipc_iface_data_destroy_t)(
globus_gfs_ipc_handle_t ipc_handle,
void * session_handle,
void * data_arg);
globus_result_t
globus_gfs_ipc_request_data_destroy(
globus_gfs_ipc_handle_t ipc_handle,
void * data_arg);
typedef struct globus_i_gfs_ipc_iface_s
{
globus_gfs_ipc_iface_session_start_t session_start_func;
globus_gfs_ipc_iface_session_stop_t session_stop_func;
globus_gfs_ipc_iface_recv_t recv_func;
globus_gfs_ipc_iface_send_t send_func;
globus_gfs_ipc_iface_command_t command_func;
globus_gfs_ipc_iface_active_data_t active_func;
globus_gfs_ipc_iface_passive_data_t passive_func;
globus_gfs_ipc_iface_data_destroy_t data_destroy_func;
globus_gfs_ipc_iface_stat_t stat_func;
globus_gfs_ipc_iface_list_t list_func;
globus_gfs_ipc_iface_transfer_event_t transfer_event_func;
globus_gfs_ipc_iface_set_cred_t set_cred;
globus_gfs_ipc_iface_buffer_send_t buffer_send;
} globus_gfs_ipc_iface_t;
/*
* getting an IPC handle
*/
/*
* create an IPC handle from a xio system handle, can be used
* imediately, is not in handle table
*/
globus_result_t
globus_gfs_ipc_handle_create(
globus_gfs_ipc_iface_t * iface,
globus_xio_system_socket_t system_handle,
globus_i_gfs_ipc_done_callback_t done_cb,
void * user_arg);
/*
* actually close the handle
*/
globus_result_t
globus_gfs_ipc_close(
globus_gfs_ipc_handle_t ipc_handle,
globus_gfs_ipc_close_callback_t cb,
void * user_arg);
globus_result_t
globus_gfs_ipc_reply_close(
globus_gfs_ipc_handle_t ipc_handle);
globus_result_t
globus_gfs_ipc_session_stop(
globus_gfs_ipc_handle_t ipc_handle);
globus_result_t
globus_gfs_ipc_handle_connect(
globus_gfs_session_info_t * session_info,
globus_gfs_ipc_open_callback_t cb,
void * user_arg,
globus_gfs_ipc_error_callback_t error_cb,
void * error_user_arg);
globus_result_t
globus_gfs_ipc_handle_obtain(
globus_gfs_session_info_t * session_info,
globus_gfs_ipc_iface_t * iface,
globus_gfs_ipc_open_callback_t cb,
void * user_arg,
globus_gfs_ipc_error_callback_t error_cb,
void * error_user_arg);
/*
* the brain bit
*/
#define BRAIN_SYMBOL_NAME (void*)"gridftp_brain"
extern globus_extension_registry_t brain_i_registry;
typedef globus_result_t
(*globus_i_gfs_brain_select_nodes_func_t)(
globus_i_gfs_brain_node_t *** out_node_array,
int * out_array_length,
const char * repo_name,
globus_off_t filesize,
int min_count,
int max_count);
typedef globus_result_t
(*globus_i_gfs_brain_release_node_func_t)(
globus_i_gfs_brain_node_t * contact_node,
globus_gfs_brain_reason_t reason);
typedef globus_result_t
(*globus_i_gfs_brain_init_func_t)();
typedef void
(*globus_i_gfs_brain_stop_func_t)();
typedef globus_result_t
(*globus_i_gfs_brain_get_available_func_t)(
const char * user_id,
const char * repo_name,
int * count);
typedef struct globus_i_gfs_brain_module_s
{
globus_i_gfs_brain_init_func_t init_func;
globus_i_gfs_brain_stop_func_t stop_func;
globus_i_gfs_brain_select_nodes_func_t select_func;
globus_i_gfs_brain_release_node_func_t release_func;
globus_i_gfs_brain_get_available_func_t available_func;
} globus_i_gfs_brain_module_t;
extern globus_i_gfs_brain_module_t globus_i_gfs_default_brain;
globus_result_t
globus_gfs_brain_select_nodes(
globus_i_gfs_brain_node_t *** out_node_array,
int * out_array_length,
const char * repo_name,
globus_off_t filesize,
int min_count,
int max_count);
globus_result_t
globus_gfs_brain_release_node(
globus_i_gfs_brain_node_t * contact_node,
globus_gfs_brain_reason_t reason);
globus_result_t
globus_gfs_brain_get_available(
const char * user_id,
const char * repo_name,
int * count);
globus_result_t
globus_gfs_ipc_handle_get_contact_string(
globus_gfs_ipc_handle_t ipc_handle,
char ** contact_string);
globus_result_t
globus_gfs_ipc_init(
globus_bool_t requester);
/*
*
*/
void
globus_gfs_ipc_add_server(
globus_xio_server_t server_handle);
extern globus_gfs_ipc_iface_t globus_gfs_ipc_default_iface;
/* end IPC */
/* ACL interface */
/*
* interface implementation functions
* see the globus_gridftp_server_acl_example package at
* gridftp/server/acl/example for an example implementation.
*/
/* acl handle object. members are internal use only. */
typedef struct globus_i_gfs_acl_handle_s * globus_gfs_acl_handle_t;
/* supported actions, all authorization callouts will be of these types.
* an authorization callout should return success for any actions that
* are not interesting. */
typedef enum globus_gfs_acl_action_e
{
/* internal use only */
GFS_ACL_ACTION_INIT = 1,
/* the named object. will be deleted. */
GFS_ACL_ACTION_DELETE,
/* write to an existing object */
GFS_ACL_ACTION_WRITE,
/* create and write to a non-existant object */
GFS_ACL_ACTION_CREATE,
/* read an object */
GFS_ACL_ACTION_READ,
/* query metadata of an object (i.e. list) */
GFS_ACL_ACTION_LOOKUP,
/* speficy an authorization assertion. client may submit data to
* influence future authorization decisions. data is in an unspecified
* format. */
GFS_ACL_ACTION_AUTHZ_ASSERT,
/* report data safely written to disk. failure means data written has
* overrun acceptable limits. */
GFS_ACL_ACTION_COMMIT,
/* increase previously requested write limits for an object */
GFS_ACL_ACTION_GROW
} globus_gfs_acl_action_t;
/* user connection descriptor. this provides info about the user
* attempting the connection or action */
typedef struct globus_gfs_acl_info_s
{
char * hostname;
char * subject;
char * username;
char * password;
char * ipaddr;
gss_ctx_id_t context;
} globus_gfs_acl_info_t;
/* object descriptor. this provides various info about the object of the
* action attempt. */
typedef struct globus_gfs_acl_object_desc_s
{
/* ALL: name of the object. commonly a filename.
* value is NULL when not known or not used. */
char * name;
/* WRITE/CREATE: size being requested to write.
* COMMIT: amount of data already written safely.
* GROW: new full size being requested to write.
* value is 0 when not known or not used. */
globus_off_t size;
/* AUTHZ_ASSERT: assertion data from the client.
* value is NULL when not known or not used. */
char * data;
/* COMMIT: all data has been safely written
* value is FALSE when not known or not used. */
globus_bool_t final;
/** op info */
globus_gfs_op_info_t op_info;
} globus_gfs_acl_object_desc_t;
/* return values for authorization functions */
typedef enum globus_gfs_acl_status_e
{
/* decision is complete */
GLOBUS_GFS_ACL_COMPLETE = 1,
/* decision will be made in a seperate call to
globus_gfs_acl_authorized_finished() */
GLOBUS_GFS_ACL_WOULD_BLOCK
} globus_gfs_acl_status_t;
/* initialization callout. this is ususally necessary. must be
* implemented if:
* 1) we need to set up some sort of internal state/handle that can be passed
* back to us in all callouts
* and/or
* 2) we are interested in authorizing the gridftp session based on client
* user information.
*
* must return GLOBUS_GFS_ACL_COMPLETE or GLOBUS_GFS_ACL_WOULD_BLOCK, and
* store GLOBUS_SUCCESS or an error result_t in out_res. if returning
* GLOBUS_GFS_ACL_WOULD_BLOCK, the result must be returned in a call to
* globus_gfs_acl_authorized_finished(). optionally, a pointer may be stored
* in out_handle. this pointer will then be passed back in later callouts.
*/
typedef int
(*globus_gfs_acl_init_t)(
void ** out_handle,
globus_gfs_acl_info_t * acl_info,
globus_gfs_acl_handle_t acl_handle,
globus_result_t * out_res);
/* authorization callout. this is usually necessary. here we will
* get called to authrorize all actions the client performs. see the
* globus_gfs_acl_action_t declaration for all of the supported actions.
*
* must return GLOBUS_GFS_ACL_COMPLETE or GLOBUS_GFS_ACL_WOULD_BLOCK, and
* store GLOBUS_SUCCESS or an error result_t in out_res. If returning
* GLOBUS_GFS_ACL_WOULD_BLOCK, the result must be returned in a call to
* globus_gfs_acl_authorized_finished().
*/
typedef int
(*globus_gfs_acl_authorize_t)(
void * out_handle,
globus_gfs_acl_action_t action,
globus_gfs_acl_object_desc_t * object,
globus_gfs_acl_info_t * acl_info,
globus_gfs_acl_handle_t acl_handle,
globus_result_t * out_res);
/* destructor callout. clean up our session state if necessary */
typedef void
(*globus_gfs_acl_destroy_t)(
void * out_handle);
/* audit callout. informational callout only. implement this if you would
* like to be notified of activities, but don't need to allow/deny them. */
typedef void
(*globus_gfs_acl_audit_t)(
void * out_handle,
globus_gfs_acl_action_t action,
globus_gfs_acl_object_desc_t * object,
const char * message);
/* acl module descriptor.
* Only define the functions you implement, otherwise NULL */
typedef struct globus_gfs_acl_module_s
{
globus_gfs_acl_init_t init_func;
globus_gfs_acl_authorize_t authorize_func;
globus_gfs_acl_destroy_t destroy_func;
globus_gfs_acl_audit_t audit_func;
} globus_gfs_acl_module_t;
/* authorization finalization function. this must be called when the
* initialization or authorization callouts return GLOBUS_GFS_ACL_WOULD_BLOCK.
*/
void
globus_gfs_acl_authorized_finished(
globus_gfs_acl_handle_t acl_handle,
globus_result_t result);
/* helper function to get strings from action types. useful for log/error
* messages */
const char *
globus_gfs_acl_action_to_string(
globus_gfs_acl_action_t action);
/* end ACL */
/* config locking functions */
typedef
void
(*globus_i_gfs_config_set_string_cb_t)(
const char * option_name,
const char * val,
void * user_arg);
typedef
void
(*globus_i_gfs_config_set_int_cb_t)(
const char * option_name,
int val,
void * user_arg);
typedef struct
{
void * user_arg;
globus_bool_t enabled;
void * cb;
} globus_i_gfs_config_option_cb_ent_t;
void
globus_gfs_config_enable_cb(
globus_i_gfs_config_option_cb_ent_t * cb_handle,
globus_bool_t enabled);
int
globus_gfs_config_add_cb(
globus_i_gfs_config_option_cb_ent_t ** cb_handle,
char * option_name,
void * cb,
void * user_arg);
globus_bool_t
globus_gfs_config_get_bool(
const char * option_name);
char *
globus_gfs_config_get_string(
const char * option_name);
globus_list_t *
globus_gfs_config_get_list(
const char * option_name);
void *
globus_gfs_config_get(
const char * option_name);
int
globus_gfs_config_get_int(
const char * option_name);
int
globus_gfs_config_set_int(
char * option_name,
int int_value);
int
globus_gfs_config_set_bool(
char * option_name,
int int_value);
int
globus_gfs_config_set_ptr(
char * option_name,
void * ptr);
int
globus_gfs_config_inc_int(
char * option_name,
int inc_val);
#endif
|