home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 October / PCWorld_2000-10_cd1.bin / Komunik / sambar / _setup.1 / sambar.h < prev    next >
C/C++ Source or Header  |  2000-07-30  |  24KB  |  875 lines

  1. /*
  2. ** SAMBAR.H
  3. **
  4. **      This is the public WIN32 header file for the Sambar 
  5. **        Server application.
  6. **
  7. **        Confidential Property of Tod Sambar
  8. **        (c) Copyright Tod Sambar 1996-1997
  9. **        All rights reserved.
  10. **
  11. **
  12. ** History:
  13. ** Chg#    Date    Description                                                Resp
  14. ** ----    -------    -------------------------------------------------------    ----
  15. **        10AUG96    Created                                                    sambar
  16. **        11APR97    Added server start/stop APIs                            sambar
  17. */
  18.  
  19. #if     !defined(__SAMBAR_H__)
  20. #define __SAMBAR_H__
  21.  
  22. /*
  23. ** Types
  24. */
  25. typedef int                            SA_RETCODE;
  26. typedef long                        SA_INT;
  27. typedef int                            SA_BOOL;
  28. typedef void                        SA_VOID;
  29. typedef unsigned char                SA_BYTE;
  30. typedef unsigned char                SA_CHAR;
  31.  
  32. #ifndef TEXT
  33. #define TEXT(x)                        (x)
  34. #endif
  35.  
  36. #ifndef MAX
  37. #define MAX(a,b)                    ((SA_INT)(a) > (SA_INT)(b) ? (a) : (b))
  38. #endif
  39.  
  40. #ifndef MIN
  41. #define MIN(a,b)                    ((SA_INT)(a) < (SA_INT)(b) ? (a) : (b))
  42. #endif
  43.  
  44. /*
  45. ** Public Structures
  46. */
  47. #define SA_CTX                        SA_VOID
  48. #define SA_CONN                        SA_VOID
  49. #define SA_PARAMS                    SA_VOID
  50. #define SA_REC                        SA_VOID
  51. #define SA_PROFILE                    SA_VOID
  52.  
  53.  
  54. /*
  55. ** Return Codes
  56. */
  57. #define SA_SUCCEED                    1
  58. #define SA_FAIL                        0
  59.  
  60.  
  61. /*
  62. ** Error Codes
  63. */
  64. #define SA_E_DOCFOLLOWS                (SA_INT)-1
  65. #define SA_E_INTERNALSYSTEM            (SA_INT)0
  66. #define SA_E_ALREADYLOGGEDIN        (SA_INT)1
  67. #define SA_E_BADCOOKIE                (SA_INT)2
  68. #define SA_E_INVALIDLOGIN            (SA_INT)3
  69. #define SA_E_MAXLOGINS                (SA_INT)4
  70. #define SA_E_ALREADYDEFINED            (SA_INT)5
  71. #define SA_E_INVALIDDATA            (SA_INT)6
  72. #define SA_E_NOTIMPLEMENTED            (SA_INT)7
  73. #define SA_E_FORBIDDEN                (SA_INT)8
  74. #define SA_E_NOTFOUND                (SA_INT)9
  75. #define SA_E_DUPLICATE                (SA_INT)10
  76. #define SA_E_DBOPFAILED                (SA_INT)11
  77. #define SA_E_BADGATEWAY                (SA_INT)12
  78. #define SA_E_REDIRECT                (SA_INT)13
  79. #define SA_E_USRDEF1                (SA_INT)14
  80. #define SA_E_USRDEF2                (SA_INT)15
  81. #define SA_E_USRDEF3                (SA_INT)16
  82. #define SA_E_USRDEF4                (SA_INT)17
  83. #define SA_E_USRDEF5                (SA_INT)18
  84. #define SA_E_USRDEF6                (SA_INT)19
  85. #define SA_E_USRDEF7                (SA_INT)20
  86. #define SA_E_USRDEF8                (SA_INT)21
  87. #define SA_E_USRDEF9                (SA_INT)22
  88. #define SA_E_USRDEF10                (SA_INT)23
  89. #define SA_E_USRDEF11                (SA_INT)24
  90. #define SA_E_USRDEF12                (SA_INT)25
  91. #define SA_E_USRDEF13                (SA_INT)26
  92. #define SA_E_USRDEF14                (SA_INT)27
  93. #define SA_E_USRDEF15                (SA_INT)28
  94. #define SA_E_USRDEF16                (SA_INT)29
  95. #define SA_E_USRDEF17                (SA_INT)30
  96. #define SA_E_USRDEF18                (SA_INT)31
  97. #define SA_E_USRDEF19                (SA_INT)32
  98. #define SA_E_USRDEF20                (SA_INT)33
  99. #define SA_E_TIMEOUT                (SA_INT)34
  100. #define SA_E_SHUTDOWN                (SA_INT)35
  101. #define SA_E_SERVERDOWN                (SA_INT)36
  102. #define SA_E_PAUSED                    (SA_INT)37
  103. #define SA_E_MAXCGIS                (SA_INT)38
  104. #define SA_E_INUSE                    (SA_INT)39
  105. #define SA_E_RESTART                (SA_INT)40
  106. #define SA_E_INTERRUPTED            (SA_INT)41
  107. #define SA_E_SSLONLY                (SA_INT)42
  108. #define SA_E_VERSIONCONTROL            (SA_INT)43
  109. #define SA_E_PERMANENTREDIRECT        (SA_INT)44
  110. #define SA_E_GONE                    (SA_INT)45
  111.  
  112.  
  113. /*
  114. ** Actions
  115. */
  116. #define    SA_GET                        (SA_INT)1
  117. #define    SA_SET                        (SA_INT)2
  118. #define    SA_CLEAR                    (SA_INT)3
  119.  
  120. /*
  121. ** Misc Defines
  122. */
  123. #define SA_NULLTERM                    (SA_INT)-3
  124.  
  125. /*
  126. ** Context Properties
  127. */
  128. #define SA_CTXPROP_SYSADMIN            (SA_INT)1
  129. #define SA_CTXPROP_HOMEDIR            (SA_INT)2
  130. #define SA_CTXPROP_LOGDIR            (SA_INT)3
  131. #define SA_CTXPROP_DBCACHE            (SA_INT)4
  132. #define SA_CTXPROP_APPLICDIR        (SA_INT)5
  133. #define SA_CTXPROP_SERVERSW            (SA_INT)7
  134. #define SA_CTXPROP_SERVERPORT        (SA_INT)8
  135. #define SA_CTXPROP_SERVERNAME        (SA_INT)9
  136. #define SA_CTXPROP_SERVERIP            (SA_INT)10
  137. #define SA_CTXPROP_BUILDID            (SA_INT)11
  138. #define SA_CTXPROP_HTTPLOGFUNC        (SA_INT)12
  139. #define SA_CTXPROP_SECURITYMODEL    (SA_INT)13
  140. #define SA_CTXPROP_LICENSETYPE        (SA_INT)14
  141. #define SA_CTXPROP_AUTHLOGINS        (SA_INT)15
  142. #define SA_CTXPROP_NTAUTH            (SA_INT)16
  143.  
  144. /*
  145. ** Connection Properties
  146. */
  147. #define SA_CONNPROP_HOST            (SA_INT)1
  148. #define SA_CONNPROP_AGENT            (SA_INT)2
  149. #define SA_CONNPROP_REFERER            (SA_INT)3
  150. #define SA_CONNPROP_REQUEST            (SA_INT)4
  151. #define SA_CONNPROP_REQUESTMETHOD    (SA_INT)5
  152. #define SA_CONNPROP_USERNAME        (SA_INT)6
  153. #define SA_CONNPROP_NAME            (SA_INT)7
  154. #define SA_CONNPROP_PASSWORD        (SA_INT)8
  155. #define SA_CONNPROP_IPADDR            (SA_INT)9
  156. #define SA_CONNPROP_DOCSDIR            (SA_INT)10
  157. #define SA_CONNPROP_DOCSPATH        (SA_INT)11
  158.  
  159. /*
  160. ** Scheduler Time Arguments
  161. */
  162. #define SA_SCHEDULETIME_TIMEOUT        (SA_INT)1        /* Every 2 minutes    */
  163. #define SA_SCHEDULETIME_HOURLY        (SA_INT)2        /* Every hour         */
  164. #define SA_SCHEDULETIME_DAILY        (SA_INT)3        /* Every day         */
  165. #define SA_SCHEDULETIME_WEEKLY        (SA_INT)4        /* Every week         */
  166. #define SA_SCHEDULETIME_MONTHLY        (SA_INT)5        /* Every month         */
  167.  
  168. /*
  169. ** Next Page Argument
  170. */
  171. #define SA_PAGE_ARG                    TEXT("RCpage")
  172. #define SA_REDIRECT_ARG                TEXT("RCredirect")
  173.  
  174. /*
  175. ** System Administrator & User Folders
  176. */
  177. #define SA_ADMIN_FOLDER                TEXT("sysadmin")
  178. #define SA_USER_FOLDER                TEXT("sysuser")
  179.  
  180. /*
  181. ** Default group
  182. */
  183. #define SA_DEFAULT_GROUP            TEXT("other")
  184.  
  185. /*
  186. ** RPC authorization types
  187. */
  188. #define SA_AUTHORIZATION_ALL        (SA_INT)0        /* All clients */
  189. #define SA_AUTHORIZATION_USER        (SA_INT)1        /* Logged in users only */
  190. #define SA_AUTHORIZATION_ADMIN        (SA_INT)2        /* Admin only */
  191. #define SA_AUTHORIZATION_SCRIPT        (SA_INT)3        /* Only inside scripts */
  192.  
  193. /*
  194. ** RPC parameters
  195. */
  196. typedef struct sa__rpcparam
  197. {
  198.     SA_CHAR            *name;                /* Parameter name */
  199.     SA_BOOL            required;            /* Required or optional param */
  200.     SA_CHAR            *descr;                /* Parameter description */
  201. } SA_RPCPARAM;
  202.  
  203. typedef struct sa__arg
  204. {
  205.     SA_CHAR            *value;                /* Parameter value */
  206.     struct sa__arg    *next;
  207. } SA_ARG;
  208.  
  209. /*
  210. ** Scalar parameters
  211. */
  212. typedef struct sa__scalararg
  213. {
  214.     SA_CHAR            *name;                /* Argument name */
  215.     SA_CHAR            *descr;                /* Argument description */
  216. } SA_SCALARARG;
  217.  
  218. /*
  219. ** Request-handler modules
  220. */
  221. typedef struct sa__request
  222. {
  223.         SA_INT        method;                /* SA_METHOD_* */
  224.         SA_CHAR        *uri;                /* URI requested. */
  225.         SA_INT         urilen; 
  226.         SA_CHAR        *path;                /* path to requested URI. */
  227.         SA_INT         pathlen; 
  228.         SA_CHAR     *args;
  229.         SA_INT         argslen; 
  230.         SA_CHAR     *content;
  231.         SA_INT         contentlen;
  232.         SA_CHAR     *pathinfo;
  233.         SA_INT         pathinfolen;
  234. } SA_REQUEST;
  235.  
  236. #define SA_METHOD_GET                (SA_INT)1
  237. #define SA_METHOD_POST                (SA_INT)2
  238. #define SA_METHOD_PUT                (SA_INT)3
  239. #define SA_METHOD_HEAD                (SA_INT)4
  240. #define SA_METHOD_PATCH                (SA_INT)5
  241. #define SA_METHOD_PROPFIND            (SA_INT)6
  242. #define SA_METHOD_PROPPATCH            (SA_INT)7
  243. #define SA_METHOD_DELETE            (SA_INT)8
  244. #define SA_METHOD_CONNECT            (SA_INT)9
  245. #define SA_METHOD_COPY                (SA_INT)10
  246. #define SA_METHOD_MKCOL                (SA_INT)11
  247. #define SA_METHOD_MOVE                (SA_INT)12
  248. #define SA_METHOD_OPTIONS            (SA_INT)13
  249. #define SA_METHOD_TRACE                (SA_INT)14
  250. #define SA_METHOD_LOCK                (SA_INT)15
  251. #define SA_METHOD_UNLOCK            (SA_INT)16
  252. #define SA_METHOD_SEARCH            (SA_INT)17
  253. #define SA_METHOD_CHECKOUT            (SA_INT)18
  254. #define SA_METHOD_UNCHECKOUT        (SA_INT)19
  255. #define SA_METHOD_CHECKIN            (SA_INT)20
  256. #define SA_METHOD_MKRESOURCE        (SA_INT)21
  257. #define SA_METHOD_REPORT            (SA_INT)22
  258.  
  259. /*
  260. ** HTTP Log callback structure
  261. */
  262. typedef struct sa__httplog
  263. {
  264.         SA_INT         size; 
  265.         SA_INT         status; 
  266.         SA_CHAR        *method;
  267.         SA_CHAR     *timestamp;
  268.         SA_CHAR     *request;
  269.         SA_CHAR     *args;
  270.         SA_CHAR     *vhost;
  271.         SA_CHAR     *user;                /* User IP Address */
  272.         SA_CHAR        *username;
  273.         SA_CHAR        *referer;
  274.         SA_CHAR        *agent;
  275.  
  276.         /* Include system statistics.                                    */
  277.         SA_INT         allconns;             /* Total network connections    */
  278.         SA_INT         httpconns;             /* # of HTTP connections        */
  279.         SA_INT         threads;             /* Total threads                */
  280. } SA_HTTPLOG;
  281.  
  282. /*
  283. ** Password Management
  284. */
  285. #define SA_PASSWD_FILE                TEXT("passwd")
  286. #define SA_MAX_NAME                    (SA_INT)64
  287. #define SA_MAX_VALUE                (SA_INT)1000
  288.  
  289. typedef struct sa__ftp
  290. {
  291.     SA_INT        privs;                                    /* FTP access */
  292.     SA_INT        ftpmax;                                    /* Maximum FTP MB */
  293.     SA_INT        dirlen;
  294.     SA_CHAR        dir[SA_MAX_NAME + 1];                    /* FTP root dir */
  295. } SA_FTP;
  296.  
  297. typedef struct sa__sip
  298. {
  299.     SA_INT        unused;                                    /* SIP access */
  300. } SA_SIP;
  301.  
  302. typedef struct sa__passwd
  303. {
  304.     SA_INT        ftpprivs;                                /* FTP priviledges */
  305.     SA_INT        ftpmax;                                    /* FTP max upload */
  306.     SA_INT        dirlen;
  307.     SA_INT        namelen;
  308.     SA_INT        grouplen;
  309.     SA_INT        passwordlen;
  310.     SA_CHAR        name[SA_MAX_NAME + 1];                    /* Symbolic name */
  311.     SA_CHAR        group[SA_MAX_NAME + 1];
  312.     SA_CHAR        password[SA_MAX_NAME + 1];
  313.     SA_CHAR        dir[SA_MAX_NAME + 1];                    /* FTP dir */
  314.  
  315. } SA_PASSWD;
  316.  
  317. typedef struct sa__user
  318. {
  319.     SA_INT        grouplen;
  320.     SA_INT        usernamelen;
  321.     SA_CHAR        group[SA_MAX_NAME + 1];
  322.     SA_CHAR        username[SA_MAX_NAME + 1];
  323. } SA_USER;
  324.  
  325. typedef struct sa__group
  326. {
  327.     SA_INT        namelen;
  328.     SA_CHAR        name[SA_MAX_NAME + 1];
  329. } SA_GROUP;
  330.  
  331. /*
  332. ** FTP Priviledges
  333. */
  334. #define SA_PRIV_NOACCESS            (SA_INT)0
  335. #define SA_PRIV_READONLY            (SA_INT)1
  336. #define SA_PRIV_READWRITE            (SA_INT)2
  337.  
  338. /*
  339. ** Server Types
  340. */
  341. #define SA_SERVERTYPE_HTTP            (SA_INT)100
  342. #define SA_SERVERTYPE_HTTPPROXY        (SA_INT)101
  343. #define SA_SERVERTYPE_FTP            (SA_INT)102
  344. #define SA_SERVERTYPE_SMTPPROXY        (SA_INT)103
  345. #define SA_SERVERTYPE_POP3PROXY        (SA_INT)104
  346. #define SA_SERVERTYPE_IMAP4PROXY    (SA_INT)105
  347. #define SA_SERVERTYPE_BRIDGEPROXY    (SA_INT)106
  348. #define SA_SERVERTYPE_NNTPPROXY        (SA_INT)107
  349. #define SA_SERVERTYPE_FTPPROXY        (SA_INT)108
  350. #define SA_SERVERTYPE_SOCKSPROXY    (SA_INT)109
  351. #define SA_SERVERTYPE_TELNETPROXY    (SA_INT)110
  352. #define SA_SERVERTYPE_REALPROXY        (SA_INT)111
  353. #define SA_SERVERTYPE_SMTP            (SA_INT)112
  354. #define SA_SERVERTYPE_POP3            (SA_INT)113
  355. #define SA_SERVERTYPE_IMAP4            (SA_INT)114
  356. #define SA_SERVERTYPE_TELNET        (SA_INT)115
  357. #define SA_SERVERTYPE_DNS            (SA_INT)116
  358. #define SA_SERVERTYPE_SIP            (SA_INT)117
  359. #define SA_SERVERTYPE_DHCP            (SA_INT)118
  360.  
  361. /*
  362. ** Record Flags
  363. */ 
  364. #define SA_REC_CREATE                (SA_INT)0x0001
  365. #define SA_REC_DELETE                (SA_INT)0x0002
  366.  
  367.  
  368. /*
  369. ** Sambar Server callbacks
  370. */
  371. typedef SA_RETCODE                (* SA_INITFUNC)(SA_CTX *ctx);
  372. typedef SA_RETCODE                (* SA_EXITFUNC)(SA_CTX *ctx);
  373. typedef SA_RETCODE                (* SA_LOGINFUNC)(SA_CTX *ctx, SA_CONN *conn, 
  374.                                     SA_CHAR *username, SA_INT usernamelen, 
  375.                                     SA_CHAR *password, SA_INT passwordlen, 
  376.                                     SA_INT *infop);
  377. typedef SA_RETCODE                (* SA_LOGOUTFUNC)(SA_CTX *ctx, SA_CONN *conn);
  378. typedef SA_RETCODE                (* SA_PROFILEFUNC)(SA_CTX *ctx, SA_CONN *conn,
  379.                                     SA_INT action, SA_CHAR *name, 
  380.                                     SA_INT namelen, SA_VOID *datap);
  381. typedef SA_RETCODE                (* SA_REQUESTFUNC)(SA_CTX *ctx, SA_CONN *conn,
  382.                                     SA_CHAR *uri, SA_INT urilen, 
  383.                                     SA_PARAMS *params, SA_INT *infop);
  384. typedef SA_RETCODE                (* SA_RPCFUNC)(SA_CTX *ctx, SA_CONN *conn,
  385.                                     SA_PARAMS *params, SA_INT *infop);
  386. typedef SA_RETCODE                (* SA_SCALARFUNC)(SA_CTX *ctx, SA_CONN *conn,
  387.                                     SA_ARG *args, SA_CHAR *value);
  388. typedef SA_RETCODE                (* SA_PROPFUNC)(SA_CTX *ctx, SA_VOID *argp, 
  389.                                     SA_CHAR *name, SA_CHAR *value);
  390. typedef SA_RETCODE                (* SA_FTPFUNC)(SA_CTX *ctx, SA_CHAR *name,
  391.                                     SA_INT namelen, SA_CHAR *password, 
  392.                                     SA_INT passwordlen, SA_FTP *ftpresp);
  393. typedef SA_RETCODE                (* SA_SIPFUNC)(SA_CTX *ctx, SA_CHAR *name,
  394.                                     SA_INT namelen, SA_CHAR *password, 
  395.                                     SA_INT passwordlen, SA_SIP *sipresp);
  396. typedef SA_RETCODE                (* SA_TELNETFUNC)(SA_CTX *ctx, SA_CHAR *name,
  397.                                     SA_INT namelen, SA_CHAR *password, 
  398.                                     SA_INT passwordlen);
  399. typedef SA_RETCODE                (* SA_MAILFUNC)(SA_CTX *ctx, SA_CHAR *name,
  400.                                     SA_INT namelen, SA_CHAR *password, 
  401.                                     SA_INT passwordlen);
  402. typedef SA_RETCODE                (* SA_NETCONNECTFUNC)(SA_CTX *ctx, 
  403.                                     SA_CHAR *ipaddr, SA_INT servertype);
  404. typedef SA_RETCODE                (* SA_HTTPPROXYFUNC)(SA_CTX *ctx, SA_CONN *conn,
  405.                                     SA_CHAR *host, SA_INT hostlen,
  406.                                     SA_CHAR *url, SA_INT urllen);
  407. typedef SA_RETCODE                (* SA_ENVTFUNC)(SA_CTX *ctx, SA_CONN *conn,
  408.                                     SA_CHAR *buffer, SA_INT buflen, 
  409.                                     SA_CHAR *data);
  410. typedef SA_RETCODE                (* SA_MODULEFUNC)(SA_CTX *ctx, SA_CONN *conn,
  411.                                     SA_REQUEST *request, SA_INT *infop);
  412. typedef SA_VOID                    (* SA_HTTPLOGFUNC)(SA_CTX *ctx, 
  413.                                     SA_HTTPLOG *httplog);
  414. typedef SA_RETCODE                (* SA_SCHEDULEFUNC)(SA_CTX *ctx, SA_CHAR *name,
  415.                                     SA_VOID *argp);
  416. typedef SA_VOID                    (* SA_RASFUNC)(SA_CTX *ctx, SA_CHAR *ip,
  417.                                     SA_CHAR *previp, SA_BOOL connected);
  418.  
  419.  
  420. /*
  421. ** Sambar Server Function Prototypes
  422. */
  423. #ifdef    WIN32
  424. #define SA_PUBLIC                __cdecl
  425. #define SA_EXPORT                __declspec(dllexport)
  426. #else    /* UNIX */
  427. #define SA_PUBLIC
  428. #define SA_EXPORT
  429. #endif
  430.  
  431. #if defined(__cplusplus)
  432. extern "C" {
  433. #endif    /* defined(__cplusplus) */
  434.  
  435. /*
  436. ** Sambar Server startup/shutdown
  437. */
  438. extern SA_RETCODE SA_EXPORT        sa_server(
  439.                                 SA_VOID            *hWnd
  440.                                 );
  441. extern SA_BOOL SA_EXPORT        sa_stopped(
  442.                                 void
  443.                                 );
  444. extern SA_RETCODE SA_EXPORT        sa_shutdown(
  445.                                 SA_BOOL            restart
  446.                                 );
  447. extern SA_RETCODE SA_EXPORT        sa_pause(
  448.                                 SA_BOOL            unpause
  449.                                 );
  450. /*
  451. ** General Functions
  452. */
  453.  
  454. extern SA_RETCODE SA_EXPORT        sa_cgi_exec(
  455.                                 SA_CTX            *ctx,
  456.                                 SA_CONN            *conn,
  457.                                 SA_REQUEST        *request
  458.                                 );
  459. extern SA_RETCODE SA_EXPORT        sa_wincgi_exec(
  460.                                 SA_CTX            *ctx,
  461.                                 SA_CONN            *conn,
  462.                                 SA_REQUEST        *request
  463.                                 );
  464. extern SA_RETCODE SA_EXPORT        sa_cmd_init(
  465.                                 SA_CTX            *ctx,
  466.                                 SA_CHAR            *name,
  467.                                 SA_RPCPARAM        *params,
  468.                                 SA_INT            numparams,
  469.                                 SA_INT            authorization,
  470.                                 SA_CHAR            *descr,
  471.                                 SA_RPCFUNC        funcp
  472.                                 );
  473. extern SA_RETCODE SA_EXPORT        sa_scalar_init(
  474.                                 SA_CTX            *ctx,
  475.                                 SA_CHAR            *name,
  476.                                 SA_SCALARARG    *args,
  477.                                 SA_INT            numargs,
  478.                                 SA_CHAR            *descr,
  479.                                 SA_SCALARFUNC    funcp
  480.                                 );
  481. extern SA_RETCODE SA_EXPORT        sa_props_load(
  482.                                 SA_CTX            *ctx,
  483.                                 SA_CHAR            *filename,
  484.                                 SA_CHAR            *section,
  485.                                 SA_VOID            *argp,
  486.                                 SA_PROPFUNC        funcp
  487.                                 );
  488. extern SA_RETCODE SA_EXPORT        sa_send_file(
  489.                                 SA_CONN            *conn,
  490.                                 SA_CHAR            *filename
  491.                                 );
  492. extern SA_RETCODE SA_EXPORT        sa_send_macro(
  493.                                 SA_CONN            *conn,
  494.                                 SA_CHAR            *macroname
  495.                                 );
  496. extern SA_RETCODE SA_EXPORT        sa_send_header(
  497.                                 SA_CONN            *conn,
  498.                                 SA_CHAR            *buffer,
  499.                                 SA_INT            buflen
  500.                                 );
  501. extern SA_RETCODE SA_EXPORT        sa_params(
  502.                                 SA_CTX            *ctx,
  503.                                 SA_CONN            *conn,
  504.                                 SA_PARAMS        **paramsp
  505.                                 );
  506. extern SA_RETCODE SA_EXPORT        sa_param(
  507.                                 SA_CTX            *ctx,
  508.                                 SA_PARAMS        *params,
  509.                                 SA_CHAR            *name,
  510.                                 SA_CHAR            **valuep,
  511.                                 SA_INT            *valuelenp
  512.                                 );
  513. extern SA_RETCODE SA_EXPORT        sa_param_set(
  514.                                 SA_CTX            *ctx,
  515.                                 SA_PARAMS        *params,
  516.                                 SA_CHAR            *name,
  517.                                 SA_CHAR            *value,
  518.                                 SA_INT            valuelen
  519.                                 );
  520. extern SA_RETCODE SA_EXPORT        sa_state_get(
  521.                                 SA_CTX            *ctx,
  522.                                 SA_CONN            *conn,
  523.                                 SA_CHAR            *name,
  524.                                 SA_CHAR            **valuep,
  525.                                 SA_INT            *valuelenp
  526.                                 );
  527. extern SA_RETCODE SA_EXPORT        sa_state_set(
  528.                                 SA_CTX            *ctx,
  529.                                 SA_CONN            *conn,
  530.                                 SA_CHAR            *name,
  531.                                 SA_CHAR            *value,
  532.                                 SA_INT            valuelen
  533.                                 );
  534. extern SA_VOID SA_EXPORT        sa_log(
  535.                                 SA_CTX            *ctx,
  536.                                 SA_CHAR            *buffer
  537.                                 );
  538. extern SA_VOID SA_EXPORT        sa_observe(
  539.                                 SA_CTX            *ctx,
  540.                                 SA_CHAR            *buffer
  541.                                 );
  542. extern SA_RETCODE SA_EXPORT        sa_get_macro(
  543.                                 SA_CTX            *ctx,
  544.                                 SA_CHAR            *macroname,
  545.                                 SA_CHAR            **macrop,
  546.                                 SA_INT            *macrolenp
  547.                                 );
  548. extern SA_RETCODE SA_EXPORT        sa_get_mime(
  549.                                 SA_CTX            *ctx,
  550.                                 SA_CHAR            *name,
  551.                                 SA_INT            namelen,
  552.                                 SA_CHAR            **mimetypep
  553.                                 );
  554. extern SA_RETCODE SA_EXPORT        sa_get_realpath(
  555.                                 SA_CTX            *ctx,
  556.                                 SA_CONN            *conn,
  557.                                 SA_CHAR            *name,
  558.                                 SA_INT            namelen,
  559.                                 SA_CHAR            *path,
  560.                                 SA_INT            maxpath
  561.                                 );
  562. extern SA_INT SA_EXPORT            sa_wildcmp(
  563.                                 SA_CTX            *ctx,
  564.                                 SA_CHAR            *wildstr,
  565.                                 SA_INT            wildstrlen,
  566.                                 SA_CHAR            *arg,
  567.                                 SA_INT            arglen
  568.                                 );
  569. extern SA_RETCODE SA_EXPORT        sa_schedule_task(
  570.                                 SA_CTX            *ctx,
  571.                                 SA_CHAR            *name,
  572.                                 SA_SCHEDULEFUNC    func,
  573.                                 SA_VOID            *argp,
  574.                                 SA_INT            when
  575.                                 );
  576.                                 
  577.  
  578. /*
  579. ** Mail Utility Functions
  580. */
  581. extern SA_RETCODE SA_EXPORT        sa_smtpmail(
  582.                                 SA_CTX            *ctx,
  583.                                 SA_CHAR            *from,
  584.                                 SA_CHAR            *tolist,
  585.                                 SA_CHAR            *cclist,
  586.                                 SA_CHAR            *bcclist,
  587.                                 SA_CHAR            *subject,
  588.                                 SA_CHAR            *message,
  589.                                 SA_CHAR            *attachment
  590.                                 );
  591. extern SA_RETCODE SA_EXPORT        sa_smtpmail2(
  592.                                 SA_CTX            *ctx,
  593.                                 SA_CHAR            *from,
  594.                                 SA_CHAR            *tolist,
  595.                                 SA_CHAR            *cclist,
  596.                                 SA_CHAR            *bcclist,
  597.                                 SA_CHAR            *subject,
  598.                                 SA_CHAR            *message,
  599.                                 SA_CHAR            *signature,
  600.                                 SA_CHAR            *attachname,
  601.                                 SA_BYTE            *attachdata,
  602.                                 SA_INT            attachdatalen
  603.                                 );
  604.  
  605. extern SA_RETCODE SA_EXPORT        sa_mbox_create(
  606.                                 SA_CTX            *ctx,
  607.                                 SA_CHAR            *user
  608.                                 );
  609. extern SA_RETCODE SA_EXPORT        sa_mbox_delete(
  610.                                 SA_CTX            *ctx,
  611.                                 SA_CHAR            *user
  612.                                 );
  613. extern SA_BOOL SA_EXPORT        sa_mbox_exists(
  614.                                 SA_CTX            *ctx,
  615.                                 SA_CHAR            *user
  616.                                 );
  617.  
  618. /*
  619. ** Context Functions
  620. */
  621. extern SA_RETCODE SA_EXPORT        sa_ctx_global(
  622.                                 SA_CTX            **ctxp
  623.                                 );
  624. extern SA_RETCODE SA_EXPORT        sa_ctx_key(
  625.                                 SA_CTX            *ctx,
  626.                                 SA_INT            action,
  627.                                 SA_CHAR            *key,
  628.                                 SA_VOID            **valuep
  629.                                 );
  630. extern SA_RETCODE SA_EXPORT        sa_ctx_props(
  631.                                 SA_CTX            *ctx,
  632.                                 SA_INT            action,
  633.                                 SA_INT            property,
  634.                                 SA_BYTE            *buffer,
  635.                                 SA_INT            buflen,
  636.                                 SA_INT            *outlenp
  637.                                 );
  638. extern SA_RETCODE SA_EXPORT        sa_envt_prop(
  639.                                 SA_CTX            *ctx,
  640.                                 SA_CONN            *conn,
  641.                                 SA_BYTE            *prop,
  642.                                 SA_INT            proplen,
  643.                                 SA_CHAR            *buffer
  644.                                 );
  645.  
  646. /*
  647. ** Connection Functions
  648. */
  649. extern SA_RETCODE SA_EXPORT        sa_conn_key(
  650.                                 SA_CONN            *conn,
  651.                                 SA_INT            action,
  652.                                 SA_CHAR            *key,
  653.                                 SA_VOID            **valuep
  654.                                 );
  655. extern SA_RETCODE SA_EXPORT        sa_conn_props(
  656.                                 SA_CONN            *conn,
  657.                                 SA_INT            action,
  658.                                 SA_INT            property,
  659.                                 SA_BYTE            *buffer,
  660.                                 SA_INT            buflen,
  661.                                 SA_INT            *outlenp
  662.                                 );
  663. extern SA_RETCODE SA_EXPORT        sa_conn_send(
  664.                                 SA_CONN            *conn,
  665.                                 SA_CHAR            *buffer,
  666.                                 SA_INT            buflen
  667.                                 );
  668. extern SA_RETCODE SA_EXPORT        sa_conn_flush(
  669.                                 SA_CONN            *conn
  670.                                 );
  671. extern SA_RETCODE SA_EXPORT        sa_conn_redirect(
  672.                                 SA_CONN            *conn,
  673.                                 SA_CHAR            *location,
  674.                                 SA_CHAR            *buffer,
  675.                                 SA_INT            buflen
  676.                                 );
  677. extern SA_RETCODE SA_EXPORT        sa_conn_login(
  678.                                 SA_CONN            *conn,
  679.                                 SA_CHAR            *user,
  680.                                 SA_INT            userlen,
  681.                                 SA_CHAR            *password,
  682.                                 SA_INT            passwordlen,
  683.                                 SA_INT            *infop
  684.                                 );
  685.  
  686. /*
  687. ** User/Password Management Routines
  688. */
  689. extern SA_RETCODE SA_EXPORT        sa_passwd_verify(
  690.                                 SA_CTX            *ctx,
  691.                                 SA_CHAR            *username,
  692.                                 SA_INT            usernamelen,
  693.                                 SA_CHAR            *password,
  694.                                 SA_INT            passwordlen,
  695.                                 SA_BOOL            *statusp
  696.                                 );
  697. extern SA_RETCODE SA_EXPORT        sa_passwd_lookup(
  698.                                 SA_CTX            *ctx,
  699.                                 SA_CHAR            *username,
  700.                                 SA_INT            usernamelen,
  701.                                 SA_PASSWD        *passwd
  702.                                 );
  703. extern SA_RETCODE SA_EXPORT        sa_passwd_add(
  704.                                 SA_CTX            *ctx,
  705.                                 SA_CHAR            *username,
  706.                                 SA_INT            usernamelen,
  707.                                 SA_PASSWD        *passwd
  708.                                 );
  709. extern SA_RETCODE SA_EXPORT        sa_passwd_update(
  710.                                 SA_CTX            *ctx,
  711.                                 SA_CHAR            *username,
  712.                                 SA_INT            usernamelen,
  713.                                 SA_PASSWD        *passwd
  714.                                 );
  715. extern SA_RETCODE SA_EXPORT        sa_passwd_delete(
  716.                                 SA_CTX            *ctx,
  717.                                 SA_CHAR            *username,
  718.                                 SA_INT            usernamelen
  719.                                 );
  720. extern SA_RETCODE SA_EXPORT        sa_passwd_list(
  721.                                 SA_CTX            *ctx,
  722.                                 SA_USER            *users,
  723.                                 SA_INT            numusers,
  724.                                 SA_INT            *countp
  725.                                 );
  726.  
  727. /*
  728. ** Group Management Routines
  729. */
  730. extern SA_RETCODE SA_EXPORT        sa_group_add(
  731.                                 SA_CTX            *ctx,
  732.                                 SA_CHAR            *name,
  733.                                 SA_INT            namelen
  734.                                 );
  735. extern SA_RETCODE SA_EXPORT        sa_group_delete(
  736.                                 SA_CTX            *ctx,
  737.                                 SA_CHAR            *name,
  738.                                 SA_INT            namelen
  739.                                 );
  740. extern SA_RETCODE SA_EXPORT        sa_group_list(
  741.                                 SA_CTX            *ctx,
  742.                                 SA_GROUP        *groups,
  743.                                 SA_INT            numgroups,
  744.                                 SA_INT            *countp
  745.                                 );
  746.  
  747. /*
  748. ** Profile Functions
  749. */
  750. extern SA_RETCODE SA_EXPORT        sa_profile_init(
  751.                                 SA_CTX            *ctx,
  752.                                 SA_CHAR            *username,
  753.                                 SA_INT            usernamelen,
  754.                                 SA_PROFILE        **profilep
  755.                                 );
  756. extern SA_RETCODE SA_EXPORT        sa_profile_exit(
  757.                                 SA_CTX            *ctx,
  758.                                 SA_PROFILE        *profile
  759.                                 );
  760. extern SA_RETCODE SA_EXPORT        sa_profile_save(
  761.                                 SA_CTX            *ctx,
  762.                                 SA_PROFILE        *profile
  763.                                 );
  764. extern SA_RETCODE SA_EXPORT        sa_profile_get(
  765.                                 SA_CTX            *ctx,
  766.                                 SA_PROFILE        *profile,
  767.                                 SA_CHAR            *name,
  768.                                 SA_INT            namelen,
  769.                                 SA_CHAR            **datap
  770.                                 );
  771. extern SA_RETCODE SA_EXPORT        sa_profile_set(
  772.                                 SA_CTX            *ctx,
  773.                                 SA_PROFILE        *profile,
  774.                                 SA_CHAR            *name,
  775.                                 SA_INT            namelen,
  776.                                 SA_CHAR            *value
  777.                                 );
  778.  
  779.  
  780. /*
  781. ** Search Functions
  782. */
  783. extern SA_RETCODE SA_EXPORT        sa_search_add(
  784.                                 SA_CTX            *ctx,
  785.                                 SA_CHAR            *indexname,
  786.                                 SA_CHAR            *title,
  787.                                 SA_CHAR            *url,
  788.                                 SA_CHAR            *data,
  789.                                 SA_INT            datalen
  790.                                 );
  791.  
  792. /*
  793. ** RAS Functions
  794. */
  795. extern SA_RETCODE SA_EXPORT        sa_ras_disconnect(
  796.                                 SA_CTX            *ctx,
  797.                                 SA_BOOL            *activep
  798.                                 );
  799.  
  800. /*
  801. ** Record Functions
  802. */
  803. extern SA_RETCODE SA_EXPORT        sa_rec_init(
  804.                                 SA_CTX            *ctx,
  805.                                 SA_CHAR            *filename,
  806.                                 SA_INT            flags,
  807.                                 SA_INT            reclen,
  808.                                 SA_REC            **recp
  809.                                 );
  810. extern SA_RETCODE SA_EXPORT        sa_rec_exit(
  811.                                 SA_REC            *rec,
  812.                                 SA_INT            flags
  813.                                 );
  814. extern SA_RETCODE SA_EXPORT        sa_rec_insert(
  815.                                 SA_REC            *rec,
  816.                                 SA_BYTE            *data,
  817.                                 SA_INT            *idp
  818.                                 );
  819. extern SA_RETCODE SA_EXPORT        sa_rec_update(
  820.                                 SA_REC            *rec,
  821.                                 SA_INT            id,
  822.                                 SA_BYTE            *data
  823.                                 );
  824. extern SA_RETCODE SA_EXPORT        sa_rec_delete(
  825.                                 SA_REC            *rec,
  826.                                 SA_INT            id
  827.                                 );
  828. extern SA_RETCODE SA_EXPORT        sa_rec_fetch(
  829.                                 SA_REC            *rec,
  830.                                 SA_INT            id,
  831.                                 SA_BYTE            *data
  832.                                 );
  833. extern SA_RETCODE SA_EXPORT        sa_rec_next(
  834.                                 SA_REC            *rec,
  835.                                 SA_INT            lastid,
  836.                                 SA_BYTE            *data,
  837.                                 SA_INT            *idp
  838.                                 );
  839.  
  840. /*
  841. ** General Utilities
  842. */
  843. extern SA_INT SA_EXPORT            sa_dirsize(
  844.                                 SA_CHAR            *dirpath
  845.                                 );
  846. extern SA_INT SA_EXPORT            sa_dirfiles(
  847.                                 SA_CHAR            *dirpath
  848.                                 );
  849. extern SA_RETCODE SA_EXPORT        sa_gzip(
  850.                                 SA_CHAR            *filename,
  851.                                 SA_CHAR            *ext
  852.                                 );
  853. extern SA_RETCODE SA_EXPORT        sa_gunzip(
  854.                                 SA_CHAR            *filename,
  855.                                 SA_CHAR            *ext
  856.                                 );
  857. extern SA_RETCODE SA_EXPORT        sa_compress(
  858.                                 SA_BYTE            *in,
  859.                                 SA_INT            inlen,
  860.                                 SA_BYTE            *out,
  861.                                 SA_INT            *outlenp
  862.                                 );
  863. extern SA_RETCODE SA_EXPORT        sa_uncompress(
  864.                                 SA_BYTE            *in,
  865.                                 SA_INT            inlen,
  866.                                 SA_BYTE            *out,
  867.                                 SA_INT            *outlenp
  868.                                 );
  869.  
  870. #if defined(__cplusplus)
  871. }
  872. #endif    /* defined(__cplusplus) */
  873.  
  874. #endif /* __SAMBAR_H__ */
  875.