2013-07-18 08:12:44 +02:00
|
|
|
/* $OpenBSD: packet.h,v 1.59 2013/07/12 00:19:59 djm Exp $ */
|
2002-03-05 02:53:02 +01:00
|
|
|
|
1999-10-27 05:42:43 +02:00
|
|
|
/*
|
1999-11-24 14:26:21 +01:00
|
|
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
|
|
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
|
|
|
* All rights reserved
|
|
|
|
* Interface for the packet protocol functions.
|
2000-04-16 03:18:38 +02:00
|
|
|
*
|
2000-09-16 04:29:08 +02: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".
|
1999-11-24 14:26:21 +01:00
|
|
|
*/
|
|
|
|
|
1999-10-27 05:42:43 +02:00
|
|
|
#ifndef PACKET_H
|
|
|
|
#define PACKET_H
|
|
|
|
|
2006-03-15 01:11:28 +01:00
|
|
|
#include <termios.h>
|
|
|
|
|
1999-10-27 05:42:43 +02:00
|
|
|
#include <openssl/bn.h>
|
2010-09-10 04:28:24 +02:00
|
|
|
#ifdef OPENSSL_HAS_ECC
|
2010-08-31 14:41:14 +02:00
|
|
|
#include <openssl/ec.h>
|
2010-09-10 04:28:24 +02:00
|
|
|
#endif
|
1999-10-27 05:42:43 +02:00
|
|
|
|
2001-07-04 06:46:56 +02:00
|
|
|
void packet_set_connection(int, int);
|
2008-06-12 22:42:45 +02:00
|
|
|
void packet_set_timeout(int, int);
|
2001-07-04 06:46:56 +02:00
|
|
|
void packet_set_nonblocking(void);
|
|
|
|
int packet_get_connection_in(void);
|
|
|
|
int packet_get_connection_out(void);
|
|
|
|
void packet_close(void);
|
|
|
|
void packet_set_encryption_key(const u_char *, u_int, int);
|
2002-06-21 02:43:42 +02:00
|
|
|
u_int packet_get_encryption_key(u_char *);
|
2001-07-04 06:46:56 +02:00
|
|
|
void packet_set_protocol_flags(u_int);
|
|
|
|
u_int packet_get_protocol_flags(void);
|
|
|
|
void packet_start_compression(int);
|
2010-11-20 05:19:38 +01:00
|
|
|
void packet_set_interactive(int, int, int);
|
2001-07-04 06:46:56 +02:00
|
|
|
int packet_is_interactive(void);
|
2005-07-26 13:54:56 +02:00
|
|
|
void packet_set_server(void);
|
|
|
|
void packet_set_authenticated(void);
|
2001-07-04 06:46:56 +02:00
|
|
|
|
|
|
|
void packet_start(u_char);
|
|
|
|
void packet_put_char(int ch);
|
|
|
|
void packet_put_int(u_int value);
|
2009-06-21 10:16:26 +02:00
|
|
|
void packet_put_int64(u_int64_t value);
|
2001-07-04 06:46:56 +02:00
|
|
|
void packet_put_bignum(BIGNUM * value);
|
|
|
|
void packet_put_bignum2(BIGNUM * value);
|
2010-09-10 04:28:24 +02:00
|
|
|
#ifdef OPENSSL_HAS_ECC
|
2010-08-31 14:41:14 +02:00
|
|
|
void packet_put_ecpoint(const EC_GROUP *, const EC_POINT *);
|
2010-09-10 04:28:24 +02:00
|
|
|
#endif
|
2001-12-21 04:56:54 +01:00
|
|
|
void packet_put_string(const void *buf, u_int len);
|
2001-07-04 06:46:56 +02:00
|
|
|
void packet_put_cstring(const char *str);
|
2001-12-21 04:56:54 +01:00
|
|
|
void packet_put_raw(const void *buf, u_int len);
|
2001-07-04 06:46:56 +02:00
|
|
|
void packet_send(void);
|
|
|
|
|
2002-01-22 13:16:32 +01:00
|
|
|
int packet_read(void);
|
|
|
|
void packet_read_expect(int type);
|
2001-07-04 06:46:56 +02:00
|
|
|
void packet_process_incoming(const char *buf, u_int len);
|
2002-01-22 13:16:32 +01:00
|
|
|
int packet_read_seqnr(u_int32_t *seqnr_p);
|
|
|
|
int packet_read_poll_seqnr(u_int32_t *seqnr_p);
|
2001-07-04 06:46:56 +02:00
|
|
|
|
|
|
|
u_int packet_get_char(void);
|
|
|
|
u_int packet_get_int(void);
|
2009-06-21 10:16:26 +02:00
|
|
|
u_int64_t packet_get_int64(void);
|
2002-01-22 13:14:44 +01:00
|
|
|
void packet_get_bignum(BIGNUM * value);
|
|
|
|
void packet_get_bignum2(BIGNUM * value);
|
2010-09-10 04:28:24 +02:00
|
|
|
#ifdef OPENSSL_HAS_ECC
|
2010-08-31 14:41:14 +02:00
|
|
|
void packet_get_ecpoint(const EC_GROUP *, EC_POINT *);
|
2010-09-10 04:28:24 +02:00
|
|
|
#endif
|
2005-06-17 04:59:34 +02:00
|
|
|
void *packet_get_raw(u_int *length_ptr);
|
2001-12-21 04:56:54 +01:00
|
|
|
void *packet_get_string(u_int *length_ptr);
|
2010-08-31 14:36:39 +02:00
|
|
|
char *packet_get_cstring(u_int *length_ptr);
|
2008-05-19 06:59:37 +02:00
|
|
|
void *packet_get_string_ptr(u_int *length_ptr);
|
2013-07-18 08:12:44 +02:00
|
|
|
void packet_disconnect(const char *fmt,...) __attribute__((noreturn)) __attribute__((format(printf, 1, 2)));
|
2001-07-04 06:46:56 +02:00
|
|
|
void packet_send_debug(const char *fmt,...) __attribute__((format(printf, 1, 2)));
|
1999-10-27 05:42:43 +02:00
|
|
|
|
2002-03-22 02:42:04 +01:00
|
|
|
void set_newkeys(int mode);
|
|
|
|
int packet_get_keyiv_len(int);
|
|
|
|
void packet_get_keyiv(int, u_char *, u_int);
|
|
|
|
int packet_get_keycontext(int, u_char *);
|
|
|
|
void packet_set_keycontext(int, u_char *);
|
2008-07-11 09:36:48 +02:00
|
|
|
void packet_get_state(int, u_int32_t *, u_int64_t *, u_int32_t *, u_int64_t *);
|
|
|
|
void packet_set_state(int, u_int32_t, u_int64_t, u_int32_t, u_int64_t);
|
2002-03-22 02:42:04 +01:00
|
|
|
int packet_get_ssh1_cipher(void);
|
|
|
|
void packet_set_iv(int, u_char *);
|
2009-06-21 10:12:20 +02:00
|
|
|
void *packet_get_newkeys(int);
|
2002-03-22 02:42:04 +01:00
|
|
|
|
2001-07-04 06:46:56 +02:00
|
|
|
void packet_write_poll(void);
|
|
|
|
void packet_write_wait(void);
|
|
|
|
int packet_have_data_to_write(void);
|
|
|
|
int packet_not_very_much_data_to_write(void);
|
1999-10-27 05:42:43 +02:00
|
|
|
|
2001-07-04 06:46:56 +02:00
|
|
|
int packet_connection_is_on_socket(void);
|
|
|
|
int packet_remaining(void);
|
|
|
|
void packet_send_ignore(int);
|
2001-11-12 01:02:52 +01:00
|
|
|
void packet_add_padding(u_char);
|
1999-10-27 05:42:43 +02:00
|
|
|
|
2001-07-04 06:46:56 +02:00
|
|
|
void tty_make_modes(int, struct termios *);
|
|
|
|
void tty_parse_modes(int, int *);
|
1999-10-27 05:42:43 +02:00
|
|
|
|
2009-06-21 10:12:20 +02:00
|
|
|
void packet_set_alive_timeouts(int);
|
|
|
|
int packet_inc_alive_timeouts(void);
|
2004-05-13 08:39:33 +02:00
|
|
|
int packet_set_maxsize(u_int);
|
2009-06-21 10:12:20 +02:00
|
|
|
u_int packet_get_maxsize(void);
|
1999-10-27 05:42:43 +02:00
|
|
|
|
2002-01-22 13:11:40 +01:00
|
|
|
/* don't allow remaining bytes after the end of the message */
|
|
|
|
#define packet_check_eom() \
|
2000-04-16 03:18:38 +02:00
|
|
|
do { \
|
|
|
|
int _len = packet_remaining(); \
|
|
|
|
if (_len > 0) { \
|
2003-04-09 12:59:48 +02:00
|
|
|
logit("Packet integrity error (%d bytes remaining) at %s:%d", \
|
2000-04-16 03:18:38 +02:00
|
|
|
_len ,__FILE__, __LINE__); \
|
|
|
|
packet_disconnect("Packet integrity error."); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2003-04-09 12:50:06 +02:00
|
|
|
int packet_need_rekeying(void);
|
2013-05-16 12:28:16 +02:00
|
|
|
void packet_set_rekey_limits(u_int32_t, time_t);
|
|
|
|
time_t packet_get_rekey_timeout(void);
|
2003-04-09 12:50:06 +02:00
|
|
|
|
2009-07-05 23:11:13 +02:00
|
|
|
void packet_backup_state(void);
|
|
|
|
void packet_restore_state(void);
|
|
|
|
|
2009-06-21 10:12:20 +02:00
|
|
|
void *packet_get_input(void);
|
|
|
|
void *packet_get_output(void);
|
|
|
|
|
1999-11-24 14:26:21 +01:00
|
|
|
#endif /* PACKET_H */
|