www.beck-ipc.com

Data Structures used in CGI API - SC12 @CHIP-RTOS V1.10


    IPC@CHIP Documentation Index

Data Structures

Here are the data structures used by the CGI API.
All constants and data structures are defined in the header file cgi.h

Notes:
  • Byte alignment is required for all data structures used within the API.

Contents :

  • _typedef CGI_Entry
  • _define CGI HTTP Request
  • _typedef FormItem
  • _typedef rpCgi

  • typedef CGI_Entry

                
    typedef struct tag_cgi_table
    
    {
    
        char         *PathPtr;     // Name of the page, URL
    
        int           method;      // http method: Get, Head  or Post
    
        RpCgiFuncPtr  CgiFuncPtr;  // ptr to callback function for this page
    
    
    
    } CGI_Entry;

    Comments

    The members of the CGI_Entry structure should be filled as follows.

    PathPtr
      This is a far pointer to a zero terminated URL address of the page.   (URL's are case sensitive.)

    method
      This int is an enumerator used to specify what HTTP method this CGI function supports.

    CgiFuncPtr
      This is a far vector to the CGI function for this Web page.   For Borland C compilers the RpCgiFuncPtr type is:

        typedef void (huge _pascal *RpCgiFuncPtr)
                    (rpCgi far *CgiRequestPtr);


            ... and therefore the CGI function itself is declared as ...

        void huge _pascal CGI_Func(rpCgi far *CgiRequest);

      For Microsoft Visual C compilers the RpCgiFuncPtr type is:

        typedef void far _saveregs _loadds _pascal
            (*RpCgiFuncPtr)(rpCgi far *CgiRequestPtr);


            ... and the CGI function declared as ...

        void far _saveregs _loadds _pascal
                CGI_Func(rpCgi far *CgiRequest);

    Related Topics

    API function CGI_INSTALL - Install a CGI function
    rpCgi structure type

    Top of list
    Index page

    define CGI HTTP Request

                
    #define CgiHttpGet  1       //  Cgi request is HTTP GET
    
    #define CgiHttpHead 2       //  Cgi request is HTTP HEAD
    
    #define CgiHttpPost 3       //  Cgi request is HTTP POST

    Comments

    These defines are used as enumeration names for request methods.

    Related Topics

    method member of CGI_Entry type

    Top of list
    Index page

    typedef FormItem

                
    typedef struct tag_form_item
    
    {
    
        char   *NamePtr;  //Buffer, pointed by NamePtr should have 64 bytes length
    
        char   *ValuePtr; //Buffer, pointed by ValuePtr should have 256 bytes length
    
    } FormItem;

    Comments

    Both strings referenced here are null terminated.

    Related Topics

    API function CGI_GETFORMITEM - Split a formular into name and value

    Top of list
    Index page

    typedef rpCgi

                
    typedef struct {
    
        //******************************************************
    
        //    Request fields  (Read Only!!!!)
    
        //******************************************************
    
        unsigned char  fConnectionId;          // -- internal use only --
    
        int            fHttpRequest;           // get, post, head
    
        char          *fPathPtr;               // URL
    
        char          *fHostPtr;               // Host:
    
        char          *fRefererPtr;            // (at time not supported)
    
        char          *fAgentPtr;              // (at time not supported)
    
        char          *fLanguagePtr;           // (at time not supported)
    
        unsigned long  fBrowserDate;           // Date:   (internal)
    
        char          *fArgumentBufferPtr;     // Pointer to argument buf
    
        long           fArgumentBufferLength;  // Length of argument buf
    
        char          *fUserNamePtr;           // Username from Authorization
    
        char          *fPasswordPtr;           // Password from Authorization
    
        long          *fRemoteIPPtr;           // new at V1.00 Beta, points to the remoteIP,
    
                                               // you must split the octets
    
                                               // For using the IP to etsablish TCP/IP
    
                                               // connections, you have to exchange
    
                                               // lowbyte and highbyte!
    
    
    
        //******************************************************
    
        //    Response fields  (Set by CGI function)
    
        //******************************************************
    
        int            fResponseState;         // -- internal, do not modify --
    
        int            fHttpResponse;          // Response httpmsg e.g. CgiHttpOk
    
        int            fDataType;              // Content type, e.g. text/HTML, text/plain
    
        char          *fResponseBufferPtr;     // Pointer to the created page
    
        long           fResponseBufferLength;  // Length of the page (max. length is 65519 chars)
    
        unsigned long  fObjectDate;            // -- internal, do not modify --
    
        unsigned int   fHostIndex;             // -- internal, do not modify --
    
    
    
    } rpCgi, *rpCgiPtr;

    Comments

    fDataType
      This is an enumeration type that specifies the file type.

    Related Topics

    CGI Callback Function

    Top of list
    Index page


    End of document