Defines | |
#define | GWEN_BUFFER_MAX_BOOKMARKS 32 |
#define | GWEN_BUFFER_MODE_ABORT_ON_MEMFULL 0x0002 |
#define | GWEN_BUFFER_MODE_DEFAULT |
#define | GWEN_BUFFER_MODE_DYNAMIC 0x0001 |
#define | GWEN_BUFFER_MODE_USE_BIO 0x0004 |
#define | GWEN_BUFFER_MODE_USE_IO 0x0008 |
Typedefs | |
typedef struct GWEN_BUFFER | GWEN_BUFFER |
A dynamically resizeable text buffer. | |
Functions | |
GWENHYWFAR_API void | GWEN_Buffer_AddMode (GWEN_BUFFER *bf, uint32_t mode) |
GWENHYWFAR_API int | GWEN_Buffer_AdjustUsedBytes (GWEN_BUFFER *bf) |
GWENHYWFAR_API int | GWEN_Buffer_AllocRoom (GWEN_BUFFER *bf, uint32_t size) |
GWENHYWFAR_API int | GWEN_Buffer_AppendBuffer (GWEN_BUFFER *bf, GWEN_BUFFER *sf) |
GWENHYWFAR_API int | GWEN_Buffer_AppendByte (GWEN_BUFFER *bf, char c) |
GWENHYWFAR_API int | GWEN_Buffer_AppendBytes (GWEN_BUFFER *bf, const char *buffer, uint32_t size) |
GWENHYWFAR_API int | GWEN_Buffer_AppendString (GWEN_BUFFER *bf, const char *buffer) |
GWENHYWFAR_API int | GWEN_Buffer_Crop (GWEN_BUFFER *bf, uint32_t pos, uint32_t l) |
GWENHYWFAR_API int | GWEN_Buffer_DecrementPos (GWEN_BUFFER *bf, uint32_t i) |
GWENHYWFAR_API void | GWEN_Buffer_Dump (GWEN_BUFFER *bf, FILE *f, unsigned int insert) |
GWENHYWFAR_API GWEN_BUFFER * | GWEN_Buffer_dup (GWEN_BUFFER *bf) |
GWENHYWFAR_API int | GWEN_Buffer_FillLeftWithBytes (GWEN_BUFFER *bf, unsigned char c, uint32_t size) |
GWENHYWFAR_API int | GWEN_Buffer_FillWithBytes (GWEN_BUFFER *bf, unsigned char c, uint32_t size) |
GWENHYWFAR_API void | GWEN_Buffer_free (GWEN_BUFFER *bf) |
GWENHYWFAR_API uint32_t | GWEN_Buffer_GetBookmark (GWEN_BUFFER *bf, unsigned int idx) |
GWENHYWFAR_API uint32_t | GWEN_Buffer_GetBytesLeft (GWEN_BUFFER *bf) |
GWENHYWFAR_API uint32_t | GWEN_Buffer_GetHardLimit (GWEN_BUFFER *bf) |
GWENHYWFAR_API uint32_t | GWEN_Buffer_GetMaxUnsegmentedWrite (GWEN_BUFFER *bf) |
GWENHYWFAR_API uint32_t | GWEN_Buffer_GetMode (GWEN_BUFFER *bf) |
GWENHYWFAR_API uint32_t | GWEN_Buffer_GetPos (GWEN_BUFFER *bf) |
GWENHYWFAR_API char * | GWEN_Buffer_GetPosPointer (GWEN_BUFFER *bf) |
GWENHYWFAR_API uint32_t | GWEN_Buffer_GetSize (GWEN_BUFFER *bf) |
GWENHYWFAR_API char * | GWEN_Buffer_GetStart (GWEN_BUFFER *bf) |
GWENHYWFAR_API uint32_t | GWEN_Buffer_GetStep (GWEN_BUFFER *bf) |
GWENHYWFAR_API uint32_t | GWEN_Buffer_GetUsedBytes (GWEN_BUFFER *bf) |
GWENHYWFAR_API int | GWEN_Buffer_IncrementPos (GWEN_BUFFER *bf, uint32_t i) |
GWENHYWFAR_API int | GWEN_Buffer_InsertBuffer (GWEN_BUFFER *bf, GWEN_BUFFER *sf) |
GWENHYWFAR_API int | GWEN_Buffer_InsertByte (GWEN_BUFFER *bf, char c) |
GWENHYWFAR_API int | GWEN_Buffer_InsertBytes (GWEN_BUFFER *bf, const char *buffer, uint32_t size) |
GWENHYWFAR_API int | GWEN_Buffer_InsertRoom (GWEN_BUFFER *bf, uint32_t size) |
GWENHYWFAR_API int | GWEN_Buffer_InsertString (GWEN_BUFFER *bf, const char *buffer) |
GWENHYWFAR_API GWEN_BUFFER * | GWEN_Buffer_new (char *buffer, uint32_t size, uint32_t used, int take_ownership) |
GWENHYWFAR_API int | GWEN_Buffer_PeekByte (GWEN_BUFFER *bf) |
GWENHYWFAR_API int | GWEN_Buffer_ReadByte (GWEN_BUFFER *bf) |
GWENHYWFAR_API int | GWEN_Buffer_ReadBytes (GWEN_BUFFER *bf, char *buffer, uint32_t *size) |
GWENHYWFAR_API int | GWEN_Buffer_Relinquish (GWEN_BUFFER *bf) |
GWENHYWFAR_API int | GWEN_Buffer_RemoveRoom (GWEN_BUFFER *bf, uint32_t size) |
GWENHYWFAR_API int | GWEN_Buffer_ReplaceBytes (GWEN_BUFFER *bf, uint32_t rsize, const char *buffer, uint32_t size) |
GWENHYWFAR_API int | GWEN_Buffer_ReserveBytes (GWEN_BUFFER *bf, uint32_t res) |
GWENHYWFAR_API void | GWEN_Buffer_Reset (GWEN_BUFFER *bf) |
GWENHYWFAR_API void | GWEN_Buffer_Rewind (GWEN_BUFFER *bf) |
GWENHYWFAR_API void | GWEN_Buffer_SetBookmark (GWEN_BUFFER *bf, unsigned int idx, uint32_t v) |
GWENHYWFAR_API void | GWEN_Buffer_SetHardLimit (GWEN_BUFFER *bf, uint32_t l) |
GWENHYWFAR_API void | GWEN_Buffer_SetMode (GWEN_BUFFER *bf, uint32_t mode) |
GWENHYWFAR_API int | GWEN_Buffer_SetPos (GWEN_BUFFER *bf, uint32_t i) |
GWENHYWFAR_API void | GWEN_Buffer_SetSourceBIO (GWEN_BUFFER *bf, GWEN_BUFFEREDIO *bio, int take) |
GWENHYWFAR_API void | GWEN_Buffer_SetSourceIoLayer (GWEN_BUFFER *bf, GWEN_IO_LAYER *io, int take) |
GWENHYWFAR_API void | GWEN_Buffer_SetStep (GWEN_BUFFER *bf, uint32_t step) |
GWENHYWFAR_API int | GWEN_Buffer_SetUsedBytes (GWEN_BUFFER *bf, uint32_t i) |
GWENHYWFAR_API void | GWEN_Buffer_SubMode (GWEN_BUFFER *bf, uint32_t mode) |
#define GWEN_BUFFER_MAX_BOOKMARKS 32 |
Definition at line 68 of file buffer.h.
Referenced by GWEN_Buffer_AdjustBookmarks(), GWEN_Buffer_Dump(), GWEN_Buffer_dup(), GWEN_Buffer_GetBookmark(), and GWEN_Buffer_SetBookmark().
#define GWEN_BUFFER_MODE_ABORT_ON_MEMFULL 0x0002 |
Definition at line 71 of file buffer.h.
Referenced by GWEN_Buffer_AllocRoom(), and GWEN_Buffer_Dump().
#define GWEN_BUFFER_MODE_DEFAULT |
#define GWEN_BUFFER_MODE_DYNAMIC 0x0001 |
Definition at line 70 of file buffer.h.
Referenced by GWEN_Buffer_AllocRoom(), GWEN_Buffer_Dump(), and GWEN_Buffer_GetSize().
#define GWEN_BUFFER_MODE_USE_BIO 0x0004 |
Definition at line 72 of file buffer.h.
Referenced by GWEN_Buffer__FillBuffer(), GWEN_Buffer_IncrementPos(), and GWEN_Buffer_SetPos().
#define GWEN_BUFFER_MODE_USE_IO 0x0008 |
Definition at line 73 of file buffer.h.
Referenced by GWEN_Buffer__FillBuffer(), and GWEN_Buffer_SetPos().
typedef struct GWEN_BUFFER GWEN_BUFFER |
GWENHYWFAR_API void GWEN_Buffer_AddMode | ( | GWEN_BUFFER * | bf, | |
uint32_t | mode | |||
) |
Adds the give mode to the current mode of the buffer (such as GWEN_BUFFER_MODE_DYNAMIC).
GWENHYWFAR_API int GWEN_Buffer_AdjustUsedBytes | ( | GWEN_BUFFER * | bf | ) |
The functions GWEN_Buffer_IncrementPos and GWEN_Buffer_DecrementPos only modify the internal position pointer. This function here adjusts the number of used bytes to just before the internal position pointer. This is often used to avoid copying, like in the following example:
char *p; int i; for (i=0; i<100; i++) { GWEN_Buffer_AllocRoom(buffer, 512); p=GWEN_Buffer_GetPosPtr(buffer); READ_512_BYTES_TO_P; GWEN_Buffer_IncrementPos(buffer, 512); GWEN_Buffer_AdjustUsedBytes(buffer); }
Definition at line 535 of file buffer.c.
References DBG_DEBUG, DBG_ERROR, and GWEN_LOGDOMAIN.
Referenced by GWEN_Crypt_TokenFile__Decipher(), GWEN_Crypt_TokenFile__Sign(), GWEN_Crypt_TokenFile__Verify(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgrKeys_DecryptKey(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_CryptMgrKeys_VerifyData(), GWEN_Io_Layer_ReadPacketToBuffer(), GWEN_Io_LayerHttp_WorkOnReadRequest1(), GWEN_Io_LayerTls__readFile(), GWEN_MsgEngine__WriteValue(), and GWEN_Text_UnescapeXmlToBuffer().
GWENHYWFAR_API int GWEN_Buffer_AllocRoom | ( | GWEN_BUFFER * | bf, | |
uint32_t | size | |||
) |
Make sure that the buffer has enough room for the given bytes.
Definition at line 282 of file buffer.c.
References DBG_ERROR, DBG_VERBOUS, GWEN_BUFFER_MODE_ABORT_ON_MEMFULL, GWEN_BUFFER_MODE_DYNAMIC, GWEN_LOGDOMAIN, GWEN_Memory_malloc(), GWEN_Memory_realloc(), and NULL.
Referenced by GWEN_Buffer__FillBuffer_Bio(), GWEN_Buffer__FillBuffer_IoLayer(), GWEN_Buffer_AppendByte(), GWEN_Buffer_AppendBytes(), GWEN_Buffer_FillWithBytes(), GWEN_Buffer_InsertRoom(), GWEN_Buffer_ReserveBytes(), GWEN_Crypt_TokenFile__Sign(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_Io_Layer_ReadPacketToBuffer(), GWEN_Io_LayerHttp_WorkOnReadRequest1(), GWEN_Io_LayerTls__readFile(), GWEN_MsgEngine__WriteValue(), and GWEN_Path_AppendPathElement().
GWENHYWFAR_API int GWEN_Buffer_AppendBuffer | ( | GWEN_BUFFER * | bf, | |
GWEN_BUFFER * | sf | |||
) |
Append the content of the buffer sf
at the end of the buffer bf
. The size of bf
will be increased accordingly. Returns zero on success or nonzero if this failed (e.g. because of out of memory error).
Definition at line 571 of file buffer.c.
References GWEN_Buffer_AppendBytes().
Referenced by check2(), GWEN_Crypt_Token_PluginManager_CheckToken(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgrKeys_DecryptKey(), GWEN_Directory_FindFileInPaths(), GWEN_MsgEngine__WriteValue(), and GWEN_XMLNode_GetXPath().
GWENHYWFAR_API int GWEN_Buffer_AppendByte | ( | GWEN_BUFFER * | bf, | |
char | c | |||
) |
Appends a single byte to this GWEN_BUFFER, if there is enough room. The position pointer is adjusted accordingly.
Definition at line 381 of file buffer.c.
References DBG_DEBUG, GWEN_Buffer_AllocRoom(), GWEN_LIKELY, GWEN_LOGDOMAIN, and GWEN_UNLIKELY.
Referenced by GWEN_Args__AppendTXT(), GWEN_Base64_Decode(), GWEN_Base64_Encode(), GWEN_BufferedIO_ReadLine2Buffer(), GWEN_CryptHead_toBuffer(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), GWEN_Date_toStringWithTemplate(), GWEN_DB__ReadValues(), GWEN_Directory_HandlePathElement(), GWEN_Directory_OsifyPath(), GWEN_Gui_CProgress_Log(), GWEN_Io_LayerHttp_WorkOnReadRequest1(), GWEN_LoadPluginDescrsByType(), GWEN_Logger__CreateMessage(), GWEN_Logger_Log(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__ReadValue(), GWEN_MsgEngine__WriteGroup(), GWEN_MsgEngine__WriteValue(), GWEN_Padd_PaddWithAnsiX9_23(), GWEN_Padd_PaddWithIso9796_2(), GWEN_Path_AppendPathElement(), GWEN_Path_Handle(), GWEN_Path_HandleWithIdx(), GWEN_PluginManager_LoadPlugin(), GWEN_PluginManager_LoadPluginFile(), GWEN_SigHead_toBuffer(), GWEN_SigTail_toBuffer(), GWEN_Tag16_DirectlyToBuffer(), GWEN_Text_DumpString2Buffer(), GWEN_Text_EscapeToBuffer(), GWEN_Text_EscapeToBufferTolerant(), GWEN_Text_EscapeToBufferTolerant2(), GWEN_Text_EscapeXmlToBuffer(), GWEN_Text_FromBcdBuffer(), GWEN_Text_FromHexBuffer(), GWEN_Text_GetWordToBuffer(), GWEN_Text_ToBcdBuffer(), GWEN_Text_ToHexBuffer(), GWEN_Text_UnescapeToBuffer(), GWEN_Text_UnescapeToBufferTolerant(), GWEN_Time__toString(), GWEN_TLV_DirectlyToBuffer(), GWEN_XML__ReadData(), GWEN_XML__ReadTag(), GWEN_XML_AddNameSpace(), GWEN_XML_FindNameSpace(), and GWEN_XMLNode__CheckAndSetNameSpace().
GWENHYWFAR_API int GWEN_Buffer_AppendBytes | ( | GWEN_BUFFER * | bf, | |
const char * | buffer, | |||
uint32_t | size | |||
) |
Copies the contents of the given buffer to this GWEN_BUFFER, if there is enough room. The position pointer is adjusted accordingly.
Definition at line 352 of file buffer.c.
References DBG_DEBUG, DBG_ERROR, GWEN_Buffer_AllocRoom(), and GWEN_LOGDOMAIN.
Referenced by GWEN_Buffer_AppendBuffer(), GWEN_Buffer_AppendString(), GWEN_BufferedIO_Buffer__Write(), GWEN_BufferedIO_Buffer_fromString(), GWEN_Crypt_TokenFile__Encipher(), GWEN_Crypt_TokenFile__Sign(), GWEN_Crypt_TokenFile__Verify(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Verify(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_FastBuffer_ReadLineToBuffer(), GWEN_Gui_CGui__ConvertFromUtf8(), GWEN_Gui_CGui_GetRawText(), GWEN_Io_Layer_ReadToBufferUntilEof(), GWEN_Io_LayerBuffered_ReadLineToBuffer(), GWEN_Io_LayerMemory_AddRequest(), GWEN_Io_LayerMemory_fromString(), GWEN_MsgEngine__ReadValue(), GWEN_Padd_PaddWithISO9796(), GWEN_Tag16_DirectlyToBuffer(), GWEN_TLV_DirectlyToBuffer(), GWEN_Url_fromCommandString(), and GWEN_Url_fromString().
GWENHYWFAR_API int GWEN_Buffer_AppendString | ( | GWEN_BUFFER * | bf, | |
const char * | buffer | |||
) |
Appends a string to the buffer (without the trailing null char!) The position pointer is adjusted accordingly.
Definition at line 985 of file buffer.c.
References GWEN_Buffer_AppendBytes().
Referenced by check2(), GWEN_Args_UsageTXT(), GWEN_Base64_Encode(), GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token__CreatePasswordName(), GWEN_Crypt_Token_ModuleInit(), GWEN_Crypt_Token_PluginManager_CheckToken(), GWEN_DBIO_ModuleInit(), GWEN_Directory_FindFileInPaths(), GWEN_Directory_FindPathForFile(), GWEN_Directory_GetDirEntries(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetFileEntriesWithType(), GWEN_Directory_HandlePathElement(), GWEN_Gui_CGui_GetRawText(), GWEN_Gui_CProgress_Log(), GWEN_HttpSession__RecvPacket(), GWEN_Io_LayerHttp_WriteCommand(), GWEN_Io_LayerHttp_WriteHeader(), GWEN_Io_LayerHttp_WriteStatus(), GWEN_Io_LayerTls_GetPeerCert(), GWEN_Io_LayerTls_WorkOnRequests(), GWEN_LoadPluginDescrsByType(), GWEN_Logger__CreateMessage(), GWEN_MsgEngine__GetInline(), GWEN_MsgEngine__ReadGroup(), GWEN_Path_AppendPathElement(), GWEN_PathManager_AddRelPath(), GWEN_PluginManager_LoadPlugin(), GWEN_PluginManager_LoadPluginFile(), GWEN_Text_DoubleToBuffer(), GWEN_Text_DumpString2Buffer(), GWEN_Text_EscapeXmlToBuffer(), GWEN_Url_toCommandString(), GWEN_Url_toString(), GWEN_XML__ReadTag(), GWEN_XML_AddNameSpace(), GWEN_XML_FindNameSpace(), GWEN_XMLNode__CheckAndSetNameSpace(), and GWEN_XMLNode_GetXPath().
GWENHYWFAR_API int GWEN_Buffer_Crop | ( | GWEN_BUFFER * | bf, | |
uint32_t | pos, | |||
uint32_t | l | |||
) |
Definition at line 958 of file buffer.c.
References DBG_ERROR, DBG_INFO, GWEN_Buffer_AdjustBookmarks(), and GWEN_LOGDOMAIN.
Referenced by GWEN_Directory_GetDirEntries(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetFileEntriesWithType(), GWEN_HttpSession_RecvPacket(), GWEN_LoadPluginDescrsByType(), GWEN_MsgEngine__WriteGroup(), GWEN_Padd__UnpaddWithPkcs1Bt1Or2(), GWEN_Padd_PaddWithISO9796(), GWEN_Padd_UnpaddWithAnsiX9_23(), GWEN_Padd_UnpaddWithIso9796_2(), GWEN_Text_CondenseBuffer(), GWEN_Text_GetWordToBuffer(), and GWEN_XmlCtxStore_AddData().
GWENHYWFAR_API int GWEN_Buffer_DecrementPos | ( | GWEN_BUFFER * | bf, | |
uint32_t | i | |||
) |
Move the position pointer backward by the given number i
.
Definition at line 556 of file buffer.c.
References DBG_ERROR, and GWEN_LOGDOMAIN.
Referenced by GWEN_MsgEngine__ReadValue().
GWENHYWFAR_API void GWEN_Buffer_Dump | ( | GWEN_BUFFER * | bf, | |
FILE * | f, | |||
unsigned int | insert | |||
) |
Print the current content of buffer bf
into the file f
.
Definition at line 625 of file buffer.c.
References GWEN_BUFFER_MAX_BOOKMARKS, GWEN_BUFFER_MODE_ABORT_ON_MEMFULL, GWEN_BUFFER_MODE_DYNAMIC, and GWEN_Text_DumpString().
Referenced by check1(), check2(), and GWEN_DB_ReadFromFastBuffer().
GWENHYWFAR_API GWEN_BUFFER* GWEN_Buffer_dup | ( | GWEN_BUFFER * | bf | ) |
Create a new copy as a duplicate of the buffer bf
.
Definition at line 95 of file buffer.c.
References GWEN_BUFFER_MAX_BOOKMARKS, GWEN_Memory_malloc(), and GWEN_NEW_OBJECT.
Referenced by GWEN_Crypt_Token_PluginManager_CheckToken().
GWENHYWFAR_API int GWEN_Buffer_FillLeftWithBytes | ( | GWEN_BUFFER * | bf, | |
unsigned char | c, | |||
uint32_t | size | |||
) |
Definition at line 1065 of file buffer.c.
References GWEN_Buffer_InsertRoom().
Referenced by GWEN_Padd_ApplyPaddAlgo().
GWENHYWFAR_API int GWEN_Buffer_FillWithBytes | ( | GWEN_BUFFER * | bf, | |
unsigned char | c, | |||
uint32_t | size | |||
) |
Definition at line 1039 of file buffer.c.
References DBG_DEBUG, DBG_ERROR, GWEN_Buffer_AllocRoom(), and GWEN_LOGDOMAIN.
Referenced by GWEN_Padd_ApplyPaddAlgo().
GWENHYWFAR_API void GWEN_Buffer_free | ( | GWEN_BUFFER * | bf | ) |
Frees the given buffer.
If the internal storage was allocated for this new buffer, then it will freed here. If the internal storage is used from a different buffer
, then it will only be freed if the argument take_ownership
of GWEN_Buffer_new() was nonzero.
Definition at line 80 of file buffer.c.
References GWEN_BufferedIO_free(), GWEN_FREE_OBJECT, and GWEN_Memory_dealloc().
Referenced by GWEN_BufferedIO_Buffer_Table__free(), GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token_GetPin(), GWEN_Crypt_Token_ModuleInit(), GWEN_Crypt_Token_PluginManager_CheckToken(), GWEN_Crypt_Token_SetPinStatus(), GWEN_Crypt_TokenFile__Decipher(), GWEN_Crypt_TokenFile__Encipher(), GWEN_Crypt_TokenFile__Sign(), GWEN_Crypt_TokenFile__Verify(), GWEN_CryptMgr_Decode(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Encode(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), GWEN_CryptMgrKeys_DecryptKey(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_CryptMgrKeys_VerifyData(), GWEN_DB__ReadValues(), GWEN_DB_ReadFromFastBuffer(), GWEN_DB_WriteGroupToIoLayer(), GWEN_DBIO_ModuleInit(), GWEN_Directory_FindFileInPaths(), GWEN_Directory_FindPathForFile(), GWEN_Directory_GetPath(), GWEN_Directory_HandlePathElement(), GWEN_Gui_CGui_CheckCert(), GWEN_Gui_CGui_GetPassword(), GWEN_Gui_CGui_InputBox(), GWEN_Gui_CGui_MessageBox(), GWEN_Gui_CGui_SetPasswordStatus(), GWEN_Gui_CGui_ShowBox(), GWEN_Gui_CheckCertBuiltIn(), GWEN_Gui_CProgress_free(), GWEN_Gui_CProgress_Log(), GWEN_HttpSession__RecvPacket(), GWEN_HttpSession_Init(), GWEN_Io_LayerHttp_freeData(), GWEN_Io_LayerMemory_freeData(), GWEN_Io_LayerTls_GetPeerCert(), GWEN_Io_LayerTls_Prepare(), GWEN_Io_LayerTls_WorkOnRequests(), GWEN_IpcManager__SendMsg(), GWEN_LoadPluginDescrsByType(), GWEN_Logger__Log(), GWEN_Logger_Log(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__WriteElement(), GWEN_Path_Handle(), GWEN_Path_HandleWithIdx(), GWEN_PathManager_AddPath(), GWEN_PathManager_AddRelPath(), GWEN_PluginManager_LoadPlugin(), GWEN_PluginManager_LoadPluginFile(), GWEN_SigHead_toBuffer(), GWEN_Text_LogString(), GWEN_Url_fromCommandString(), GWEN_Url_fromString(), GWEN_XML__ReadData(), GWEN_XML__ReadTag(), GWEN_XML_AddNameSpace(), GWEN_XML_FindNameSpace(), GWEN_XmlCtxStore_AddData(), GWEN_XMLNode__CheckAndSetNameSpace(), GWEN_XMLNode__CheckNameSpaceDecls1(), and GWEN_XMLNode_GetXPath().
GWENHYWFAR_API uint32_t GWEN_Buffer_GetBookmark | ( | GWEN_BUFFER * | bf, | |
unsigned int | idx | |||
) |
Returns the given bookmark
Definition at line 608 of file buffer.c.
References GWEN_BUFFER_MAX_BOOKMARKS.
GWENHYWFAR_API uint32_t GWEN_Buffer_GetBytesLeft | ( | GWEN_BUFFER * | bf | ) |
Returns the number of bytes from pos to the end of the used area.
Definition at line 590 of file buffer.c.
Referenced by GWEN_Io_LayerHttp_AddRequest(), GWEN_Io_LayerHttp_WorkOnWriteRequest1(), GWEN_Io_LayerMemory_AddRequest(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__ReadValue(), GWEN_MsgEngine_ReadMessage(), GWEN_MsgEngine_SkipSegment(), GWEN_Tag16_fromBuffer(), GWEN_Text_EscapeToBufferTolerant2(), and GWEN_TLV_fromBuffer().
GWENHYWFAR_API uint32_t GWEN_Buffer_GetHardLimit | ( | GWEN_BUFFER * | bf | ) |
GWENHYWFAR_API uint32_t GWEN_Buffer_GetMaxUnsegmentedWrite | ( | GWEN_BUFFER * | bf | ) |
Returns the maximum number of bytes which can be written to the buffer at once (i.e. without reallocation).
Definition at line 582 of file buffer.c.
Referenced by GWEN_Crypt_TokenFile__Decipher(), GWEN_Crypt_TokenFile__Sign(), GWEN_Crypt_TokenFile__Verify(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgrKeys_DecryptKey(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_CryptMgrKeys_VerifyData(), and GWEN_Text_UnescapeXmlToBuffer().
GWENHYWFAR_API uint32_t GWEN_Buffer_GetMode | ( | GWEN_BUFFER * | bf | ) |
Returns the current mode of the buffer (such as GWEN_BUFFER_MODE_DYNAMIC).
GWENHYWFAR_API uint32_t GWEN_Buffer_GetPos | ( | GWEN_BUFFER * | bf | ) |
Returns the current position within the buffer. This pointer is adjusted by the various read and write functions.
Definition at line 230 of file buffer.c.
Referenced by GWEN_CryptHead_toBuffer(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), GWEN_Directory_GetDirEntries(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetFileEntriesWithType(), GWEN_HttpSession_RecvPacket(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__ReadValue(), GWEN_MsgEngine__WriteGroup(), GWEN_MsgEngine__WriteValue(), GWEN_MsgEngine_ReadMessage(), GWEN_MsgEngine_SkipSegment(), GWEN_SigHead_toBuffer(), GWEN_SigTail_toBuffer(), GWEN_Tag16_fromBuffer(), GWEN_Text_GetWordToBuffer(), and GWEN_TLV_fromBuffer().
GWENHYWFAR_API char* GWEN_Buffer_GetPosPointer | ( | GWEN_BUFFER * | bf | ) |
Returns a pointer to the current position within the buffer.
Definition at line 601 of file buffer.c.
Referenced by GWEN_CryptMgrKeys_DecryptKey(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_CryptMgrKeys_VerifyData(), GWEN_Io_Layer_ReadPacketToBuffer(), GWEN_Io_LayerHttp_WorkOnReadRequest1(), GWEN_Io_LayerHttp_WorkOnWriteRequest1(), GWEN_Io_LayerMemory_AddRequest(), GWEN_Io_LayerTls__readFile(), GWEN_MsgEngine__ReadValue(), GWEN_MsgEngine__WriteValue(), GWEN_Path_AppendPathElement(), GWEN_Tag16_fromBuffer(), GWEN_Text_UnescapeXmlToBuffer(), and GWEN_TLV_fromBuffer().
GWENHYWFAR_API uint32_t GWEN_Buffer_GetSize | ( | GWEN_BUFFER * | bf | ) |
Returns the size of the buffer (i.e. the number of bytes allocated).
Definition at line 221 of file buffer.c.
References GWEN_BUFFER_MODE_DYNAMIC.
GWENHYWFAR_API char* GWEN_Buffer_GetStart | ( | GWEN_BUFFER * | bf | ) |
Returns the start of the buffer. You can use the function GWEN_Buffer_GetPos to navigate within the buffer.
Definition at line 214 of file buffer.c.
Referenced by check1(), check2(), GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token_GetPin(), GWEN_Crypt_Token_ModuleInit(), GWEN_Crypt_Token_PluginManager_CheckToken(), GWEN_Crypt_Token_SetPinStatus(), GWEN_Crypt_TokenFile__Decipher(), GWEN_Crypt_TokenFile__Encipher(), GWEN_Crypt_TokenFile__Sign(), GWEN_Crypt_TokenFile__Verify(), GWEN_CryptHead_toBuffer(), GWEN_CryptMgr_Decode(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Encode(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_CryptMgrKeys_VerifyData(), GWEN_DB__ReadValues(), GWEN_DB_ReadFromFastBuffer(), GWEN_DB_WriteGroupToIoLayer(), GWEN_DBIO_ModuleInit(), GWEN_Directory_FindFileInPaths(), GWEN_Directory_FindPathForFile(), GWEN_Directory_GetDirEntries(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetFileEntriesWithType(), GWEN_Directory_GetPath(), GWEN_Directory_HandlePathElement(), GWEN_Gui_CGui_CheckCert(), GWEN_Gui_CGui_GetPassword(), GWEN_Gui_CGui_InputBox(), GWEN_Gui_CGui_MessageBox(), GWEN_Gui_CGui_SetPasswordStatus(), GWEN_Gui_CGui_ShowBox(), GWEN_Gui_CheckCertBuiltIn(), GWEN_Gui_CProgress_GetLogBuf(), GWEN_Gui_CProgress_Log(), GWEN_HttpSession__RecvPacket(), GWEN_HttpSession_Init(), GWEN_Io_LayerHttp_WorkOnReadRequest1(), GWEN_Io_LayerTls_GetPeerCert(), GWEN_Io_LayerTls_Prepare(), GWEN_Io_LayerTls_WorkOnRequests(), GWEN_IpcManager__SendMsg(), GWEN_LoadPluginDescrsByType(), GWEN_Logger__Log(), GWEN_Logger_Log(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__ReadValue(), GWEN_MsgEngine__WriteElement(), GWEN_MsgEngine_ReadMessage(), GWEN_Padd__UnpaddWithPkcs1Bt1Or2(), GWEN_Padd_PaddWithISO9796(), GWEN_Padd_PaddWithIso9796_2(), GWEN_Padd_PaddWithPkcs1Bt1(), GWEN_Padd_PaddWithPkcs1Bt2(), GWEN_Padd_UnpaddWithAnsiX9_23(), GWEN_Padd_UnpaddWithIso9796_2(), GWEN_Path_Handle(), GWEN_Path_HandleWithIdx(), GWEN_PathManager_AddPath(), GWEN_PathManager_AddRelPath(), GWEN_PluginManager_LoadPlugin(), GWEN_PluginManager_LoadPluginFile(), GWEN_SigHead_toBuffer(), GWEN_SigTail_toBuffer(), GWEN_Text_CondenseBuffer(), GWEN_Text_LogString(), GWEN_Url_fromCommandString(), GWEN_Url_fromString(), GWEN_XML__ReadData(), GWEN_XML__ReadTag(), GWEN_XML_AddNameSpace(), GWEN_XML_FindNameSpace(), GWEN_XmlCtxStore_AddData(), GWEN_XMLNode__CheckAndSetNameSpace(), GWEN_XMLNode__CheckNameSpaceDecls1(), and GWEN_XMLNode_GetXPath().
GWENHYWFAR_API uint32_t GWEN_Buffer_GetStep | ( | GWEN_BUFFER * | bf | ) |
GWENHYWFAR_API uint32_t GWEN_Buffer_GetUsedBytes | ( | GWEN_BUFFER * | bf | ) |
Definition at line 258 of file buffer.c.
Referenced by check1(), check2(), GWEN_Crypt_TokenFile__Decipher(), GWEN_Crypt_TokenFile__Encipher(), GWEN_Crypt_TokenFile__Sign(), GWEN_Crypt_TokenFile__Verify(), GWEN_CryptMgr_Decode(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Encode(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_CryptMgrKeys_VerifyData(), GWEN_DB__ReadValues(), GWEN_DB_ReadFromFastBuffer(), GWEN_Directory_HandlePathElement(), GWEN_HttpSession__RecvPacket(), GWEN_Io_LayerHttp_AddRequest(), GWEN_Io_LayerHttp_WorkOnReadRequest1(), GWEN_Io_LayerTls_GetPeerCert(), GWEN_Io_LayerTls_Prepare(), GWEN_IpcManager__SendMsg(), GWEN_LoadPluginDescrsByType(), GWEN_Logger__Log(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__ReadValue(), GWEN_MsgEngine__WriteElement(), GWEN_MsgEngine__WriteValue(), GWEN_MsgEngine_ReadMessage(), GWEN_MsgEngine_SkipSegment(), GWEN_Padd__UnpaddWithPkcs1Bt1Or2(), GWEN_Padd_ApplyPaddAlgo(), GWEN_Padd_PaddWithAnsiX9_23(), GWEN_Padd_PaddWithISO9796(), GWEN_Padd_PaddWithIso9796_2(), GWEN_Padd_PaddWithPkcs1Bt1(), GWEN_Padd_PaddWithPkcs1Bt2(), GWEN_Padd_UnpaddWithAnsiX9_23(), GWEN_Padd_UnpaddWithIso9796_2(), GWEN_Text_CondenseBuffer(), GWEN_Url_fromCommandString(), GWEN_Url_fromString(), GWEN_XML__ReadData(), GWEN_XML__ReadTag(), and GWEN_XmlCtxStore_AddData().
GWENHYWFAR_API int GWEN_Buffer_IncrementPos | ( | GWEN_BUFFER * | bf, | |
uint32_t | i | |||
) |
Move the position pointer forward by the given number i
.
Definition at line 517 of file buffer.c.
References DBG_DEBUG, GWEN_BUFFER_MODE_USE_BIO, and GWEN_LOGDOMAIN.
Referenced by GWEN_Crypt_TokenFile__Decipher(), GWEN_Crypt_TokenFile__Sign(), GWEN_Crypt_TokenFile__Verify(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgrKeys_DecryptKey(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_CryptMgrKeys_VerifyData(), GWEN_Io_Layer_ReadPacketToBuffer(), GWEN_Io_LayerHttp_WorkOnReadRequest1(), GWEN_Io_LayerHttp_WorkOnWriteRequest1(), GWEN_Io_LayerMemory_AddRequest(), GWEN_Io_LayerTls__readFile(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__ReadValue(), GWEN_MsgEngine__WriteValue(), GWEN_MsgEngine_SkipSegment(), GWEN_Tag16_fromBuffer(), GWEN_Text_UnescapeXmlToBuffer(), and GWEN_TLV_fromBuffer().
GWENHYWFAR_API int GWEN_Buffer_InsertBuffer | ( | GWEN_BUFFER * | bf, | |
GWEN_BUFFER * | sf | |||
) |
Insert the content of the buffer sf
into the buffer bf
at the position of its current position pointer. The size of bf
will be increased accordingly. Returns zero on success or nonzero if this failed (e.g. because of out of memory error).
Definition at line 948 of file buffer.c.
References GWEN_Buffer_InsertBytes().
GWENHYWFAR_API int GWEN_Buffer_InsertByte | ( | GWEN_BUFFER * | bf, | |
char | c | |||
) |
Inserts a byte at the current position. If the current position is 0 and there is reserved space at the beginning of the buffer then that space will be used. Otherwise the data at the current position will be moved out of the way and the new byte inserted. The position pointer will not be altered, but after calling this function at that position there is the begin of the newly inserted byte. All pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) become invalid ! This function updates the bookmarks accordingly.
Definition at line 936 of file buffer.c.
References GWEN_Buffer_InsertRoom().
Referenced by GWEN_XMLNode_GetXPath().
GWENHYWFAR_API int GWEN_Buffer_InsertBytes | ( | GWEN_BUFFER * | bf, | |
const char * | buffer, | |||
uint32_t | size | |||
) |
Inserts multiple bytes at the current position. If the current position is 0 and there is reserved space at the beginning of the buffer then that space will be used. Otherwise the data at the current position will be moved out of the way and the new bytes inserted. The position pointer will not be altered, but all pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) become invalid !
Definition at line 921 of file buffer.c.
References GWEN_Buffer_InsertRoom().
Referenced by GWEN_Buffer_InsertBuffer(), and GWEN_Buffer_InsertString().
GWENHYWFAR_API int GWEN_Buffer_InsertRoom | ( | GWEN_BUFFER * | bf, | |
uint32_t | size | |||
) |
This function makes room for the given number of bytes at the current buffer position. It moves any existing data at the current position out of the way. The position pointer will not be altered, but after calling this function at that position there is the begin of the newly inserted room. All pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) become invalid ! This function updates the bookmarks accordingly.
Definition at line 792 of file buffer.c.
References DBG_DEBUG, DBG_ERROR, GWEN_Buffer_AdjustBookmarks(), GWEN_Buffer_AllocRoom(), and GWEN_LOGDOMAIN.
Referenced by GWEN_Buffer_FillLeftWithBytes(), GWEN_Buffer_InsertByte(), GWEN_Buffer_InsertBytes(), GWEN_Buffer_ReplaceBytes(), GWEN_Padd_PaddWithIso9796_2(), GWEN_Padd_PaddWithPkcs1Bt1(), and GWEN_Padd_PaddWithPkcs1Bt2().
GWENHYWFAR_API int GWEN_Buffer_InsertString | ( | GWEN_BUFFER * | bf, | |
const char * | buffer | |||
) |
Inserts the given string at the current position (without the trailing null byte) The position pointer will not be altered, but after calling this function at that position there is the begin of the newly inserted string. All pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) become invalid ! This function updates the bookmarks accordingly.
Definition at line 994 of file buffer.c.
References GWEN_Buffer_InsertBytes().
Referenced by GWEN_XMLNode_GetXPath().
GWENHYWFAR_API GWEN_BUFFER* GWEN_Buffer_new | ( | char * | buffer, | |
uint32_t | size, | |||
uint32_t | used, | |||
int | take_ownership | |||
) |
Creates a new GWEN_BUFFER, which is a dynamically resizeable text buffer.
buffer | If non-NULL, then this buffer will be used as actual storage space. Otherwise a new buffer will be allocated (with size bytes) | |
size | If buffer was non-NULL, then this argument must specifiy the size of that buffer. If buffer was NULL, then this argument specifies the number of bytes that will be allocated. | |
used | Number of bytes of the buffer actually used. This is interesting when reading from a buffer. | |
take_ownership | If buffer was non-NULL and this argument is nonzero, then the new GWEN_BUFFER object takes over the ownership of the given buffer so that it will be freed on GWEN_Buffer_free(). If this argument is zero, the given buffer will not be freed. If buffer was NULL, this argument has no effect. |
Definition at line 41 of file buffer.c.
References GWEN_BUFFER_MODE_DEFAULT, GWEN_Memory_malloc(), and GWEN_NEW_OBJECT.
Referenced by check1(), check2(), GWEN_BufferedIO_Buffer_fromString(), GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token_GetPin(), GWEN_Crypt_Token_ModuleInit(), GWEN_Crypt_Token_SetPinStatus(), GWEN_Crypt_TokenFile__Decipher(), GWEN_Crypt_TokenFile__Encipher(), GWEN_Crypt_TokenFile__Sign(), GWEN_Crypt_TokenFile__Verify(), GWEN_CryptMgr_Decode(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Encode(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), GWEN_CryptMgrKeys_DecryptKey(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_CryptMgrKeys_VerifyData(), GWEN_DB__ReadValues(), GWEN_DB_ReadFromFastBuffer(), GWEN_DB_WriteGroupToIoLayer(), GWEN_DBIO_ModuleInit(), GWEN_Directory_FindFileInPaths(), GWEN_Directory_FindPathForFile(), GWEN_Directory_GetDirEntries(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetFileEntriesWithType(), GWEN_Directory_GetPath(), GWEN_Directory_HandlePathElement(), GWEN_Gui_CGui_CheckCert(), GWEN_Gui_CGui_GetPassword(), GWEN_Gui_CGui_InputBox(), GWEN_Gui_CGui_MessageBox(), GWEN_Gui_CGui_SetPasswordStatus(), GWEN_Gui_CGui_ShowBox(), GWEN_Gui_CheckCertBuiltIn(), GWEN_Gui_CProgress_Log(), GWEN_Gui_CProgress_new(), GWEN_HttpSession__RecvPacket(), GWEN_HttpSession_Init(), GWEN_Io_LayerHttp_new(), GWEN_Io_LayerMemory_fromString(), GWEN_Io_LayerTls_GetPeerCert(), GWEN_Io_LayerTls_Prepare(), GWEN_Io_LayerTls_WorkOnRequests(), GWEN_IpcManager__SendMsg(), GWEN_LoadPluginDescrsByType(), GWEN_Logger__Log(), GWEN_Logger_Log(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__WriteElement(), GWEN_Path_Handle(), GWEN_Path_HandleWithIdx(), GWEN_PathManager_AddPath(), GWEN_PathManager_AddRelPath(), GWEN_PluginManager_LoadPlugin(), GWEN_PluginManager_LoadPluginFile(), GWEN_SigHead_toBuffer(), GWEN_Text_LogString(), GWEN_Url_fromCommandString(), GWEN_Url_fromString(), GWEN_XML__ReadData(), GWEN_XML__ReadTag(), GWEN_XML_AddNameSpace(), GWEN_XML_FindNameSpace(), GWEN_XmlCtxStore_AddData(), GWEN_XMLNode__CheckAndSetNameSpace(), GWEN_XMLNode__CheckNameSpaceDecls1(), and GWEN_XMLNode_GetXPath().
GWENHYWFAR_API int GWEN_Buffer_PeekByte | ( | GWEN_BUFFER * | bf | ) |
Returns the byte from the current position without changing the position pointer. So multiple calls to this function will result in returning the same character.
Definition at line 491 of file buffer.c.
References GWEN_Buffer__FillBuffer().
Referenced by GWEN_MsgEngine__ReadGroup().
GWENHYWFAR_API int GWEN_Buffer_ReadByte | ( | GWEN_BUFFER * | bf | ) |
Returns the byte from the current position. The position pointer is adjusted accordingly.
Definition at line 504 of file buffer.c.
References GWEN_Buffer__FillBuffer().
Referenced by GWEN_Buffer_ReadBytes(), GWEN_MsgEngine__ReadValue(), GWEN_MsgEngine__WriteValue(), GWEN_MsgEngine_SkipSegment(), and GWEN_Text_EscapeToBufferTolerant2().
GWENHYWFAR_API int GWEN_Buffer_ReadBytes | ( | GWEN_BUFFER * | bf, | |
char * | buffer, | |||
uint32_t * | size | |||
) |
Returns the bytes from the current position. The position pointer is adjusted accordingly.
Definition at line 702 of file buffer.c.
References DBG_DEBUG, DBG_VERBOUS, GWEN_Buffer__FillBuffer(), GWEN_Buffer_ReadByte(), and GWEN_LOGDOMAIN.
Referenced by GWEN_BufferedIO_Buffer__Read().
GWENHYWFAR_API int GWEN_Buffer_Relinquish | ( | GWEN_BUFFER * | bf | ) |
This function relinquishes ownership of the internal buffer if possible. It returns an error if this object does not own the buffer (it can't give you what it doesn't possess) or if the internal pointer to the memory allocated does not match the internal pointer to the current start of the buffer (this can be the case when GWEN_Buffer_ReserveBytes() of GWEN_Buffer_Crop() have been called).
Definition at line 130 of file buffer.c.
References GWEN_ERROR_INVALID.
Referenced by GWEN_IpcManager__SendMsg().
GWENHYWFAR_API int GWEN_Buffer_RemoveRoom | ( | GWEN_BUFFER * | bf, | |
uint32_t | size | |||
) |
This function removes the given number of bytes at the current buffer position. It moves any existing bytes behind the area to be removed to the current position. The position pointer will not be altered, but after calling this function at that position there is the begin of the data behind the removed area. All pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) become invalid ! This function updates the bookmarks accordingly.
Definition at line 850 of file buffer.c.
References GWEN_Buffer_AdjustBookmarks(), and GWEN_ERROR_INVALID.
Referenced by GWEN_Buffer_ReplaceBytes().
GWENHYWFAR_API int GWEN_Buffer_ReplaceBytes | ( | GWEN_BUFFER * | bf, | |
uint32_t | rsize, | |||
const char * | buffer, | |||
uint32_t | size | |||
) |
This function remplaces the given number of bytes at the current buffer position with some new bytes. If the number of bytes to be replaced does not equal the number of replacement bytes then the buffer is resized accordingly (e.g. shrunk or extended). The position pointer will not be altered. All pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) become invalid ! This function updates the bookmarks accordingly.
Definition at line 888 of file buffer.c.
References DBG_ERROR, GWEN_Buffer_InsertRoom(), GWEN_Buffer_RemoveRoom(), and GWEN_LOGDOMAIN.
GWENHYWFAR_API int GWEN_Buffer_ReserveBytes | ( | GWEN_BUFFER * | bf, | |
uint32_t | res | |||
) |
Reserves the given amount of bytes at the beginning of the buffer. Please note that this most likely results in a shift of the current position inside the buffer, so after this call all pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) are invalid ! You can use this function to save some memory copy actions when inserting bytes at the beginning of the buffer.
Definition at line 143 of file buffer.c.
References GWEN_Buffer_AllocRoom().
Referenced by GWEN_XMLNode_GetXPath().
GWENHYWFAR_API void GWEN_Buffer_Reset | ( | GWEN_BUFFER * | bf | ) |
Resets the position pointer and the byte counter.
Definition at line 686 of file buffer.c.
Referenced by GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token_ModuleInit(), GWEN_Crypt_Token_PluginManager_CheckToken(), GWEN_DB__ReadValues(), GWEN_DB_ReadFromFastBuffer(), GWEN_DBIO_ModuleInit(), GWEN_Gui_CGui_GetRawText(), GWEN_HttpSession__RecvPacket(), GWEN_Io_LayerHttp_AddRequest(), GWEN_Io_LayerHttp_WorkOnReadRequest1(), GWEN_Io_LayerHttp_WorkOnReadRequest2(), GWEN_Io_LayerHttp_WorkOnWriteRequest1(), GWEN_Padd_PaddWithISO9796(), GWEN_Path_Handle(), GWEN_Path_HandleWithIdx(), and GWEN_XMLNode_GetXPath().
GWENHYWFAR_API void GWEN_Buffer_Rewind | ( | GWEN_BUFFER * | bf | ) |
Resets the pos pointer
Definition at line 695 of file buffer.c.
Referenced by GWEN_BufferedIO_Buffer_fromString(), GWEN_Crypt_TokenFile__Encipher(), GWEN_Io_LayerHttp_AddRequest(), GWEN_Io_LayerMemory_fromString(), GWEN_MsgEngine__ReadGroup(), GWEN_Padd_PaddWithIso9796_2(), GWEN_Padd_PaddWithPkcs1Bt1(), and GWEN_Padd_PaddWithPkcs1Bt2().
GWENHYWFAR_API void GWEN_Buffer_SetBookmark | ( | GWEN_BUFFER * | bf, | |
unsigned int | idx, | |||
uint32_t | v | |||
) |
Set a bookmark. These bookmarks are not used by the GWEN_BUFFER functions, but may be usefull for an application.
Definition at line 616 of file buffer.c.
References GWEN_BUFFER_MAX_BOOKMARKS.
GWENHYWFAR_API void GWEN_Buffer_SetHardLimit | ( | GWEN_BUFFER * | bf, | |
uint32_t | l | |||
) |
GWENHYWFAR_API void GWEN_Buffer_SetMode | ( | GWEN_BUFFER * | bf, | |
uint32_t | mode | |||
) |
Changes the current mode of the buffer (such as GWEN_BUFFER_MODE_DYNAMIC).
GWENHYWFAR_API int GWEN_Buffer_SetPos | ( | GWEN_BUFFER * | bf, | |
uint32_t | i | |||
) |
Definition at line 237 of file buffer.c.
References DBG_ERROR, GWEN_BUFFER_MODE_USE_BIO, GWEN_BUFFER_MODE_USE_IO, and GWEN_LOGDOMAIN.
Referenced by GWEN_LoadPluginDescrsByType(), GWEN_MsgEngine__WriteGroup(), GWEN_MsgEngine_ReadMessage(), and GWEN_Padd_UnpaddWithAnsiX9_23().
GWENHYWFAR_API void GWEN_Buffer_SetSourceBIO | ( | GWEN_BUFFER * | bf, | |
GWEN_BUFFEREDIO * | bio, | |||
int | take | |||
) |
Sets the buffered input to be used as a source. This BIO is used when a byte is to be returned while the buffer is empty (or the end of the buffer is reached). In such a case the missing bytes are read from this BIO if the mode contains GWEN_BUFFER_MODE_USE_BIO.
Definition at line 1003 of file buffer.c.
References GWEN_BufferedIO_free().
GWENHYWFAR_API void GWEN_Buffer_SetSourceIoLayer | ( | GWEN_BUFFER * | bf, | |
GWEN_IO_LAYER * | io, | |||
int | take | |||
) |
Sets the io layer to be used as a source. This io layer is used when a byte is to be returned while the buffer is empty (or the end of the buffer is reached). In such a case the missing bytes are read from this io layer if the mode contains GWEN_BUFFER_MODE_USE_IO.
Definition at line 1021 of file buffer.c.
References GWEN_Io_Layer_free().
GWENHYWFAR_API void GWEN_Buffer_SetStep | ( | GWEN_BUFFER * | bf, | |
uint32_t | step | |||
) |
In dynamic mode, whenever there is new data to allocate then this value specifies how much data to allocate in addition. The allocated data in total for this buffer will be aligned to this value. 1024 is a reasonable value. This value NEEDS to be aligned 2^n (i.e. only ONE bit must be set !)
Definition at line 771 of file buffer.c.
Referenced by GWEN_MsgEngine__WriteElement(), GWEN_Path_Handle(), and GWEN_Path_HandleWithIdx().
GWENHYWFAR_API int GWEN_Buffer_SetUsedBytes | ( | GWEN_BUFFER * | bf, | |
uint32_t | i | |||
) |
Definition at line 265 of file buffer.c.
References DBG_ERROR, DBG_WARN, and GWEN_LOGDOMAIN.
GWENHYWFAR_API void GWEN_Buffer_SubMode | ( | GWEN_BUFFER * | bf, | |
uint32_t | mode | |||
) |
Removes the give mode from the current mode of the buffer (such as GWEN_BUFFER_MODE_DYNAMIC).