Guardtime KSI c SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 #include <stdio.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29  typedef struct fast_tlv_s KSI_FTLV;
30 
31  struct fast_tlv_s {
33  size_t off;
34 
36  size_t hdr_len;
37 
39  size_t dat_len;
40 
42  unsigned tag;
43 
44  /* Flag - is non critical. */
45  int is_nc;
46 
47  /* Flag - is forward. */
48  int is_fwd;
49  };
50 
56  };
57 
67  int KSI_FTLV_fileRead(FILE *f, unsigned char *buf, size_t len, size_t *consumed, struct fast_tlv_s *t);
68 
78  int KSI_FTLV_socketRead(int fd, unsigned char *buf, size_t len, size_t *consumed, KSI_FTLV *t);
79 
90  int KSI_FTLV_memRead(const unsigned char *m, size_t l, KSI_FTLV *t);
91 
107  int KSI_FTLV_memReadN(const unsigned char *buf, size_t buf_len, KSI_FTLV *arr, size_t arr_len, size_t *rd);
108 
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #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:55
int is_nc
Definition: fast_tlv.h:45
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:33
Definition: fast_tlv.h:53
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:42
size_t dat_len
Definition: fast_tlv.h:39
Definition: fast_tlv.h:31
size_t hdr_len
Definition: fast_tlv.h:36
int is_fwd
Definition: fast_tlv.h:48
KSI_Serialize_Opt_en
Definition: fast_tlv.h:51