/usr/include/gwenhywfar4/gwenhywfar/tlv.h is in libgwenhywfar-core-dev 4.20.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | /***************************************************************************
begin : Sun Jun 13 2004
copyright : (C) 2004-2011 by Martin Preuss
email : martin@libchipcard.de
***************************************************************************
* Please see toplevel file COPYING for license details *
***************************************************************************/
#ifndef GWENHYWFAR_TLV_H
#define GWENHYWFAR_TLV_H
#include <gwenhywfar/buffer.h>
#include <gwenhywfar/misc.h>
typedef struct GWEN_TLV GWEN_TLV;
GWEN_LIST_FUNCTION_LIB_DEFS(GWEN_TLV, GWEN_TLV, GWENHYWFAR_API)
GWENHYWFAR_API
GWEN_TLV *GWEN_TLV_new(void);
GWENHYWFAR_API
void GWEN_TLV_free(GWEN_TLV *tlv);
GWENHYWFAR_API
GWEN_TLV *GWEN_TLV_create(unsigned int tagType,
unsigned int tagMode,
const void *p,
unsigned int dlen,
int isBerTlv);
GWENHYWFAR_API
GWEN_TLV *GWEN_TLV_fromBuffer(GWEN_BUFFER *mbuf, int isBerTlv);
GWENHYWFAR_API
int GWEN_TLV_toBuffer(GWEN_TLV *tlv, GWEN_BUFFER *mbuf);
GWENHYWFAR_API
int GWEN_TLV_DirectlyToBuffer(unsigned int tagType,
unsigned int tagMode,
const void *tagData,
int tagLength,
int isBerTlv,
GWEN_BUFFER *mbuf);
GWENHYWFAR_API
int GWEN_TLV_IsBerTlv(const GWEN_TLV *tlv);
GWENHYWFAR_API
unsigned int GWEN_TLV_GetTagType(const GWEN_TLV *tlv);
GWENHYWFAR_API
unsigned int GWEN_TLV_GetTagLength(const GWEN_TLV *tlv);
GWENHYWFAR_API
const void *GWEN_TLV_GetTagData(const GWEN_TLV *tlv);
GWENHYWFAR_API
int GWEN_TLV_IsContructed(const GWEN_TLV *tlv);
GWENHYWFAR_API
unsigned int GWEN_TLV_GetClass(const GWEN_TLV *tlv);
GWENHYWFAR_API
unsigned int GWEN_TLV_GetTagSize(const GWEN_TLV *tlv);
/**
* Reads a TLV header from a buffer (tag and length) and returns the number of bytes
* used by the header.
* @return number of bytes used to specify tag and length (i.e. TLV size without the data part)
* @param tlv TLV to read the header into
* @param p pointer to a buffer containing at least the header
* @param size siez of the buffer pointed to by @b p
* @param isBerTlv if !=0 then the TLV is supposed to be a BER-TLV object
*/
GWENHYWFAR_API
int GWEN_TLV_ReadHeader(GWEN_TLV *tlv, const uint8_t *p, uint32_t size, int isBerTlv);
/**
* Directly writes a TLV header (tag and length) to the given buffer.
* @return 0 if ok, error code otherwise
* @param tagType tag id
* @param tagMode bits 5, 6 and 7 of the first TLV byte (bits 6/7: class, bit 5: constructed)
* @param tagLength length of the data part introduced by the TLV header
* @param isBerTlv if !=0 then the TLV is supposed to be a BER-TLV object
* @param mbuf buffer to receive the TLV header
*/
GWENHYWFAR_API
int GWEN_TLV_WriteHeader(unsigned int tagType,
unsigned int tagMode,
uint64_t tagLength,
int isBerTlv,
GWEN_BUFFER *mbuf);
#endif /* GWENHYWFAR_TLV_H */
|