sonic-openssh/getput.h

59 строки
1.9 KiB
C
Исходник Обычный вид История

1999-10-27 07:42:43 +04:00
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
* Macros for storing and retrieving data in msb first and lsb first order.
*
- (djm) Merge OpenBSD changes: - markus@cvs.openbsd.org 2000/09/05 02:59:57 [session.c] print hostname (not hushlogin) - markus@cvs.openbsd.org 2000/09/05 13:18:48 [authfile.c ssh-add.c] enable ssh-add -d for DSA keys - markus@cvs.openbsd.org 2000/09/05 13:20:49 [sftp-server.c] cleanup - markus@cvs.openbsd.org 2000/09/06 03:46:41 [authfile.h] prototype - deraadt@cvs.openbsd.org 2000/09/07 14:27:56 [ALL] cleanup copyright notices on all files. I have attempted to be accurate with the details. everything is now under Tatu's licence (which I copied from his readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd developers under a 2-term bsd licence. We're not changing any rules, just being accurate. - markus@cvs.openbsd.org 2000/09/07 14:40:30 [channels.c channels.h clientloop.c serverloop.c ssh.c] cleanup window and packet sizes for ssh2 flow control; ok niels - markus@cvs.openbsd.org 2000/09/07 14:53:00 [scp.c] typo - markus@cvs.openbsd.org 2000/09/07 15:13:37 [auth-options.c auth-options.h auth-rh-rsa.c auth-rsa.c auth.c] [authfile.h canohost.c channels.h compat.c hostfile.h log.c match.h] [pty.c readconf.c] some more Copyright fixes - markus@cvs.openbsd.org 2000/09/08 03:02:51 [README.openssh2] bye bye - deraadt@cvs.openbsd.org 2000/09/11 18:38:33 [LICENCE cipher.c] a few more comments about it being ARC4 not RC4 - markus@cvs.openbsd.org 2000/09/12 14:53:11 [log-client.c log-server.c log.c ssh.1 ssh.c ssh.h sshd.8 sshd.c] multiple debug levels - markus@cvs.openbsd.org 2000/09/14 14:25:15 [clientloop.c] typo - deraadt@cvs.openbsd.org 2000/09/15 01:13:51 [ssh-agent.c] check return value for setenv(3) for failure, and deal appropriately
2000-09-16 06:29:08 +04:00
* 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".
*/
/* RCSID("$OpenBSD: getput.h,v 1.7 2001/01/10 22:56:22 markus Exp $"); */
1999-10-27 07:42:43 +04:00
#ifndef GETPUT_H
#define GETPUT_H
/*------------ macros for storing/extracting msb first words -------------*/
#define GET_64BIT(cp) (((u_int64_t)(u_char)(cp)[0] << 56) | \
((u_int64_t)(u_char)(cp)[1] << 48) | \
((u_int64_t)(u_char)(cp)[2] << 40) | \
((u_int64_t)(u_char)(cp)[3] << 32) | \
((u_int64_t)(u_char)(cp)[4] << 24) | \
((u_int64_t)(u_char)(cp)[5] << 16) | \
((u_int64_t)(u_char)(cp)[6] << 8) | \
((u_int64_t)(u_char)(cp)[7]))
#define GET_32BIT(cp) (((u_long)(u_char)(cp)[0] << 24) | \
((u_long)(u_char)(cp)[1] << 16) | \
((u_long)(u_char)(cp)[2] << 8) | \
((u_long)(u_char)(cp)[3]))
1999-10-27 07:42:43 +04:00
#define GET_16BIT(cp) (((u_long)(u_char)(cp)[0] << 8) | \
((u_long)(u_char)(cp)[1]))
1999-10-27 07:42:43 +04:00
#define PUT_64BIT(cp, value) do { \
(cp)[0] = (value) >> 56; \
(cp)[1] = (value) >> 48; \
(cp)[2] = (value) >> 40; \
(cp)[3] = (value) >> 32; \
(cp)[4] = (value) >> 24; \
(cp)[5] = (value) >> 16; \
(cp)[6] = (value) >> 8; \
(cp)[7] = (value); } while (0)
1999-10-27 07:42:43 +04:00
#define PUT_32BIT(cp, value) do { \
(cp)[0] = (value) >> 24; \
(cp)[1] = (value) >> 16; \
(cp)[2] = (value) >> 8; \
(cp)[3] = (value); } while (0)
#define PUT_16BIT(cp, value) do { \
(cp)[0] = (value) >> 8; \
(cp)[1] = (value); } while (0)
#endif /* GETPUT_H */