]> andersk Git - openssh.git/commitdiff
- markus@cvs.openbsd.org 2002/01/14 13:55:55
authordjm <djm>
Tue, 22 Jan 2002 12:28:45 +0000 (12:28 +0000)
committerdjm <djm>
Tue, 22 Jan 2002 12:28:45 +0000 (12:28 +0000)
     [channels.c channels.h nchan.c]
     remove function pointers for events, remove chan_init*; ok provos@

ChangeLog
channels.c
channels.h
nchan.c

index 824bcb5f733050967dc7218ede3ea700dfab80fe..9d660df57061b5d3c3dbbe7420b0497de42b5868 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
    - markus@cvs.openbsd.org 2002/01/14 13:41:13
      [nchan.c]
      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
  - (djm) Rework ssh-rand-helper:
index db3bda66a37ad90e72519e5cfb78243c2e5301a7..473c5efe4edf00d1a46f0f56dd88acba6cc42af6 100644 (file)
@@ -39,7 +39,7 @@
  */
 
 #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 "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. */
        if (channels_alloc == 0) {
-               chan_init();
                channels_alloc = 10;
                channels = xmalloc(channels_alloc * sizeof(Channel *));
                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->output);
        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);
        c->self = found;
        c->type = type;
index a857db11edec53e15116439d8e261ee69b720680..9f97488b2c3dc03876b91e8b2484effb969c569b 100644 (file)
@@ -32,7 +32,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * 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
 #define CHANNEL_H
@@ -215,19 +215,15 @@ void       auth_input_open_request(int, u_int32_t, void *);
 
 int     chan_is_dead(Channel *, int);
 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 */
-extern chan_event_fn   *chan_rcvd_oclose;
-extern chan_event_fn   *chan_read_failed;
-extern chan_event_fn   *chan_ibuf_empty;
+void    chan_rcvd_oclose(Channel *);
+void    chan_read_failed(Channel *);
+void    chan_ibuf_empty(Channel *);
 
-/* for the output state */
-extern chan_event_fn   *chan_rcvd_ieof;
-extern chan_event_fn   *chan_write_failed;
-extern chan_event_fn   *chan_obuf_empty;
+void    chan_rcvd_ieof(Channel *);
+void    chan_write_failed(Channel *);
+void    chan_obuf_empty(Channel *);
 
 #endif
diff --git a/nchan.c b/nchan.c
index 9ecf42105f923eb5bd8e4bf47b8529817086a253..ebb8e6858fff53b0a52a456978d472a1dd1abec9 100644 (file)
--- a/nchan.c
+++ b/nchan.c
@@ -23,7 +23,7 @@
  */
 
 #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 "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 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
  */
@@ -133,8 +125,8 @@ chan_rcvd_oclose1(Channel *c)
                return;
        }
 }
-static void
-chan_read_failed_12(Channel *c)
+void
+chan_read_failed(Channel *c)
 {
        debug("channel %d: read failed", c->self);
        switch (c->istate) {
@@ -148,8 +140,8 @@ chan_read_failed_12(Channel *c)
                break;
        }
 }
-static void
-chan_ibuf_empty1(Channel *c)
+void
+chan_ibuf_empty(Channel *c)
 {
        debug("channel %d: ibuf empty", c->self);
        if (buffer_len(&c->input)) {
@@ -212,8 +204,8 @@ chan_write_failed1(Channel *c)
                break;
        }
 }
-static void
-chan_obuf_empty1(Channel *c)
+void
+chan_obuf_empty(Channel *c)
 {
        debug("channel %d: obuf empty", c->self);
        if (buffer_len(&c->output)) {
@@ -307,11 +299,6 @@ chan_rcvd_close2(Channel *c)
        }
 }
 static void
-chan_ibuf_empty2(Channel *c)
-{
-       chan_ibuf_empty1(c);
-}
-static void
 chan_rcvd_eof2(Channel *c)
 {
        debug("channel %d: rcvd eof", c->self);
@@ -335,11 +322,6 @@ chan_write_failed2(Channel *c)
        }
 }
 static void
-chan_obuf_empty2(Channel *c)
-{
-       chan_obuf_empty1(c);
-}
-static void
 chan_send_eof2(Channel *c)
 {
        debug("channel %d: send eof", c->self);
@@ -375,6 +357,31 @@ chan_send_close2(Channel *c)
 
 /* 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
 chan_mark_dead(Channel *c)
 {
@@ -431,37 +438,6 @@ chan_is_dead(Channel *c, int send)
        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 */
 static void
 chan_shutdown_write(Channel *c)
This page took 0.518825 seconds and 5 git commands to generate.