1
#ifndef __LIBSSH2_CHANNEL_H
2
#define __LIBSSH2_CHANNEL_H
3
/* Copyright (c) 2008-2010 by Daniel Stenberg
7
* Redistribution and use in source and binary forms,
8
* with or without modification, are permitted provided
9
* that the following conditions are met:
11
* Redistributions of source code must retain the above
12
* copyright notice, this list of conditions and the
13
* following disclaimer.
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.
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.
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
42
* _libssh2_channel_receive_window_adjust
44
* Adjust the receive window for a channel by adjustment bytes. If the amount
45
* to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the
46
* adjustment amount will be queued for a later packet.
48
* Always non-blocking.
50
int _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel,
51
unsigned long adjustment,
56
* _libssh2_channel_flush
58
* Flush data from one (or all) stream
59
* Returns number of bytes flushed, or negative on failure
61
int _libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid);
64
* _libssh2_channel_free
66
* Make sure a channel is closed, then remove the channel from the session
67
* and free its resource(s)
69
* Returns 0 on success, negative on failure
71
int _libssh2_channel_free(LIBSSH2_CHANNEL *channel);
74
_libssh2_channel_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode);
77
* _libssh2_channel_write
79
* Send data to a channel
82
_libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id,
83
const char *buf, size_t buflen);
86
* _libssh2_channel_open
88
* Establish a generic session channel
91
_libssh2_channel_open(LIBSSH2_SESSION * session, const char *channel_type,
92
uint32_t channel_type_len,
95
const char *message, unsigned int message_len);
99
* _libssh2_channel_process_startup
101
* Primitive for libssh2_channel_(shell|exec|subsystem)
104
_libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
105
const char *request, unsigned int request_len,
106
const char *message, unsigned int message_len);
110
* _libssh2_channel_read
112
* Read data from a channel
114
* It is important to not return 0 until the currently read channel is
115
* complete. If we read stuff from the wire but it was no payload data to fill
116
* in the buffer with, we MUST make sure to return PACKET_EAGAIN.
118
ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id,
119
char *buf, size_t buflen);
121
uint32_t _libssh2_channel_nextid(LIBSSH2_SESSION * session);
123
LIBSSH2_CHANNEL *_libssh2_channel_locate(LIBSSH2_SESSION * session,
124
uint32_t channel_id);
126
size_t _libssh2_channel_packet_data_len(LIBSSH2_CHANNEL * channel,
129
int _libssh2_channel_close(LIBSSH2_CHANNEL * channel);
132
* _libssh2_channel_forward_cancel
134
* Stop listening on a remote port and free the listener
135
* Toss out any pending (un-accept()ed) connections
137
* Return 0 on success, LIBSSH2_ERROR_EAGAIN if would block, -1 on error
139
int _libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener);
141
#endif /* __LIBSSH2_CHANNEL_H */