| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
#ifndef MOD_SFTP_CHANNEL_H |
| 26 |
#define MOD_SFTP_CHANNEL_H |
| 27 |
|
| 28 |
#include "mod_sftp.h" |
| 29 |
#include "packet.h" |
| 30 |
|
| 31 |
#define SFTP_SSH2_CHANNEL_OPEN_ADMINISTRATIVELY_PROHIBITED 1 |
| 32 |
#define SFTP_SSH2_CHANNEL_OPEN_CONNECT_FAILED 2 |
| 33 |
#define SFTP_SSH2_CHANNEL_OPEN_UNKNOWN_CHANNEL_TYPE 3 |
| 34 |
#define SFTP_SSH2_CHANNEL_OPEN_RESOURCE_SHORTAGE 4 |
| 35 |
|
| 36 |
#define SFTP_SSH2_CHANNEL_MAX_COUNT 10 |
| 37 |
#define SFTP_SSH2_CHANNEL_MAX_PACKET_SIZE 32768UL |
| 38 |
|
| 39 |
|
| 40 |
#define SFTP_SSH2_CHANNEL_WINDOW_SIZE 4294967295UL |
| 41 |
|
| 42 |
struct ssh2_channel_databuf; |
| 43 |
|
| 44 |
struct ssh2_channel { |
| 45 |
pool *pool; |
| 46 |
const char *type; |
| 47 |
|
| 48 |
uint32_t local_channel_id; |
| 49 |
uint32_t local_windowsz; |
| 50 |
uint32_t local_max_packetsz; |
| 51 |
|
| 52 |
uint32_t remote_channel_id; |
| 53 |
uint32_t remote_windowsz; |
| 54 |
uint32_t remote_max_packetsz; |
| 55 |
|
| 56 |
struct ssh2_channel_databuf *incoming_head, *incoming_tail; |
| 57 |
struct ssh2_channel_databuf *outgoing_head, *outgoing_tail; |
| 58 |
unsigned long incoming_len, outgoing_len; |
| 59 |
|
| 60 |
int recvd_eof, sent_eof; |
| 61 |
int recvd_close, sent_close; |
| 62 |
|
| 63 |
|
| 64 |
int (*prepare)(uint32_t); |
| 65 |
int (*postopen)(uint32_t); |
| 66 |
int (*handle_packet)(pool *, void *, uint32_t, unsigned char *, uint32_t); |
| 67 |
int (*finish)(uint32_t); |
| 68 |
}; |
| 69 |
|
| 70 |
uint32_t sftp_channel_get_max_packetsz(void); |
| 71 |
uint32_t sftp_channel_get_windowsz(uint32_t); |
| 72 |
unsigned int sftp_channel_set_max_count(unsigned int); |
| 73 |
uint32_t sftp_channel_set_max_packetsz(uint32_t); |
| 74 |
uint32_t sftp_channel_set_max_windowsz(uint32_t); |
| 75 |
|
| 76 |
int sftp_channel_drain_data(void); |
| 77 |
int sftp_channel_free(void); |
| 78 |
int sftp_channel_handle(struct ssh2_packet *, char); |
| 79 |
int sftp_channel_init(void); |
| 80 |
int sftp_channel_write_data(pool *, uint32_t, unsigned char *, uint32_t); |
| 81 |
|
| 82 |
|
| 83 |
int sftp_channel_write_ext_data_stderr(pool *, uint32_t, unsigned char *, |
| 84 |
uint32_t); |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
unsigned int sftp_channel_opened(uint32_t *); |
| 92 |
|
| 93 |
#endif |