geom_gate userland utility improvements
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

77 lines
3.1 KiB

  1. .TH libssh2_session_callback_set 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
  2. .SH NAME
  3. libssh2_session_callback_set - set a callback function
  4. .SH SYNOPSIS
  5. .nf
  6. #include <libssh2.h>
  7. void *libssh2_session_callback_set(LIBSSH2_SESSION *session,
  8. int cbtype, void *callback);
  9. .SH DESCRIPTION
  10. Sets a custom callback handler for a previously initialized session
  11. object. Callbacks are triggered by the receipt of special packets at the
  12. Transport layer. To disable a callback, set it to NULL.
  13. \fIsession\fP - Session instance as returned by
  14. .BR libssh2_session_init_ex(3)
  15. \fIcbtype\fP - Callback type. One of the types listed in Callback Types.
  16. \fIcallback\fP - Pointer to custom callback function. The prototype for
  17. this function must match the associated callback declaration macro.
  18. .SH CALLBACK TYPES
  19. .IP LIBSSH2_CALLBACK_IGNORE
  20. Called when a SSH_MSG_IGNORE message is received
  21. .IP LIBSSH2_CALLBACK_DEBUG
  22. Called when a SSH_MSG_DEBUG message is received
  23. .IP LIBSSH2_CALLBACK_DISCONNECT
  24. Called when a SSH_MSG_DISCONNECT message is received
  25. .IP LIBSSH2_CALLBACK_MACERROR
  26. Called when a mismatched MAC has been detected in the transport layer. If the
  27. function returns 0, the packet will be accepted nonetheless.
  28. .IP LIBSSH2_CALLBACK_X11
  29. Called when an X11 connection has been accepted
  30. .IP LIBSSH2_CALLBACK_SEND
  31. Called when libssh2 wants to send data on the connection. Can be set to a
  32. custom function to handle I/O your own way.
  33. The prototype of the callback:
  34. .nf
  35. ssize_t sendcb(libssh2_socket_t sockfd, const void *buffer,
  36. size_t length, int flags, void **abstract);
  37. .fi
  38. \fBsockfd\fP is the socket to write to, \fBbuffer\fP points to the data to
  39. send, \fBlength\fP is the size of the data, \fBflags\fP is the flags that
  40. would've been used to a \fIsend()\fP call and \fBabstract\fP is a pointer to
  41. the abstract pointer set in the \fIlibssh2_session_init_ex(3)\fP call.
  42. The callback returns the number of bytes sent, or -1 for error. The special
  43. return code \fB-EAGAIN\fP can be returned to signal that the send was aborted
  44. to prevent getting blocked and it needs to be called again.
  45. .IP LIBSSH2_CALLBACK_RECV
  46. Called when libssh2 wants to read data from the connection. Can be set to a
  47. custom function to handle I/O your own way.
  48. The prototype of the callback:
  49. .nf
  50. ssize_t recvcb(libssh2_socket_t sockfd, void *buffer,
  51. size_t length, int flags, void **abstract);
  52. .fi
  53. \fBsockfd\fP is the socket to read from, \fBbuffer\fP where to store received
  54. data into, \fBlength\fP is the size of the buffer, \fBflags\fP is the flags
  55. that would've been used to a \fIrecv()\fP call and \fBabstract\fP is a pointer
  56. to the abstract pointer set in the \fIlibssh2_session_init_ex(3)\fP call.
  57. The callback returns the number of bytes read, or -1 for error. The special
  58. return code \fB-EAGAIN\fP can be returned to signal that the read was aborted
  59. to prevent getting blocked and it needs to be called again.
  60. .SH RETURN VALUE
  61. Pointer to previous callback handler. Returns NULL if no prior callback
  62. handler was set or the callback type was unknown.
  63. .SH SEE ALSO
  64. .BR libssh2_session_init_ex(3)