www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: [libssh2] #161: Create API for socket I/O in application

[libssh2] #161: Create API for socket I/O in application

From: libssh2 Trac <trac_at_libssh2.stuge.se>
Date: Mon, 22 Feb 2010 19:08:47 -0000

#161: Create API for socket I/O in application
 Reporter: stuge | Owner:
     Type: enhancement | Status: new
 Priority: normal | Milestone:
Component: API | Version: 1.1
 Keywords: | Blocking:
Blockedby: |
 libssh2 always uses non-blocking I/O and creates blocking semantics
 internally, but it doesn't always work.

 #123, #160 and possibly also #159 are effects of this and
 [/browser/example/direct_tcpip.c examples/direct_tcpip.c] is also
 affected; it only works correctly because it uses libssh2 in non-blocking
 mode, thus bypassing the internal blocking in the library, but it must
 still wake up every 100ms and do polling, which is pretty ugly.

 This is an unfortunate problem, since select() could have been used to
 successfully handle all file descriptors if libssh2 relied on the
 operating system to operate correctly in blocking mode.

 I want an API that works with both blocking modes, meaning we either fix
 the current implementation to block according to operating system settings
 for the underlying socket, or create a new API that is blocking agnostic
 by definition.

 This ticket suggests an API that moves socket I/O out of libssh2 and lets
 applications give and get bytes for the sshd connection using new library
 functions. This shifts more work onto apps, but on the other hand it
 greatly simplifies proxying of SSH connections in direct-tcpip channels,
 since libssh2 currently requires a file descriptor for each sshd
 connection and a direct-tcpip connection only gets us a LIBSSH2_CHANNEL.
 (This can not be worked around in a portable manner using pipes, so
 portable apps must currently use a very inconvenient loopback TCP socket.)

 There could be helper functions in libssh2 to make the API as easy as
 possible to use in typical scenarios. It could even enable easy multihop

Ticket URL: <http://libssh2.stuge.se/ticket/161>
libssh2 <http://libssh2.stuge.se/>
C library for writing portable SSH2 clients
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-02-22

the libssh2 team