gwenhywfar  4.99.8beta
Macros | Functions
syncio.c File Reference
#include "syncio_p.h"
#include "syncio_file.h"
#include "syncio_buffered.h"
#include <gwenhywfar/misc.h>
#include <gwenhywfar/debug.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for syncio.c:

Go to the source code of this file.

Macros

#define DISABLE_DEBUGLOG
 

Functions

void GWEN_SyncIo_AddFlags (GWEN_SYNCIO *sio, uint32_t fl)
 
void GWEN_SyncIo_Attach (GWEN_SYNCIO *sio)
 
int GWEN_SyncIo_Connect (GWEN_SYNCIO *sio)
 
int GWEN_SyncIo_Disconnect (GWEN_SYNCIO *sio)
 
int GWEN_SyncIo_Flush (GWEN_SYNCIO *sio)
 
void GWEN_SyncIo_free (GWEN_SYNCIO *sio)
 
GWEN_SYNCIOGWEN_SyncIo_GetBaseIo (const GWEN_SYNCIO *sio)
 
GWEN_SYNCIOGWEN_SyncIo_GetBaseIoByTypeName (const GWEN_SYNCIO *sio, const char *typeName)
 
uint32_t GWEN_SyncIo_GetFlags (const GWEN_SYNCIO *sio)
 
GWEN_SYNCIO_STATUS GWEN_SyncIo_GetStatus (const GWEN_SYNCIO *sio)
 
const char * GWEN_SyncIo_GetTypeName (const GWEN_SYNCIO *sio)
 
int GWEN_SyncIo_Helper_PartiallyReadFile (const char *fName, uint8_t *buffer, uint32_t size)
 
int GWEN_SyncIo_Helper_ReadFile (const char *fName, GWEN_BUFFER *dbuf)
 
int GWEN_SyncIo_Helper_ReadFileToStringList (const char *fname, int maxLines, GWEN_STRINGLIST *sl)
 
GWEN_SYNCIOGWEN_SyncIo_new (const char *typeName, GWEN_SYNCIO *baseIo)
 
int GWEN_SyncIo_Read (GWEN_SYNCIO *sio, uint8_t *buffer, uint32_t size)
 
int GWEN_SyncIo_ReadForced (GWEN_SYNCIO *sio, uint8_t *buffer, uint32_t size)
 
GWEN_SYNCIO_CONNECT_FN GWEN_SyncIo_SetConnectFn (GWEN_SYNCIO *sio, GWEN_SYNCIO_CONNECT_FN fn)
 
GWEN_SYNCIO_DISCONNECT_FN GWEN_SyncIo_SetDisconnectFn (GWEN_SYNCIO *sio, GWEN_SYNCIO_DISCONNECT_FN fn)
 
void GWEN_SyncIo_SetFlags (GWEN_SYNCIO *sio, uint32_t fl)
 
GWEN_SYNCIO_FLUSH_FN GWEN_SyncIo_SetFlushFn (GWEN_SYNCIO *sio, GWEN_SYNCIO_FLUSH_FN fn)
 
GWEN_SYNCIO_READ_FN GWEN_SyncIo_SetReadFn (GWEN_SYNCIO *sio, GWEN_SYNCIO_READ_FN fn)
 
void GWEN_SyncIo_SetStatus (GWEN_SYNCIO *sio, GWEN_SYNCIO_STATUS st)
 
GWEN_SYNCIO_WRITE_FN GWEN_SyncIo_SetWriteFn (GWEN_SYNCIO *sio, GWEN_SYNCIO_WRITE_FN fn)
 
void GWEN_SyncIo_SubFlags (GWEN_SYNCIO *sio, uint32_t fl)
 
int GWEN_SyncIo_Write (GWEN_SYNCIO *sio, const uint8_t *buffer, uint32_t size)
 
int GWEN_SyncIo_WriteChar (GWEN_SYNCIO *sio, char s)
 
int GWEN_SyncIo_WriteForced (GWEN_SYNCIO *sio, const uint8_t *buffer, uint32_t size)
 
int GWEN_SyncIo_WriteLine (GWEN_SYNCIO *sio, const char *s)
 
int GWEN_SyncIo_WriteString (GWEN_SYNCIO *sio, const char *s)
 

Macro Definition Documentation

#define DISABLE_DEBUGLOG

Definition at line 29 of file syncio.c.

Function Documentation

void GWEN_SyncIo_AddFlags ( GWEN_SYNCIO sio,
uint32_t  fl 
)
void GWEN_SyncIo_Attach ( GWEN_SYNCIO sio)

Definition at line 68 of file syncio.c.

int GWEN_SyncIo_Connect ( GWEN_SYNCIO sio)
int GWEN_SyncIo_Disconnect ( GWEN_SYNCIO sio)
int GWEN_SyncIo_Flush ( GWEN_SYNCIO sio)

Definition at line 116 of file syncio.c.

Referenced by GWEN_HttpSession_RecvPacketToFile(), and GWEN_Sar_CloseArchive().

Here is the caller graph for this function:

void GWEN_SyncIo_free ( GWEN_SYNCIO sio)
GWEN_SYNCIO* GWEN_SyncIo_GetBaseIo ( const GWEN_SYNCIO sio)
GWEN_SYNCIO* GWEN_SyncIo_GetBaseIoByTypeName ( const GWEN_SYNCIO sio,
const char *  typeName 
)

Definition at line 217 of file syncio.c.

References NULL.

Referenced by GWEN_HttpSession_Init().

Here is the caller graph for this function:

uint32_t GWEN_SyncIo_GetFlags ( const GWEN_SYNCIO sio)
GWEN_SYNCIO_STATUS GWEN_SyncIo_GetStatus ( const GWEN_SYNCIO sio)
const char* GWEN_SyncIo_GetTypeName ( const GWEN_SYNCIO sio)

Definition at line 201 of file syncio.c.

Referenced by GWEN_DBIO_Import(), and GWEN_HttpSession_Init().

Here is the caller graph for this function:

int GWEN_SyncIo_Helper_PartiallyReadFile ( const char *  fName,
uint8_t *  buffer,
uint32_t  size 
)

Read SIZE bytes from the given file. Returns the number of bytes actually read or an error code (negative value).

Returns
number of bytes actually read (or error code if negative value)
Parameters
fNamename of the file to load
bufferpointer to a fixed buffer to receive the bytes read
sizenumber of bytes to read

Definition at line 448 of file syncio.c.

References DBG_INFO, GWEN_ERROR_INTERRUPTED, GWEN_LOGDOMAIN, GWEN_SyncIo_Connect(), GWEN_SyncIo_Disconnect(), GWEN_SyncIo_File_CreationMode_OpenExisting, GWEN_SYNCIO_FILE_FLAGS_READ, GWEN_SyncIo_File_new(), GWEN_SyncIo_free(), GWEN_SyncIo_Read(), and GWEN_SyncIo_SetFlags().

Here is the call graph for this function:

int GWEN_SyncIo_Helper_ReadFile ( const char *  fName,
GWEN_BUFFER dbuf 
)

Read a whole file into the given buffer

Returns
number of bytes actually read (or error code if negative value)
Parameters
fNamename of the file to load
dbufGWEN_BUFFER to receive the bytes read

Definition at line 497 of file syncio.c.

References DBG_INFO, GWEN_Buffer_AdjustUsedBytes(), GWEN_Buffer_AllocRoom(), GWEN_Buffer_GetMaxUnsegmentedWrite(), GWEN_Buffer_GetPosPointer(), GWEN_Buffer_IncrementPos(), GWEN_ERROR_INTERRUPTED, GWEN_LOGDOMAIN, GWEN_SyncIo_Connect(), GWEN_SyncIo_Disconnect(), GWEN_SyncIo_File_CreationMode_OpenExisting, GWEN_SYNCIO_FILE_FLAGS_READ, GWEN_SyncIo_File_new(), GWEN_SyncIo_File_Seek(), GWEN_SyncIo_File_Whence_End, GWEN_SyncIo_File_Whence_Set, GWEN_SyncIo_free(), GWEN_SyncIo_Read(), and GWEN_SyncIo_SetFlags().

Here is the call graph for this function:

int GWEN_SyncIo_Helper_ReadFileToStringList ( const char *  fname,
int  maxLines,
GWEN_STRINGLIST sl 
)
GWEN_SYNCIO* GWEN_SyncIo_new ( const char *  typeName,
GWEN_SYNCIO baseIo 
)
int GWEN_SyncIo_Read ( GWEN_SYNCIO sio,
uint8_t *  buffer,
uint32_t  size 
)
int GWEN_SyncIo_ReadForced ( GWEN_SYNCIO sio,
uint8_t *  buffer,
uint32_t  size 
)
GWEN_SYNCIO_CONNECT_FN GWEN_SyncIo_SetConnectFn ( GWEN_SYNCIO sio,
GWEN_SYNCIO_CONNECT_FN  fn 
)

Definition at line 235 of file syncio.c.

Referenced by GWEN_SyncIo_Buffered_new(), GWEN_SyncIo_Http_new(), GWEN_SyncIo_Socket_new(), GWEN_SyncIo_Socket_TakeOver(), and GWEN_SyncIo_Tls_new().

Here is the caller graph for this function:

GWEN_SYNCIO_DISCONNECT_FN GWEN_SyncIo_SetDisconnectFn ( GWEN_SYNCIO sio,
GWEN_SYNCIO_DISCONNECT_FN  fn 
)

Definition at line 247 of file syncio.c.

Referenced by GWEN_SyncIo_Buffered_new(), GWEN_SyncIo_Http_new(), GWEN_SyncIo_Socket_new(), GWEN_SyncIo_Socket_TakeOver(), and GWEN_SyncIo_Tls_new().

Here is the caller graph for this function:

void GWEN_SyncIo_SetFlags ( GWEN_SYNCIO sio,
uint32_t  fl 
)

Definition at line 161 of file syncio.c.

Referenced by GWEN_MDigest__HashFile(), GWEN_SyncIo_Helper_PartiallyReadFile(), GWEN_SyncIo_Helper_ReadFile(), and GWEN_SyncIo_Helper_ReadFileToStringList().

Here is the caller graph for this function:

GWEN_SYNCIO_FLUSH_FN GWEN_SyncIo_SetFlushFn ( GWEN_SYNCIO sio,
GWEN_SYNCIO_FLUSH_FN  fn 
)

Definition at line 259 of file syncio.c.

GWEN_SYNCIO_READ_FN GWEN_SyncIo_SetReadFn ( GWEN_SYNCIO sio,
GWEN_SYNCIO_READ_FN  fn 
)
void GWEN_SyncIo_SetStatus ( GWEN_SYNCIO sio,
GWEN_SYNCIO_STATUS  st 
)
GWEN_SYNCIO_WRITE_FN GWEN_SyncIo_SetWriteFn ( GWEN_SYNCIO sio,
GWEN_SYNCIO_WRITE_FN  fn 
)
void GWEN_SyncIo_SubFlags ( GWEN_SYNCIO sio,
uint32_t  fl 
)

Definition at line 177 of file syncio.c.

Referenced by GWEN_SyncIo_Buffered_Read(), GWEN_SyncIo_Http_ReadHeader(), GWEN_SyncIo_Http_ReadLine(), and GWEN_SyncIo_Tls_Connect().

Here is the caller graph for this function:

int GWEN_SyncIo_Write ( GWEN_SYNCIO sio,
const uint8_t *  buffer,
uint32_t  size 
)

Definition at line 140 of file syncio.c.

References GWEN_ERROR_BROKEN_PIPE.

Referenced by GWEN_SyncIo_Buffered_Write(), GWEN_SyncIo_Tls_Push(), and GWEN_SyncIo_WriteForced().

Here is the caller graph for this function:

int GWEN_SyncIo_WriteChar ( GWEN_SYNCIO sio,
char  s 
)
int GWEN_SyncIo_WriteForced ( GWEN_SYNCIO sio,
const uint8_t *  buffer,
uint32_t  size 
)
int GWEN_SyncIo_WriteLine ( GWEN_SYNCIO sio,
const char *  s 
)
int GWEN_SyncIo_WriteString ( GWEN_SYNCIO sio,
const char *  s 
)