diff options
author | Hans Nilsson <[email protected]> | 2019-06-11 10:38:10 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2019-06-11 10:38:10 +0200 |
commit | f9f8e4137cc2860444fdf412c5dbf9b7d0cb1cf3 (patch) | |
tree | ed217becc819d766b548e11a46d46fff49d420fa /lib/ssh/src/ssh.hrl | |
parent | f4b64d3ddaaedf29c81a32af291104279fbbfdce (diff) | |
parent | f422241a1a2be4a69041e5fce35a18fcddd75e83 (diff) | |
download | otp-f9f8e4137cc2860444fdf412c5dbf9b7d0cb1cf3.tar.gz otp-f9f8e4137cc2860444fdf412c5dbf9b7d0cb1cf3.tar.bz2 otp-f9f8e4137cc2860444fdf412c5dbf9b7d0cb1cf3.zip |
Merge branch 'hans/ssh/internal_cleaning/PR-2255/PR-2256/OTP-15876' into maint
* hans/ssh/internal_cleaning/PR-2255/PR-2256/OTP-15876:
Remove duplication of SSH encoding macros
Remove duplicate ssh_userauth.hrl
Diffstat (limited to 'lib/ssh/src/ssh.hrl')
-rw-r--r-- | lib/ssh/src/ssh.hrl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/ssh/src/ssh.hrl b/lib/ssh/src/ssh.hrl index 04453e6ef0..54e98ee10e 100644 --- a/lib/ssh/src/ssh.hrl +++ b/lib/ssh/src/ssh.hrl @@ -68,6 +68,25 @@ -define(string(X), ?string_utf8(X)). -define(binary(X), << ?STRING(X) >>). +-define('2bin'(X), (if is_binary(X) -> X; + is_list(X) -> list_to_binary(X); + X==undefined -> <<>> + end) ). + +%% encoding macros +-define('E...'(X), ?'2bin'(X)/binary ). +-define(Eboolean(X), ?BOOLEAN(case X of + true -> ?TRUE; + false -> ?FALSE + end) ). +-define(Ebyte(X), ?BYTE(X) ). +-define(Euint32(X), ?UINT32(X) ). +-define(Estring(X), ?STRING(?'2bin'(X)) ). +-define(Estring_utf8(X), ?string_utf8(X)/binary ). +-define(Ename_list(X), ?STRING(ssh_bits:name_list(X)) ). +-define(Empint(X), (ssh_bits:mpint(X))/binary ). +-define(Ebinary(X), ?STRING(X) ). + %% Cipher details -define(SSH_CIPHER_NONE, 0). -define(SSH_CIPHER_3DES, 3). |