xref: /titanic_41/usr/src/cmd/ssh/include/bufaux.h (revision bfc032a14cc866ab7f34ca6fd86c240a5ebede9d)
1 /*
2  * Copyright 2009 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 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 
15 /*
16  * Author: Tatu Ylonen <ylo@cs.hut.fi>
17  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
18  *                    All rights reserved
19  *
20  * As far as I am concerned, the code I have written for this software
21  * can be used freely for any purpose.  Any derived versions of this
22  * software must be clearly marked as such, and if the derived work is
23  * incompatible with the protocol description in the RFC file, it must be
24  * called by a name other than "ssh" or "Secure Shell".
25  */
26 
27 #include "buffer.h"
28 #include <openssl/bn.h>
29 
30 void    buffer_put_bignum(Buffer *, const BIGNUM *);
31 void    buffer_put_bignum2(Buffer *, const BIGNUM *);
32 void	buffer_get_bignum(Buffer *, BIGNUM *);
33 void	buffer_get_bignum2(Buffer *, BIGNUM *);
34 
35 u_short	buffer_get_short(Buffer *);
36 void	buffer_put_short(Buffer *, u_short);
37 
38 u_int	buffer_get_int(Buffer *);
39 void    buffer_put_int(Buffer *, u_int);
40 
41 #ifdef HAVE_U_INT64_T
42 u_int64_t buffer_get_int64(Buffer *);
43 void	buffer_put_int64(Buffer *, u_int64_t);
44 #endif
45 
46 int     buffer_get_char(Buffer *);
47 void    buffer_put_char(Buffer *, int);
48 
49 void   *buffer_get_string(Buffer *, u_int *);
50 char   *buffer_get_utf8_string(Buffer *, uint_t *);
51 void    buffer_put_string(Buffer *, const void *, u_int);
52 void	buffer_put_cstring(Buffer *, const char *);
53 void	buffer_put_utf8_string(Buffer *, const char *, uint_t len);
54 void	buffer_put_utf8_cstring(Buffer *, const char *);
55 
56 #define buffer_skip_string(b) \
57     do { u_int l = buffer_get_int(b); buffer_consume(b, l); } while(0)
58 
59 int	buffer_put_bignum_ret(Buffer *, const BIGNUM *);
60 int	buffer_get_bignum_ret(Buffer *, BIGNUM *);
61 int	buffer_put_bignum2_ret(Buffer *, const BIGNUM *);
62 int	buffer_get_bignum2_ret(Buffer *, BIGNUM *);
63 int	buffer_get_short_ret(u_short *, Buffer *);
64 int	buffer_get_int_ret(u_int *, Buffer *);
65 #ifdef HAVE_U_INT64_T
66 int	buffer_get_int64_ret(u_int64_t *, Buffer *);
67 #endif
68 void	*buffer_get_string_ret(Buffer *, u_int *);
69 int	buffer_get_char_ret(char *, Buffer *);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* _BUFAUX_H */
76