/*!**********************************************************************

  module: vwd95wacom.idl

  -----------------------------------------------------------------------

  responsible:  Holger Bischoff
				Markus Oezgen

  special area: WebAgent

  description:  idl for WebAgentCOM-Interface

  see also:

  -----------------------------------------------------------------------





    ========== licence begin  GPL
    Copyright (c) 1999-2005 SAP AG

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    ========== licence end




************************************************************************/

[
  // UID of library
  uuid(ee05d370-bec7-11d3-a9c1-006094b91c8b),
  version(1.0)
]
library WebAgentCOM
{
    // TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
    importlib("STDOLE2.TLB");

    // Forward declare all types defined in this typelib
    interface IWebAgentCOM;

    interface IWACallBackObject;

    interface IWebAgentCB;
    coclass   CWebAgentCB;

    interface IHttpRequestCB;
    coclass   CHttpRequestCB;

    interface IHttpReplyCB;
    coclass   CHttpReplyCB;


/*!**********************************************************************

  Chapter: interface IWebAgentCOM

  description:
  This interface has to be implented by the user defined request handler.

************************************************************************/

    [
      odl,
      uuid(888c87f0-bec7-11d3-a9c1-006094b91c8b),
      version(1.0),
      hidden,
      dual,
      helpstring("WebAgentCOM: Main Interface"),
      nonextensible,
      oleautomation
    ]
    interface IWebAgentCOM : IUnknown {
        [id(0x60030000)]
    /*!**********************************************************************
      Function: ProcessRequest

      description: Process incoming HTTP request.

      arguments:
        pIWebAgentCB  [in]  WebAgent callback.
        pIReqCB       [in]  Request data callback.
        pIRepCB       [in]  Reply callback.

      return value: HRESULT
    */
            HRESULT ProcessRequest( [in] IWebAgentCB     *pIWebAgentCB,
                                    [in] IHttpRequestCB  *pIReqCB,
                                    [in] IHttpReplyCB    *pIRepCB);
    }; // interface IWebAgentCOM

/*!**********************************************************************

  EndChapter: interface IWebAgentCOM

************************************************************************/
/*!**********************************************************************

  Chapter: interface IWACallBackObject

  description:
  This interface describes a common set of methods (retrieving error info)
  maintained by IWAWebAgentCB, IWAHttpRequestCB and IWAHttpReplyCB.

************************************************************************/
    [
      odl,
      uuid(c8b2a830-c841-11d3-a9c2-006094b91c8b),
      version(1.0),
      hidden,
      dual,
      helpstring("WebAgentCOM: Callback object interface"),
      nonextensible,
      oleautomation
    ]
    interface IWACallBackObject : IUnknown {
    /*!**********************************************************************
      Function: GetErrMsg

      description: Return error text of last error.

      arguments:
        errMsg [out]  Error text.

      return value: HRESULT
    */
        HRESULT GetErrMsg( [out]  BSTR  *errMsg );

    /*!**********************************************************************
      Function: GetErrId

      description: Return error id of last error. These are defined in
      <A HREF="hwd06waerr.html">hwd06waerr.html</A>.

      arguments:
        errId [out]  The error id.

      return value: HRESULT
    */
        HRESULT GetErrId( [out] long *errId );
    }; // interface IWACallBackObject
/*!**********************************************************************

  EndChapter: interface IWACallBackObject

************************************************************************/
/*!**********************************************************************

  Chapter: interface IWebAgentCB

  description:
  This interface is used by the user defined request handler to retrieve
  parameters and write log messages.

************************************************************************/
    [
      odl,
      uuid(8bea5db0-bec7-11d3-a9c1-006094b91c8b),
      version(1.0),
      hidden,
      dual,
      helpstring("WebAgentCOM: WebAgent Callback Interface"),
      nonextensible,
      oleautomation
    ]
    interface IWebAgentCB : IWACallBackObject
    {
    /*!**********************************************************************
      Function: GetParam

      description: Get parameter from the WebAgent.ini file. Only parameters
                   from the section of the ComClass are returned.

      arguments:
        paramName  [in]  Name of parameter.
        paramValue [out] Value of parameter.

      return value: HRESULT
    */
        HRESULT GetParam( [in]   BSTR  paramName,
                          [out]  BSTR *paramValue );

    /*!**********************************************************************
      Function: WriteLogMsg

      description: Write message to the configured log file.

      arguments:
        msg [in] The message text.

      return value: HRESULT
    */
        HRESULT WriteLogMsg( [in] BSTR msg );
    };


    ////////////////////////////////////////////////////////////////////
    // CWebAgentCB
    [
      uuid(cf2824e0-bec7-11d3-a9c1-006094b91c8b),
      version(1.0)
    ]
    coclass CWebAgentCB {
        interface IWebAgentCB;
    };
/*!**********************************************************************

  EndChapter: interface IWebAgentCB

************************************************************************/
/*!**********************************************************************

  Chapter: interface IHttpRequestCB

  description:
  This interface is used by the user defined request handler to retrieve
  information for the HTTP request.

************************************************************************/
    ////////////////////////////////////////////////////////////////////
    // IHttpRequestCB
    [
      odl,
      uuid(d7403720-bec7-11d3-a9c1-006094b91c8b),
      version(1.0),
      hidden,
      dual,
      helpstring("WebAgentCOM: HTTP Request Callback Interface"),
      nonextensible,
      oleautomation
    ]
    interface IHttpRequestCB : IWACallBackObject
    {
    /*!**********************************************************************
      Function: GetHeader

      description: Get HTTP header field with given name.

      arguments:
        name [in] The header field name. (CGI names have to be used: e.g.
                  PATH_INFO, HTTP_USER_AGENT, ...
        value [out] The value of the header field.

      return value: HRESULT
    */
        HRESULT GetHeader( [in] BSTR  name, [out]  BSTR  *value );

    /*!**********************************************************************
      Function: GetRequestURI

      description: Get the HTTP request URI

      arguments:
        value [out]  The URI.

      return value: HRESULT
    */
        HRESULT GetRequestURI( [out]  BSTR  *value );

    /*!**********************************************************************
      Function: GetIfModifiedSince

      description: Get the IfModifiedSince header field.

      arguments:
        value [out]  The IfModifiedSince header.

      return value: HRESULT
    */
        HRESULT GetIfModifiedSince( [out]  BSTR  *value );

    /*!**********************************************************************
      Function: GetQueryString

      description: Get the QueryString.

      arguments:
        value [out]  The QueryString.

      return value: HRESULT
    */
        HRESULT GetQueryString( [out]  BSTR  *value );

    /*!**********************************************************************
      Function: GetPathInfo

      description: Get additional PathInfo.

      arguments:
        value [out]  The PathInfo.

      return value: HRESULT
    */
        HRESULT GetPathInfo( [out]  BSTR  *value );

    /*!**********************************************************************
      Function: GetMethod

      description: Get the method of the request (GET, POST, PUT, ...)

      arguments:
        value [out]  The request method.

      return value: HRESULT
    */
        HRESULT GetMethod( [out]  BSTR  *value );

    /*!**********************************************************************
      Function: GetContentType

      description: Get the Content-Type header field.

      arguments:
        value [out]  The Content-Type.

      return value: HRESULT
    */
        HRESULT GetContentType( [out]  BSTR  *value );

    /*!**********************************************************************
      Function: GetContentLength

      description: Get the Content-Length header field.

      arguments:
        value [out]  The Content-Length.

      return value: HRESULT
    */
        HRESULT GetContentLength( [out]  BSTR  *value );

    /*!**********************************************************************
      Function: GetPathTranslated

      description: Get the translated path. This is the path the server will
                   will use, if the request is ignored.

      arguments:
        value [out]  The translated path.

      return value: HRESULT
    */
        HRESULT GetPathTranslated( [out]  BSTR  *value );

    /*!**********************************************************************
      Function: GetServerName

      description: Get the name of the server.

      arguments:
        value [out]  The server name.

      return value: HRESULT
    */
        HRESULT GetServerName( [out]  BSTR  *value );

    /*!**********************************************************************
      Function: GetCookieNames

      description: Return an array with all cookie names.

      arguments:
        names [out]  An array containing all cookie names.

      return value: HRESULT
    */
        HRESULT GetCookieNames( [out] SAFEARRAY(BSTR)  *names );

    /*!**********************************************************************
      Function: GetParameterNames

      description: Return an array with all parameter names (parameters
                   from the query string and if method is POST also from
                   the request body).

      arguments:
        names [out]  An array with all parameter names.

      return value: HRESULT
    */
        HRESULT GetParameterNames( [out] SAFEARRAY(BSTR)  *names );

    /*!**********************************************************************
      Function: GetParameterValues

      description: Return all values for a named parameter.

      arguments:
        paramName [in] The name of the parameter.
        values [out]  An array with all parameter values for paramName.

      return value: HRESULT
    */
        HRESULT GetParameterValues( [in]  BSTR            paramName,
                                    [out] SAFEARRAY(BSTR)  *values );

        //HRESULT GetReqBody([in, out] SAFEARRAY(unsigned char) *RequestBody);
    };

    ////////////////////////////////////////////////////////////////////
    // CHttpRequestCB
    [
      uuid(de6e7db0-bec7-11d3-a9c1-006094b91c8b),
      version(1.0)
    ]
    coclass CHttpRequestCB {
        interface IHttpRequestCB;
    };
/*!**********************************************************************

  EndChapter: interface IHttpRequestCB

************************************************************************/
/*!**********************************************************************

  Chapter: interface IHttpReplyCB

  description:
  This interface provides functions to send a HTTP reply with header and
  body data.

************************************************************************/
    [
      odl,
      uuid(4fb4cae0-bec8-11d3-a9c1-006094b91c8b),
      version(1.0),
      hidden,
      dual,
      helpstring("WebAgentCOM: HTTP Reply Callback Interface"),
      nonextensible,
      oleautomation
    ]
    interface IHttpReplyCB : IWACallBackObject
    {
    /*!**********************************************************************
      Function: InitHeader

      description: Initialize HTTP header information.

      arguments:
        status      [in]  The request status (e.g. 200 OK, 400 Bad request, ...).
        contentType [in]  Content-Type header field.
        contentLength [in] Content-Length header field.
        lastModified [in] Last-Modified header field.
        location     [in] Location header field.

      return value: HRESULT
    */
        HRESULT InitHeader( [in]  short status,
                            [in]  BSTR  contentType,
                            [in]  BSTR  contentLength,
                            [in]  BSTR  lastModified,
                            [in]  BSTR  expires,
                            [in]  BSTR  location );

    /*!**********************************************************************
      Function: SetHeader

      description: Add special header field to HTTP reply header.

      arguments:
        headerName [in]  The name of the header field (e.g. content-type, ...).
        headerValue [in] The value for HeaderName.

      return value: HRESULT
    */
        HRESULT SetHeader( [in]  BSTR  headerName,
                           [in]  BSTR  headerValue );

    /*!**********************************************************************
      Function: SetCookie

      description: Set info for cookie header.

      arguments:
        name [in]  Name of the cookie.
        value [in]  Value of the cookie.
        expires [in] Speicifies lifetime of the cookie.
        path    [in] Path for which the cookie is sent back.
        doamin  [in] Domain to which the cookie is sent back.
        secure  [in] Use secure cookies?

      return value: HRESULT
    */
        HRESULT SetCookie( [in]  BSTR         name,
                           [in]  BSTR         value,
                           [in]  BSTR         expires,
                           [in]  BSTR         path,
                           [in]  BSTR         domain,
                           [in]  VARIANT_BOOL secure );

    /*!**********************************************************************
      Function: SendHeader

      description: Send HTTP reply header to client.

      arguments:

      return value: HRESULT
    */
        HRESULT SendHeader();

    /*!**********************************************************************
      Function: SendBody

      description: Send body data to client. This may be called several times
                   after SendHeader was called.

      arguments:
        bodyData [in]  The data to send.

      return value: HRESULT
    */
        HRESULT SendBody( [in] BSTR  bodyData);
    };

    ////////////////////////////////////////////////////////////////////
    // CHttpReplyCB
    [
      uuid(e5c78d80-bec7-11d3-a9c1-006094b91c8b),
      version(1.0)
    ]
    coclass CHttpReplyCB {
        interface IHttpReplyCB;
    };
/*!**********************************************************************

  EndChapter: interface IHttpReplyCB

************************************************************************/
}; // library WebAgentCOM

