Skip to content

Commit c42d801

Browse files
author
Pan
committed
Added channels, misc and bind definition files.
1 parent cac5352 commit c42d801

File tree

4 files changed

+167
-0
lines changed

4 files changed

+167
-0
lines changed

ssh/c_bind.pxd

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This file is part of ssh-python.
2+
# Copyright (C) 2018 Panos Kittenis
3+
#
4+
# This library is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU Lesser General Public
6+
# License as published by the Free Software Foundation, version 2.1.
7+
#
8+
# This library is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
# Lesser General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU Lesser General Public
14+
# License along with this library; if not, write to the Free Software
15+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130
16+
17+
cimport c_priv
18+
cimport c_session
19+
20+
21+
cdef extern from "libssh/include/bind.h" nogil:
22+
struct ssh_bind_struct:
23+
ssh_common_struct common
24+
ssh_bind_callbacks_struct *bind_callbacks
25+
void *bind_callbacks_userdata
26+
ssh_poll_handle_struct *poll
27+
char *wanted_methods[10]
28+
char *banner
29+
char *ecdsakey
30+
char *dsakey
31+
char *rsakey
32+
char *ed25519key
33+
ssh_key ecdsa
34+
ssh_key dsa
35+
ssh_key rsa
36+
ssh_key ed25519
37+
char *bindaddr
38+
socket_t bindfd
39+
unsigned int bindport
40+
int blocking
41+
int toaccept
42+
ssh_poll_handle_struct *ssh_bind_get_poll(ssh_bind_struct *sshbind)

ssh/c_channels.pxd

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This file is part of ssh-python.
2+
# Copyright (C) 2018 Panos Kittenis
3+
#
4+
# This library is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU Lesser General Public
6+
# License as published by the Free Software Foundation, version 2.1.
7+
#
8+
# This library is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
# Lesser General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU Lesser General Public
14+
# License along with this library; if not, write to the Free Software
15+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130
16+
17+
cimport c_ssh
18+
from c_ssh cimport uint32_t, ssh_channel, ssh_session, ssh_buffer, ssh_counter
19+
from c_misc cimport ssh_list
20+
# cimport c_priv
21+
22+
cdef extern from "libssh/include/channels.h" nogil:
23+
enum ssh_channel_request_state_e:
24+
SSH_CHANNEL_REQ_STATE_NONE,
25+
SSH_CHANNEL_REQ_STATE_PENDING,
26+
SSH_CHANNEL_REQ_STATE_ACCEPTED,
27+
SSH_CHANNEL_REQ_STATE_DENIED,
28+
SSH_CHANNEL_REQ_STATE_ERROR
29+
30+
enum ssh_channel_state_e:
31+
SSH_CHANNEL_STATE_NOT_OPEN,
32+
SSH_CHANNEL_STATE_OPENING,
33+
SSH_CHANNEL_STATE_OPEN_DENIED,
34+
SSH_CHANNEL_STATE_OPEN,
35+
SSH_CHANNEL_STATE_CLOSED
36+
37+
enum:
38+
SSH_CHANNEL_FLAG_CLOSED_REMOTE
39+
SSH_CHANNEL_FLAG_FREED_LOCAL
40+
SSH_CHANNEL_FLAG_NOT_BOUND
41+
42+
struct ssh_channel_struct:
43+
ssh_session session
44+
uint32_t local_channel
45+
uint32_t local_window
46+
int local_eof
47+
uint32_t local_maxpacket
48+
uint32_t remote_channel
49+
uint32_t remote_window
50+
int remote_eof
51+
uint32_t remote_maxpacket
52+
ssh_channel_state_e state
53+
int delayed_close
54+
int flags
55+
ssh_buffer stdout_buffer
56+
ssh_buffer stderr_buffer
57+
void *userarg
58+
int version
59+
int exit_status
60+
ssh_channel_request_state_e request_state
61+
ssh_list *callbacks
62+
ssh_counter counter
63+
64+
c_ssh.ssh_channel ssh_channel_new(c_ssh.ssh_session session)
65+
int channel_default_bufferize(c_ssh.ssh_channel channel, void *data, int len,
66+
int is_stderr)
67+
int ssh_channel_flush(c_ssh.ssh_channel channel)
68+
uint32_t ssh_channel_new_id(c_ssh.ssh_session session)
69+
c_ssh.ssh_channel ssh_channel_from_local(c_ssh.ssh_session session, c_ssh.uint32_t id)
70+
void ssh_channel_do_free(c_ssh.ssh_channel channel)

ssh/c_misc.pxd

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This file is part of ssh-python.
2+
# Copyright (C) 2018 Panos Kittenis
3+
#
4+
# This library is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU Lesser General Public
6+
# License as published by the Free Software Foundation, version 2.1.
7+
#
8+
# This library is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
# Lesser General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU Lesser General Public
14+
# License along with this library; if not, write to the Free Software
15+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130
16+
17+
from c_ssh cimport ssh_session
18+
19+
cdef extern from "libssh/include/misc.h" nogil:
20+
char *ssh_get_user_home_dir()
21+
char *ssh_get_local_username()
22+
int ssh_file_readaccess_ok(const char *file)
23+
char *ssh_path_expand_tilde(const char *d)
24+
char *ssh_path_expand_escape(ssh_session session, const char *s)
25+
int ssh_analyze_banner(ssh_session session, int server, int *ssh1, int *ssh2)
26+
int ssh_is_ipaddr_v4(const char *str)
27+
int ssh_is_ipaddr(const char *str)
28+
struct ssh_iterator
29+
struct ssh_iterator:
30+
ssh_iterator *next
31+
const void *data
32+
struct ssh_list:
33+
ssh_iterator *root
34+
ssh_iterator *end
35+
struct ssh_timestamp:
36+
long seconds
37+
long useconds
38+
39+
ssh_list *ssh_list_new()
40+
void ssh_list_free(ssh_list *list);
41+
ssh_iterator *ssh_list_get_iterator(const ssh_list *list)
42+
ssh_iterator *ssh_list_find(const ssh_list *list, void *value)
43+
int ssh_list_append(ssh_list *list, const void *data)
44+
int ssh_list_prepend(ssh_list *list, const void *data)
45+
void ssh_list_remove(ssh_list *list, ssh_iterator *iterator)
46+
char *ssh_lowercase(const char* str)
47+
char *ssh_hostport(const char *host, int port)
48+
const void *_ssh_list_pop_head(ssh_list *list)
49+
int ssh_make_milliseconds(long sec, long usec)
50+
void ssh_timestamp_init(ssh_timestamp *ts)
51+
int ssh_timeout_elapsed(ssh_timestamp *ts, int timeout)
52+
int ssh_timeout_update(ssh_timestamp *ts, int timeout)
53+
int ssh_match_group(const char *group, const char *object)

ssh/ssh.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@
1818
cimport c_ssh
1919
cimport c_agent
2020
cimport c_auth
21+
cimport c_channels
22+
cimport c_misc

0 commit comments

Comments
 (0)