ssh2.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /* $OpenBSD: ssh2.h,v 1.19 2020/11/19 23:05:05 dtucker Exp $ */
  2. /*
  3. * Copyright (c) 2000 Markus Friedl. All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  15. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  16. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  17. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  18. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  19. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  21. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. /*
  26. * RFC4251:
  27. *
  28. * Transport layer protocol:
  29. *
  30. * 1-19 Transport layer generic (e.g. disconnect, ignore, debug,
  31. * etc)
  32. * 20-29 Algorithm negotiation
  33. * 30-49 Key exchange method specific (numbers can be reused for
  34. * different authentication methods)
  35. *
  36. * User authentication protocol:
  37. *
  38. * 50-59 User authentication generic
  39. * 60-79 User authentication method specific (numbers can be reused
  40. * for different authentication methods)
  41. *
  42. * Connection protocol:
  43. *
  44. * 80-89 Connection protocol generic
  45. * 90-127 Channel related messages
  46. *
  47. * Reserved for client protocols:
  48. *
  49. * 128-191 Reserved
  50. *
  51. * Local extensions:
  52. *
  53. * 192-255 Local extensions
  54. */
  55. /* special marker for no message */
  56. #define SSH_MSG_NONE 0
  57. /* ranges */
  58. #define SSH2_MSG_TRANSPORT_MIN 1
  59. #define SSH2_MSG_TRANSPORT_MAX 49
  60. #define SSH2_MSG_USERAUTH_MIN 50
  61. #define SSH2_MSG_USERAUTH_MAX 79
  62. #define SSH2_MSG_USERAUTH_PER_METHOD_MIN 60
  63. #define SSH2_MSG_USERAUTH_PER_METHOD_MAX SSH2_MSG_USERAUTH_MAX
  64. #define SSH2_MSG_CONNECTION_MIN 80
  65. #define SSH2_MSG_CONNECTION_MAX 127
  66. #define SSH2_MSG_RESERVED_MIN 128
  67. #define SSH2_MSG_RESERVED_MAX 191
  68. #define SSH2_MSG_LOCAL_MIN 192
  69. #define SSH2_MSG_LOCAL_MAX 255
  70. #define SSH2_MSG_MIN 1
  71. #define SSH2_MSG_MAX 255
  72. /* transport layer: generic */
  73. #define SSH2_MSG_DISCONNECT 1
  74. #define SSH2_MSG_IGNORE 2
  75. #define SSH2_MSG_UNIMPLEMENTED 3
  76. #define SSH2_MSG_DEBUG 4
  77. #define SSH2_MSG_SERVICE_REQUEST 5
  78. #define SSH2_MSG_SERVICE_ACCEPT 6
  79. #define SSH2_MSG_EXT_INFO 7
  80. /* transport layer: alg negotiation */
  81. #define SSH2_MSG_KEXINIT 20
  82. #define SSH2_MSG_NEWKEYS 21
  83. /* transport layer: kex specific messages, can be reused */
  84. #define SSH2_MSG_KEXDH_INIT 30
  85. #define SSH2_MSG_KEXDH_REPLY 31
  86. /* dh-group-exchange */
  87. #define SSH2_MSG_KEX_DH_GEX_REQUEST_OLD 30
  88. #define SSH2_MSG_KEX_DH_GEX_GROUP 31
  89. #define SSH2_MSG_KEX_DH_GEX_INIT 32
  90. #define SSH2_MSG_KEX_DH_GEX_REPLY 33
  91. #define SSH2_MSG_KEX_DH_GEX_REQUEST 34
  92. /* ecdh */
  93. #define SSH2_MSG_KEX_ECDH_INIT 30
  94. #define SSH2_MSG_KEX_ECDH_REPLY 31
  95. /* user authentication: generic */
  96. #define SSH2_MSG_USERAUTH_REQUEST 50
  97. #define SSH2_MSG_USERAUTH_FAILURE 51
  98. #define SSH2_MSG_USERAUTH_SUCCESS 52
  99. #define SSH2_MSG_USERAUTH_BANNER 53
  100. /* user authentication: method specific, can be reused */
  101. #define SSH2_MSG_USERAUTH_PK_OK 60
  102. #define SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ 60
  103. #define SSH2_MSG_USERAUTH_INFO_REQUEST 60
  104. #define SSH2_MSG_USERAUTH_INFO_RESPONSE 61
  105. /* connection protocol: generic */
  106. #define SSH2_MSG_GLOBAL_REQUEST 80
  107. #define SSH2_MSG_REQUEST_SUCCESS 81
  108. #define SSH2_MSG_REQUEST_FAILURE 82
  109. /* channel related messages */
  110. #define SSH2_MSG_CHANNEL_OPEN 90
  111. #define SSH2_MSG_CHANNEL_OPEN_CONFIRMATION 91
  112. #define SSH2_MSG_CHANNEL_OPEN_FAILURE 92
  113. #define SSH2_MSG_CHANNEL_WINDOW_ADJUST 93
  114. #define SSH2_MSG_CHANNEL_DATA 94
  115. #define SSH2_MSG_CHANNEL_EXTENDED_DATA 95
  116. #define SSH2_MSG_CHANNEL_EOF 96
  117. #define SSH2_MSG_CHANNEL_CLOSE 97
  118. #define SSH2_MSG_CHANNEL_REQUEST 98
  119. #define SSH2_MSG_CHANNEL_SUCCESS 99
  120. #define SSH2_MSG_CHANNEL_FAILURE 100
  121. /* disconnect reason code */
  122. #define SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT 1
  123. #define SSH2_DISCONNECT_PROTOCOL_ERROR 2
  124. #define SSH2_DISCONNECT_KEY_EXCHANGE_FAILED 3
  125. #define SSH2_DISCONNECT_HOST_AUTHENTICATION_FAILED 4
  126. #define SSH2_DISCONNECT_RESERVED 4
  127. #define SSH2_DISCONNECT_MAC_ERROR 5
  128. #define SSH2_DISCONNECT_COMPRESSION_ERROR 6
  129. #define SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE 7
  130. #define SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED 8
  131. #define SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE 9
  132. #define SSH2_DISCONNECT_CONNECTION_LOST 10
  133. #define SSH2_DISCONNECT_BY_APPLICATION 11
  134. #define SSH2_DISCONNECT_TOO_MANY_CONNECTIONS 12
  135. #define SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER 13
  136. #define SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE 14
  137. #define SSH2_DISCONNECT_ILLEGAL_USER_NAME 15
  138. /* misc */
  139. #define SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED 1
  140. #define SSH2_OPEN_CONNECT_FAILED 2
  141. #define SSH2_OPEN_UNKNOWN_CHANNEL_TYPE 3
  142. #define SSH2_OPEN_RESOURCE_SHORTAGE 4
  143. #define SSH2_EXTENDED_DATA_STDERR 1
  144. /* Certificate types for OpenSSH certificate keys extension */
  145. #define SSH2_CERT_TYPE_USER 1
  146. #define SSH2_CERT_TYPE_HOST 2