]> andersk Git - gssapi-openssh.git/blame - openssh/buffer.h
The man2html from jbasney on pkilab2 works whereas the standard one doesn't.
[gssapi-openssh.git] / openssh / buffer.h
CommitLineData
5156b1a1 1/* $OpenBSD: buffer.h,v 1.17 2008/05/08 06:59:01 markus Exp $ */
473db5ab 2
3c0ef626 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
5 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
6 * All rights reserved
7 * Code for manipulating FIFO buffers.
8 *
9 * As far as I am concerned, the code I have written for this software
10 * can be used freely for any purpose. Any derived versions of this
11 * software must be clearly marked as such, and if the derived work is
12 * incompatible with the protocol description in the RFC file, it must be
13 * called by a name other than "ssh" or "Secure Shell".
14 */
15
3c0ef626 16#ifndef BUFFER_H
17#define BUFFER_H
6df46d40 18
19/* move the following to a more appropriate place and name */
20#define BUFFER_MAX_LEN_HPN 0x4000000 /* 64MB */
3c0ef626 21
22typedef struct {
473db5ab 23 u_char *buf; /* Buffer for data. */
3c0ef626 24 u_int alloc; /* Number of bytes allocated for data. */
25 u_int offset; /* Offset of first byte containing data. */
26 u_int end; /* Offset of last byte containing data. */
27} Buffer;
28
29void buffer_init(Buffer *);
30void buffer_clear(Buffer *);
31void buffer_free(Buffer *);
32
33u_int buffer_len(Buffer *);
473db5ab 34void *buffer_ptr(Buffer *);
3c0ef626 35
473db5ab 36void buffer_append(Buffer *, const void *, u_int);
37void *buffer_append_space(Buffer *, u_int);
3c0ef626 38
30460aeb 39int buffer_check_alloc(Buffer *, u_int);
40
473db5ab 41void buffer_get(Buffer *, void *, u_int);
3c0ef626 42
43void buffer_consume(Buffer *, u_int);
44void buffer_consume_end(Buffer *, u_int);
45
46void buffer_dump(Buffer *);
47
473db5ab 48int buffer_get_ret(Buffer *, void *, u_int);
49int buffer_consume_ret(Buffer *, u_int);
50int buffer_consume_end_ret(Buffer *, u_int);
51
30460aeb 52#include <openssl/bn.h>
53
54void buffer_put_bignum(Buffer *, const BIGNUM *);
55void buffer_put_bignum2(Buffer *, const BIGNUM *);
56void buffer_get_bignum(Buffer *, BIGNUM *);
57void buffer_get_bignum2(Buffer *, BIGNUM *);
58
59u_short buffer_get_short(Buffer *);
60void buffer_put_short(Buffer *, u_short);
61
62u_int buffer_get_int(Buffer *);
63void buffer_put_int(Buffer *, u_int);
64
65u_int64_t buffer_get_int64(Buffer *);
66void buffer_put_int64(Buffer *, u_int64_t);
67
68int buffer_get_char(Buffer *);
69void buffer_put_char(Buffer *, int);
70
71void *buffer_get_string(Buffer *, u_int *);
5156b1a1 72void *buffer_get_string_ptr(Buffer *, u_int *);
30460aeb 73void buffer_put_string(Buffer *, const void *, u_int);
74void buffer_put_cstring(Buffer *, const char *);
75
76#define buffer_skip_string(b) \
77 do { u_int l = buffer_get_int(b); buffer_consume(b, l); } while (0)
78
79int buffer_put_bignum_ret(Buffer *, const BIGNUM *);
80int buffer_get_bignum_ret(Buffer *, BIGNUM *);
81int buffer_put_bignum2_ret(Buffer *, const BIGNUM *);
82int buffer_get_bignum2_ret(Buffer *, BIGNUM *);
83int buffer_get_short_ret(u_short *, Buffer *);
84int buffer_get_int_ret(u_int *, Buffer *);
85int buffer_get_int64_ret(u_int64_t *, Buffer *);
86void *buffer_get_string_ret(Buffer *, u_int *);
87int buffer_get_char_ret(char *, Buffer *);
88
3c0ef626 89#endif /* BUFFER_H */
This page took 0.903502 seconds and 5 git commands to generate.