⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fcgiapp.h

📁 FastCGI,语言无关的、可伸缩架构的CGI开放扩展
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * fcgiapp.h -- * *      Definitions for FastCGI application server programs * * * Copyright (c) 1996 Open Market, Inc. * * See the file "LICENSE.TERMS" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * $Id: fcgiapp.h,v 1.12 2001/11/21 21:10:11 robs Exp $ */#ifndef _FCGIAPP_H#define _FCGIAPP_H/* Hack to see if we are building TCL - TCL needs varargs not stdarg */#ifndef TCL_LIBRARY#include <stdarg.h>#else#include <varargs.h>#endif#ifndef DLLAPI#ifdef _WIN32#define DLLAPI __declspec(dllimport)#else#define DLLAPI#endif#endif#if defined (c_plusplus) || defined (__cplusplus)extern "C" {#endif/* * Error codes.  Assigned to avoid conflict with EOF and errno(2). */#define FCGX_UNSUPPORTED_VERSION -2#define FCGX_PROTOCOL_ERROR -3#define FCGX_PARAMS_ERROR -4#define FCGX_CALL_SEQ_ERROR -5/* * This structure defines the state of a FastCGI stream. * Streams are modeled after the FILE type defined in stdio.h. * (We wouldn't need our own if platform vendors provided a * standard way to subclass theirs.) * The state of a stream is private and should only be accessed * by the procedures defined below. */typedef struct FCGX_Stream {    unsigned char *rdNext;    /* reader: first valid byte                               * writer: equals stop */    unsigned char *wrNext;    /* writer: first free byte                               * reader: equals stop */    unsigned char *stop;      /* reader: last valid byte + 1                               * writer: last free byte + 1 */    unsigned char *stopUnget; /* reader: first byte of current buffer                               * fragment, for ungetc                               * writer: undefined */    int isReader;    int isClosed;    int wasFCloseCalled;    int FCGI_errno;                /* error status */    void (*fillBuffProc) (struct FCGX_Stream *stream);    void (*emptyBuffProc) (struct FCGX_Stream *stream, int doClose);    void *data;} FCGX_Stream;/* * An environment (as defined by environ(7)): A NULL-terminated array * of strings, each string having the form name=value. */typedef char **FCGX_ParamArray;/* * FCGX_Request Flags * * Setting FCGI_FAIL_ACCEPT_ON_INTR prevents FCGX_Accept() from * restarting upon being interrupted. */#define FCGI_FAIL_ACCEPT_ON_INTR	1/* * FCGX_Request -- State associated with a request. * * Its exposed for API simplicity, I expect parts of it to change! */typedef struct FCGX_Request {    int requestId;            /* valid if isBeginProcessed */    int role;    FCGX_Stream *in;    FCGX_Stream *out;    FCGX_Stream *err;	char **envp;	/* Don't use anything below here */    struct Params *paramsPtr;    int ipcFd;               /* < 0 means no connection */    int isBeginProcessed;     /* FCGI_BEGIN_REQUEST seen */    int keepConnection;       /* don't close ipcFd at end of request */    int appStatus;    int nWriters;             /* number of open writers (0..2) */	int flags;	int listen_sock;} FCGX_Request;/* *====================================================================== * Control *====================================================================== *//* *---------------------------------------------------------------------- * * FCGX_IsCGI -- * *      Returns TRUE iff this process appears to be a CGI process *      rather than a FastCGI process. * *---------------------------------------------------------------------- */DLLAPI int FCGX_IsCGI(void);/* *---------------------------------------------------------------------- * * FCGX_Init -- * *      Initialize the FCGX library.  Call in multi-threaded apps *      before calling FCGX_Accept_r(). * *      Returns 0 upon success. * *---------------------------------------------------------------------- */DLLAPI int FCGX_Init(void);/* *---------------------------------------------------------------------- * * FCGX_OpenSocket -- * *	Create a FastCGI listen socket. * *	path is the Unix domain socket (named pipe for WinNT), or a colon *	followed by a port number.  e.g. "/tmp/fastcgi/mysocket", ":5000" * *	backlog is the listen queue depth used in the listen() call. * *  Returns the socket's file descriptor or -1 on error. * *---------------------------------------------------------------------- */DLLAPI int FCGX_OpenSocket(const char *path, int backlog);/* *---------------------------------------------------------------------- * * FCGX_InitRequest -- * *	Initialize a FCGX_Request for use with FCGX_Accept_r(). * * 	sock is a file descriptor returned by FCGX_OpenSocket() or 0 (default). * 	The only supported flag at this time is FCGI_FAIL_ON_INTR. * * 	Returns 0 upon success. *---------------------------------------------------------------------- */DLLAPI int FCGX_InitRequest(FCGX_Request *request, int sock, int flags);/* *---------------------------------------------------------------------- * * FCGX_Accept_r -- * *      Accept a new request (multi-thread safe).  Be sure to call * 	FCGX_Init() first. * * Results: *	0 for successful call, -1 for error. * * Side effects: * *      Finishes the request accepted by (and frees any *      storage allocated by) the previous call to FCGX_Accept. *      Creates input, output, and error streams and *      assigns them to *in, *out, and *err respectively. *      Creates a parameters data structure to be accessed *      via getenv(3) (if assigned to environ) or by FCGX_GetParam *      and assigns it to *envp. * *      DO NOT retain pointers to the envp array or any strings *      contained in it (e.g. to the result of calling FCGX_GetParam), *      since these will be freed by the next call to FCGX_Finish *      or FCGX_Accept. * *	DON'T use the FCGX_Request, its structure WILL change. * *---------------------------------------------------------------------- */DLLAPI int FCGX_Accept_r(FCGX_Request *request);/* *---------------------------------------------------------------------- * * FCGX_Finish_r -- * *      Finish the request (multi-thread safe). * * Side effects: * *      Finishes the request accepted by (and frees any *      storage allocated by) the previous call to FCGX_Accept. * *      DO NOT retain pointers to the envp array or any strings *      contained in it (e.g. to the result of calling FCGX_GetParam), *      since these will be freed by the next call to FCGX_Finish *      or FCGX_Accept. * *---------------------------------------------------------------------- */DLLAPI void FCGX_Finish_r(FCGX_Request *request);/* *---------------------------------------------------------------------- * * FCGX_Free -- * *      Free the memory and, if close is true,  *	    IPC FD associated with the request (multi-thread safe). * *---------------------------------------------------------------------- */DLLAPI void FCGX_Free(FCGX_Request * request, int close);/* *---------------------------------------------------------------------- * * FCGX_Accept -- * *      Accept a new request (NOT multi-thread safe). * * Results: *	0 for successful call, -1 for error. * * Side effects: * *      Finishes the request accepted by (and frees any *      storage allocated by) the previous call to FCGX_Accept. *      Creates input, output, and error streams and *      assigns them to *in, *out, and *err respectively. *      Creates a parameters data structure to be accessed *      via getenv(3) (if assigned to environ) or by FCGX_GetParam *      and assigns it to *envp. * *      DO NOT retain pointers to the envp array or any strings *      contained in it (e.g. to the result of calling FCGX_GetParam), *      since these will be freed by the next call to FCGX_Finish *      or FCGX_Accept. * *---------------------------------------------------------------------- */DLLAPI int FCGX_Accept(        FCGX_Stream **in,        FCGX_Stream **out,        FCGX_Stream **err,        FCGX_ParamArray *envp);/* *---------------------------------------------------------------------- * * FCGX_Finish -- * *      Finish the current request (NOT multi-thread safe). * * Side effects: * *      Finishes the request accepted by (and frees any *      storage allocated by) the previous call to FCGX_Accept. * *      DO NOT retain pointers to the envp array or any strings *      contained in it (e.g. to the result of calling FCGX_GetParam), *      since these will be freed by the next call to FCGX_Finish *      or FCGX_Accept. * *---------------------------------------------------------------------- */DLLAPI void FCGX_Finish(void);/* *---------------------------------------------------------------------- * * FCGX_StartFilterData -- * *      stream is an input stream for a FCGI_FILTER request. *      stream is positioned at EOF on FCGI_STDIN. *      Repositions stream to the start of FCGI_DATA. *      If the preconditions are not met (e.g. FCGI_STDIN has not *      been read to EOF) sets the stream error code to *      FCGX_CALL_SEQ_ERROR. * * Results: *      0 for a normal return, < 0 for error * *---------------------------------------------------------------------- */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -