Guardtime KSI c SDK
fast_tlv.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013-2015 Guardtime, Inc.
3  *
4  * This file is part of the Guardtime client SDK.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License").
7  * You may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  * http://www.apache.org/licenses/LICENSE-2.0
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES, CONDITIONS, OR OTHER LICENSES OF ANY KIND, either
13  * express or implied. See the License for the specific language governing
14  * permissions and limitations under the License.
15  * "Guardtime" and "KSI" are trademarks or registered trademarks of
16  * Guardtime, Inc., and no license to trademarks is granted; Guardtime
17  * reserves and retains all trademark rights.
18  */
19 
20 #ifndef FAST_TLV_H_
21 #define FAST_TLV_H_
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27  typedef struct fast_tlv_s KSI_FTLV;
28 
29  struct fast_tlv_s {
31  size_t off;
32 
34  size_t hdr_len;
35 
37  size_t dat_len;
38 
40  unsigned tag;
41 
42  /* Flag - is non critical. */
43  int is_nc;
44 
45  /* Flag - is forward. */
46  int is_fwd;
47  };
48 
54  };
55 
65  int KSI_FTLV_fileRead(FILE *f, unsigned char *buf, size_t len, size_t *consumed, struct fast_tlv_s *t);
66 
76  int KSI_FTLV_socketRead(int fd, unsigned char *buf, size_t len, size_t *consumed, KSI_FTLV *t);
77 
85  int KSI_FTLV_memRead(const unsigned char *m, size_t l, KSI_FTLV *t);
86 
102  int KSI_FTLV_memReadN(const unsigned char *buf, size_t buf_len, KSI_FTLV *arr, size_t arr_len, size_t *rd);
103 
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* FAST_TLV_H_ */
int KSI_FTLV_fileRead(FILE *f, unsigned char *buf, size_t len, size_t *consumed, struct fast_tlv_s *t)
Definition: fast_tlv.h:53
int is_nc
Definition: fast_tlv.h:43
int KSI_FTLV_memReadN(const unsigned char *buf, size_t buf_len, KSI_FTLV *arr, size_t arr_len, size_t *rd)
size_t off
Definition: fast_tlv.h:31
Definition: fast_tlv.h:51
int KSI_FTLV_socketRead(int fd, unsigned char *buf, size_t len, size_t *consumed, KSI_FTLV *t)
int KSI_FTLV_memRead(const unsigned char *m, size_t l, KSI_FTLV *t)
unsigned tag
Definition: fast_tlv.h:40
size_t dat_len
Definition: fast_tlv.h:37
Definition: fast_tlv.h:29
size_t hdr_len
Definition: fast_tlv.h:34
int is_fwd
Definition: fast_tlv.h:46
KSI_Serialize_Opt_en
Definition: fast_tlv.h:49