Mercurial > dropbear
comparison common-channel.c @ 449:3e6c536bc023
Add -W <windowsize> argument and document it.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 25 Jul 2007 15:44:25 +0000 |
parents | 9c61e7af0156 |
children | 0871a0b89f7c |
comparison
equal
deleted
inserted
replaced
448:9c61e7af0156 | 449:3e6c536bc023 |
---|---|
32 #include "circbuffer.h" | 32 #include "circbuffer.h" |
33 #include "dbutil.h" | 33 #include "dbutil.h" |
34 #include "channel.h" | 34 #include "channel.h" |
35 #include "ssh.h" | 35 #include "ssh.h" |
36 #include "listener.h" | 36 #include "listener.h" |
37 #include "runopts.h" | |
37 | 38 |
38 static void send_msg_channel_open_failure(unsigned int remotechan, int reason, | 39 static void send_msg_channel_open_failure(unsigned int remotechan, int reason, |
39 const unsigned char *text, const unsigned char *lang); | 40 const unsigned char *text, const unsigned char *lang); |
40 static void send_msg_channel_open_confirmation(struct Channel* channel, | 41 static void send_msg_channel_open_confirmation(struct Channel* channel, |
41 unsigned int recvwindow, | 42 unsigned int recvwindow, |
148 newchan->errfd = FD_CLOSED; /* this isn't always set to start with */ | 149 newchan->errfd = FD_CLOSED; /* this isn't always set to start with */ |
149 newchan->initconn = 0; | 150 newchan->initconn = 0; |
150 newchan->await_open = 0; | 151 newchan->await_open = 0; |
151 newchan->flushing = 0; | 152 newchan->flushing = 0; |
152 | 153 |
153 newchan->writebuf = cbuf_new(RECV_MAX_WINDOW); | 154 newchan->writebuf = cbuf_new(opts.recv_window); |
154 newchan->extrabuf = NULL; /* The user code can set it up */ | 155 newchan->extrabuf = NULL; /* The user code can set it up */ |
155 newchan->recvwindow = RECV_MAX_WINDOW; | 156 newchan->recvwindow = opts.recv_window; |
156 newchan->recvdonelen = 0; | 157 newchan->recvdonelen = 0; |
157 newchan->recvmaxpacket = RECV_MAX_PAYLOAD_LEN; | 158 newchan->recvmaxpacket = RECV_MAX_PAYLOAD_LEN; |
158 | 159 |
159 ses.channels[i] = newchan; | 160 ses.channels[i] = newchan; |
160 ses.chancount++; | 161 ses.chancount++; |
419 send_msg_channel_window_adjust(channel, channel->recvdonelen); | 420 send_msg_channel_window_adjust(channel, channel->recvdonelen); |
420 channel->recvwindow += channel->recvdonelen; | 421 channel->recvwindow += channel->recvdonelen; |
421 channel->recvdonelen = 0; | 422 channel->recvdonelen = 0; |
422 } | 423 } |
423 | 424 |
424 dropbear_assert(channel->recvwindow <= RECV_MAX_WINDOW); | 425 dropbear_assert(channel->recvwindow <= opts.recv_window); |
425 dropbear_assert(channel->recvwindow <= cbuf_getavail(channel->writebuf)); | 426 dropbear_assert(channel->recvwindow <= cbuf_getavail(channel->writebuf)); |
426 dropbear_assert(channel->extrabuf == NULL || | 427 dropbear_assert(channel->extrabuf == NULL || |
427 channel->recvwindow <= cbuf_getavail(channel->extrabuf)); | 428 channel->recvwindow <= cbuf_getavail(channel->extrabuf)); |
428 | 429 |
429 TRACE(("leave writechannel")) | 430 TRACE(("leave writechannel")) |
708 len -= buflen; | 709 len -= buflen; |
709 } | 710 } |
710 | 711 |
711 dropbear_assert(channel->recvwindow >= datalen); | 712 dropbear_assert(channel->recvwindow >= datalen); |
712 channel->recvwindow -= datalen; | 713 channel->recvwindow -= datalen; |
713 dropbear_assert(channel->recvwindow <= RECV_MAX_WINDOW); | 714 dropbear_assert(channel->recvwindow <= opts.recv_window); |
714 | 715 |
715 TRACE(("leave recv_msg_channel_data")) | 716 TRACE(("leave recv_msg_channel_data")) |
716 } | 717 } |
717 | 718 |
718 /* Increment the outgoing data window for a channel - the remote end limits | 719 /* Increment the outgoing data window for a channel - the remote end limits |
968 CHECKCLEARTOWRITE(); | 969 CHECKCLEARTOWRITE(); |
969 | 970 |
970 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_OPEN); | 971 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_OPEN); |
971 buf_putstring(ses.writepayload, type->name, strlen(type->name)); | 972 buf_putstring(ses.writepayload, type->name, strlen(type->name)); |
972 buf_putint(ses.writepayload, chan->index); | 973 buf_putint(ses.writepayload, chan->index); |
973 buf_putint(ses.writepayload, RECV_MAX_WINDOW); | 974 buf_putint(ses.writepayload, opts.recv_window); |
974 buf_putint(ses.writepayload, RECV_MAX_PAYLOAD_LEN); | 975 buf_putint(ses.writepayload, RECV_MAX_PAYLOAD_LEN); |
975 | 976 |
976 TRACE(("leave send_msg_channel_open_init()")) | 977 TRACE(("leave send_msg_channel_open_init()")) |
977 return DROPBEAR_SUCCESS; | 978 return DROPBEAR_SUCCESS; |
978 } | 979 } |