1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202
|
#Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetDriverProc
Overview
Get a communications driver procedure
Syntax
int Ns_GetDriverProc(
Ns_Driver driver,
Ns_DrvId id,
void **pprocPtrPtr
);
Description
Get a communications driver procedure for the specified ID. Valid ID
values are listed in the left column of the table below.
The procPtrPtr will be filled in with the address of a registerd
driver function. NS_ERROR will be returned if no registered function
could be found. The resulting function is of the type shown in the
right column below
ID Value
Resulting Function Type
Ns_DrvIdName
typedef char *(Ns_ConnDriverNameProc) (void *pConnCtx);
Ns_DrvIdStart
typedef int (Ns_DriverStartProc) (char *hServer, char *hDriver, void
**ppDriverCtx);
Ns_DrvIdAccept
typedef int (Ns_DriverAcceptProc) (void *pDriverCtx, void
**ppConnCtx);
Ns_DrvIdStop
typedef void (Ns_DriverStopProc) (void *pDriverCtx);
Ns_DrvIdInit
typedef int (Ns_ConnInitProc) (void *pConnCtx);
Ns_DrvIdRead
typedef int (Ns_ConnReadProc) (void *pConnCtx, void *pvBuf, int
iToRead);
Ns_DrvIdWrite
typedef int (Ns_ConnWriteProc) (void *pConnCtx, void *pvBuf, int
iToWrite);
Ns_DrvIdClose
typedef int (Ns_ConnCloseProc) (void *pConnCtx);
Ns_DrvIdFree
typedef void (Ns_ConnFreeProc) (void *pConnCtx);
Ns_DrvIdPeer
typedef char *(Ns_ConnPeerProc) (void *pConnCtx);
Ns_DrvIdLocation
typedef char *(Ns_ConnLocationProc) (void *pConnCtx);
Ns_DrvIdHost
typedef char *(Ns_ConnHostProc) (void *pConnCtx);
Ns_DrvIdPort
typedef int (Ns_ConnPortProc) (void *pConnCtx);
Ns_DrvIdSendFd
typedef int (Ns_ConnSendFdProc) (void *pConnCtx, int fd, int nsend);
Ns_DrvIdSendFile
typedef int (Ns_ConnSendFileProc) (void *pConnCtx, char *file);
Ns_DrvIdDetach
typedef void *(Ns_ConnDetachProc) (void *pConnCtx);
Ns_DrvIdConnectionFd
typedef int (Ns_ConnConnectionFdProc) (void *pConnCtx);
Ns_DrvIdMoveContext
(unsupported)
Ns_DrvIdPeerPort
typedef int (Ns_ConnPeerPortProc) (void *pConnCtx);
Ns_DrvIdSetSSLAuth
typedef int (Ns_SetSSLAuthProc) (void *pCtx, Ns_SSLAuthProc *, void
*ctx, Ns_FreeAuthCtxProc *);
Ns_DrvIdSSLHandshake
typedef void *(Ns_SSLHandshakeProc) (void *aCtx, int socket, char *DN,
Ns_SSLAuthProc *auth, void *authctx, Ns_FreeAuthCtxProc *pFree);
:
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetFirstDriver
Overview
Get pointer to first socket driver
Syntax
void* Ns_GetFirstDriver (
char* ignored
);
Description
Returns a pointer to the first socket driver. Use this function with
Ns_GetNextDriver.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetHostByAddr
Overview
Convert an IP address to a hostname
Syntax
int Ns_GetHostByAddr(
Ns_DString *pds,
char *addrStr
);
Description
The Ns_GetHostByAddr function converts a numeric IP address into a
host name. If no name can be found, the function returns NS_FALSE;
otherwise, it returns NS_TRUE. Because the response time of the Domain
Name Service can be slow, this function may significantly delay the
response to a client. The hostname string is appended to the specified
Ns_DString (pds).
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetMimeType
Overview
Get Mime type
Syntax
char* Ns_GetMimeType (
char* file
);
Description
Guess the Mime type based on the filename extension. Case is ignored.
The return value is of the form: "text/html".
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetNextDriver
Overview
Get pointer to next socket driver
Syntax
void* Ns_GetNextDriver (
Ns_Driver driver
);
Description
Returns a pointer to the next socket driver. Use this function with
Ns_GetFirstDriver.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetRequest
Overview
Return the parameters of a request
Syntax
typedef void *Ns_OpContext;
typedef int (Ns_OpProc) (void *context, Ns_Conn *conn);
typedef void (Ns_OpDeleteProc) (void *context);
void Ns_GetRequest(
char *hServer
char *method,
char *URL,
Ns_OpProc **pProc,
Ns_OpDeleteProc **pDeleteProc,
Ns_OpContext **pContext
int *pflags
);
Description
The Ns_GetRequest function sets pproc to the procedure the server
would call to handle a request of method and URL on the specified
server. pContext is set to the context that would be passed to pProc
when called, and pDeletepProc is set to the delete procedure that
would be called if pProc were unregistered (or re-registered). pflags
points to the flags argument passed to Ns_RegisterRequest. The
function returned is the best matching function and not necessarily an
exact matching function.
You can use Ns_GetRequest and the NS_OP_NODELETE flag for
Ns_RegisterRequest to implement wrapper-type operation, where you save
the operation function, delete procedure, and context and register a
new function that does some type of pre-processing before calling the
operation or delete procedures.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetSockAddr
Overview
Get socket driver address
Syntax
int Ns_GetSockAddr (
struct sockaddr_in* saPtr,
char* host,
int port
);
Description
Specify host and port in saPtr. Specify an IP address or a hostname
for host. A NULL host means INADDR_ANY.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetThread
Overview
Get the identifier for the current thread
Syntax
void Ns_GetThread(
Ns_Thread *thread
);
Description
Ns_GetThread fills in the unique thread identifier for the current
thread. (see Ns_WaitForThread)
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetThreadId
Overview
Get the unique ID number for the current thread
Syntax
int Ns_GetThreadId(void);
Description
This routine tries to come up with a unique integer corresponding to
the current thread. (This is the integer that shows up in the log
files.) Often, this unique ID is the PID, but not always.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetThreadLocalStorage
Overview
Get the thread local storage
Syntax
int Ns_GetThreadLocalStorage(
Ns_ThreadLocalStorage * tls,
void **p
);
Description
Fill *p with the value of the thread local storage. Note: If tls has
not been set within the current the thread *p will be set to NULL.
Ns_TlsGet is the preferred function for getting thread local storage.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetTime
Overview
Perform gettimeofday
Syntax
void Ns_GetTime (
Ns_Time*
);
Description
This function is a wrapper for gettimeofday(3B).
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetUid
Overview
Return UID of user
Syntax
int Ns_GetUid (
char* user
);
Description
Returns the Unix UID of the user running the server.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_GetUserHome
Overview
Get UNIX user's home directory
Syntax
int Ns_GetUserHome(
Ns_DString *pds,
char *user
);
Description
The Ns_GetUserHome function returns NS_TRUE and appends the user's
home directory to the Ns_DString passed in, or it returns NS_FALSE if
the user doesn't exist.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_Gmtime
Overview
Perform gmtime
Syntax
struct tm* Ns_Gmtime (
const time_t* clock
);
Description
This function is a wrapper for gmtime(3C).
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_HomePath
Overview
Construct a path name relative to the AOLserver home directory
Syntax
char *Ns_HomePath(
Ns_DString * dest,
char *relpath
);
Description
The Ns_HomePath function constructs a path name by appending the given
relative path to the AOLserver home directory. The resulting path name
is appended to the given Ns_DString.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_HttpTime
Overview
Return a formatted time string
Syntax
char *Ns_HttpTime(
Ns_DString *pds
time_t *when
);
Description
The Ns_HttpTime function converts given time to the appropriate format
for an HTTP header or log file. The Ns_HttpTime function returns the
time and date with a four digit year, e.g., "Sun, 06 Nov 1994 08:49:37
GMT".
If when is NULL, the function returns a string containing the current
time. The formatted time string is appended to the specified
Ns_DString (pds).
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_HtuuDecode
Overview
Perform base64 decode
Syntax
int Ns_HtuuDecode (
char* string,
unsigned char* buf,
int bufsize
);
Description
Performs a base64 decode on string and writes the result into buf.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_HtuuEncode
Overview
Perform base64 encode
Syntax
int Ns_HtuuEncode (
unsigned char* string,
unsigned int bufsize,
char* buf
);
Description
Performs a base64 encode on string and writes the result into buf.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_IncrTime
Overview
Increment time by seconds and microseconds
Syntax
void Ns_IncrTime (
Ns_Time* time,
time_t sec,
long usec
);
Description
Increment time by sec.usec, where usec is microseconds.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InetNtoa
Overview
Perform inet_ntoa
Syntax
char* Ns_InetNtoa (
struct in_addr addr
);
Description
This function wraps inet_ntoa(3N).
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoBootTime
Overview
Return server boot time
Syntax
int Ns_InfoBootTime (void);
Description
Return the time (in time_t form) of the most recent server boot.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoBuildDate
Overview
Return AOLserver build date
Syntax
char *Ns_InfoBuildDate(void);
Description
The Ns_InfoBuildDate function returns the date and time AOLServer was
compiled.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoConfigFile
Overview
Return full path name of the configuration file in use.
Syntax
char *Ns_InfoConfigFile(void)
Description
Return full path name of the configuration file in use.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoErrorLog
Overview
Return error log name
Syntax
char* Ns_InfoErrorLog (void);
Description
Return the name of the error log.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoHomePath
Overview
Return directory where the AOLserver is installed.
Syntax
char *Ns_InfoHomePath(void)
Description
Return directory where the AOLserver is installed.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoHostname
Overview
Return hostname of server
Syntax
char* Ns_InfoHostname (void);
Description
Return the hostname that AOLserver thinks it's running on, as
specified in the configuration file.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoLabel
Overview
Return source code label for server
Syntax
char *Ns_InfoLabel(void);
Description
Returns the source code label for the server. If no label was used,
"unlabeled" is returned. You can use these functions to provide the
source code label when you report problems with the server.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoPid
Overview
Return server pid
Syntax
int Ns_InfoPid (void);
Description
Return pid of AOLserver.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoPlatform
Overview
Return platform
Syntax
char* Ns_InfoPlatform (void);
Description
Returns platform name, e.g. "IRIX".
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoServerName
Overview
Return AOLserver name string ("AOLserver").
Syntax
char *Ns_InfoServerName(void)
Description
Return AOLserver name string ("AOLserver").
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoServersStarted
Overview
Determine if server has started
Syntax
int Ns_InfoServersStarted (void);
Description
Return TRUE if the server has started, i.e., if initialization and
module loading is complete.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoServerVersion
Overview
Return AOLserver version string.
Syntax
char *Ns_InfoServerVersion(void)
Description
Return AOLserver version string.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoShutdownPending
Overview
Determine if a server shutdown is pending
Syntax
int Ns_InfoShutdownPending (void);
Description
Return TRUE if there is there a shutdown pending, i.e., if an INTR
signal has been received or if ns_shutdown has been called.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoStarted
Overview
Determine if server has started
Syntax
int Ns_InfoStarted (void);
Description
Return TRUE if the server has started, i.e., if initialization and
module loading is complete.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InfoUptime
Overview
Return time server has been running
Syntax
int Ns_InfoUptime (void);
Description
Return how long, in seconds, AOLserver has been running.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InitializeCriticalSection
Overview
Initialize a critical section
Syntax
int Ns_InitializeCriticalSection(
Ns_CriticalSection * section
);
Description
Initialize the specified critical section. It is recommended that you
use a mutex instead of a critical section if possible.
Ns_CsInit is the preferred function for initializing a critical
section.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InitializeEvent
Overview
Initialize an event object
Syntax
int Ns_InitializeEvent(
Ns_Event * event
);
Description
Initialize an event object.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InitializeMutex
Overview
Initialize a mutual exclusion lock
Syntax
int Ns_InitializeMutex(
Ns_Mutex * mutex
);
Description
Initialize a Mutual Exclusion lock for use.
Ns_MutexInit is the preferred function for initializing a mutex.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InitializeRWLock
Overview
Initialize a read/write lock
Syntax
int Ns_InitializeRWLock(
Ns_RWLock *lock
);
Description
Initialize a read/write lock for use. A lock ID is returned via the
lock parameter, which can be used in the other read/write lock
functions.
About Read/Write Locks
Read/write locks are a serialization mechanism for using data
structures where multiple reads can happen simultaneously, but where
writes must happen singly. For example, suppose you have a hash table
that is heavily used but doesn't change very often. You'd like to have
multiple threads be able to read from the table without blocking on
each other, but when you need to update the table, you can do so
safely without having to worry about other threads reading incorrect
data.
The principal feature of read/write locks is the mechanism of which
locks have priority and which locks must wait. Any number of read
locks can be pending. If there's a write lock active, the read lock
acquisition blocks until the write lock is released. Also, only one
write lock can be in effect. If there are pending read locks active,
the write lock acquisition blocks until all of the read locks drain.
If a subsequent read lock acquisition attempt is made while a write
lock is waiting to acquire, the write lock has priority.
Ns_RWLockInit is the preferred function for initializing a read/write
lock.
Examples
NS_RWLock lock;
int GetData (int key)
{
/* acquire a read lock */
Ns_ReadLockRWLock (&lock);
search through the data structure looking for key's data;
/* release our read lock */
Ns_ReadUnlockRWLock (&lock);
return (value);
} /* GetData */
int StoreData (int key, int value)
{
/* acquire the write lock */
Ns_WriteLockRWLock (&lock);
manipulate the data structure storing key's value;
/* release the write lock */
Ns_WriteUnlockRWLock (&lock);
return (value);
} /* StoreData */
...
Ns_InitializeRWLock (&lock);
...
(different threads using GetData and StoreData)
...
Ns_DestoryRWLock (&lock);
See Also
Ns_DestroyRWLock
Ns_ReadLockRWLock
Ns_ReadUnlockRWLock
Ns_WriteLockRWLock
Ns_WriteUnlockRWLock
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_InitializeSemaphore
Overview
Initialize a semaphore
Syntax
int Ns_InitializeSemaphore(
Ns_Semaphore * sema,
int beg_count
);
Description
Initialize the semaphore with a semaphore count of beg_count.
Ns_SemaInit is the preferred function for initializing a semaphore.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_LeaveCriticalSection
Overview
Leave a critical section
Syntax
int Ns_LeaveCriticalSection(
Ns_CriticalSection * section
);
Description
Leave the specified critical section.
Ns_CsLeave is the preferred function for leaving a critical section.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_LibPath
Overview
Construct path relative to lib
Syntax
char* Ns_LibPath (Ns_DString* dest,...);
Description
Make a path relative to $ASHOME/lib/ given the specified destination.
For example, if AOLserver is running out of /disk2/aolserver, the
following call would return "/disk2/aolserver/lib/foo/bar":
Ns_LibPath("foo", "bar", NULL);
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_Localtime
Overview
Perform localtime
Syntax
struct tm* Ns_Localtime (
const time_t* clock
);
Description
This function wraps localtime(3C).
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_LockMutex
Overview
Create a mutual exclusion lock
Syntax
int Ns_LockMutex(
Ns_Mutex * mutex
);
Description
Acquire the mutex. If the mutex is already locked then the current
thread will block until the mutex is unlocked. Note: mutexes are not
recursive. If the current thread tries to lock the mutex twice in a
row, it will block or get an error depending on the platform.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_Log
Overview
Log formatted message
Syntax
void Ns_Log(
Ns_LogSeverity severity,
char *fmt,
...
);
Description
The Ns_Log function writes formatted messages to the server log file.
Allowable values for severity are:
Notice
Something interesting occurred.
Warning
Maybe something bad occurred.
Error
Something bad occurred.
Fatal
Something extremely bad occurred. The server will shut down after
logging this message.
Bug
Something occurred that implies there is a bug in your code.
Debug
If the server is in Debug mode, the message is printed. Debug mode is
specified in the [ns/parameters] section of the configuration file. If
the server is not in debug mode, the message is not printed.
Examples
char *hServer; /* server handle */
char *hModule; /* module handle */
Ns_Log(Notice, "Initializing module %s on server %s",
hModule, hServer);
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_LogRoll
Overview
Roll server log
Syntax
int Ns_LogRoll (void);
Description
Roll the server.log file, renaming the existing file with the date and
starting a new log file.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_LogTime
Overview
Construct local date and time for log file
Syntax
char *Ns_LogTime(
char *dateTimeBuf
);
Description
The Ns_LogTime function constructs the local date and time for use in
the log file. Upon completion, dateTimeBuf will contain the formatted
string. Ns_LogTime is used by Ns_Log to create log file entries.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_MakePath
Overview
Construct a path name from a list of path elements
Syntax
char *Ns_MakePath(
Ns_DString * dest,
...
);
Description
The Ns_MakePath function constructs a path name by appending a list of
path elements to the given Ns_DString. The path elements are separated
by single slashes, and the resulting path name is appended to the
given Ns_DString. The last argument needs to be NULL to indicate the
end of the argument list.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_Malloc
Overview
Allocate a block of memory
Syntax
void *Ns_Malloc(
size_t size
);
Description
The Ns_Malloc function returns a block of memory of the given size.
This function replaces the system malloc function.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_Match
Overview
Compare strings
Syntax
char* Ns_Match (
char* pattern,
char* string
);
Description
Compare the beginnings of two strings, case insensitively. The
comparison stops when the end of the shorter string is reached.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ModLog
Overview
Log a message within a realm
Syntax
void Ns_ModLog(
Ns_LogSeverity severity,
Ns_ModLogHandle handle,
char *inFormat,
...
);
Description
The Ns_ModLog function logs a message of some severity to a realm
contained in the handle. The severities, in order from highest to
lowest, are Fatal, Bug, Error, Notice, Warning, and Debug.
Examples
Ns_ModLog(Warning, cgiModLogHandle, "No such CGI interps section: %s",
ds.string);
See also
ns_modlog
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ModLogGetThreshold
Overview
Get the severity of the logging threshold of a handle
Syntax
Ns_LogSeverity Ns_ModLogGetThreshold(
Ns_ModLogHandle handle
);
Description
The Ns_ModLogGetThreshold function obtains the severity of the logging
threshold of a handle. The default handle is used instead for a null
handle.
Examples
Ns_LogSeverity severity;
Ns_ModLogHandle handle;
handle = Ns_ModLogLookupHandle("nsd.sock");
severity = Ns_ModLogGetThreshold(handle);
See also
ns_modlogcontrol get_threshold
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ModLogLookupHandle
Overview
Obtain the handle given a realm
Syntax
Ns_ModLogHandle Ns_ModLogLookupHandle(
char *realm
);
Description
The Ns_ModLogLookupHandle function returns a handle given a realm
name. A null handle is returned if that realm is not registered. The
default handle is returned for a null realm.
Examples
Ns_ModLogHandle handle;
handle = Ns_ModLogLookupHandle("myrealm");
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ModLogLookupRealm
Overview
Obtain the realm from the handle
Syntax
char *Ns_ModLogLookupRealm(
Ns_ModLogHandle handle
);
Description
The Ns_ModLogLookupRealm function returns a realm from a handle. The
realm of the default handle is returned for a null handle.
Examples
Ns_ModLogHandle handle;
Ns_ModLogRegister("testrealm", &handle);
Ns_Log(Notice, "Realm is %s", Ns_ModLogLookupRealm(handle));
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ModLogRedirect
Overview
Redirect logging of a realm to a file
Syntax
void Ns_ModLogRedirect(
Ns_ModLogHandle handle,
FILE *fp,
char *description
);
Description
The Ns_ModLogRedirect function redirects logging of a realm to an open
file. The default handle is used instead for a null handle. fp refers
to an open file. A null pointer for fp redirects the output to the
default server log file. The description string is printed in the
original server log file for the handle.
Examples
FILE *fp;
fp = fopen("cgirealm.log", "a");
Ns_ModLogRedirect(cgiModLogHandle, fp, "redirecting to a different
file");
See also
ns_modlogcontrol redirect
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ModLogRegister
Overview
Register a new realm
Syntax
void Ns_ModLogRegister(
char *realm,
Ns_ModLogHandle *handle
);
Description
The Ns_ModLogRegister function allocates a new handle. The new handle
initialized with the realm, the default logging severity, and the
default server log file. A realm is a character string. The default
handle is returned if realm is null.
Examples
static Ns_ModLogHandle cgiModLogHandle;
int Ns_ModuleInit(char *server, char *name)
{
Ns_ModLogRegister(name, &cgiModLogHandle);
CgiInit(server);
return NS_OK;
}
See also
ns_modlogcontrol register
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ModLogSetThreshold
Overview
Set the logging severity of a handle
Syntax
void Ns_ModLogSetThreshold(
Ns_ModLogHandle handle,
Ns_LogSeverity severity
);
Description
The Ns_ModLogSetThreshold function sets the logging threshold of a
handle to a particular severity. Only those messages that have the
same severity or higher as the handle will be logged with Ns_Modlog
for that handle. The default handle is used instead for a null handle.
Examples
Ns_ModLogHandle handle;
Ns_ModLogRegister("testrealm", &handle);
Ns_ModLogSetThreshold(handle, Debug);
Ns_ModLog(Debug, handle, "This should appear");
Ns_ModLogSetThreshold(handle, Notice);
Ns_ModLog(Debug, handle, "This should not appear");
See also
ns_modlogcontrol set_threshold
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ModuleLoad
Overview
Load a module into AOLserver
Syntax
int Ns_ModuleLoad(
char *hServer,
char *hModule,
char *sModuleFile,
char *sInitProc
);
Description
The Ns_ModuleLoad function loads a module into AOLserver and calls the
initialization routine (sInitProc). If sInitProc is NULL, the
initialization routine used defaults to Ns_ModuleInit.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ModulePath
Overview
Construct a path from base path
Syntax
char *Ns_ModulePath(
Ns_DString *dest,
char *hServer,
char *hModule,
...
);
Description
The Ns_ModulePath function constructs a path by appending the final
variable arguments to the base path defined by a module on the
specified server. The list of arguments must end with NULL.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ModuleSymbol
Overview
Return symbol
Syntax
int Ns_ModuleSymbol(
char *sModuleFile,
char *sSymbolName
);
Description
The Ns_ModuleSymbol function returns a pointer to the value of a
symbol in a particular shared library.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_MutexDestroy
Overview
Destroy a mutex object
Syntax
void Ns_MutexDestroy (
Ns_Mutex *mutexPtr
);
Description
Free the mutex's associated resources.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_MutexInit
Overview
Initialize a mutex object
Syntax
void Ns_MutexInit (
Ns_Mutex *mutexPtr
);
Description
Initialize a Mutual Exclusion lock for use.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_MutexLock
Overview
Lock a mutex object
Syntax
void Ns_MutexLock (
Ns_Mutex *mutexPtr
);
Description
Acquire the mutex. If the mutex is already locked then the current
thread will block until the mutex is unlocked. Note: mutexes are not
recursive. If the current thread tries to lock the mutex twice in a
row, it will block or get an error depending on the platform.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_MutexUnlock
Overview
Unlock a mutex object
Syntax
void Ns_MutexUnlock (
Ns_Mutex *mutexPtr
);
Description
Unlock the mutex.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_NextWord
Overview
Find next word in string
Syntax
char* Ns_NextWord (
char* line
);
Description
Find the next word (after whiteaspace) in a string.
For example, Ns_NextWord("abc def") returns a pointer to the 'd' in
that string.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_NormalizePath
Overview
Normalize a path name
Syntax
char *Ns_NormalizePath(
Ns_DString *dest,
char *path
);
Description
This function removes any extraneous slashes from the path and
resolves "." and ".." references. The result is appended to the given
Ns_DString. For example
Ns_NormalizePath(&ds,
"/dog/cat/../../rat/../../dog//mouse/..");
appends "/dog" to the Ns_DString.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_PageRoot
Overview
Return path name of the AOLserver pages directory for a server.
Syntax
char *Ns_PageRoot(
char *hServer
);
Description
Return path name of the AOLserver pages directory for a server.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ParseHeader
Overview
Parse Http headers
Syntax
int Ns_ParseHeader (
Ns_Set* psetHeaders,
char* sHeader,
...
);
Description
Parse http headers into the Ns_Set. The trailing arguments exist for
backwards compatibility and are ignored.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ParseHttpTime
Overview
Convert Http time into time_t
Syntax
time_t Ns_ParseHttpTime (
char* str
);
Description
Convert a time like "Thursday, 10-Jun-93 01:29:59 GMT" or "Thu, 10 Jan
1993 01:29:59 GMT" into time_t.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ParseRequest
Overview
Parse an HTTP request line into an Ns_Request
Syntax
Ns_Request *Ns_ParseRequest(
char *requestLine
);
Description
The Ns_ParseRequest function takes an HTTP request line and returns a
newly allocated Ns_Request structure. You must eventually call
Ns_FreeRequest to free the memory used by the Ns_Request structure and
its members.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ParseUrl
Overview
Parse a URL
Syntax
int Ns_ParseUrl(
char *url,
char **pprotocol,
char **phost,
char **pport,
char **ppath,
char **ptail
);
Description
Parse a URL into its component parts. Pointers to the protocol, host,
port, path, and "tail" (last path element) will be set by reference in
the passed-in pointers. The passed-in url will be modified. Return
NS_OK on success or NS_ERROR on failure.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_PathIsAbsolute
Overview
Check for an absolute path name
Syntax
int Ns_PathIsAbsolute(
char *path
);
Description
This function returns 1 if the path is absolute and 0 otherwise. Under
Unix, an absolute path starts with a `/'.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_PermPasswordCheck
Overview
Check user's encrypted password
Syntax
int Ns_PermPasswordCheck(
char *user,
char *password
);
Description
Validate a user's encrypted password. This function is only accessible
if the nsperm module is loaded. NS_TRUE is returned if the password is
correct.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_PoolAlloc
Overview
Allocate memory within a pool
Syntax
void* Ns_PoolAlloc (
Ns_Pool* pool,
unsigned int size
);
Description
Alloc memory within a pool. Memory pools are thread-specific memory
that reduce the number of globally-locking malloc(3C) calls.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_PoolCreate
Overview
Create a new memory pool
Syntax
Ns_Pool* Ns_PoolCreate (
char* name
);
Description
Create a new memory pool with the specified name.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_PoolDestroy
Overview
Destroy a memory pool
Syntax
void Ns_PoolDestroy (
Ns_Pool* pool
);
Description
Destroy the specified memory pool.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_PoolDump
Overview
Debug a memory pool
Syntax
void Ns_PoolDump (
int fd,
Ns_Pool* pool
);
Description
Write information about the pool to the open file descriptor fd.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_PoolFree
Overview
Free pool memory
Syntax
void Ns_PoolFree (
Ns_Pool* pool,
void* ptr
);
Description
Free pool memory.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_PoolRealloc
Overview
Reallocate pool memory
Syntax
void* Ns_PoolRealloc (
Ns_Pool* pool,
void* ptr,
unsigned int size
);
Description
Perform realloc for pools. See the realloc(3C) man page.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_PoolTrace
Overview
Trace a memory pool
Syntax
int Ns_PoolTrace (
char* filename
);
Description
Open the specified filename to contain debugging information and begin
debugging. Returns NS_OK or NS_ERROR
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_QueryToSet
Overview
Parse query data into Ns_Set
Syntax
int Ns_QueryToSet (
char* query,
Ns_Set* set
);
Description
Parse query data (such as "a=b&c=d&jkl=rew") into an Ns_Set.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_QueueConn
Overview
Make and queue a new conn
Syntax
int Ns_QueueConn (
Ns_Driver driver,
void* ctx
);
Description
Make a new conn and put it on the list of conns to be served. This
function is called by socket drivers.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_QuoteHtml
Overview
Quote an HTML string
Syntax
void Ns_QuoteHtml(
Ns_DString *pds,
char *string
);
Description
The Ns_QuoteHtml function appends the given string to the Ns_DString,
making the following substitutions that allow HTML to be included in
another HTML page as plain text:
<
<
>
>
&
&
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_Readdir
Overview
Perform readdir
Syntax
struct dirent* Ns_Readdir (
DIR* pDir
);
Description
This funciton wraps readdir(3B).
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_Realloc
Overview
Resize a previously allocated block of memory
Syntax
void *Ns_Realloc(
void *buf,
size_t size
);
Description
The Ns_Realloc function reallocates a block of memory previously
allocated with Ns_Malloc or Ns_Calloc to the given size. The block of
memory may or may not move as a result. This function replaces the
system realloc function.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ReadLockRWLock
Overview
Acquire a read lock
Syntax
int Ns_ReadLockRWLock(
Ns_RWLock *lock
);
Description
Ns_ReadLockRWLock acquires a read lock. Any number of read locks can
be pending. If there's a write lock active, the read lock acquisition
blocks until the write lock is released.
For general information about read/write locks and an example showing
the use of the read/write lock functions, see the Ns_InitializeRWLock
function.
Ns_RWLockRdLock is the preferred function for acquiring a read lock.
See Also
Ns_InitializeRWLock
Ns_DestroyRWLock
Ns_ReadUnlockRWLock
Ns_WriteLockRWLock
Ns_WriteUnlockRWLock
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_ReadUnlockRWLock
Overview
Release a read lock
Syntax
int Ns_ReadUnlockRWLock(
Ns_RWLock *lock
);
Description
Ns_ReadUnlockRWLock releases a read lock.
For general information about read/write locks and an example showing
the use of the read/write lock functions, see the Ns_InitializeRWLock
function.
Ns_RWLockUnlock is the preferred function for releasing a lock.
See Also
Ns_InitializeRWLock
Ns_DestroyRWLock
Ns_ReadLockRWLock
Ns_WriteLockRWLock
Ns_WriteUnlockRWLock
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterAtExit
Overview
Register an exit procedure.
Syntax
typedef void (Ns_Callback) (void *context);
Ns_ProcHandle Ns_RegisterAtExit(
Ns_Callback *proc,
void *context
);
Description
The Ns_RegisterAtExit function registers proc as a function to call
before AOLserver exits after all servers are shut down. The procedures
are run in last-registered first-run order.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterAtPreStartup
Overview
Register a procedure for pre-server startup
Syntax
void* Ns_RegisterAtPreStartup (
Ns_Callback* proc,
void* arg
);
Description
Register a procedure to be called just before the binder is
terminated, prior to server startup. The return value is an opaque
handle (which is currently not useful).
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterAtSignal
Overview
Register a procedure at HUP signal
Syntax
void* Ns_RegisterAtSignal (
Ns_Callback* proc,
void* context
);
Description
Register a callback to run when the HUP signal is received by the
server.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterAtStartup
Overview
Register a procedure for server startup
Syntax
void* Ns_RegisterAtStartup (
Ns_Callback* proc,
void* context
);
Description
Register a callback to run when the server is done starting up.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterCleanup
Overview
Register a procedure for connection cleanup trace
Syntax
void *Ns_RegisterCleanup(
Ns_TraceProc *proc,
void *arg
);
Description
Register a connection cleanup trace procedure. Traces registered with
this procedure are always called in LIFO order at the end of
connection, regardless of the result code from the connection's
request procedure. In other words, the procedure is called even if the
client drops connection.
It returns a pointer to the trace.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterDriver
Overview
Register a socket driver
Syntax
Ns_Driver Ns_RegisterDriver (
char* hServer,
char* hDriver,
Ns_DrvProc* procs,
void* ctx
);
Description
Register a socket driver.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterFilter
Overview
Register a filter function to handle a method/URL combination
Syntax
typedef int (Ns_FilterProc) (void *context, Ns_Conn *conn, int
why);
Ns_ProcHandle Ns_RegisterFilter(
char *hServer,
char *method,
char *URLpatterns,
Ns_FilterProc *proc,
int why,
void *context
);
Description
This function will register a filter procedure for a method/URL
combination on a server. This function will be called at the specified
stage of a connection, if the method/URL combination for the filter
matches the method/URL combination for the connection using glob style
matching. The procedures are run in last-registered last-run order. A
filter procedure is often used for logging.
The why argument can be any of the following, or some combination of
them by bitwise OR-ing (with "|") them together:
NS_FILTER_PRE_AUTH: the filter will be called before
authorization of a page
NS_FILTER_POST_AUTH: the filter will be called after
authorization but before a page has been returned
NS_FILTER_TRACE: the filter will be called after the connection
has been totally processed
Using pre-authorization, the procedure will be called (assuming that
the method/URL combination matches) just before authorization. If the
procedure returns:
* NS_OK: The server will continue to the next pre-authorization
filter for this connection, or, if there are no more
pre-authorization filters, it will continue on with authorization.
* NS_FILTER_BREAK: The server will not process any more
pre-authorization filters for this connection, and it will
continue on with authorization.
* NS_FILTER_RETURN: The server will close the connection and will
not run any more pre-authorization filters. It will not authorize
the request, and it will not run the function registered for this
METHOD/URL. It WILL run any trace functions registered for this
METHOD/URL, usually including logging. It is assumed that the
filter has returned a proper response to the client before
returning NS_FILTER_RETURN.
Using post-authorization, the procedure will be called (assuming that
the method/URL combination matches) just after successful
authorization. If the procedure returns:
* NS_OK: The server will continue to the next post-authorization
filter for this connection, or, if there are no more
post-authorization filters, it will run the function registered to
handle this request.
* NS_FILTER_BREAK: The server will not process any more
post-authorization filters for this connection, and it will run
the function registered to handle this request.
* NS_FILTER_RETURN: The server will close the connection and will
not run any more post-authorization filters and it will not run
the function registered for this METHOD/URL. It WILL run any trace
functions registered for this METHOD/URL, usually including
logging. It is assumed that the filter has returned a proper
response to the client before returning NS_FILTER_RETURN.
Using trace, the procedure will be called (assuming that the
method/URL combination match) after the connection has been totally
processed and closed. If the procedure returns:
* NS_OK: The server will continue to the next trace filter.
* NS_FILTER_BREAK, NS_FILTER_RETURN: The rest of the trace filters
are ignored
The URLpatterns can contain standard string-matching characters. For
example, these are valid URLpatterns:
/employees/*.tcl
/accounts/*/out
Examples
static int
ReportUse(void *context, Ns_Conn *conn, int why){
int status=NS_OK;
switch(why){
case NS_FILTER_PRE_AUTH:
Ns_Log(Notice, "User trying to access %s",conn->request->url);
break;
case NS_FILTER_POST_AUTH:
Ns_Log(Notice, "User authorized to access %s",conn->request-
>url);
break;
case NS_FILTER_TRACE:
Ns_Log(Notice, "User has retrieved %s",conn->request->url);
break;
default:
status=NS_ERROR;
}
return status;
}
int
Ns_ModuleInit(char *hServer, char *hModule){
Ns_RegisterFilter(hServer, "GET", "/test/a*", ReportUse,
Ns_FILTER_PRE_AUTH, NULL);
Ns_RegisterFilter(hServer, "GET", "/test/b*", ReportUse,
Ns_FILTER_POST_AUTH, NULL);
Ns_RegisterFilter(hServer, "GET", "/test/c*", ReportUse,
Ns_FILTER_TRACE, NULL);
Ns_RegisterFilter(hServer, "GET", "/test/d*", ReportUse,
Ns_FILTER_PRE_AUTH | NS_FILTER_POST_AUTH, NULL);
Ns_RegisterFilter(hServer, "GET", "/test/e*", ReportUse,
Ns_FILTER_POST_AUTH | NS_FILTER_TRACE, NULL);
Ns_RegisterFilter(hServer, "GET", "/test/f*", ReportUse,
Ns_FILTER_PRE_AUTH | Ns_FILTER_POST_AUTH | NS_FILTER_TRACE,
NULL);
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterLocation
Overview
Register location for socket driver
Syntax
int Ns_RegisterLocation (
char* name,
char* location,
char* address,
int port
);
Description
Register the built-in socket driver with the name of the socket driver
and a location, host, and port. For example:
Ns_RegisterLocation("nssock", "http://host:port/",
"hostname.com", 80)
After this call, the server will immediately begin serving pages from
that location, host, and port.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterProxyRequest
Overview
Register a function to proxy requests for a method/protocol
combination
Syntax
typedef void *Ns_OpContext;
typedef int (Ns_OpProc) (void *context, Ns_Conn *conn);
typedef void (Ns_OpDeleteProc) (void *context);
void Ns_RegisterProxyRequest(
char *Server,
char *method,
char *protocol,
Ns_OpProc *proc,
Ns_Callback *deleteProc,
void *context
);
Description
The Ns_RegisterProxyRequest function registers function proc to handle
HTTP requests. When the specified server receives a proxy request, it
finds the appropriate registered function.
The server passes your procedure the context you specify here and the
Ns_Conn structure associated with the new HTTP connection.
When a procedure is unregistered with either
Ns_UnRegisterProxyRequest, the server calls the deleteProc with the
same context. You can use this to do any cleanup you might require
(e.g., close an index file or free something from the heap). If the
value of deleteProc is NULL, the server does nothing.
Examples
See the example in the examples/c/nsproxy directory.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterRequest
Overview
Register one or two functions to handle HTTP requests for a method/URL
combination
Syntax
typedef void *Ns_OpContext;
typedef int (Ns_OpProc) (void *context, Ns_Conn *conn);
typedef void (Ns_OpDeleteProc) (void *context);
void Ns_RegisterRequest(
char *hServer,
char *method,
char *URL,
Ns_OpProc *proc,
Ns_OpDeleteProc *deleteProc,
Ns_OpContext context,
int flags
);
Description
The Ns_RegisterRequest function registers function proc to handle HTTP
requests. When the specified server receives an HTTP request, it finds
the most specific registered operation. The default operation for a
GET (i.e., the one registered with URL \Q/') serves up a page out of
the file system.
The server passes your procedure the context you specify here and the
Ns_Conn structure associated with the new HTTP connection.
When a procedure is unregistered with either Ns_UnRegisterRequest or
by registering another procedure with the same method and URL, the
server calls the deleteProc with the same context. You can use this to
do any cleanup you might require (e.g., close an index file or free
something from the heap). If the value of deleteProc is NULL, the
server does nothing.
The flags parameter specifies one or more constants that can be OR'ed
together. The available flags are NS_OP_NOINHERIT and NS_OP_NODELETE.
NS_OP_NOINHERIT tells AOLserver to only call your procedure if the URL
matches exactly (the default behavior is to look for the closest
match). You can register two procedures for the same method/URL
combination by calling Ns_RegisterRequest once with NS_OP_NOINHERIT
specified and once without NS_OP_NOINHERIT specified. The first
procedure will be called if there is an exact match with the specified
URL. The second procedure will be called if the requested URL is below
the specified URL, provided there is not already another procedure
registered with a closer match.
NS_OP_NODELETE specifies that the previous procedure's deleteproc
should not be called. NS_OP_NODELETE can be used in conjunction with
Ns_GetRequest to implement wrappers.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterReturn
Overview
Register a return status for a URL
Syntax
void Ns_RegisterReturn (
int status,
char* url
);
Description
Associate a URL with a return status (for custom error pages). For
exmaple:
Ns_RegisterReturn(404, "http://www.foo.com/notfound.html");
will send redirects to http://www.foo.com/notfound.html whenever a 404
error is to be returned.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterServerShutdown
Overview
Register a shutdown procedure for a server.
Syntax
typedef void (Ns_Callback) (void *context);
Ns_ProcHandle Ns_RegisterServerShutdown(
char *hServer,
Ns_Callback *proc,
Ns_OpContext context
);
Description
The Ns_RegisterServerShutdown function registers proc as a shutdown
procedure on the specified server. The server calls all shutdown
procedures before shutting down, in last-registered first-run order.
The shutdown procedure takes the context as its sole argument. A
shutdown procedure is often used to close or free a resource allocated
by a module's initialization routine.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
Previous ToC Index Next
[as-c-sm.gif] [ Previous ] [ Contents ] [ Index ] [ Next ]
Ns_RegisterServerTrace
Overview
Register a trace procedure for a server.
Syntax
typedef void (Ns_TraceProc) (void *context, Ns_Conn *conn);
Ns_ProcHandle Ns_RegisterServerTrace(
char *hServer,
Ns_TraceProc *proc,
void *context
);
Description
The Ns_RegisterServerTrace function registers proc as a trace for the
specified server. The server calls all trace procedures after every
HTTP connection with the context and the Ns_Conn for that connection.
The procedures are run in last-registered first-run order. A trace
procedure is often used for logging.
[bluebult.gif] Top of Page [bluebult.gif]
[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright 1998-99 America Online, Inc.
|