/* sexp.h
+ *
+ * Parsing s-expressions.
+ */
- Parsing s-expressions.
- Copyright (C) 2002 Niels Möller
-
- This file is part of GNU Nettle.
-
- GNU Nettle is free software: you can redistribute it and/or
- modify it under the terms of either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- or
-
- * the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- or both in parallel, as here.
-
- GNU Nettle is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received copies of the GNU General Public License and
- the GNU Lesser General Public License along with this program. If
- not, see http://www.gnu.org/licenses/.
-*/
+/* nettle, low-level cryptographics library
+ *
+ * Copyright (C) 2002 Niels Möller
+ *
+ * The nettle library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * The nettle library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the nettle library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02111-1301, USA.
+ */
#ifndef NETTLE_SEXP_H_INCLUDED
#define NETTLE_SEXP_H_INCLUDED
struct sexp_iterator
{
- size_t length;
+ unsigned length;
const uint8_t *buffer;
/* Points at the start of the current sub expression. */
- size_t start;
+ unsigned start;
/* If type is SEXP_LIST, pos points at the start of the current
* element. Otherwise, it points at the end. */
- size_t pos;
+ unsigned pos;
unsigned level;
enum sexp_type type;
- size_t display_length;
+ unsigned display_length;
const uint8_t *display;
- size_t atom_length;
+ unsigned atom_length;
const uint8_t *atom;
};
/* Initializes the iterator. */
int
sexp_iterator_first(struct sexp_iterator *iterator,
- size_t length, const uint8_t *input);
+ unsigned length, const uint8_t *input);
/* NOTE: Decodes the input string in place */
int
sexp_transport_iterator_first(struct sexp_iterator *iterator,
- size_t length, uint8_t *input);
+ unsigned length, uint8_t *input);
int
sexp_iterator_next(struct sexp_iterator *iterator);
* sexp_iterator_next. */
const uint8_t *
sexp_iterator_subexpr(struct sexp_iterator *iterator,
- size_t *length);
+ unsigned *length);
int
sexp_iterator_get_uint32(struct sexp_iterator *iterator,
* separates tokens but is otherwise ignored) and the following
* formatting specifiers:
*
- * %s String represented as size_t length, const uint8_t *data.
+ * %s String represented as unsigned length, const uint8_t *data.
*
* %t Optional display type, represented as
- * size_t display_length, const uint8_t *display,
+ * unsigned display_length, const uint8_t *display,
* display == NULL means no display type.
*
* %i Non-negative small integer, uint32_t.
* %b Non-negative bignum, mpz_t.
*
* %l Literal string (no length added), typically a balanced
- * subexpression. Represented as size_t length, const uint8_t
+ * subexpression. Represented as unsigned length, const uint8_t
* *data.
*
* %(, %) Allows insertion of unbalanced parenthesis.
* const uint8_t * argument.
*/
-size_t
+unsigned
sexp_format(struct nettle_buffer *buffer,
const char *format, ...);
-size_t
+unsigned
sexp_vformat(struct nettle_buffer *buffer,
const char *format, va_list args);
-size_t
+unsigned
sexp_transport_format(struct nettle_buffer *buffer,
const char *format, ...);
-size_t
+unsigned
sexp_transport_vformat(struct nettle_buffer *buffer,
const char *format, va_list args);