| 39 |
|
|
| 40 |
#include "buffer.h" |
#include "buffer.h" |
| 41 |
#include "config.h" |
#include "config.h" |
| 42 |
|
#include <sys/types.h> |
| 43 |
|
#include <sys/stat.h> |
| 44 |
|
|
| 45 |
#define DEBUG_PRINT_TO_FILE(base, msg, len) { \ |
#define DEBUG_PRINT_TO_FILE(base, msg, len) { \ |
| 46 |
static int count = 0; \ |
static int count = 0; \ |
| 631 |
void SSH2_update_hmac_myproposal(PTInstVar pvar); |
void SSH2_update_hmac_myproposal(PTInstVar pvar); |
| 632 |
int SSH_notify_break_signal(PTInstVar pvar); |
int SSH_notify_break_signal(PTInstVar pvar); |
| 633 |
|
|
| 634 |
|
/// |
| 635 |
|
enum scp_state { |
| 636 |
|
SCP_INIT, SCP_TIMESTAMP, SCP_FILEINFO, SCP_DATA, SCP_CLOSING, |
| 637 |
|
}; |
| 638 |
|
|
| 639 |
|
typedef struct bufchain { |
| 640 |
|
buffer_t *msg; |
| 641 |
|
struct bufchain *next; |
| 642 |
|
} bufchain_t; |
| 643 |
|
|
| 644 |
|
typedef struct scp { |
| 645 |
|
enum scp_dir dir; // transfer direction |
| 646 |
|
enum scp_state state; // SCP state |
| 647 |
|
char localfile[MAX_PATH]; // local filename |
| 648 |
|
char localfilefull[MAX_PATH]; // local filename fullpath |
| 649 |
|
char remotefile[MAX_PATH]; // remote filename |
| 650 |
|
FILE *localfp; // file pointer for local file |
| 651 |
|
struct __stat64 filestat; // file status information |
| 652 |
|
HWND progress_window; |
| 653 |
|
HANDLE thread; |
| 654 |
|
unsigned int thread_id; |
| 655 |
|
PTInstVar pvar; |
| 656 |
|
// for receiving file |
| 657 |
|
long long filetotalsize; |
| 658 |
|
long long filercvsize; |
| 659 |
|
} scp_t; |
| 660 |
|
|
| 661 |
|
enum sftp_state { |
| 662 |
|
SFTP_INIT, |
| 663 |
|
}; |
| 664 |
|
|
| 665 |
|
typedef struct sftp { |
| 666 |
|
enum sftp_state state; |
| 667 |
|
} sftp_t; |
| 668 |
|
|
| 669 |
|
typedef struct channel { |
| 670 |
|
int used; |
| 671 |
|
int self_id; |
| 672 |
|
int remote_id; |
| 673 |
|
unsigned int local_window; |
| 674 |
|
unsigned int local_window_max; |
| 675 |
|
unsigned int local_consumed; |
| 676 |
|
unsigned int local_maxpacket; |
| 677 |
|
unsigned int remote_window; |
| 678 |
|
unsigned int remote_maxpacket; |
| 679 |
|
enum channel_type type; |
| 680 |
|
int local_num; |
| 681 |
|
bufchain_t *bufchain; |
| 682 |
|
scp_t scp; |
| 683 |
|
buffer_t *agent_msg; |
| 684 |
|
int agent_request_len; |
| 685 |
|
sftp_t sftp; |
| 686 |
|
} Channel_t; |
| 687 |
|
|
| 688 |
|
unsigned char FAR *begin_send_packet(PTInstVar pvar, int type, int len); |
| 689 |
|
void finish_send_packet_special(PTInstVar pvar, int skip_compress); |
| 690 |
|
void SSH2_send_channel_data(PTInstVar pvar, Channel_t *c, unsigned char FAR * buf, unsigned int buflen); |
| 691 |
|
|
| 692 |
|
#define finish_send_packet(pvar) finish_send_packet_special((pvar), 0) |
| 693 |
|
#define get_payload_uint32(pvar, offset) get_uint32_MSBfirst((pvar)->ssh_state.payload + (offset)) |
| 694 |
|
#define get_uint32(buf) get_uint32_MSBfirst((buf)) |
| 695 |
|
#define set_uint32(buf, v) set_uint32_MSBfirst((buf), (v)) |
| 696 |
|
#define get_mpint_len(pvar, offset) ((get_ushort16_MSBfirst((pvar)->ssh_state.payload + (offset)) + 7) >> 3) |
| 697 |
|
#define get_ushort16(buf) get_ushort16_MSBfirst((buf)) |
| 698 |
|
/// |
| 699 |
|
|
| 700 |
#endif |
#endif |