# netconnectionhttp.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  $RCSfile: netconnectionhttp.h,v $
    00003                              -------------------
    00004     cvs         : $Id: netconnectionhttp.h,v 1.7 2005/04/30 07:54:55 aquamaniac Exp $
    00005     begin       : Mon Mar 01 2004
    00006     copyright   : (C) 2004 by Martin Preuss
    00007     email       : martin@libchipcard.de
    00008
    00009  ***************************************************************************
    00010  *          Please see toplevel file COPYING for license details           *
    00011  ***************************************************************************/
    00012
    00013 #ifndef GWENNET_HTTP_H
    00014 #define GWENNET_HTTP_H
    00015
    00016 #include <gwenhywfar/gwenhywfarapi.h>
    00017 #include <gwenhywfar/netconnection.h>
    00018 #include <gwenhywfar/bufferedio.h>
    00019
    00020 #ifdef __cplusplus
    00021 extern "C" {
    00022 #endif
    00023
    00024
    00029 #define GWEN_NETCONN_MODE_WAITBEFOREREAD     0x00000001
    00030 #define GWEN_NETCONN_MODE_WAITBEFOREBODYREAD 0x00000002
    00031 #define GWEN_NETCONN_MODE_RAW                0x00000004
    00032
    00050 #define GWEN_NETCONN_MODE_IPC                  0x00000004
    00051
    00052 #define GWEN_NETCONN_MODE_DEFAULT (\
    00053   0 \
    00054   )
    00055
    00062
    00064 #define GWEN_NETCONNHTTP_STATE_STARTEDREAD        0x0001
    00065
    00066 #define GWEN_NETCONNHTTP_STATE_STARTEDBODYREAD    0x0002
    00067
    00072 #define GWEN_NETCONNHTTP_STATE_WAITINGFORREAD     0x0004
    00073
    00078 #define GWEN_NETCONNHTTP_STATE_WAITINGFORBODYREAD 0x0008
    00079
    00085 typedef enum {
    00087   GWEN_NetConnHttp_WriteBodyModeStart=0,
    00089   GWEN_NetConnHttp_WriteBodyModeWrite,
    00091   GWEN_NetConnHttp_WriteBodyModeStop,
    00093   GWEN_NetConnHttp_WriteBodyModeAbort
    00094 } GWEN_NETCONNHTTP_WRITEBODY_MODE;
    00095
    00096
    00097 GWENHYWFAR_API
    00098 GWEN_NETCONNECTION *GWEN_NetConnectionHTTP_new(GWEN_NETTRANSPORT *tr,
    00099                                                int take,
    00100                                                GWEN_TYPE_UINT32 libId,
    00101                                                int pmajor,
    00102                                                int pminor);
    00103
    00129 typedef int (*GWEN_NETCONNHTTP_WRITEBODY_FN)(GWEN_NETCONNECTION *conn,
    00130                                              const char *buffer,
    00131                                              GWEN_TYPE_UINT32 *bsize,
    00132                                              GWEN_NETCONNHTTP_WRITEBODY_MODE m);
    00139 GWENHYWFAR_API
    00140 void GWEN_NetConnectionHTTP_StartBodyRead(GWEN_NETCONNECTION *conn);
    00141
    00147 GWENHYWFAR_API
    00148 void GWEN_NetConnectionHTTP_StartRead(GWEN_NETCONNECTION *conn);
    00149
    00160 GWENHYWFAR_API
    00161 GWEN_NETMSG *GWEN_NetConnectionHTTP_GetCurrentInMsg(GWEN_NETCONNECTION *conn);
    00169 GWENHYWFAR_API
    00170 GWEN_TYPE_UINT32 GWEN_NetConnectionHTTP_GetMode(GWEN_NETCONNECTION *conn);
    00171 GWENHYWFAR_API
    00172 void GWEN_NetConnectionHTTP_SetMode(GWEN_NETCONNECTION *conn,
    00173                                     GWEN_TYPE_UINT32 m);
    00174 GWENHYWFAR_API
    00175 void GWEN_NetConnectionHTTP_AddMode(GWEN_NETCONNECTION *conn,
    00176                                     GWEN_TYPE_UINT32 m);
    00177 GWENHYWFAR_API
    00178 void GWEN_NetConnectionHTTP_SubMode(GWEN_NETCONNECTION *conn,
    00179                                     GWEN_TYPE_UINT32 m);
    00180
    00181 const char*
    00182   GWEN_NetConnectionHTTP_GetDefaultURL(const GWEN_NETCONNECTION *conn);
    00183 void GWEN_NetConnectionHTTP_SetDefaultURL(GWEN_NETCONNECTION *conn,
    00184                                           const char *s);
    00185
    00186
    00191 GWENHYWFAR_API
    00192 GWEN_TYPE_UINT32 GWEN_NetConnectionHTTP_GetState(GWEN_NETCONNECTION *conn);
    00254 GWENHYWFAR_API
    00255 int GWEN_NetConnectionHTTP_AddRequest(GWEN_NETCONNECTION *conn,
    00256                                       GWEN_DB_NODE *dbRequest,
    00257                                       GWEN_BUFFER *body,
    00258                                       GWEN_BUFFEREDIO *bio);
    00259
    00260
    00261 GWENHYWFAR_API
    00262 int GWEN_NetConnectionHTTP_AddResponse(GWEN_NETCONNECTION *conn,
    00263                                        GWEN_DB_NODE *dbResponse,
    00264                                        GWEN_BUFFER *body,
    00265                                        GWEN_BUFFEREDIO *bio);
    00273 GWENHYWFAR_API
    00274 void GWEN_NetConnectionHTTP_Escape(const char *src, GWEN_BUFFER *buf);
    00275
    00276 GWENHYWFAR_API
    00277 int GWEN_NetConnectionHTTP_Unescape(const char *src, GWEN_BUFFER *buf);
    00281 #ifdef __cplusplus
    00282 }
    00283 #endif
    00284
    00285
    00286 #endif /* GWENNET_HTTP_H */
    00287
    00288
    00289
    00290
    00291