bufaux.h 1.82 KB
Newer Older
1
/* $OpenBSD: bufaux.h,v 1.22 2006/03/25 22:22:42 djm Exp $ */
2

Damien Miller's avatar
Damien Miller committed
3
/*
4 5 6
 * Author: Tatu Ylonen <ylo@cs.hut.fi>
 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
 *                    All rights reserved
7
 *
8 9 10 11 12
 * As far as I am concerned, the code I have written for this software
 * can be used freely for any purpose.  Any derived versions of this
 * software must be clearly marked as such, and if the derived work is
 * incompatible with the protocol description in the RFC file, it must be
 * called by a name other than "ssh" or "Secure Shell".
13 14
 */

Damien Miller's avatar
Damien Miller committed
15 16 17 18
#ifndef BUFAUX_H
#define BUFAUX_H

#include "buffer.h"
19
#include <openssl/bn.h>
Damien Miller's avatar
Damien Miller committed
20

21 22
void    buffer_put_bignum(Buffer *, const BIGNUM *);
void    buffer_put_bignum2(Buffer *, const BIGNUM *);
23 24
void	buffer_get_bignum(Buffer *, BIGNUM *);
void	buffer_get_bignum2(Buffer *, BIGNUM *);
Damien Miller's avatar
Damien Miller committed
25

26 27 28
u_short	buffer_get_short(Buffer *);
void	buffer_put_short(Buffer *, u_short);

Kevin Steves's avatar
Kevin Steves committed
29
u_int	buffer_get_int(Buffer *);
30
void    buffer_put_int(Buffer *, u_int);
31 32

u_int64_t buffer_get_int64(Buffer *);
33
void	buffer_put_int64(Buffer *, u_int64_t);
Damien Miller's avatar
Damien Miller committed
34

35 36
int     buffer_get_char(Buffer *);
void    buffer_put_char(Buffer *, int);
Damien Miller's avatar
Damien Miller committed
37

38
void   *buffer_get_string(Buffer *, u_int *);
39 40
void    buffer_put_string(Buffer *, const void *, u_int);
void	buffer_put_cstring(Buffer *, const char *);
Damien Miller's avatar
Damien Miller committed
41

42
#define buffer_skip_string(b) \
43
    do { u_int l = buffer_get_int(b); buffer_consume(b, l); } while (0)
44

45 46 47 48 49 50 51 52 53 54
int	buffer_put_bignum_ret(Buffer *, const BIGNUM *);
int	buffer_get_bignum_ret(Buffer *, BIGNUM *);
int	buffer_put_bignum2_ret(Buffer *, const BIGNUM *);
int	buffer_get_bignum2_ret(Buffer *, BIGNUM *);
int	buffer_get_short_ret(u_short *, Buffer *);
int	buffer_get_int_ret(u_int *, Buffer *);
int	buffer_get_int64_ret(u_int64_t *, Buffer *);
void	*buffer_get_string_ret(Buffer *, u_int *);
int	buffer_get_char_ret(char *, Buffer *);

55
#endif				/* BUFAUX_H */