04dfbe2df034aa7a24bb7195f57f000abca6df5b
[catagits/fcgi2.git] / include / fcgios.h
1 /* 
2  * fcgios.h --
3  *
4  *      Description of file.
5  *
6  *
7  *  Copyright (c) 1996 Open Market, Inc.
8  *  All rights reserved.
9  *
10  *  This file contains proprietary and confidential information and
11  *  remains the unpublished property of Open Market, Inc. Use, 
12  *  disclosure, or reproduction is prohibited except as permitted by 
13  *  express written license agreement with Open Market, Inc. 
14  *
15  *  Bill Snapper
16  *  snapper@openmarket.com
17  */
18 #ifndef _FCGIOS_H
19 #define _FCGIOS_H
20
21 #ifdef _WIN32
22 #define OS_Errno GetLastError()
23 #define OS_SetErrno(err) SetLastError(err)
24 #ifndef DLLAPI
25 #define DLLAPI __declspec(dllimport)
26 #endif
27 #else
28 #define DLLAPI
29 #define OS_Errno errno
30 #define OS_SetErrno(err) errno = (err)
31 #endif
32
33 #ifdef _WIN32
34 #include <io.h>
35 #endif
36
37 #ifndef STDIN_FILENO
38 #define STDIN_FILENO  0
39 #endif
40
41
42 #ifndef STDOUT_FILENO
43 #define STDOUT_FILENO 1
44 #endif
45
46 #ifndef STDERR_FILENO
47 #define STDERR_FILENO 2
48 #endif
49
50 #ifndef MAXPATHLEN
51 #define MAXPATHLEN 1024
52 #endif
53
54 #ifndef X_OK
55 #define X_OK       0x01
56 #endif
57
58 #ifdef _WIN32
59 #ifndef O_NONBLOCK
60 #define O_NONBLOCK     0x0004  /* no delay */
61 #endif
62 #endif
63
64 #if defined (c_plusplus) || defined (__cplusplus)
65 extern "C" {
66 #endif
67
68 #ifndef _CLIENTDATA
69 #   if defined(__STDC__) || defined(__cplusplus)
70     typedef void *ClientData;
71 #   else
72     typedef int *ClientData;
73 #   endif /* __STDC__ */
74 #define _CLIENTDATA
75 #endif
76
77 typedef void (*OS_AsyncProc) (ClientData clientData, int len);
78
79 DLLAPI int OS_LibInit(int stdioFds[3]);
80 DLLAPI void OS_LibShutdown(void);
81 DLLAPI int OS_CreateLocalIpcFd(char *bindPath);
82 DLLAPI int OS_FcgiConnect(char *bindPath);
83 DLLAPI int OS_Read(int fd, char * buf, size_t len);
84 DLLAPI int OS_Write(int fd, char * buf, size_t len);
85 DLLAPI int OS_SpawnChild(char *execPath, int listenFd);
86 DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr, 
87                       ClientData clientData);
88 DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len,
89                  OS_AsyncProc procPtr, ClientData clientData);
90 DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len, 
91                   OS_AsyncProc procPtr, ClientData clientData);
92 DLLAPI int OS_Close(int fd);
93 DLLAPI int OS_CloseRead(int fd);
94 DLLAPI int OS_DoIo(struct timeval *tmo);
95 DLLAPI int OS_FcgiIpcAccept(char *clientAddrList);
96 DLLAPI int OS_IpcClose(int ipcFd);
97 DLLAPI int OS_IsFcgi(void);
98 DLLAPI void OS_SetFlags(int fd, int flags);
99
100 #if defined (__cplusplus) || defined (c_plusplus)
101 } /* terminate extern "C" { */
102 #endif
103
104 #endif /* _FCGIOS_H */