Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/ttssh2/ttxssh/buffer.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9048 - (show annotations) (download) (as text)
Wed Dec 16 12:24:13 2020 UTC (3 years, 5 months ago) by nmaya
File MIME type: text/x-chdr
File size: 4118 byte(s)
ソースファイルの著作権表記の "最後の発行の年" を削除

ticket #40996
1 /*
2 * Copyright (C) 2004- TeraTerm Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 #ifndef BUFFER_H
29 #define BUFFER_H
30
31 #include <openssl/bn.h>
32 #include <openssl/ec.h>
33 #include <zlib.h>
34
35 typedef struct buffer {
36 char *buf; /* �o�b�t�@�������|�C���^�Brealloc()���������������B*/
37 size_t offset; /* �����������o�����u */
38 size_t maxlen; /* �o�b�t�@�������T�C�Y */
39 size_t len; /* �o�b�t�@�����������L�����f�[�^�T�C�Y */
40 } buffer_t;
41
42 /* buffer_t.buf ���g���������l (16MB) */
43 #define BUFFER_SIZE_MAX 0x1000000
44 /* buffer_t.buf ���g�������������m�������� (32KB) */
45 #define BUFFER_INCREASE_MARGIN (32*1024)
46
47 void buffer_clear(buffer_t *buf);
48 buffer_t *buffer_init(void);
49 void buffer_free(buffer_t *buf);
50 void *buffer_append_space(buffer_t * buf, size_t size);
51 int buffer_append(buffer_t *buf, char *ptr, int size);
52 int buffer_append_length(buffer_t *msg, char *ptr, int size);
53 void buffer_put_raw(buffer_t *msg, char *ptr, int size);
54 char *buffer_get_string(char **data_ptr, int *buflen_ptr);
55 void buffer_put_string(buffer_t *msg, char *ptr, int size);
56 void buffer_put_cstring(buffer_t *msg, char *ptr);
57 void buffer_put_char(buffer_t *msg, int value);
58 void buffer_put_padding(buffer_t *msg, int size);
59 void buffer_put_int(buffer_t *msg, int value);
60 int buffer_len(buffer_t *msg);
61 char *buffer_ptr(buffer_t *msg);
62 void buffer_put_bignum(buffer_t *buffer, BIGNUM *value);
63 void buffer_put_bignum2(buffer_t *msg, BIGNUM *value);
64 void buffer_get_bignum2(char **data, BIGNUM *value);
65 void buffer_get_bignum2_msg(buffer_t *msg, BIGNUM *value);
66 void buffer_get_bignum_SECSH(buffer_t *buffer, BIGNUM *value);
67 void buffer_put_ecpoint(buffer_t *msg, const EC_GROUP *curve, const EC_POINT *point);
68 void buffer_get_ecpoint(char **data, const EC_GROUP *curve, EC_POINT *point);
69 void buffer_get_ecpoint_msg(buffer_t *msg, const EC_GROUP *curve, EC_POINT *point);
70 char *buffer_tail_ptr(buffer_t *msg);
71 int buffer_overflow_verify(buffer_t *msg, int len);
72 void buffer_consume(buffer_t *buf, size_t shift_byte);
73 void buffer_consume_end(buffer_t *buf, size_t shift_byte);
74 int buffer_compress(z_stream *zstream, char *payload, int len, buffer_t *compbuf);
75 int buffer_decompress(z_stream *zstream, char *payload, int len, buffer_t *compbuf);
76 int buffer_get_ret(buffer_t *msg, void *buf, size_t len);
77 int buffer_get_int_ret(unsigned int *ret, buffer_t *msg);
78 unsigned int buffer_get_int(buffer_t *msg);
79 int buffer_get_char_ret(char *ret, buffer_t *msg);
80 int buffer_get_char(buffer_t *msg);
81 void buffer_rewind(buffer_t *buf);
82 void *buffer_get_string_msg(buffer_t *msg, int *buflen_ptr);
83 int buffer_remain_len(buffer_t *msg);
84
85 #endif /* BUFFER_H */

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26