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.
 
 
 
 

87 lines
3.4 KiB

  1. #ifndef __LIBSSH2_TRANSPORT_H
  2. #define __LIBSSH2_TRANSPORT_H
  3. /* Copyright (C) 2007 The Written Word, Inc. All rights reserved.
  4. * Copyright (C) 2009-2010 by Daniel Stenberg
  5. * Author: Daniel Stenberg <daniel@haxx.se>
  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. * This file handles reading and writing to the SECSH transport layer. RFC4253.
  41. */
  42. #include "libssh2_priv.h"
  43. #include "packet.h"
  44. /*
  45. * libssh2_transport_send
  46. *
  47. * Send a packet, encrypting it and adding a MAC code if necessary
  48. * Returns 0 on success, non-zero on failure.
  49. *
  50. * The data is provided as _two_ data areas that are combined by this
  51. * function. The 'data' part is sent immediately before 'data2'. 'data2' can
  52. * be set to NULL (or data2_len to 0) to only use a single part.
  53. *
  54. * Returns LIBSSH2_ERROR_EAGAIN if it would block or if the whole packet was
  55. * not sent yet. If it does so, the caller should call this function again as
  56. * soon as it is likely that more data can be sent, and this function MUST
  57. * then be called with the same argument set (same data pointer and same
  58. * data_len) until ERROR_NONE or failure is returned.
  59. *
  60. * This function DOES NOT call _libssh2_error() on any errors.
  61. */
  62. int _libssh2_transport_send(LIBSSH2_SESSION *session,
  63. const unsigned char *data, size_t data_len,
  64. const unsigned char *data2, size_t data2_len);
  65. /*
  66. * _libssh2_transport_read
  67. *
  68. * Collect a packet into the input brigade block only controls whether or not
  69. * to wait for a packet to start.
  70. *
  71. * Returns packet type added to input brigade (PACKET_NONE if nothing added),
  72. * or PACKET_FAIL on failure and PACKET_EAGAIN if it couldn't process a full
  73. * packet.
  74. */
  75. /*
  76. * This function reads the binary stream as specified in chapter 6 of RFC4253
  77. * "The Secure Shell (SSH) Transport Layer Protocol"
  78. */
  79. int _libssh2_transport_read(LIBSSH2_SESSION * session);
  80. #endif /* __LIBSSH2_TRANSPORT_H */