xref: /onnv-gate/usr/src/cmd/ssh/include/bufaux.h (revision 9600:113cf06ae502)
10Sstevel@tonic-gate /*
2*9600SNobutomo.Nakano@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
30Sstevel@tonic-gate  * Use is subject to license terms.
40Sstevel@tonic-gate  */
50Sstevel@tonic-gate /*	$OpenBSD: bufaux.h,v 1.18 2002/04/20 09:14:58 markus Exp $	*/
60Sstevel@tonic-gate 
70Sstevel@tonic-gate #ifndef	_BUFAUX_H
80Sstevel@tonic-gate #define	_BUFAUX_H
90Sstevel@tonic-gate 
100Sstevel@tonic-gate #ifdef __cplusplus
110Sstevel@tonic-gate extern "C" {
120Sstevel@tonic-gate #endif
130Sstevel@tonic-gate 
140Sstevel@tonic-gate 
150Sstevel@tonic-gate /*
160Sstevel@tonic-gate  * Author: Tatu Ylonen <ylo@cs.hut.fi>
170Sstevel@tonic-gate  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
180Sstevel@tonic-gate  *                    All rights reserved
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * As far as I am concerned, the code I have written for this software
210Sstevel@tonic-gate  * can be used freely for any purpose.  Any derived versions of this
220Sstevel@tonic-gate  * software must be clearly marked as such, and if the derived work is
230Sstevel@tonic-gate  * incompatible with the protocol description in the RFC file, it must be
240Sstevel@tonic-gate  * called by a name other than "ssh" or "Secure Shell".
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #include "buffer.h"
280Sstevel@tonic-gate #include <openssl/bn.h>
290Sstevel@tonic-gate 
302757Sjp161948 void    buffer_put_bignum(Buffer *, const BIGNUM *);
312757Sjp161948 void    buffer_put_bignum2(Buffer *, const BIGNUM *);
320Sstevel@tonic-gate void	buffer_get_bignum(Buffer *, BIGNUM *);
330Sstevel@tonic-gate void	buffer_get_bignum2(Buffer *, BIGNUM *);
340Sstevel@tonic-gate 
350Sstevel@tonic-gate u_short	buffer_get_short(Buffer *);
360Sstevel@tonic-gate void	buffer_put_short(Buffer *, u_short);
370Sstevel@tonic-gate 
380Sstevel@tonic-gate u_int	buffer_get_int(Buffer *);
390Sstevel@tonic-gate void    buffer_put_int(Buffer *, u_int);
400Sstevel@tonic-gate 
410Sstevel@tonic-gate #ifdef HAVE_U_INT64_T
420Sstevel@tonic-gate u_int64_t buffer_get_int64(Buffer *);
430Sstevel@tonic-gate void	buffer_put_int64(Buffer *, u_int64_t);
440Sstevel@tonic-gate #endif
450Sstevel@tonic-gate 
460Sstevel@tonic-gate int     buffer_get_char(Buffer *);
470Sstevel@tonic-gate void    buffer_put_char(Buffer *, int);
480Sstevel@tonic-gate 
490Sstevel@tonic-gate void   *buffer_get_string(Buffer *, u_int *);
50*9600SNobutomo.Nakano@Sun.COM char   *buffer_get_utf8_string(Buffer *, uint_t *);
510Sstevel@tonic-gate void    buffer_put_string(Buffer *, const void *, u_int);
520Sstevel@tonic-gate void	buffer_put_cstring(Buffer *, const char *);
53*9600SNobutomo.Nakano@Sun.COM void	buffer_put_utf8_string(Buffer *, const char *, uint_t len);
54*9600SNobutomo.Nakano@Sun.COM void	buffer_put_utf8_cstring(Buffer *, const char *);
550Sstevel@tonic-gate 
560Sstevel@tonic-gate #define buffer_skip_string(b) \
570Sstevel@tonic-gate     do { u_int l = buffer_get_int(b); buffer_consume(b, l); } while(0)
580Sstevel@tonic-gate 
592757Sjp161948 int	buffer_put_bignum_ret(Buffer *, const BIGNUM *);
602757Sjp161948 int	buffer_get_bignum_ret(Buffer *, BIGNUM *);
612757Sjp161948 int	buffer_put_bignum2_ret(Buffer *, const BIGNUM *);
622757Sjp161948 int	buffer_get_bignum2_ret(Buffer *, BIGNUM *);
632757Sjp161948 int	buffer_get_short_ret(u_short *, Buffer *);
642757Sjp161948 int	buffer_get_int_ret(u_int *, Buffer *);
652757Sjp161948 #ifdef HAVE_U_INT64_T
662757Sjp161948 int	buffer_get_int64_ret(u_int64_t *, Buffer *);
672757Sjp161948 #endif
682757Sjp161948 void	*buffer_get_string_ret(Buffer *, u_int *);
692757Sjp161948 int	buffer_get_char_ret(char *, Buffer *);
702757Sjp161948 
710Sstevel@tonic-gate #ifdef __cplusplus
720Sstevel@tonic-gate }
730Sstevel@tonic-gate #endif
740Sstevel@tonic-gate 
750Sstevel@tonic-gate #endif /* _BUFAUX_H */
76