summaryrefslogtreecommitdiff
path: root/getput.h
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-01-11 06:20:23 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-01-11 06:20:23 +0000
commit2f959b4cd1d1afcd241d7ffa06a34646c0c89969 (patch)
treea83ffc7dd3f484af4debdad46c5de25e985bf4ad /getput.h
parentfd9885e3264ea16c75b61812d17ed64ca8dfd308 (diff)
20010112
- (bal) OpenBSD Sync - markus@cvs.openbsd.org 2001/01/10 22:56:22 [bufaux.h bufaux.c sftp-server.c sftp.h getput.h] cleanup sftp-server implementation: add buffer_get_int64, buffer_put_int64, GET_64BIT, PUT_64BIT parse SSH2_FILEXFER_ATTR_EXTENDED send SSH2_FX_EOF if readdir returns no more entries reply to SSH2_FXP_EXTENDED message use #defines from the draft move #definations to sftp.h more info: http://www.ietf.org/internet-drafts/draft-ietf-secsh-filexfer-00.txt - markus@cvs.openbsd.org 2001/01/10 19:43:20 [sshd.c] XXX - generate_empheral_server_key() is not safe against races, because it calls log() - markus@cvs.openbsd.org 2001/01/09 21:19:50 [packet.c] allow TCP_NDELAY for ipv6; from netbsd via itojun@
Diffstat (limited to 'getput.h')
-rw-r--r--getput.h43
1 files changed, 20 insertions, 23 deletions
diff --git a/getput.h b/getput.h
index b8e83453a..1a19d22cd 100644
--- a/getput.h
+++ b/getput.h
@@ -11,13 +11,22 @@
11 * called by a name other than "ssh" or "Secure Shell". 11 * called by a name other than "ssh" or "Secure Shell".
12 */ 12 */
13 13
14/* RCSID("$OpenBSD: getput.h,v 1.6 2000/12/19 23:17:56 markus Exp $"); */ 14/* RCSID("$OpenBSD: getput.h,v 1.7 2001/01/10 22:56:22 markus Exp $"); */
15 15
16#ifndef GETPUT_H 16#ifndef GETPUT_H
17#define GETPUT_H 17#define GETPUT_H
18 18
19/*------------ macros for storing/extracting msb first words -------------*/ 19/*------------ macros for storing/extracting msb first words -------------*/
20 20
21#define GET_64BIT(cp) (((u_int64_t)(u_char)(cp)[0] << 56) | \
22 ((u_int64_t)(u_char)(cp)[1] << 48) | \
23 ((u_int64_t)(u_char)(cp)[2] << 40) | \
24 ((u_int64_t)(u_char)(cp)[3] << 32) | \
25 ((u_int64_t)(u_char)(cp)[4] << 24) | \
26 ((u_int64_t)(u_char)(cp)[5] << 16) | \
27 ((u_int64_t)(u_char)(cp)[6] << 8) | \
28 ((u_int64_t)(u_char)(cp)[7]))
29
21#define GET_32BIT(cp) (((u_long)(u_char)(cp)[0] << 24) | \ 30#define GET_32BIT(cp) (((u_long)(u_char)(cp)[0] << 24) | \
22 ((u_long)(u_char)(cp)[1] << 16) | \ 31 ((u_long)(u_char)(cp)[1] << 16) | \
23 ((u_long)(u_char)(cp)[2] << 8) | \ 32 ((u_long)(u_char)(cp)[2] << 8) | \
@@ -26,6 +35,16 @@
26#define GET_16BIT(cp) (((u_long)(u_char)(cp)[0] << 8) | \ 35#define GET_16BIT(cp) (((u_long)(u_char)(cp)[0] << 8) | \
27 ((u_long)(u_char)(cp)[1])) 36 ((u_long)(u_char)(cp)[1]))
28 37
38#define PUT_64BIT(cp, value) do { \
39 (cp)[0] = (value) >> 56; \
40 (cp)[1] = (value) >> 48; \
41 (cp)[2] = (value) >> 40; \
42 (cp)[3] = (value) >> 32; \
43 (cp)[4] = (value) >> 24; \
44 (cp)[5] = (value) >> 16; \
45 (cp)[6] = (value) >> 8; \
46 (cp)[7] = (value); } while (0)
47
29#define PUT_32BIT(cp, value) do { \ 48#define PUT_32BIT(cp, value) do { \
30 (cp)[0] = (value) >> 24; \ 49 (cp)[0] = (value) >> 24; \
31 (cp)[1] = (value) >> 16; \ 50 (cp)[1] = (value) >> 16; \
@@ -36,26 +55,4 @@
36 (cp)[0] = (value) >> 8; \ 55 (cp)[0] = (value) >> 8; \
37 (cp)[1] = (value); } while (0) 56 (cp)[1] = (value); } while (0)
38 57
39/*------------ macros for storing/extracting lsb first words -------------*/
40
41#define GET_32BIT_LSB_FIRST(cp) \
42 (((u_long)(u_char)(cp)[0]) | \
43 ((u_long)(u_char)(cp)[1] << 8) | \
44 ((u_long)(u_char)(cp)[2] << 16) | \
45 ((u_long)(u_char)(cp)[3] << 24))
46
47#define GET_16BIT_LSB_FIRST(cp) \
48 (((u_long)(u_char)(cp)[0]) | \
49 ((u_long)(u_char)(cp)[1] << 8))
50
51#define PUT_32BIT_LSB_FIRST(cp, value) do { \
52 (cp)[0] = (value); \
53 (cp)[1] = (value) >> 8; \
54 (cp)[2] = (value) >> 16; \
55 (cp)[3] = (value) >> 24; } while (0)
56
57#define PUT_16BIT_LSB_FIRST(cp, value) do { \
58 (cp)[0] = (value); \
59 (cp)[1] = (value) >> 8; } while (0)
60
61#endif /* GETPUT_H */ 58#endif /* GETPUT_H */