gwenhywfar  4.11.0beta
tlv.h
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Sun Jun 13 2004
3  copyright : (C) 2004-2011 by Martin Preuss
4  email : martin@libchipcard.de
5 
6  ***************************************************************************
7  * Please see toplevel file COPYING for license details *
8  ***************************************************************************/
9 
10 
11 #ifndef GWENHYWFAR_TLV_H
12 #define GWENHYWFAR_TLV_H
13 
14 #include <gwenhywfar/buffer.h>
15 #include <gwenhywfar/misc.h>
16 
17 
18 typedef struct GWEN_TLV GWEN_TLV;
19 
21 
22 
24 GWEN_TLV *GWEN_TLV_new(void);
26 void GWEN_TLV_free(GWEN_TLV *tlv);
27 
29 GWEN_TLV *GWEN_TLV_create(unsigned int tagType,
30  unsigned int tagMode,
31  const void *p,
32  unsigned int dlen,
33  int isBerTlv);
34 
35 
37 GWEN_TLV *GWEN_TLV_fromBuffer(GWEN_BUFFER *mbuf, int isBerTlv);
38 
40 int GWEN_TLV_toBuffer(GWEN_TLV *tlv, GWEN_BUFFER *mbuf);
41 
43 int GWEN_TLV_DirectlyToBuffer(unsigned int tagType,
44  unsigned int tagMode,
45  const void *tagData,
46  int tagLength,
47  int isBerTlv,
48  GWEN_BUFFER *mbuf);
49 
50 
52 int GWEN_TLV_IsBerTlv(const GWEN_TLV *tlv);
53 
55 unsigned int GWEN_TLV_GetTagType(const GWEN_TLV *tlv);
57 unsigned int GWEN_TLV_GetTagLength(const GWEN_TLV *tlv);
59 const void *GWEN_TLV_GetTagData(const GWEN_TLV *tlv);
60 
62 int GWEN_TLV_IsContructed(const GWEN_TLV *tlv);
64 unsigned int GWEN_TLV_GetClass(const GWEN_TLV *tlv);
66 unsigned int GWEN_TLV_GetTagSize(const GWEN_TLV *tlv);
67 
68 
79 int GWEN_TLV_ReadHeader(GWEN_TLV *tlv, const uint8_t *p, uint32_t size, int isBerTlv);
80 
81 
92 int GWEN_TLV_WriteHeader(unsigned int tagType,
93  unsigned int tagMode,
94  uint64_t tagLength,
95  int isBerTlv,
96  GWEN_BUFFER *mbuf);
97 
98 
99 #endif /* GWENHYWFAR_TLV_H */
100