5 * Reading and writing packet buffers
7 * (c) 2001 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of Catacomb.
14 * Catacomb is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
19 * Catacomb is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with Catacomb; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 #ifndef CATACOMB_BUF_H
31 #define CATACOMB_BUF_H
37 /*----- Header files ------------------------------------------------------*/
39 #include <mLib/bits.h>
50 /*----- Functions provided ------------------------------------------------*/
52 /* --- @buf_getmp@ --- *
54 * Arguments: @buf *b@ = pointer to a buffer block
56 * Returns: A multiprecision integer, or null if there wasn't one there.
58 * Use: Gets a multiprecision integer from a buffer.
61 extern mp
*buf_getmp(buf */
*b*/
);
63 /* --- @buf_putmp@ --- *
65 * Arguments: @buf *b@ = pointer to a buffer block
66 * @mp *m@ = a multiprecision integer
68 * Returns: Zero if it worked, nonzero if there wasn't enough space.
70 * Use: Puts a multiprecision integer to a buffer.
73 extern int buf_putmp(buf */
*b*/
, mp */
*m*/
);
75 /* --- @buf_getec@ --- *
77 * Arguments: @buf *b@ = pointer to a buffer block
78 * @ec *p@ = where to put the point
80 * Returns: Zero if it worked, nonzero if it failed.
82 * Use: Gets a multiprecision integer from a buffer. The point must
86 extern int buf_getec(buf */
*b*/
, ec */
*p*/
);
88 /* --- @buf_putec@ --- *
90 * Arguments: @buf *b@ = pointer to a buffer block
91 * @ec *p@ = an elliptic curve point
93 * Returns: Zero if it worked, nonzero if there wasn't enough space.
95 * Use: Puts an elliptic curve point to a buffer.
98 extern int buf_putec(buf */
*b*/
, ec */
*p*/
);
100 /*----- That's all, folks -------------------------------------------------*/