#ifndef _BPP_H_1b1adb2c_ #define _BPP_H_1b1adb2c_ typedef struct bpp BPP; typedef struct layer LAYER; typedef struct layerdesc LAYERDESC; #include "str.h" #include "algs.h" /* This is more generous than the spec says we need to be; it says 255 including the trailing CRLF. Our max doesn't include the CRLF. */ #define SSH_MAX_VERSION_LEN 256 /* Max size of a packet on the wire (after compression and encryption and adding the leading/trailing goop). The spec says this must be >=35000. */ #define SSH_MAX_PACKET_LEN 40000 /* Max size of a packet payload, in the uncompressed clear. The spec says this must be >=32768. */ #define SSH_MAX_PAYLOAD_LEN 35000 /* bpp = binary packet protocol */ struct bpp { ENCALG *w_enc; void *w_encstate; ENCALG *r_enc; void *r_encstate; COMPALG *w_comp; void *w_compstate; COMPALG *r_comp; void *r_compstate; MACALG *w_mac; void *w_macstate; MACALG *r_mac; void *r_macstate; KEXALG *kex; HKALG *hk; STR K_S; unsigned int w_seq; unsigned int r_seq; void *kex_k; int kex_klen; void *kex_h; int kex_hlen; HASHALG *kex_hash; void *hashbuf; void *sessid; int sessidlen; LAYER *toplayer; char c_version[SSH_MAX_VERSION_LEN]; int c_vlen; char s_version[SSH_MAX_VERSION_LEN]; int s_vlen; void *c_kexinit_payload; int c_kexinit_paylen; void *s_kexinit_payload; int s_kexinit_paylen; int ipkts_to_rekey; int opkts_to_rekey; int ibytes_to_rekey; int obytes_to_rekey; int want_rekey; unsigned char rawipkt[SSH_MAX_PACKET_LEN]; unsigned char ipkt[SSH_MAX_PAYLOAD_LEN]; int iplen; unsigned char rawopkt[SSH_MAX_PAYLOAD_LEN]; unsigned char opkt[SSH_MAX_PACKET_LEN]; int oplen; } ; struct layer { BPP *b; void (*rpkt)(LAYER *, void *); void (*wpkt)(LAYER *, void *); void *arg; LAYER *lower; } ; struct layerdesc { void *(*init)(LAYER *); void (*rfn)(LAYER *, void *); void (*wfn)(LAYER *, void *); } ; extern void lower_read(LAYER *); extern void lower_write(LAYER *); extern void send_disconnect(int, const void *, int, const void *, int); #endif