1 | /* |
---|
2 | |
---|
3 | bufaux.h |
---|
4 | |
---|
5 | Author: Tatu Ylonen <ylo@cs.hut.fi> |
---|
6 | |
---|
7 | Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
---|
8 | All rights reserved |
---|
9 | |
---|
10 | Created: Wed Mar 29 02:18:23 1995 ylo |
---|
11 | |
---|
12 | */ |
---|
13 | |
---|
14 | /* |
---|
15 | * $Id: bufaux.h,v 1.1.1.2 1999-03-08 17:43:40 danw Exp $ |
---|
16 | * $Log: not supported by cvs2svn $ |
---|
17 | * Revision 1.1.1.1 1996/02/18 21:38:11 ylo |
---|
18 | * Imported ssh-1.2.13. |
---|
19 | * |
---|
20 | * Revision 1.2 1995/07/13 01:18:07 ylo |
---|
21 | * Removed "Last modified" header. |
---|
22 | * Added cvs log. |
---|
23 | * |
---|
24 | * $Endlog$ |
---|
25 | */ |
---|
26 | |
---|
27 | #ifndef BUFAUX_H |
---|
28 | #define BUFAUX_H |
---|
29 | |
---|
30 | #include "buffer.h" |
---|
31 | |
---|
32 | /* Stores an MP_INT in the buffer with a 2-byte msb first bit count, followed |
---|
33 | by (bits+7)/8 bytes of binary data, msb first. */ |
---|
34 | void buffer_put_mp_int(Buffer *buffer, MP_INT *value); |
---|
35 | |
---|
36 | /* Retrieves an MP_INT from the buffer. */ |
---|
37 | void buffer_get_mp_int(Buffer *buffer, MP_INT *value); |
---|
38 | |
---|
39 | /* Returns an integer from the buffer (4 bytes, msb first). */ |
---|
40 | unsigned int buffer_get_int(Buffer *buffer); |
---|
41 | |
---|
42 | /* Stores an integer in the buffer in 4 bytes, msb first. */ |
---|
43 | void buffer_put_int(Buffer *buffer, unsigned int value); |
---|
44 | |
---|
45 | /* Returns a character from the buffer (0 - 255). */ |
---|
46 | int buffer_get_char(Buffer *buffer); |
---|
47 | |
---|
48 | /* Stores a character in the buffer. */ |
---|
49 | void buffer_put_char(Buffer *buffer, int value); |
---|
50 | |
---|
51 | /* Returns an arbitrary binary string from the buffer. The string cannot |
---|
52 | be longer than 256k. The returned value points to memory allocated |
---|
53 | with xmalloc; it is the responsibility of the calling function to free |
---|
54 | the data. If length_ptr is non-NULL, the length of the returned data |
---|
55 | will be stored there. A null character will be automatically appended |
---|
56 | to the returned string, and is not counted in length. */ |
---|
57 | char *buffer_get_string(Buffer *buffer, unsigned int *length_ptr); |
---|
58 | |
---|
59 | /* Stores and arbitrary binary string in the buffer. */ |
---|
60 | void buffer_put_string(Buffer *buffer, const void *buf, unsigned int len); |
---|
61 | |
---|
62 | #endif /* BUFAUX_H */ |
---|