httpsession.h
Go to the documentation of this file.
/***************************************************************************
begin : Fri Feb 15 2008
copyright : (C) 2019 by Martin Preuss
email : martin@libchipcard.de
***************************************************************************
* Please see toplevel file COPYING for license details *
***************************************************************************/
#ifndef GWEN_HTTP_SESSION_H
#define GWEN_HTTP_SESSION_H
#include <gwenhywfar/inherit.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GWEN_HTTP_SESSION GWEN_HTTP_SESSION;
GWEN_INHERIT_FUNCTION_LIB_DEFS(GWEN_HTTP_SESSION, GWENHYWFAR_API)
#ifdef __cplusplus
}
#endif
#include <gwenhywfar/url.h>
#include <gwenhywfar/buffer.h>
#include <gwenhywfar/syncio.h>
#include <gwenhywfar/inetsocket.h>
#ifndef NO_DEPRECATED_SYMBOLS
# define GWEN_HTTP_SESSION_FLAGS_FORCE_SSL3 0x00000001 /* deprecated, will be removed in a future release */
#endif // ifndef NO_DEPRECATED_SYMBOLS
#define GWEN_HTTP_SESSION_FLAGS_NO_CACHE 0x00000002
#ifndef NO_DEPRECATED_SYMBOLS
# define GWEN_HTTP_SESSION_FLAGS_TLS_ONLY_SAFE_CIPHERS 0x00000004 /* deprecated, will be removed in a future release */
# define GWEN_HTTP_SESSION_FLAGS_TLS_FORCE_UNSAFE_CIPHERS 0x00000008 /* deprecated, will be removed in a future release */
#endif // ifndef NO_DEPRECATED_SYMBOLS
#define GWEN_HTTP_SESSION_FLAGS_TLS_IGN_PREMATURE_CLOSE 0x00000010
#define GWEN_HTTP_SESSION_FLAGS_PASSIVE 0x00000020 /* server session */
#ifdef __cplusplus
extern "C" {
#endif
GWENHYWFAR_API
GWEN_HTTP_SESSION *GWEN_HttpSession_new(const char *url, const char *defaultProto, int defaultPort);
GWENHYWFAR_API
GWEN_HTTP_SESSION *GWEN_HttpSession_fromSocketPassive(GWEN_SOCKET *sk, const char *proto, int port);
GWENHYWFAR_API
GWEN_HTTP_SESSION *GWEN_HttpSession_fromSyncIoPassive(GWEN_SYNCIO *sio);
GWENHYWFAR_API
void GWEN_HttpSession_Attach(GWEN_HTTP_SESSION *sess);
GWENHYWFAR_API
void GWEN_HttpSession_free(GWEN_HTTP_SESSION *sess);
GWENHYWFAR_API
uint32_t GWEN_HttpSession_GetFlags(const GWEN_HTTP_SESSION *sess);
GWENHYWFAR_API
void GWEN_HttpSession_SetFlags(GWEN_HTTP_SESSION *sess, uint32_t fl);
GWENHYWFAR_API
void GWEN_HttpSession_AddFlags(GWEN_HTTP_SESSION *sess, uint32_t fl);
GWENHYWFAR_API
void GWEN_HttpSession_SubFlags(GWEN_HTTP_SESSION *sess, uint32_t fl);
GWENHYWFAR_API
const char *GWEN_HttpSession_GetHttpUserAgent(const GWEN_HTTP_SESSION *sess);
GWENHYWFAR_API
void GWEN_HttpSession_SetHttpUserAgent(GWEN_HTTP_SESSION *sess, const char *s);
GWENHYWFAR_API
const char *GWEN_HttpSession_GetHttpContentType(const GWEN_HTTP_SESSION *sess);
GWENHYWFAR_API
void GWEN_HttpSession_SetHttpContentType(GWEN_HTTP_SESSION *sess, const char *s);
GWENHYWFAR_API
int GWEN_HttpSession_GetHttpVMajor(const GWEN_HTTP_SESSION *sess);
GWENHYWFAR_API
void GWEN_HttpSession_SetHttpVMajor(GWEN_HTTP_SESSION *sess, int i);
GWENHYWFAR_API
int GWEN_HttpSession_GetHttpVMinor(const GWEN_HTTP_SESSION *sess);
GWENHYWFAR_API
void GWEN_HttpSession_SetHttpVMinor(GWEN_HTTP_SESSION *sess, int i);
GWENHYWFAR_API
int GWEN_HttpSession_Init(GWEN_HTTP_SESSION *sess);
GWENHYWFAR_API
int GWEN_HttpSession_Fini(GWEN_HTTP_SESSION *sess);
GWENHYWFAR_API
int GWEN_HttpSession_SendPacket(GWEN_HTTP_SESSION *sess,
const char *httpCommand,
const uint8_t *buf, uint32_t blen);
GWENHYWFAR_API
int GWEN_HttpSession_RecvPacket(GWEN_HTTP_SESSION *sess, GWEN_BUFFER *buf);
GWENHYWFAR_API
int GWEN_HttpSession_RecvPacketToFile(GWEN_HTTP_SESSION *sess, const char *fname);
GWENHYWFAR_API
int GWEN_HttpSession_ConnectionTest(GWEN_HTTP_SESSION *sess);
GWENHYWFAR_API
int GWEN_HttpSession_RecvCommand(GWEN_HTTP_SESSION *sess,
GWEN_DB_NODE *dbCommandAndHeader,
GWEN_BUFFER *buf);
GWENHYWFAR_API
int GWEN_HttpSession_SendStatus(GWEN_HTTP_SESSION *sess,
int resultCode,
const char *resultText,
const uint8_t *buf, uint32_t blen);
typedef int GWENHYWFAR_CB(*GWEN_HTTPSESSION_INITSYNCIO_FN)(GWEN_HTTP_SESSION *sess, GWEN_SYNCIO *sio);
GWENHYWFAR_API GWEN_HTTPSESSION_INITSYNCIO_FN GWEN_HttpSession_SetInitSyncIoFn(GWEN_HTTP_SESSION *sess,
GWEN_HTTPSESSION_INITSYNCIO_FN f);
/* defgroup */
#ifdef __cplusplus
}
#endif
#endif
buffer.h
GWEN_DB_NODE
struct GWEN_DB_NODE GWEN_DB_NODE
Definition db.h:228
GWEN_BUFFER
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition buffer.h:38
GWENHYWFAR_API
#define GWENHYWFAR_API
Definition gwenhywfarapi.h:67
GWENHYWFAR_CB
#define GWENHYWFAR_CB
Definition gwenhywfarapi.h:89
GWEN_HttpSession_SendPacket
GWENHYWFAR_API int GWEN_HttpSession_SendPacket(GWEN_HTTP_SESSION *sess, const char *httpCommand, const uint8_t *buf, uint32_t blen)
GWEN_HttpSession_fromSyncIoPassive
GWENHYWFAR_API GWEN_HTTP_SESSION * GWEN_HttpSession_fromSyncIoPassive(GWEN_SYNCIO *sio)
GWEN_HTTP_SESSION
struct GWEN_HTTP_SESSION GWEN_HTTP_SESSION
Definition httpsession.h:21
GWEN_HttpSession_SendStatus
GWENHYWFAR_API int GWEN_HttpSession_SendStatus(GWEN_HTTP_SESSION *sess, int resultCode, const char *resultText, const uint8_t *buf, uint32_t blen)
GWEN_HttpSession_SetHttpVMinor
GWENHYWFAR_API void GWEN_HttpSession_SetHttpVMinor(GWEN_HTTP_SESSION *sess, int i)
GWEN_HttpSession_new
GWENHYWFAR_API GWEN_HTTP_SESSION * GWEN_HttpSession_new(const char *url, const char *defaultProto, int defaultPort)
GWEN_HttpSession_SetHttpVMajor
GWENHYWFAR_API void GWEN_HttpSession_SetHttpVMajor(GWEN_HTTP_SESSION *sess, int i)
GWEN_HttpSession_RecvCommand
GWENHYWFAR_API int GWEN_HttpSession_RecvCommand(GWEN_HTTP_SESSION *sess, GWEN_DB_NODE *dbCommandAndHeader, GWEN_BUFFER *buf)
GWEN_HttpSession_RecvPacketToFile
GWENHYWFAR_API int GWEN_HttpSession_RecvPacketToFile(GWEN_HTTP_SESSION *sess, const char *fname)
GWEN_HttpSession_SetFlags
GWENHYWFAR_API void GWEN_HttpSession_SetFlags(GWEN_HTTP_SESSION *sess, uint32_t fl)
GWEN_HttpSession_Fini
GWENHYWFAR_API int GWEN_HttpSession_Fini(GWEN_HTTP_SESSION *sess)
GWEN_HttpSession_Attach
GWENHYWFAR_API void GWEN_HttpSession_Attach(GWEN_HTTP_SESSION *sess)
GWEN_HttpSession_fromSocketPassive
GWENHYWFAR_API GWEN_HTTP_SESSION * GWEN_HttpSession_fromSocketPassive(GWEN_SOCKET *sk, const char *proto, int port)
GWEN_HttpSession_ConnectionTest
GWENHYWFAR_API int GWEN_HttpSession_ConnectionTest(GWEN_HTTP_SESSION *sess)
GWEN_HttpSession_GetHttpVMajor
GWENHYWFAR_API int GWEN_HttpSession_GetHttpVMajor(const GWEN_HTTP_SESSION *sess)
GWEN_HttpSession_AddFlags
GWENHYWFAR_API void GWEN_HttpSession_AddFlags(GWEN_HTTP_SESSION *sess, uint32_t fl)
GWEN_HttpSession_SubFlags
GWENHYWFAR_API void GWEN_HttpSession_SubFlags(GWEN_HTTP_SESSION *sess, uint32_t fl)
GWEN_HttpSession_SetHttpContentType
GWENHYWFAR_API void GWEN_HttpSession_SetHttpContentType(GWEN_HTTP_SESSION *sess, const char *s)
GWEN_HttpSession_GetHttpUserAgent
GWENHYWFAR_API const char * GWEN_HttpSession_GetHttpUserAgent(const GWEN_HTTP_SESSION *sess)
GWEN_HttpSession_GetHttpContentType
GWENHYWFAR_API const char * GWEN_HttpSession_GetHttpContentType(const GWEN_HTTP_SESSION *sess)
GWEN_HTTPSESSION_INITSYNCIO_FN
int GWENHYWFAR_CB(* GWEN_HTTPSESSION_INITSYNCIO_FN)(GWEN_HTTP_SESSION *sess, GWEN_SYNCIO *sio)
Definition httpsession.h:270
GWEN_HttpSession_SetHttpUserAgent
GWENHYWFAR_API void GWEN_HttpSession_SetHttpUserAgent(GWEN_HTTP_SESSION *sess, const char *s)
GWEN_HttpSession_GetFlags
GWENHYWFAR_API uint32_t GWEN_HttpSession_GetFlags(const GWEN_HTTP_SESSION *sess)
GWEN_HttpSession_RecvPacket
GWENHYWFAR_API int GWEN_HttpSession_RecvPacket(GWEN_HTTP_SESSION *sess, GWEN_BUFFER *buf)
GWEN_HttpSession_SetInitSyncIoFn
GWENHYWFAR_API GWEN_HTTPSESSION_INITSYNCIO_FN GWEN_HttpSession_SetInitSyncIoFn(GWEN_HTTP_SESSION *sess, GWEN_HTTPSESSION_INITSYNCIO_FN f)
GWEN_HttpSession_Init
GWENHYWFAR_API int GWEN_HttpSession_Init(GWEN_HTTP_SESSION *sess)
GWEN_HttpSession_free
GWENHYWFAR_API void GWEN_HttpSession_free(GWEN_HTTP_SESSION *sess)
GWEN_HttpSession_GetHttpVMinor
GWENHYWFAR_API int GWEN_HttpSession_GetHttpVMinor(const GWEN_HTTP_SESSION *sess)
inetsocket.h
This file contains sockets and socket sets.
GWEN_SOCKET
struct GWEN_SOCKET GWEN_SOCKET
Definition inetsocket.h:44
inherit.h
GWEN_INHERIT_FUNCTION_LIB_DEFS
#define GWEN_INHERIT_FUNCTION_LIB_DEFS(t, decl)
Definition inherit.h:125
syncio.h
GWEN_SYNCIO
struct GWEN_SYNCIO GWEN_SYNCIO
Definition syncio.h:40
url.h