ssh_transport.h
Go to the documentation of this file.
1 /**
2  * @file ssh_transport.h
3  * @brief SSH transport layer protocol
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2019-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneSSH Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _SSH_TRANSPORT_H
32 #define _SSH_TRANSPORT_H
33 
34 //Dependencies
35 #include "ssh/ssh.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 //SSH related functions
45 
47  const char_t *serviceName);
48 
50  uint32_t reasonCode, const char_t *description);
51 
53  const uint8_t *packetSeqNum);
54 
55 error_t sshFormatServiceRequest(SshConnection *connection, uint8_t *p,
56  size_t *length);
57 
59  const char_t *serviceName, uint8_t *p, size_t *length);
60 
61 error_t sshFormatDisconnect(SshConnection *connection, uint32_t reasonCode,
62  const char_t *description, uint8_t *p, size_t *length);
63 
65  const uint8_t *packetSeqNum, uint8_t *p, size_t *length);
66 
67 error_t sshParseIdString(SshConnection *connection, const uint8_t *id,
68  size_t length);
69 
70 error_t sshParseServiceRequest(SshConnection *connection, const uint8_t *message,
71  size_t length);
72 
73 error_t sshParseServiceAccept(SshConnection *connection, const uint8_t *message,
74  size_t length);
75 
76 error_t sshParseIgnore(SshConnection *connection, const uint8_t *message,
77  size_t length);
78 
79 error_t sshParseDebug(SshConnection *connection, const uint8_t *message,
80  size_t length);
81 
82 error_t sshParseDisconnect(SshConnection *connection, const uint8_t *message,
83  size_t length);
84 
85 error_t sshParseUnimplemented(SshConnection *connection, const uint8_t *message,
86  size_t length);
87 
88 error_t sshParseUnrecognized(SshConnection *connection, const uint8_t *message,
89  size_t length);
90 
91 //C++ guard
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif
uint8_t message[]
Definition: chap.h:154
char char_t
Definition: compiler_port.h:48
error_t
Error codes.
Definition: error.h:43
uint8_t p
Definition: ndp.h:300
Secure Shell (SSH)
#define SshConnection
Definition: ssh.h:883
error_t sshParseIdString(SshConnection *connection, const uint8_t *id, size_t length)
Parse identification string.
error_t sshSendUnimplemented(SshConnection *connection, const uint8_t *packetSeqNum)
Send SSH_MSG_UNIMPLEMENTED message.
error_t sshParseDisconnect(SshConnection *connection, const uint8_t *message, size_t length)
Parse SSH_MSG_DISCONNECT message.
error_t sshSendIdString(SshConnection *connection)
Send identification string.
Definition: ssh_transport.c:51
error_t sshFormatUnimplemented(SshConnection *connection, const uint8_t *packetSeqNum, uint8_t *p, size_t *length)
Format SSH_MSG_UNIMPLEMENTED message.
error_t sshSendServiceAccept(SshConnection *connection, const char_t *serviceName)
Send SSH_MSG_SERVICE_ACCEPT message.
error_t sshParseServiceAccept(SshConnection *connection, const uint8_t *message, size_t length)
Parse SSH_MSG_SERVICE_ACCEPT message.
error_t sshFormatDisconnect(SshConnection *connection, uint32_t reasonCode, const char_t *description, uint8_t *p, size_t *length)
Format SSH_MSG_DISCONNECT message.
error_t sshParseDebug(SshConnection *connection, const uint8_t *message, size_t length)
Parse SSH_MSG_DEBUG message.
error_t sshFormatServiceAccept(SshConnection *connection, const char_t *serviceName, uint8_t *p, size_t *length)
Format SSH_MSG_SERVICE_ACCEPT message.
error_t sshParseServiceRequest(SshConnection *connection, const uint8_t *message, size_t length)
Parse SSH_MSG_SERVICE_REQUEST message.
error_t sshSendServiceRequest(SshConnection *connection)
Send SSH_MSG_SERVICE_REQUEST message.
error_t sshParseUnrecognized(SshConnection *connection, const uint8_t *message, size_t length)
Parse unrecognized message.
error_t sshParseUnimplemented(SshConnection *connection, const uint8_t *message, size_t length)
Parse SSH_MSG_UNIMPLEMENTED message.
error_t sshParseIgnore(SshConnection *connection, const uint8_t *message, size_t length)
Parse SSH_MSG_IGNORE message.
error_t sshFormatServiceRequest(SshConnection *connection, uint8_t *p, size_t *length)
Format SSH_MSG_SERVICE_REQUEST message.
error_t sshSendDisconnect(SshConnection *connection, uint32_t reasonCode, const char_t *description)
Send SSH_MSG_DISCONNECT message.
uint8_t length
Definition: tcp.h:368
uint8_t description
Definition: tls.h:1855