Ignore:
Timestamp:
Feb 2, 2015, 9:55:48 AM (7 years ago)
Author:
david
Message:
  • FCX_Stream integration
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PublicaMundi_David-devel/thirds/cgic206/cgic.h

    r511 r548  
    1010        types defined by it, such as FILE *. */
    1111
    12 #include "fcgi_stdio.h"
    13 //#include <stdio.h>
     12//#include "fcgi_stdio.h"
     13#include <fcgiapp.h>
     14#include <stdio.h>
    1415
    1516/* The various CGI environment variables. Instead of using getenv(),
     
    2122        for debugging. */
    2223
    23 extern
    24 #ifdef __cplusplus
    25 "C"
    26 #endif
     24
     25typedef struct cgiFormEntryStruct {
     26        char *attr;
     27    /* value is populated for regular form fields only.
     28        For file uploads, it points to an empty string, and file
     29        upload data should be read from the file tfileName. */
     30    char *value;
     31    /* When fileName is not an empty string, tfileName is not null,
     32        and 'value' points to an empty string. */
     33    /* Valid for both files and regular fields; does not include
     34        terminating null of regular fields. */
     35    int valueLength;
     36    char *fileName;
     37    char *contentType;
     38    /* Temporary file name for working storage of file uploads. */
     39    char *tfileName;
     40        struct cgiFormEntryStruct *next;
     41} cgiFormEntry;
     42
     43
     44
     45
     46struct cgi_env {
     47int cgiRestored;// = 0;
    2748char *cgiServerSoftware;
    28 extern
    29 #ifdef __cplusplus
    30 "C"
    31 #endif
    3249char *cgiServerName;
    33 extern
    34 #ifdef __cplusplus
    35 "C"
    36 #endif
    3750char *cgiGatewayInterface;
    38 extern
    39 #ifdef __cplusplus
    40 "C"
    41 #endif
    4251char *cgiServerProtocol;
    43 extern
    44 #ifdef __cplusplus
    45 "C"
    46 #endif
    4752char *cgiServerPort;
    48 extern
    49 #ifdef __cplusplus
    50 "C"
    51 #endif
    5253char *cgiRequestMethod;
    53 extern
    54 #ifdef __cplusplus
    55 "C"
    56 #endif
    5754char *cgiPathInfo;
    58 extern
    59 #ifdef __cplusplus
    60 "C"
    61 #endif
    6255char *cgiPathTranslated;
    63 extern
    64 #ifdef __cplusplus
    65 "C"
    66 #endif
    6756char *cgiScriptName;
    68 extern
    69 #ifdef __cplusplus
    70 "C"
    71 #endif
    7257char *cgiQueryString;
    73 extern
    74 #ifdef __cplusplus
    75 "C"
    76 #endif
    7758char *cgiRemoteHost;
    78 extern
    79 #ifdef __cplusplus
    80 "C"
    81 #endif
    8259char *cgiRemoteAddr;
    83 extern
    84 #ifdef __cplusplus
    85 "C"
    86 #endif
    8760char *cgiAuthType;
    88 extern
    89 #ifdef __cplusplus
    90 "C"
    91 #endif
    9261char *cgiRemoteUser;
    93 extern
    94 #ifdef __cplusplus
    95 "C"
    96 #endif
    9762char *cgiRemoteIdent;
    98 extern
    99 #ifdef __cplusplus
    100 "C"
    101 #endif
    102 char *cgiContentType;
    103 extern
    104 #ifdef __cplusplus
    105 "C"
    106 #endif
     63char cgiContentTypeData[1024];
     64char *cgiContentType;// = cgiContentTypeData;
     65
     66char * cgiMultipartBoundary;
     67cgiFormEntry *cgiFormEntryFirst;
     68int cgiTreatUrlEncoding;
     69
    10770char *cgiAccept;
    108 extern
    109 #ifdef __cplusplus
    110 "C"
    111 #endif
    11271char *cgiUserAgent;
    113 extern
    114 #ifdef __cplusplus
    115 "C"
    116 #endif
    11772char *cgiReferrer;
    11873
    11974/* Cookies as sent to the server. You can also get them
    12075        individually, or as a string array; see the documentation. */
    121 extern
    122 #ifdef __cplusplus
    123 "C"
    124 #endif
    12576char *cgiCookie;
    126 
    127 extern
    128 #ifdef __cplusplus
    129 "C"
    130 #endif
    13177char *cgiSid;
    13278
     
    14086        directly from cgiIn; the programmer need not do so. */
    14187
    142 extern
    143 #ifdef __cplusplus
    144 "C"
    145 #endif
    14688int cgiContentLength;
    14789
     
    15294        cgiOut is always equivalent to stdout. */
    15395
    154 extern
    155 #ifdef __cplusplus
    156 "C"
    157 #endif
    158 FILE *cgiOut;
    159 
    160 /* Pointer to CGI input. The programmer does not read from this.
    161         We have continued to export it for backwards compatibility
    162         so that cgic 1.x applications link properly. */
    163 
    164 extern
    165 #ifdef __cplusplus
    166 "C"
    167 #endif
    168 FILE *cgiIn;
    169 
     96char *cgiFindTarget;
     97cgiFormEntry *cgiFindPos;
     98
     99};
    170100/* Possible return codes from the cgiForm family of functions (see below). */
    171101
     
    195125#endif
    196126cgiFormResultType cgiFormString(
    197         char *name, char *result, int max);
     127        char *name, char *result, int max,struct cgi_env **);
    198128
    199129extern
     
    202132#endif
    203133cgiFormResultType cgiFormStringNoNewlines(
    204         char *name, char *result, int max);
     134        char *name, char *result, int max,struct cgi_env ** ce);
    205135
    206136
     
    210140#endif
    211141cgiFormResultType cgiFormStringSpaceNeeded(
    212         char *name, int *length);
     142        char *name, int *length,struct cgi_env ** ce);
    213143
    214144
     
    218148#endif
    219149cgiFormResultType cgiFormStringMultiple(
    220         char *name, char ***ptrToStringArray);
     150        char *name, char ***ptrToStringArray,struct cgi_env ** ce);
    221151
    222152extern
     
    231161#endif
    232162cgiFormResultType cgiFormInteger(
    233         char *name, int *result, int defaultV);
     163        char *name, int *result, int defaultV,struct cgi_env ** ce);
    234164
    235165extern
     
    238168#endif
    239169cgiFormResultType cgiFormIntegerBounded(
    240         char *name, int *result, int min, int max, int defaultV);
     170        char *name, int *result, int min, int max, int defaultV,struct cgi_env **ce);
    241171
    242172extern
     
    245175#endif
    246176cgiFormResultType cgiFormDouble(
    247         char *name, double *result, double defaultV);
     177        char *name, double *result, double defaultV,struct cgi_env **);
    248178
    249179extern
     
    252182#endif
    253183cgiFormResultType cgiFormDoubleBounded(
    254         char *name, double *result, double min, double max, double defaultV);
     184        char *name, double *result, double min, double max, double defaultV, struct cgi_env ** ce);
    255185
    256186extern
     
    260190cgiFormResultType cgiFormSelectSingle(
    261191        char *name, char **choicesText, int choicesTotal,
    262         int *result, int defaultV);     
     192        int *result, int defaultV,struct cgi_env **ce);
    263193
    264194
     
    269199cgiFormResultType cgiFormSelectMultiple(
    270200        char *name, char **choicesText, int choicesTotal,
    271         int *result, int *invalid);
     201        int *result, int *invalid,struct cgi_env **);
    272202
    273203/* Just an alias; users have asked for this */
     
    279209#endif
    280210cgiFormResultType cgiFormCheckboxSingle(
    281         char *name);
     211        char *name,struct cgi_env ** ce);
    282212
    283213extern
     
    287217cgiFormResultType cgiFormCheckboxMultiple(
    288218        char *name, char **valuesText, int valuesTotal,
    289         int *result, int *invalid);
     219        int *result, int *invalid,struct cgi_env ** ce);
    290220
    291221extern
     
    295225cgiFormResultType cgiFormRadio(
    296226        char *name, char **valuesText, int valuesTotal,
    297         int *result, int defaultV);     
     227        int *result, int defaultV,struct cgi_env **ce);
    298228
    299229/* The paths returned by this function are the original names of files
     
    305235#endif
    306236cgiFormResultType cgiFormFileName(
    307         char *name, char *result, int max);
     237        char *name, char *result, int max,struct cgi_env **);
    308238
    309239/* The content type of the uploaded file, as reported by the browser.
     
    315245#endif
    316246cgiFormResultType cgiFormFileContentType(
    317         char *name, char *result, int max);
     247        char *name, char *result, int max,struct cgi_env ** ce);
    318248
    319249extern
     
    322252#endif
    323253cgiFormResultType cgiFormFileSize(
    324         char *name, int *sizeP);
     254        char *name, int *sizeP,struct cgi_env ** ce);
    325255
    326256typedef struct cgiFileStruct *cgiFilePtr;
     
    331261#endif
    332262cgiFormResultType cgiFormFileOpen(
    333         char *name, cgiFilePtr *cfpp);
     263        char *name, cgiFilePtr *cfpp,struct cgi_env ** ce);
    334264
    335265extern
     
    352282#endif
    353283cgiFormResultType cgiCookieString(
    354         char *name, char *result, int max);
     284        char *name, char *result, int max,char * cgiCookie);
    355285
    356286extern
     
    359289#endif
    360290cgiFormResultType cgiCookieInteger(
    361         char *name, int *result, int defaultV);
     291        char *name, int *result, int defaultV,char * cgiCookie);
    362292
    363293cgiFormResultType cgiCookies(
    364         char ***ptrToStringArray);
     294        char ***ptrToStringArray,char* cgiCookie);
    365295
    366296/* path can be null or empty in which case a path of / (entire site) is set.
     
    372302#endif
    373303void cgiHeaderCookieSetString(char *name, char *value,
    374         int secondsToLive, char *path, char *domain);
     304        int secondsToLive, char *path, char *domain,FCGX_Stream *out);
    375305extern
    376306#ifdef __cplusplus
     
    378308#endif
    379309void cgiHeaderCookieSetInteger(char *name, int value,
    380         int secondsToLive, char *path, char *domain);
    381 extern
    382 #ifdef __cplusplus
    383 "C"
    384 #endif
    385 void cgiHeaderLocation(char *redirectUrl);
    386 extern
    387 #ifdef __cplusplus
    388 "C"
    389 #endif
    390 void cgiHeaderStatus(int status, char *statusMessage);
    391 extern
    392 #ifdef __cplusplus
    393 "C"
    394 #endif
    395 void cgiHeaderContentType(char *mimeType);
     310        int secondsToLive, char *path, char *domain,FCGX_Stream *out);
     311extern
     312#ifdef __cplusplus
     313"C"
     314#endif
     315void cgiHeaderLocation(char *redirectUrl,FCGX_Stream * out);
     316extern
     317#ifdef __cplusplus
     318"C"
     319#endif
     320void cgiHeaderStatus(int status, char *statusMessage,FCGX_Stream * out);
     321extern
     322#ifdef __cplusplus
     323"C"
     324#endif
     325void cgiHeaderContentType(char *mimeType,FCGX_Stream * out);
    396326
    397327typedef enum {
     
    421351#endif
    422352cgiFormResultType cgiFormEntries(
    423         char ***ptrToStringArray);
     353        char ***ptrToStringArray,struct cgi_env **ce);
    424354
    425355/* Output string with the <, &, and > characters HTML-escaped.
    426356        's' is null-terminated. Returns cgiFormIO in the event
    427357        of error, cgiFormSuccess otherwise. */
    428 cgiFormResultType cgiHtmlEscape(char *s);
     358cgiFormResultType cgiHtmlEscape(char *s,FCGX_Stream *out);
    429359
    430360/* Output data with the <, &, and > characters HTML-escaped.
     
    432362        bytes in 'data'. Returns cgiFormIO in the event
    433363        of error, cgiFormSuccess otherwise. */
    434 cgiFormResultType cgiHtmlEscapeData(char *data, int len);
     364cgiFormResultType cgiHtmlEscapeData(char *data, int len,FCGX_Stream *out);
    435365
    436366/* Output string with the " character HTML-escaped, and no
     
    439369        's' is null-terminated. Returns cgiFormIO in the event
    440370        of error, cgiFormSuccess otherwise. */
    441 cgiFormResultType cgiValueEscape(char *s);
     371cgiFormResultType cgiValueEscape(char *s,FCGX_Stream *out);
    442372
    443373/* Output data with the " character HTML-escaped, and no
     
    447377        bytes in 'data'. Returns cgiFormIO in the event
    448378        of error, cgiFormSuccess otherwise. */
    449 cgiFormResultType cgiValueEscapeData(char *data, int len);
    450 
    451 int cgiMain_init(int argc, char *argv[]);
    452 
    453 void cgiFreeResources();
     379cgiFormResultType cgiValueEscapeData(char *data, int len,FCGX_Stream *out);
     380
     381int cgiMain_init(int argc, char *argv[],struct cgi_env ** c,FCGX_Request *);
     382
     383void cgiFreeResources(struct cgi_env ** c);
    454384
    455385#endif /* CGI_C */
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png