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.
 
 
 
 

142 lines
4.6 KiB

  1. #ifndef __LIBSSH2_CHANNEL_H
  2. #define __LIBSSH2_CHANNEL_H
  3. /* Copyright (c) 2008-2010 by Daniel Stenberg
  4. *
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms,
  8. * with or without modification, are permitted provided
  9. * that the following conditions are met:
  10. *
  11. * Redistributions of source code must retain the above
  12. * copyright notice, this list of conditions and the
  13. * following disclaimer.
  14. *
  15. * Redistributions in binary form must reproduce the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer in the documentation and/or other materials
  18. * provided with the distribution.
  19. *
  20. * Neither the name of the copyright holder nor the names
  21. * of any other contributors may be used to endorse or
  22. * promote products derived from this software without
  23. * specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  26. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  27. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  28. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  30. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  31. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  32. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  33. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  34. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  35. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  36. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  37. * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  38. * OF SUCH DAMAGE.
  39. */
  40. /*
  41. * _libssh2_channel_receive_window_adjust
  42. *
  43. * Adjust the receive window for a channel by adjustment bytes. If the amount
  44. * to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the
  45. * adjustment amount will be queued for a later packet.
  46. *
  47. * Always non-blocking.
  48. */
  49. int _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel,
  50. uint32_t adjustment,
  51. unsigned char force,
  52. unsigned int *store);
  53. /*
  54. * _libssh2_channel_flush
  55. *
  56. * Flush data from one (or all) stream
  57. * Returns number of bytes flushed, or negative on failure
  58. */
  59. int _libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid);
  60. /*
  61. * _libssh2_channel_free
  62. *
  63. * Make sure a channel is closed, then remove the channel from the session
  64. * and free its resource(s)
  65. *
  66. * Returns 0 on success, negative on failure
  67. */
  68. int _libssh2_channel_free(LIBSSH2_CHANNEL *channel);
  69. int
  70. _libssh2_channel_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode);
  71. /*
  72. * _libssh2_channel_write
  73. *
  74. * Send data to a channel
  75. */
  76. ssize_t
  77. _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id,
  78. const unsigned char *buf, size_t buflen);
  79. /*
  80. * _libssh2_channel_open
  81. *
  82. * Establish a generic session channel
  83. */
  84. LIBSSH2_CHANNEL *
  85. _libssh2_channel_open(LIBSSH2_SESSION * session, const char *channel_type,
  86. uint32_t channel_type_len,
  87. uint32_t window_size,
  88. uint32_t packet_size,
  89. const unsigned char *message, size_t message_len);
  90. /*
  91. * _libssh2_channel_process_startup
  92. *
  93. * Primitive for libssh2_channel_(shell|exec|subsystem)
  94. */
  95. int
  96. _libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
  97. const char *request, size_t request_len,
  98. const char *message, size_t message_len);
  99. /*
  100. * _libssh2_channel_read
  101. *
  102. * Read data from a channel
  103. *
  104. * It is important to not return 0 until the currently read channel is
  105. * complete. If we read stuff from the wire but it was no payload data to fill
  106. * in the buffer with, we MUST make sure to return PACKET_EAGAIN.
  107. */
  108. ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id,
  109. char *buf, size_t buflen);
  110. uint32_t _libssh2_channel_nextid(LIBSSH2_SESSION * session);
  111. LIBSSH2_CHANNEL *_libssh2_channel_locate(LIBSSH2_SESSION * session,
  112. uint32_t channel_id);
  113. size_t _libssh2_channel_packet_data_len(LIBSSH2_CHANNEL * channel,
  114. int stream_id);
  115. int _libssh2_channel_close(LIBSSH2_CHANNEL * channel);
  116. /*
  117. * _libssh2_channel_forward_cancel
  118. *
  119. * Stop listening on a remote port and free the listener
  120. * Toss out any pending (un-accept()ed) connections
  121. *
  122. * Return 0 on success, LIBSSH2_ERROR_EAGAIN if would block, -1 on error
  123. */
  124. int _libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener);
  125. #endif /* __LIBSSH2_CHANNEL_H */