xref: /titanic_44/usr/src/cmd/ssh/include/bufaux.h (revision 6f786ace10b9c0c7c5515e525fb660fbccfda6a3)
17c478bd9Sstevel@tonic-gate /*
2*6f786aceSNobutomo Nakano  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
37c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate  */
57c478bd9Sstevel@tonic-gate /*	$OpenBSD: bufaux.h,v 1.18 2002/04/20 09:14:58 markus Exp $	*/
67c478bd9Sstevel@tonic-gate 
77c478bd9Sstevel@tonic-gate #ifndef	_BUFAUX_H
87c478bd9Sstevel@tonic-gate #define	_BUFAUX_H
97c478bd9Sstevel@tonic-gate 
107c478bd9Sstevel@tonic-gate #ifdef __cplusplus
117c478bd9Sstevel@tonic-gate extern "C" {
127c478bd9Sstevel@tonic-gate #endif
137c478bd9Sstevel@tonic-gate 
147c478bd9Sstevel@tonic-gate 
157c478bd9Sstevel@tonic-gate /*
167c478bd9Sstevel@tonic-gate  * Author: Tatu Ylonen <ylo@cs.hut.fi>
177c478bd9Sstevel@tonic-gate  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
187c478bd9Sstevel@tonic-gate  *                    All rights reserved
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * As far as I am concerned, the code I have written for this software
217c478bd9Sstevel@tonic-gate  * can be used freely for any purpose.  Any derived versions of this
227c478bd9Sstevel@tonic-gate  * software must be clearly marked as such, and if the derived work is
237c478bd9Sstevel@tonic-gate  * incompatible with the protocol description in the RFC file, it must be
247c478bd9Sstevel@tonic-gate  * called by a name other than "ssh" or "Secure Shell".
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #include "buffer.h"
287c478bd9Sstevel@tonic-gate #include <openssl/bn.h>
297c478bd9Sstevel@tonic-gate 
3026ba1984Sjp161948 void    buffer_put_bignum(Buffer *, const BIGNUM *);
3126ba1984Sjp161948 void    buffer_put_bignum2(Buffer *, const BIGNUM *);
327c478bd9Sstevel@tonic-gate void	buffer_get_bignum(Buffer *, BIGNUM *);
337c478bd9Sstevel@tonic-gate void	buffer_get_bignum2(Buffer *, BIGNUM *);
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate u_short	buffer_get_short(Buffer *);
367c478bd9Sstevel@tonic-gate void	buffer_put_short(Buffer *, u_short);
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate u_int	buffer_get_int(Buffer *);
397c478bd9Sstevel@tonic-gate void    buffer_put_int(Buffer *, u_int);
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef HAVE_U_INT64_T
427c478bd9Sstevel@tonic-gate u_int64_t buffer_get_int64(Buffer *);
437c478bd9Sstevel@tonic-gate void	buffer_put_int64(Buffer *, u_int64_t);
447c478bd9Sstevel@tonic-gate #endif
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate int     buffer_get_char(Buffer *);
477c478bd9Sstevel@tonic-gate void    buffer_put_char(Buffer *, int);
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate void   *buffer_get_string(Buffer *, u_int *);
50*6f786aceSNobutomo Nakano char   *buffer_get_utf8_string(Buffer *, uint_t *);
517c478bd9Sstevel@tonic-gate void    buffer_put_string(Buffer *, const void *, u_int);
527c478bd9Sstevel@tonic-gate void	buffer_put_cstring(Buffer *, const char *);
53*6f786aceSNobutomo Nakano void	buffer_put_utf8_string(Buffer *, const char *, uint_t len);
54*6f786aceSNobutomo Nakano void	buffer_put_utf8_cstring(Buffer *, const char *);
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate #define buffer_skip_string(b) \
577c478bd9Sstevel@tonic-gate     do { u_int l = buffer_get_int(b); buffer_consume(b, l); } while(0)
587c478bd9Sstevel@tonic-gate 
5926ba1984Sjp161948 int	buffer_put_bignum_ret(Buffer *, const BIGNUM *);
6026ba1984Sjp161948 int	buffer_get_bignum_ret(Buffer *, BIGNUM *);
6126ba1984Sjp161948 int	buffer_put_bignum2_ret(Buffer *, const BIGNUM *);
6226ba1984Sjp161948 int	buffer_get_bignum2_ret(Buffer *, BIGNUM *);
6326ba1984Sjp161948 int	buffer_get_short_ret(u_short *, Buffer *);
6426ba1984Sjp161948 int	buffer_get_int_ret(u_int *, Buffer *);
6526ba1984Sjp161948 #ifdef HAVE_U_INT64_T
6626ba1984Sjp161948 int	buffer_get_int64_ret(u_int64_t *, Buffer *);
6726ba1984Sjp161948 #endif
6826ba1984Sjp161948 void	*buffer_get_string_ret(Buffer *, u_int *);
6926ba1984Sjp161948 int	buffer_get_char_ret(char *, Buffer *);
7026ba1984Sjp161948 
717c478bd9Sstevel@tonic-gate #ifdef __cplusplus
727c478bd9Sstevel@tonic-gate }
737c478bd9Sstevel@tonic-gate #endif
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate #endif /* _BUFAUX_H */
76