1 /* g13tuple.h - Tuple handling
2 * Copyright (C) 2009 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * GnuPG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <https://www.gnu.org/licenses/>.
20 #ifndef G13_G13TUPLE_H
21 #define G13_G13TUPLE_H
23 #include "../common/membuf.h"
25 /* Append a new tuple to a memory buffer. */
26 void append_tuple (membuf_t *membuf,
27 int tag, const void *value, size_t length);
28 void append_tuple_uint (membuf_t *membuf, int tag,
29 unsigned long long value);
31 /* The tuple descriptor object. */
33 typedef struct tupledesc_s *tupledesc_t;
35 gpg_error_t create_tupledesc (tupledesc_t *r_tupledesc,
36 void *data, size_t datalen);
37 void destroy_tupledesc (tupledesc_t tupledesc);
38 tupledesc_t ref_tupledesc (tupledesc_t tupledesc);
39 #define unref_tupledesc(a) destroy_tupledesc ((a))
40 const void *get_tupledesc_data (tupledesc_t tupledesc, size_t *r_datalen);
42 const void *find_tuple (tupledesc_t tupledesc,
43 unsigned int tag, size_t *r_length);
44 gpg_error_t find_tuple_uint (tupledesc_t tupledesc, unsigned int tag,
45 unsigned long long *r_value);
46 const void *next_tuple (tupledesc_t tupledesc,
47 unsigned int *r_tag, size_t *r_length);
49 void dump_tupledesc (tupledesc_t tuples);
52 #endif /*G13_G13TUPLE_H*/