1 /****************************************************************************** 2 * $Id$ 3 * 4 * Project: MapServer 5 * Purpose: cgiRequestObj and CGI parsing utility related declarations. 6 * Author: Steve Lime and the MapServer team. 7 * 8 * Notes: Portions derived from NCSA HTTPd Server's example CGI programs (util.c). 9 * 10 ****************************************************************************** 11 * Copyright (c) 1996-2005 Regents of the University of Minnesota. 12 * 13 * Permission is hereby granted, free of charge, to any person obtaining a 14 * copy of this software and associated documentation files (the "Software"), 15 * to deal in the Software without restriction, including without limitation 16 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 * and/or sell copies of the Software, and to permit persons to whom the 18 * Software is furnished to do so, subject to the following conditions: 19 * 20 * The above copyright notice and this permission notice shall be included in 21 * all copies of this Software or works derived from this Software. 22 * 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 24 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 29 * DEALINGS IN THE SOFTWARE. 30 ****************************************************************************/ 31 32 #ifndef CGIUTIL_H 33 #define CGIUTIL_H 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 #if defined(_WIN32) && !defined(__CYGWIN__) 40 # define MS_DLL_EXPORT __declspec(dllexport) 41 #else 42 #define MS_DLL_EXPORT 43 #endif 44 45 /* 46 ** Misc. defines 47 */ 48 #define MS_DEFAULT_CGI_PARAMS 100 49 50 enum MS_REQUEST_TYPE {MS_GET_REQUEST, MS_POST_REQUEST}; 51 52 /* structure to hold request information */ 53 typedef struct { 54 #ifndef SWIG 55 char **ParamNames; 56 char **ParamValues; 57 #endif 58 59 #ifdef SWIG 60 %immutable; 61 #endif 62 int NumParams; 63 #ifdef SWIG 64 %mutable; 65 #endif 66 67 enum MS_REQUEST_TYPE type; 68 char *contenttype; 69 70 char *postrequest; 71 72 char *httpcookiedata; 73 } cgiRequestObj; 74 75 76 /* 77 ** Function prototypes 78 */ 79 #ifndef SWIG 80 MS_DLL_EXPORT int loadParams(cgiRequestObj *request, char* (*getenv2)(const char*, void* thread_context), 81 char *raw_post_data, ms_uint32 raw_post_data_length, void* thread_context); 82 MS_DLL_EXPORT void getword(char *, char *, char); 83 MS_DLL_EXPORT char *makeword_skip(char *, char, char); 84 MS_DLL_EXPORT char *makeword(char *, char); 85 MS_DLL_EXPORT char *fmakeword(FILE *, char, int *); 86 MS_DLL_EXPORT char x2c(char *); 87 MS_DLL_EXPORT void unescape_url(char *); 88 MS_DLL_EXPORT void plustospace(char *); 89 MS_DLL_EXPORT int rind(char *, char); 90 MS_DLL_EXPORT void send_fd(FILE *, FILE *); 91 MS_DLL_EXPORT int ind(char *, char); 92 MS_DLL_EXPORT void escape_shell_cmd(char *); 93 94 MS_DLL_EXPORT cgiRequestObj *msAllocCgiObj(void); 95 MS_DLL_EXPORT void msFreeCgiObj(cgiRequestObj *request); 96 #endif /*SWIG*/ 97 98 #ifdef __cplusplus 99 } 100 #endif 101 102 #endif /* CGIUTIL_H */ 103