mirror of git://anongit.mindrot.org/openssh.git
- markus@cvs.openbsd.org 2002/01/14 13:55:55
[channels.c channels.h nchan.c] remove function pointers for events, remove chan_init*; ok provos@
This commit is contained in:
parent
472d05716a
commit
5144df9261
|
@ -176,6 +176,9 @@
|
||||||
- markus@cvs.openbsd.org 2002/01/14 13:41:13
|
- markus@cvs.openbsd.org 2002/01/14 13:41:13
|
||||||
[nchan.c]
|
[nchan.c]
|
||||||
remove duplicated code; ok provos@
|
remove duplicated code; ok provos@
|
||||||
|
- markus@cvs.openbsd.org 2002/01/14 13:55:55
|
||||||
|
[channels.c channels.h nchan.c]
|
||||||
|
remove function pointers for events, remove chan_init*; ok provos@
|
||||||
|
|
||||||
20020121
|
20020121
|
||||||
- (djm) Rework ssh-rand-helper:
|
- (djm) Rework ssh-rand-helper:
|
||||||
|
@ -7323,4 +7326,4 @@
|
||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.1772 2002/01/22 12:28:28 djm Exp $
|
$Id: ChangeLog,v 1.1773 2002/01/22 12:28:45 djm Exp $
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: channels.c,v 1.158 2002/01/09 17:26:35 markus Exp $");
|
RCSID("$OpenBSD: channels.c,v 1.159 2002/01/14 13:55:55 markus Exp $");
|
||||||
|
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "ssh1.h"
|
#include "ssh1.h"
|
||||||
|
@ -217,7 +217,6 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
|
||||||
|
|
||||||
/* Do initial allocation if this is the first call. */
|
/* Do initial allocation if this is the first call. */
|
||||||
if (channels_alloc == 0) {
|
if (channels_alloc == 0) {
|
||||||
chan_init();
|
|
||||||
channels_alloc = 10;
|
channels_alloc = 10;
|
||||||
channels = xmalloc(channels_alloc * sizeof(Channel *));
|
channels = xmalloc(channels_alloc * sizeof(Channel *));
|
||||||
for (i = 0; i < channels_alloc; i++)
|
for (i = 0; i < channels_alloc; i++)
|
||||||
|
@ -246,7 +245,9 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
|
||||||
buffer_init(&c->input);
|
buffer_init(&c->input);
|
||||||
buffer_init(&c->output);
|
buffer_init(&c->output);
|
||||||
buffer_init(&c->extended);
|
buffer_init(&c->extended);
|
||||||
chan_init_iostates(c);
|
c->ostate = CHAN_OUTPUT_OPEN;
|
||||||
|
c->istate = CHAN_INPUT_OPEN;
|
||||||
|
c->flags = 0;
|
||||||
channel_register_fds(c, rfd, wfd, efd, extusage, nonblock);
|
channel_register_fds(c, rfd, wfd, efd, extusage, nonblock);
|
||||||
c->self = found;
|
c->self = found;
|
||||||
c->type = type;
|
c->type = type;
|
||||||
|
|
20
channels.h
20
channels.h
|
@ -32,7 +32,7 @@
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
/* RCSID("$OpenBSD: channels.h,v 1.57 2002/01/13 21:31:20 markus Exp $"); */
|
/* RCSID("$OpenBSD: channels.h,v 1.58 2002/01/14 13:55:55 markus Exp $"); */
|
||||||
|
|
||||||
#ifndef CHANNEL_H
|
#ifndef CHANNEL_H
|
||||||
#define CHANNEL_H
|
#define CHANNEL_H
|
||||||
|
@ -215,19 +215,15 @@ void auth_input_open_request(int, u_int32_t, void *);
|
||||||
|
|
||||||
int chan_is_dead(Channel *, int);
|
int chan_is_dead(Channel *, int);
|
||||||
void chan_mark_dead(Channel *);
|
void chan_mark_dead(Channel *);
|
||||||
void chan_init_iostates(Channel *);
|
|
||||||
void chan_init(void);
|
|
||||||
|
|
||||||
typedef void chan_event_fn(Channel *);
|
/* channel events */
|
||||||
|
|
||||||
/* for the input state */
|
void chan_rcvd_oclose(Channel *);
|
||||||
extern chan_event_fn *chan_rcvd_oclose;
|
void chan_read_failed(Channel *);
|
||||||
extern chan_event_fn *chan_read_failed;
|
void chan_ibuf_empty(Channel *);
|
||||||
extern chan_event_fn *chan_ibuf_empty;
|
|
||||||
|
|
||||||
/* for the output state */
|
void chan_rcvd_ieof(Channel *);
|
||||||
extern chan_event_fn *chan_rcvd_ieof;
|
void chan_write_failed(Channel *);
|
||||||
extern chan_event_fn *chan_write_failed;
|
void chan_obuf_empty(Channel *);
|
||||||
extern chan_event_fn *chan_obuf_empty;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
88
nchan.c
88
nchan.c
|
@ -23,7 +23,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: nchan.c,v 1.41 2002/01/14 13:41:13 markus Exp $");
|
RCSID("$OpenBSD: nchan.c,v 1.42 2002/01/14 13:55:55 markus Exp $");
|
||||||
|
|
||||||
#include "ssh1.h"
|
#include "ssh1.h"
|
||||||
#include "ssh2.h"
|
#include "ssh2.h"
|
||||||
|
@ -63,14 +63,6 @@ RCSID("$OpenBSD: nchan.c,v 1.41 2002/01/14 13:41:13 markus Exp $");
|
||||||
/*
|
/*
|
||||||
* EVENTS update channel input/output states execute ACTIONS
|
* EVENTS update channel input/output states execute ACTIONS
|
||||||
*/
|
*/
|
||||||
/* events concerning the INPUT from socket for channel (istate) */
|
|
||||||
chan_event_fn *chan_rcvd_oclose = NULL;
|
|
||||||
chan_event_fn *chan_read_failed = NULL;
|
|
||||||
chan_event_fn *chan_ibuf_empty = NULL;
|
|
||||||
/* events concerning the OUTPUT from channel for socket (ostate) */
|
|
||||||
chan_event_fn *chan_rcvd_ieof = NULL;
|
|
||||||
chan_event_fn *chan_write_failed = NULL;
|
|
||||||
chan_event_fn *chan_obuf_empty = NULL;
|
|
||||||
/*
|
/*
|
||||||
* ACTIONS: should never update the channel states
|
* ACTIONS: should never update the channel states
|
||||||
*/
|
*/
|
||||||
|
@ -133,8 +125,8 @@ chan_rcvd_oclose1(Channel *c)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void
|
void
|
||||||
chan_read_failed_12(Channel *c)
|
chan_read_failed(Channel *c)
|
||||||
{
|
{
|
||||||
debug("channel %d: read failed", c->self);
|
debug("channel %d: read failed", c->self);
|
||||||
switch (c->istate) {
|
switch (c->istate) {
|
||||||
|
@ -148,8 +140,8 @@ chan_read_failed_12(Channel *c)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void
|
void
|
||||||
chan_ibuf_empty1(Channel *c)
|
chan_ibuf_empty(Channel *c)
|
||||||
{
|
{
|
||||||
debug("channel %d: ibuf empty", c->self);
|
debug("channel %d: ibuf empty", c->self);
|
||||||
if (buffer_len(&c->input)) {
|
if (buffer_len(&c->input)) {
|
||||||
|
@ -212,8 +204,8 @@ chan_write_failed1(Channel *c)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void
|
void
|
||||||
chan_obuf_empty1(Channel *c)
|
chan_obuf_empty(Channel *c)
|
||||||
{
|
{
|
||||||
debug("channel %d: obuf empty", c->self);
|
debug("channel %d: obuf empty", c->self);
|
||||||
if (buffer_len(&c->output)) {
|
if (buffer_len(&c->output)) {
|
||||||
|
@ -307,11 +299,6 @@ chan_rcvd_close2(Channel *c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
chan_ibuf_empty2(Channel *c)
|
|
||||||
{
|
|
||||||
chan_ibuf_empty1(c);
|
|
||||||
}
|
|
||||||
static void
|
|
||||||
chan_rcvd_eof2(Channel *c)
|
chan_rcvd_eof2(Channel *c)
|
||||||
{
|
{
|
||||||
debug("channel %d: rcvd eof", c->self);
|
debug("channel %d: rcvd eof", c->self);
|
||||||
|
@ -335,11 +322,6 @@ chan_write_failed2(Channel *c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
chan_obuf_empty2(Channel *c)
|
|
||||||
{
|
|
||||||
chan_obuf_empty1(c);
|
|
||||||
}
|
|
||||||
static void
|
|
||||||
chan_send_eof2(Channel *c)
|
chan_send_eof2(Channel *c)
|
||||||
{
|
{
|
||||||
debug("channel %d: send eof", c->self);
|
debug("channel %d: send eof", c->self);
|
||||||
|
@ -375,6 +357,31 @@ chan_send_close2(Channel *c)
|
||||||
|
|
||||||
/* shared */
|
/* shared */
|
||||||
|
|
||||||
|
void
|
||||||
|
chan_rcvd_ieof(Channel *c)
|
||||||
|
{
|
||||||
|
if (compat20)
|
||||||
|
chan_rcvd_eof2(c);
|
||||||
|
else
|
||||||
|
chan_rcvd_ieof1(c);
|
||||||
|
}
|
||||||
|
void
|
||||||
|
chan_rcvd_oclose(Channel *c)
|
||||||
|
{
|
||||||
|
if (compat20)
|
||||||
|
chan_rcvd_close2(c);
|
||||||
|
else
|
||||||
|
chan_rcvd_oclose1(c);
|
||||||
|
}
|
||||||
|
void
|
||||||
|
chan_write_failed(Channel *c)
|
||||||
|
{
|
||||||
|
if (compat20)
|
||||||
|
chan_write_failed2(c);
|
||||||
|
else
|
||||||
|
chan_write_failed1(c);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
chan_mark_dead(Channel *c)
|
chan_mark_dead(Channel *c)
|
||||||
{
|
{
|
||||||
|
@ -431,37 +438,6 @@ chan_is_dead(Channel *c, int send)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
chan_init_iostates(Channel *c)
|
|
||||||
{
|
|
||||||
c->ostate = CHAN_OUTPUT_OPEN;
|
|
||||||
c->istate = CHAN_INPUT_OPEN;
|
|
||||||
c->flags = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* init */
|
|
||||||
void
|
|
||||||
chan_init(void)
|
|
||||||
{
|
|
||||||
if (compat20) {
|
|
||||||
chan_rcvd_oclose = chan_rcvd_close2;
|
|
||||||
chan_read_failed = chan_read_failed_12;
|
|
||||||
chan_ibuf_empty = chan_ibuf_empty2;
|
|
||||||
|
|
||||||
chan_rcvd_ieof = chan_rcvd_eof2;
|
|
||||||
chan_write_failed = chan_write_failed2;
|
|
||||||
chan_obuf_empty = chan_obuf_empty2;
|
|
||||||
} else {
|
|
||||||
chan_rcvd_oclose = chan_rcvd_oclose1;
|
|
||||||
chan_read_failed = chan_read_failed_12;
|
|
||||||
chan_ibuf_empty = chan_ibuf_empty1;
|
|
||||||
|
|
||||||
chan_rcvd_ieof = chan_rcvd_ieof1;
|
|
||||||
chan_write_failed = chan_write_failed1;
|
|
||||||
chan_obuf_empty = chan_obuf_empty1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* helper */
|
/* helper */
|
||||||
static void
|
static void
|
||||||
chan_shutdown_write(Channel *c)
|
chan_shutdown_write(Channel *c)
|
||||||
|
|
Loading…
Reference in New Issue