xref: /titanic_44/usr/src/cmd/ssh/include/bufaux.h (revision 0cd13cbfb4270b840b4bd22ec5f673b2b6a2c02b)
1 /*
2  * Copyright 2006 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 *, const BIGNUM *);
33 void    buffer_put_bignum2(Buffer *, const 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 int	buffer_put_bignum_ret(Buffer *, const BIGNUM *);
69 int	buffer_get_bignum_ret(Buffer *, BIGNUM *);
70 int	buffer_put_bignum2_ret(Buffer *, const BIGNUM *);
71 int	buffer_get_bignum2_ret(Buffer *, BIGNUM *);
72 int	buffer_get_short_ret(u_short *, Buffer *);
73 int	buffer_get_int_ret(u_int *, Buffer *);
74 #ifdef HAVE_U_INT64_T
75 int	buffer_get_int64_ret(u_int64_t *, Buffer *);
76 #endif
77 void	*buffer_get_string_ret(Buffer *, u_int *);
78 int	buffer_get_char_ret(char *, Buffer *);
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif /* _BUFAUX_H */
85