Skip to content

Commit 2722efe

Browse files
committed
Add enums to allow type checks and bitmasks to easily be identified and what options are supported. This helps for ParallelSSH#128.
1 parent 1a587eb commit 2722efe

File tree

6 files changed

+5169
-17
lines changed

6 files changed

+5169
-17
lines changed

ssh2/c_ssh2.pxd

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# This file is part of ssh2-python.
22
# Copyright (C) 2017-2020 Panos Kittenis
3-
#
3+
44
# This library is free software; you can redistribute it and/or
55
# modify it under the terms of the GNU Lesser General Public
66
# License as published by the Free Software Foundation, version 2.1.
7-
#
7+
88
# This library is distributed in the hope that it will be useful,
99
# but WITHOUT ANY WARRANTY; without even the implied warranty of
1010
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1111
# Lesser General Public License for more details.
12-
#
12+
1313
# You should have received a copy of the GNU Lesser General Public
1414
# License along with this library; if not, write to the Free Software
1515
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -39,10 +39,37 @@ cdef extern from "libssh2.h" nogil:
3939
LIBSSH2_HOSTKEY_TYPE_UNKNOWN
4040
LIBSSH2_HOSTKEY_TYPE_RSA
4141
LIBSSH2_HOSTKEY_TYPE_DSS
42+
LIBSSH2_HOSTKEY_TYPE_ECDSA_256
43+
LIBSSH2_HOSTKEY_TYPE_ECDSA_384
44+
LIBSSH2_HOSTKEY_TYPE_ECDSA_521
45+
LIBSSH2_HOSTKEY_TYPE_ED25519
46+
enum:
47+
LIBSSH2_CALLBACK_IGNORE
48+
LIBSSH2_CALLBACK_DEBUG
49+
LIBSSH2_CALLBACK_DISCONNECT
50+
LIBSSH2_CALLBACK_MACERROR
51+
LIBSSH2_CALLBACK_X11
52+
LIBSSH2_CALLBACK_RECV
53+
LIBSSH2_CALLBACK_SEND
4254
IF EMBEDDED_LIB:
4355
enum:
4456
LIBSSH2_HOSTKEY_HASH_SHA256
4557

58+
enum:
59+
LIBSSH2_METHOD_KEX
60+
LIBSSH2_METHOD_HOSTKEY
61+
LIBSSH2_METHOD_CRYPT_CS
62+
LIBSSH2_METHOD_CRYPT_SC
63+
LIBSSH2_METHOD_MAC_CS
64+
LIBSSH2_METHOD_MAC_SC
65+
LIBSSH2_METHOD_COMP_CS
66+
LIBSSH2_METHOD_COMP_SC
67+
LIBSSH2_METHOD_LANG_CS
68+
LIBSSH2_METHOD_LANG_SC
69+
enum:
70+
LIBSSH2_FLAG_SIGPIPE
71+
LIBSSH2_FLAG_COMPRESS
72+
4673
# ctypedef libssh2_uint64_t libssh2_struct_stat_size
4774
ctypedef struct libssh2_struct_stat:
4875
dev_t st_dev
@@ -422,6 +449,10 @@ cdef extern from "libssh2.h" nogil:
422449
LIBSSH2_KNOWNHOST_KEY_RSA1
423450
LIBSSH2_KNOWNHOST_KEY_SSHRSA
424451
LIBSSH2_KNOWNHOST_KEY_SSHDSS
452+
LIBSSH2_KNOWNHOST_KEY_ECDSA_256
453+
LIBSSH2_KNOWNHOST_KEY_ECDSA_384
454+
LIBSSH2_KNOWNHOST_KEY_ECDSA_521
455+
LIBSSH2_KNOWNHOST_KEY_ED25519
425456
IF EMBEDDED_LIB:
426457
enum:
427458
LIBSSH2_KNOWNHOST_KEY_UNKNOWN

ssh2/error_codes.c

Lines changed: 37 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ssh2/error_codes.pxd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# This file is part of ssh2-python.
22
# Copyright (C) 2017-2020 Panos Kittenis
3-
#
3+
44
# This library is free software; you can redistribute it and/or
55
# modify it under the terms of the GNU Lesser General Public
66
# License as published by the Free Software Foundation, version 2.1.
7-
#
7+
88
# This library is distributed in the hope that it will be useful,
99
# but WITHOUT ANY WARRANTY; without even the implied warranty of
1010
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1111
# Lesser General Public License for more details.
12-
#
12+
1313
# You should have received a copy of the GNU Lesser General Public
1414
# License along with this library; if not, write to the Free Software
1515
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -73,3 +73,5 @@ cdef extern from "libssh2.h" nogil:
7373
_LIBSSH2_ERROR_ENCRYPT "LIBSSH2_ERROR_ENCRYPT"
7474
_LIBSSH2_ERROR_BAD_SOCKET "LIBSSH2_ERROR_BAD_SOCKET"
7575
_LIBSSH2_ERROR_KNOWN_HOSTS "LIBSSH2_ERROR_KNOWN_HOSTS"
76+
_LIBSSH2_ERROR_KEX_FAILURE "LIBSSH2_ERROR_KEX_FAILURE"
77+
_LIBSSH2_ERROR_INVALID_MAC "LIBSSH2_ERROR_INVALID_MAC"

ssh2/error_codes.pyx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# This file is part of ssh2-python.
2-
# Copyright (C) 2017-2020 Panos Kittenis
3-
#
2+
# Copyright (C) 2017 Panos Kittenis
3+
44
# This library is free software; you can redistribute it and/or
55
# modify it under the terms of the GNU Lesser General Public
66
# License as published by the Free Software Foundation, version 2.1.
7-
#
7+
88
# This library is distributed in the hope that it will be useful,
99
# but WITHOUT ANY WARRANTY; without even the implied warranty of
1010
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1111
# Lesser General Public License for more details.
12-
#
12+
1313
# You should have received a copy of the GNU Lesser General Public
1414
# License along with this library; if not, write to the Free Software
1515
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -72,5 +72,7 @@ LIBSSH2_ERROR_SOCKET_RECV = error_codes._LIBSSH2_ERROR_SOCKET_RECV
7272
LIBSSH2_ERROR_SOCKET_SEND = error_codes._LIBSSH2_ERROR_SOCKET_SEND
7373
LIBSSH2_ERROR_ENCRYPT = error_codes._LIBSSH2_ERROR_ENCRYPT
7474
LIBSSH2_ERROR_BAD_SOCKET = error_codes._LIBSSH2_ERROR_BAD_SOCKET
75+
LIBSSH2_ERROR_KEX_FAILURE = error_codes._LIBSSH2_ERROR_KEX_FAILURE
76+
LIBSSH2_ERROR_INVALID_MAC = error_codes._LIBSSH2_ERROR_INVALID_MAC
7577
IF EMBEDDED_LIB:
7678
LIBSSH2_ERROR_KNOWN_HOSTS = error_codes._LIBSSH2_ERROR_KNOWN_HOSTS

0 commit comments

Comments
 (0)