xref: /titanic_41/usr/src/cmd/ssh/include/bufaux.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 /*	$OpenBSD: bufaux.h,v 1.18 2002/04/20 09:14:58 markus Exp $	*/
6 
7 #ifndef	_BUFAUX_H
8 #define	_BUFAUX_H
9 
10 #pragma ident	"%Z%%M%	%I%	%E% SMI"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 
17 /*
18  * Author: Tatu Ylonen <ylo@cs.hut.fi>
19  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
20  *                    All rights reserved
21  *
22  * As far as I am concerned, the code I have written for this software
23  * can be used freely for any purpose.  Any derived versions of this
24  * software must be clearly marked as such, and if the derived work is
25  * incompatible with the protocol description in the RFC file, it must be
26  * called by a name other than "ssh" or "Secure Shell".
27  */
28 
29 #include "buffer.h"
30 #include <openssl/bn.h>
31 
32 void    buffer_put_bignum(Buffer *, BIGNUM *);
33 void    buffer_put_bignum2(Buffer *, BIGNUM *);
34 void	buffer_get_bignum(Buffer *, BIGNUM *);
35 void	buffer_get_bignum2(Buffer *, BIGNUM *);
36 
37 u_short	buffer_get_short(Buffer *);
38 void	buffer_put_short(Buffer *, u_short);
39 
40 u_int	buffer_get_int(Buffer *);
41 void    buffer_put_int(Buffer *, u_int);
42 
43 #ifdef HAVE_U_INT64_T
44 u_int64_t buffer_get_int64(Buffer *);
45 void	buffer_put_int64(Buffer *, u_int64_t);
46 #endif
47 
48 int     buffer_get_char(Buffer *);
49 void    buffer_put_char(Buffer *, int);
50 
51 void   *buffer_get_string(Buffer *, u_int *);
52 u_char *buffer_get_utf8_cstring(Buffer *);
53 char   *buffer_get_ascii_cstring(Buffer *);
54 void    buffer_put_string(Buffer *, const void *, u_int);
55 void	buffer_put_cstring(Buffer *, const char *);
56 void	buffer_put_utf8_cstring(Buffer *, const u_char *);
57 void	buffer_put_ascii_cstring(Buffer *, const char *);
58 
59 #if 0
60 /* If these are needed, then get rid of the #if 0 and this comment */
61 void	buffer_put_utf8_string(Buffer *, const u_char *, u_int);
62 void	buffer_put_ascii_string(Buffer *, const char *, u_int);
63 #endif
64 
65 #define buffer_skip_string(b) \
66     do { u_int l = buffer_get_int(b); buffer_consume(b, l); } while(0)
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif /* _BUFAUX_H */
73