gwenhywfar
4.8.0beta
|
#include <gwenhywfar/buffer.h>
#include <gwenhywfar/misc.h>
Go to the source code of this file.
Typedefs | |
typedef struct GWEN_TLV | GWEN_TLV |
Functions | |
GWENHYWFAR_API GWEN_TLV * | GWEN_TLV_create (unsigned int tagType, unsigned int tagMode, const void *p, unsigned int dlen, int isBerTlv) |
GWENHYWFAR_API int | GWEN_TLV_DirectlyToBuffer (unsigned int tagType, unsigned int tagMode, const void *tagData, int tagLength, int isBerTlv, GWEN_BUFFER *mbuf) |
GWENHYWFAR_API void | GWEN_TLV_free (GWEN_TLV *tlv) |
GWENHYWFAR_API GWEN_TLV * | GWEN_TLV_fromBuffer (GWEN_BUFFER *mbuf, int isBerTlv) |
GWENHYWFAR_API unsigned int | GWEN_TLV_GetClass (const GWEN_TLV *tlv) |
GWENHYWFAR_API const void * | GWEN_TLV_GetTagData (const GWEN_TLV *tlv) |
GWENHYWFAR_API unsigned int | GWEN_TLV_GetTagLength (const GWEN_TLV *tlv) |
GWENHYWFAR_API unsigned int | GWEN_TLV_GetTagSize (const GWEN_TLV *tlv) |
GWENHYWFAR_API unsigned int | GWEN_TLV_GetTagType (const GWEN_TLV *tlv) |
GWENHYWFAR_API int | GWEN_TLV_IsBerTlv (const GWEN_TLV *tlv) |
GWENHYWFAR_API int | GWEN_TLV_IsContructed (const GWEN_TLV *tlv) |
GWENHYWFAR_API GWEN_TLV * | GWEN_TLV_new (void) |
GWENHYWFAR_API int | GWEN_TLV_ReadHeader (GWEN_TLV *tlv, const uint8_t *p, uint32_t size, int isBerTlv) |
GWENHYWFAR_API int | GWEN_TLV_toBuffer (GWEN_TLV *tlv, GWEN_BUFFER *mbuf) |
GWENHYWFAR_API int | GWEN_TLV_WriteHeader (unsigned int tagType, unsigned int tagMode, uint64_t tagLength, int isBerTlv, GWEN_BUFFER *mbuf) |
GWENHYWFAR_API GWEN_TLV* GWEN_TLV_create | ( | unsigned int | tagType, |
unsigned int | tagMode, | ||
const void * | p, | ||
unsigned int | dlen, | ||
int | isBerTlv | ||
) |
Definition at line 53 of file tlv.c.
References DBG_ERROR, GWEN_LOGDOMAIN, and GWEN_TLV_new().
GWENHYWFAR_API int GWEN_TLV_DirectlyToBuffer | ( | unsigned int | tagType, |
unsigned int | tagMode, | ||
const void * | tagData, | ||
int | tagLength, | ||
int | isBerTlv, | ||
GWEN_BUFFER * | mbuf | ||
) |
Definition at line 279 of file tlv.c.
References GWEN_Buffer_AppendByte(), and GWEN_Buffer_AppendBytes().
Referenced by GWEN_Sar_AddAndDigestFileLink(), GWEN_Sar_AddFile(), GWEN_Sar_FileHeaderToTlv(), GWEN_Sar_Sign(), and GWEN_TLV_toBuffer().
GWENHYWFAR_API void GWEN_TLV_free | ( | GWEN_TLV * | tlv) |
Definition at line 43 of file tlv.c.
References GWEN_FREE_OBJECT, and GWEN_LIST_FINI.
Referenced by GWEN_Sar_ScanFile().
GWENHYWFAR_API GWEN_TLV* GWEN_TLV_fromBuffer | ( | GWEN_BUFFER * | mbuf, |
int | isBerTlv | ||
) |
Definition at line 131 of file tlv.c.
References DBG_DEBUG, DBG_ERROR, GWEN_Buffer_GetBytesLeft(), GWEN_Buffer_GetPos(), GWEN_Buffer_GetPosPointer(), GWEN_Buffer_IncrementPos(), GWEN_LOGDOMAIN, and GWEN_TLV_new().
Referenced by GWEN_Sar_TlvToFileHeader().
GWENHYWFAR_API unsigned int GWEN_TLV_GetClass | ( | const GWEN_TLV * | tlv) |
GWENHYWFAR_API const void* GWEN_TLV_GetTagData | ( | const GWEN_TLV * | tlv) |
Definition at line 124 of file tlv.c.
Referenced by GWEN_Sar_TlvToFileHeader().
GWENHYWFAR_API unsigned int GWEN_TLV_GetTagLength | ( | const GWEN_TLV * | tlv) |
Definition at line 110 of file tlv.c.
Referenced by GWEN_Sar_ScanFile(), and GWEN_Sar_TlvToFileHeader().
GWENHYWFAR_API unsigned int GWEN_TLV_GetTagSize | ( | const GWEN_TLV * | tlv) |
Definition at line 117 of file tlv.c.
Referenced by GWEN_Sar_ScanFile().
GWENHYWFAR_API unsigned int GWEN_TLV_GetTagType | ( | const GWEN_TLV * | tlv) |
Definition at line 103 of file tlv.c.
Referenced by GWEN_Sar_ScanFile(), and GWEN_Sar_TlvToFileHeader().
GWENHYWFAR_API int GWEN_TLV_IsBerTlv | ( | const GWEN_TLV * | tlv) |
GWENHYWFAR_API int GWEN_TLV_IsContructed | ( | const GWEN_TLV * | tlv) |
GWENHYWFAR_API GWEN_TLV* GWEN_TLV_new | ( | void | ) |
Definition at line 32 of file tlv.c.
References GWEN_LIST_INIT, and GWEN_NEW_OBJECT.
Referenced by GWEN_Sar_ScanFile(), GWEN_TLV_create(), and GWEN_TLV_fromBuffer().
GWENHYWFAR_API int GWEN_TLV_ReadHeader | ( | GWEN_TLV * | tlv, |
const uint8_t * | p, | ||
uint32_t | size, | ||
int | isBerTlv | ||
) |
Reads a TLV header from a buffer (tag and length) and returns the number of bytes used by the header.
tlv | TLV to read the header into |
p | pointer to a buffer containing at least the header |
size | siez of the buffer pointed to by p |
isBerTlv | if !=0 then the TLV is supposed to be a BER-TLV object |
Definition at line 340 of file tlv.c.
References DBG_DEBUG, DBG_ERROR, GWEN_ERROR_BAD_DATA, and GWEN_LOGDOMAIN.
Referenced by GWEN_Sar_ScanFile().
GWENHYWFAR_API int GWEN_TLV_toBuffer | ( | GWEN_TLV * | tlv, |
GWEN_BUFFER * | mbuf | ||
) |
Definition at line 267 of file tlv.c.
References GWEN_TLV_DirectlyToBuffer().
GWENHYWFAR_API int GWEN_TLV_WriteHeader | ( | unsigned int | tagType, |
unsigned int | tagMode, | ||
uint64_t | tagLength, | ||
int | isBerTlv, | ||
GWEN_BUFFER * | mbuf | ||
) |
Directly writes a TLV header (tag and length) to the given buffer.
tagType | tag id |
tagMode | bits 5, 6 and 7 of the first TLV byte (bits 6/7: class, bit 5: constructed) |
tagLength | length of the data part introduced by the TLV header |
isBerTlv | if !=0 then the TLV is supposed to be a BER-TLV object |
mbuf | buffer to receive the TLV header |
Definition at line 477 of file tlv.c.
References GWEN_Buffer_AppendByte().
Referenced by GWEN_Sar_AddAndDigestFileReg(), and GWEN_Sar_AddFile().