metalssh 0.0.1

Experimental SSH implementation
//! IANA assigned numbers and constants.

/// SSH message codes.
///
/// The Message Number is a byte value that describes the payload of a packet.
/// [More info here][moreinfo].
///
/// ### Table of message code ranges
///
/// Not all message codes are unique (though most are). Specifically, the
/// "method specific" ranges duplicate message codes across different method
/// types in the same range. For example, `SSH_MSG_KEXDH_INIT` and
/// `SSH_MSG_KEX_ECDH_INIT` share the same number (30).
///
/// | Range     | Layer      | Purpose                      |
/// |-----------|------------|------------------------------|
/// | 0         | Reserved   | Unused                       |
/// | 1 - 19    | Transport  | Transport generic            |
/// | 20 - 29   | Transport  | Algorithm negotiation        |
/// | 30 - 49   | Transport  | Key exchange method specific |
/// | 50 - 59   | Userauth   | Userauth generic             |
/// | 60 - 79   | Userauth   | Userauth method specific     |
/// | 80 - 89   | Connection | Connection generic           |
/// | 90 - 127  | Connection | Channel related              |
/// | 128 - 191 | Reserved   | Client protocols             |
/// | 192 - 255 | Reserved   | Private use                  |
///
/// ### RFCs and other assignment docs
///
/// - [RFC 4250][rfc4250]: Initial message ranges
/// - [RFC 4252][rfc4252]: Connection layer
/// - [RFC 4419][rfc4419]: Diffie-Hellman group exchange
/// - [RFC 5656][rfc5656]: Elliptic curve Diffie-Hellman
///
/// [moreinfo]: https://datatracker.ietf.org/doc/html/rfc4250#autoid-8
/// [rfc4250]: https://datatracker.ietf.org/doc/html/rfc4250
/// [rfc4252]: https://datatracker.ietf.org/doc/html/rfc4252
/// [rfc4419]: https://datatracker.ietf.org/doc/html/rfc4419#autoid-7
/// [rfc5656]: https://datatracker.ietf.org/doc/html/rfc5656#autoid-15
#[rustfmt::skip]
pub mod msg {
    // 1-19: Transport generic

    pub const SSH_MSG_DISCONNECT: u8      = 1;
    pub const SSH_MSG_IGNORE: u8          = 2;
    pub const SSH_MSG_UNIMPLEMENTED: u8   = 3;
    pub const SSH_MSG_DEBUG: u8           = 4;
    pub const SSH_MSG_SERVICE_REQUEST: u8 = 5;
    pub const SSH_MSG_SERVICE_ACCEPT: u8  = 6;
    pub const SSH_MSG_EXT_INFO: u8        = 7;
    pub const SSH_MSG_NEWCOMPRESS: u8     = 8;

    // 20-29: Algorithm negotiation

    pub const SSH_MSG_KEXINIT: u8 = 20;
    pub const SSH_MSG_NEWKEYS: u8 = 21;

    // 30-49: Key exchange method specific

    // DH
    pub const SSH_MSG_KEXDH_INIT: u8  = 30;
    pub const SSH_MSG_KEXDH_REPLY: u8 = 31;

    // DH GEX
    pub const SSH_MSG_KEX_DH_GEX_REQUEST_OLD: u8 = 30;
    pub const SSH_MSG_KEX_DH_GEX_GROUP: u8       = 31;
    pub const SSH_MSG_KEX_DH_GEX_INIT: u8        = 32;
    pub const SSH_MSG_KEX_DH_GEX_REPLY: u8       = 33;
    pub const SSH_MSG_KEX_DH_GEX_REQUEST: u8     = 34;

    // ECDH
    pub const SSH_MSG_KEX_ECDH_INIT: u8  = 30;
    pub const SSH_MSG_KEX_ECDH_REPLY: u8 = 31;

    // ECMQV
    pub const SSH_MSG_ECMQV_INIT: u8  = 30;
    pub const SSH_MSG_ECMQV_REPLY: u8 = 31;

    // PQ/T
    pub const SSH_MSG_KEX_HYBRID_INIT: u8 = 30;
    pub const SSH_MSG_KEX_HYBRID_REPLY: u8 = 31;

    // 50-59: Userauth generic

    pub const SSH_MSG_USERAUTH_REQUEST: u8 = 50;
    pub const SSH_MSG_USERAUTH_FAILURE: u8 = 51;
    pub const SSH_MSG_USERAUTH_SUCCESS: u8 = 52;
    pub const SSH_MSG_USERAUTH_BANNER: u8  = 53;

    // 60-79: Userauth method specific

    // Info
    pub const SSH_MSG_USERAUTH_INFO_REQUEST: u8  = 60;
    pub const SSH_MSG_USERAUTH_INFO_RESPONSE: u8 = 61;

    // Public key
    pub const SSH_MSG_USERAUTH_PK_OK: u8 = 60;

    // Password
    pub const SSH_MSG_USERAUTH_PASSWD_CHANGEREQ: u8 = 60;

    // 80-89: Connection generic

    pub const SSH_MSG_GLOBAL_REQUEST: u8  = 80;
    pub const SSH_MSG_REQUEST_SUCCESS: u8 = 81;
    pub const SSH_MSG_REQUEST_FAILURE: u8 = 82;

    // 90-127: Channel related

    pub const SSH_MSG_CHANNEL_OPEN: u8              = 90;
    pub const SSH_MSG_CHANNEL_OPEN_CONFIRMATION: u8 = 91;
    pub const SSH_MSG_CHANNEL_OPEN_FAILURE: u8      = 92;
    pub const SSH_MSG_CHANNEL_WINDOW_ADJUST: u8     = 93;
    pub const SSH_MSG_CHANNEL_DATA: u8              = 94;
    pub const SSH_MSG_CHANNEL_EXTENDED_DATA: u8     = 95;
    pub const SSH_MSG_CHANNEL_EOF: u8               = 96;
    pub const SSH_MSG_CHANNEL_CLOSE: u8             = 97;
    pub const SSH_MSG_CHANNEL_REQUEST: u8           = 98;
    pub const SSH_MSG_CHANNEL_SUCCESS: u8           = 99;
    pub const SSH_MSG_CHANNEL_FAILURE: u8           = 100;

    // 128-191: Client protocols

    // 192-255: Private use
}