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