diff options
Diffstat (limited to 'sapi/litespeed/lsapilib.h')
-rw-r--r-- | sapi/litespeed/lsapilib.h | 287 |
1 files changed, 0 insertions, 287 deletions
diff --git a/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h deleted file mode 100644 index e1c156fa51..0000000000 --- a/sapi/litespeed/lsapilib.h +++ /dev/null @@ -1,287 +0,0 @@ -/* -Copyright (c) 2005, Lite Speed Technologies Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of the Lite Speed Technologies Inc nor the - names of its contributors may be used to endorse or promote - products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/*************************************************************************** - lsapilib.h - description - ------------------- - begin : Mon Feb 21 2005 - copyright : (C) 2005 by George Wang - email : gwang@litespeedtech.com - ***************************************************************************/ - - -#ifndef _LSAPILIB_H_ -#define _LSAPILIB_H_ - -#if defined (c_plusplus) || defined (__cplusplus) -extern "C" { -#endif - -#include <stddef.h> -#include <lsapidef.h> - -struct LSAPI_key_value_pair -{ - char * pKey; - char * pValue; - int keyLen; - int valLen; -}; - - -#define LSAPI_MAX_RESP_HEADERS 100 - -typedef struct lsapi_request -{ - int m_fdListen; - int m_fd; - - char * m_pReqBuf; - int m_reqBufSize; - - char * m_pRespBuf; - char * m_pRespBufEnd; - char * m_pRespBufPos; - - char * m_pRespHeaderBuf; - char * m_pRespHeaderBufEnd; - char * m_pRespHeaderBufPos; - - - struct iovec * m_pIovec; - struct iovec * m_pIovecEnd; - struct iovec * m_pIovecCur; - struct iovec * m_pIovecToWrite; - - struct lsapi_packet_header * m_respPktHeaderEnd; - - struct lsapi_req_header * m_pHeader; - struct LSAPI_key_value_pair * m_pEnvList; - struct LSAPI_key_value_pair * m_pSpecialEnvList; - int m_envListSize; - int m_specialEnvListSize; - - struct lsapi_http_header_index * m_pHeaderIndex; - struct lsapi_header_offset * m_pUnknownHeader; - - char * m_pScriptFile; - char * m_pScriptName; - char * m_pQueryString; - char * m_pHttpHeader; - char * m_pRequestMethod; - int m_totalLen; - int m_reqState; - int m_reqBodyRead; - int m_bufProcessed; - int m_bufRead; - - struct lsapi_packet_header m_respPktHeader[5]; - - struct lsapi_resp_header m_respHeader; - short m_respHeaderLen[LSAPI_MAX_RESP_HEADERS]; - -}LSAPI_Request; - -extern LSAPI_Request g_req; - - -//return: >0 continue, ==0 stop, -1 failed -typedef int (*LSAPI_CB_EnvHandler )( const char * pKey, int keyLen, - const char * pValue, int valLen, void * arg ); - - -int LSAPI_Init(void); - -void LSAPI_stop(void); - -int LSAPI_Is_Listen_r( LSAPI_Request * pReq); - -int LSAPI_InitRequest( LSAPI_Request * pReq, int fd ); - -int LSAPI_Accept_r( LSAPI_Request * pReq ); - -void LSAPI_Reset_r( LSAPI_Request * pReq ); - -int LSAPI_Finish_r( LSAPI_Request * pReq ); - -int LSAPI_Release_r( LSAPI_Request * pReq ); - -char * LSAPI_GetHeader_r( LSAPI_Request * pReq, int headerIndex ); - -int LSAPI_ForeachHeader_r( LSAPI_Request * pReq, - LSAPI_CB_EnvHandler fn, void * arg ); - -int LSAPI_ForeachEnv_r( LSAPI_Request * pReq, - LSAPI_CB_EnvHandler fn, void * arg ); - -int LSAPI_ForeachSpecialEnv_r( LSAPI_Request * pReq, - LSAPI_CB_EnvHandler fn, void * arg ); - -char * LSAPI_GetEnv_r( LSAPI_Request * pReq, const char * name ); - - -int LSAPI_GetContentLen_r( LSAPI_Request * pReq ); - -int LSAPI_ReadReqBody_r( LSAPI_Request * pReq, char * pBuf, int len ); - -int LSAPI_FinalizeRespHeaders_r( LSAPI_Request * pReq ); - -int LSAPI_Write_r( LSAPI_Request * pReq, const char * pBuf, int len ); - -int LSAPI_Write_Stderr_r( LSAPI_Request * pReq, const char * pBuf, int len ); - -int LSAPI_Flush_r( LSAPI_Request * pReq ); - -int LSAPI_AppendRespHeader_r( LSAPI_Request * pHeader, char * pBuf, int len ); - -static inline int LSAPI_SetRespStatus_r( LSAPI_Request * pReq, int code ) -{ - if ( !pReq ) - return -1; - pReq->m_respHeader.m_respInfo.m_status = code; - return 0; -} - -static inline char * LSAPI_GetQueryString_r( LSAPI_Request * pReq ) -{ - if ( pReq ) - return pReq->m_pQueryString; - return NULL; -} - - -static inline char * LSAPI_GetScriptFileName_r( LSAPI_Request * pReq ) -{ - if ( pReq ) - return pReq->m_pScriptFile; - return NULL; -} - - -static inline char * LSAPI_GetScriptName_r( LSAPI_Request * pReq ) -{ - if ( pReq ) - return pReq->m_pScriptName; - return NULL; -} - - -static inline char * LSAPI_GetRequestMethod_r( LSAPI_Request * pReq) -{ - if ( pReq ) - return pReq->m_pRequestMethod; - return NULL; -} - - - -static inline int LSAPI_GetReqBodyLen_r( LSAPI_Request * pReq ) -{ - if ( pReq ) - return pReq->m_pHeader->m_reqBodyLen; - return -1; -} - - -int LSAPI_Is_Listen(void); - -static inline int LSAPI_Accept( void ) -{ return LSAPI_Accept_r( &g_req ); } - -static inline int LSAPI_Finish(void) -{ return LSAPI_Finish_r( &g_req ); } - -static inline char * LSAPI_GetHeader( int headerIndex ) -{ return LSAPI_GetHeader_r( &g_req, headerIndex ); } - -static inline int LSAPI_ForeachHeader( LSAPI_CB_EnvHandler fn, void * arg ) -{ return LSAPI_ForeachHeader_r( &g_req, fn, arg ); } - -static inline int LSAPI_ForeachEnv( LSAPI_CB_EnvHandler fn, void * arg ) -{ return LSAPI_ForeachEnv_r( &g_req, fn, arg ); } - -static inline int LSAPI_ForeachSpecialEnv( LSAPI_CB_EnvHandler fn, void * arg ) -{ return LSAPI_ForeachSpecialEnv_r( &g_req, fn, arg ); } - -static inline char * LSAPI_GetEnv( const char * name ) -{ return LSAPI_GetEnv_r( &g_req, name ); } - -static inline char * LSAPI_GetQueryString() -{ return LSAPI_GetQueryString_r( &g_req ); } - -static inline char * LSAPI_GetScriptFileName() -{ return LSAPI_GetScriptFileName_r( &g_req ); } - -static inline char * LSAPI_GetScriptName() -{ return LSAPI_GetScriptName_r( &g_req ); } - -static inline char * LSAPI_GetRequestMethod() -{ return LSAPI_GetRequestMethod_r( &g_req ); } - -static inline int LSAPI_GetReqBodyLen() -{ return LSAPI_GetReqBodyLen_r( &g_req ); } - -static inline int LSAPI_ReadReqBody( char * pBuf, int len ) -{ return LSAPI_ReadReqBody_r( &g_req, pBuf, len ); } - -static inline int LSAPI_FinalizeRespHeaders(void) -{ return LSAPI_FinalizeRespHeaders_r( &g_req ); } - -static inline int LSAPI_Write( const char * pBuf, int len ) -{ return LSAPI_Write_r( &g_req, pBuf, len ); } - -static inline int LSAPI_Write_Stderr( const char * pBuf, int len ) -{ return LSAPI_Write_Stderr_r( &g_req, pBuf, len ); } - -static inline int LSAPI_Flush() -{ return LSAPI_Flush_r( &g_req ); } - -static inline int LSAPI_AppendRespHeader( char * pBuf, int len ) -{ return LSAPI_AppendRespHeader_r( &g_req, pBuf, len ); } - -static inline int LSAPI_SetRespStatus( int code ) -{ return LSAPI_SetRespStatus_r( &g_req, code ); } - - -#if defined (c_plusplus) || defined (__cplusplus) -} -#endif - - -#endif - - - - - - - |