15 #define DISABLE_DEBUGLOG
19 #include <gwenhywfar/debug.h>
20 #include <gwenhywfar/inherit.h>
21 #include <gwenhywfar/misc.h>
22 #include <gwenhywfar/text.h>
63 return tlv->tagLength;
85 unsigned int tagLength;
108 DBG_ERROR(0,
"Too few bytes for BER-TLV");
111 j=(
unsigned char)(p[pos]);
120 j=((
unsigned char)(p[pos+1]))<<8;
121 j|=(
unsigned char)(p[pos]);
129 tlv->tagType=tagType;
130 tlv->tagLength=tagLength;
132 tlv->tagData=(
void*)malloc(tagLength);
133 memmove(tlv->tagData, tagData, tagLength);
145 unsigned int tagType;
146 unsigned int tagLength;
147 const uint8_t *tagData;
168 j=(
unsigned char)(p[pos]);
177 j=((
unsigned char)(p[pos+1]))<<8;
178 j|=(
unsigned char)(p[pos]);
185 tlv->tagType=tagType;
186 tlv->tagLength=tagLength;
189 tlv->tagData=(
void*)malloc(tagLength);
190 memmove(tlv->tagData, tagData, tagLength);
194 tlv->tagData=(uint8_t*)tagData;
199 tlv->tagSize=tagLength+3;
uint32_t GWEN_Buffer_GetBytesLeft(GWEN_BUFFER *bf)
GWEN_TAG16 * GWEN_Tag16_fromBuffer(GWEN_BUFFER *mbuf, int isBerTlv)
#define GWEN_FREE_OBJECT(varname)
unsigned int GWEN_Tag16_GetTagSize(const GWEN_TAG16 *tlv)
uint32_t GWEN_Buffer_GetPos(const GWEN_BUFFER *bf)
struct GWEN_TAG16 GWEN_TAG16
char * GWEN_Buffer_GetPosPointer(const GWEN_BUFFER *bf)
void GWEN_Tag16_DirectlyToBuffer(unsigned int tagType, const char *p, int size, GWEN_BUFFER *buf)
int GWEN_Buffer_IncrementPos(GWEN_BUFFER *bf, uint32_t i)
const void * GWEN_Tag16_GetTagData(const GWEN_TAG16 *tlv)
#define GWEN_NEW_OBJECT(typ, varname)
GWEN_TAG16 * GWEN_Tag16_new(void)
int GWEN_Buffer_AppendByte(GWEN_BUFFER *bf, char c)
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
unsigned int GWEN_Tag16_GetTagLength(const GWEN_TAG16 *tlv)
unsigned int GWEN_Tag16_GetTagType(const GWEN_TAG16 *tlv)
#define DBG_ERROR(dbg_logger, format, args...)
#define GWEN_LIST_INIT(t, element)
int GWEN_Buffer_AppendBytes(GWEN_BUFFER *bf, const char *buffer, uint32_t size)
#define GWEN_LIST_FUNCTIONS(t, pr)
void GWEN_Tag16_free(GWEN_TAG16 *tlv)
#define GWEN_LIST_FINI(t, element)
GWEN_TAG16 * GWEN_Tag16_fromBuffer2(const uint8_t *p, uint32_t l, int doCopy)