SSH secure shell server. More...
#include "ssh/ssh.h"
#include "shell/shell_server.h"
#include "shell/shell_server_pty.h"
#include "shell/shell_server_misc.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL SHELL_TRACE_LEVEL |
Functions | |
void | shellServerGetDefaultSettings (ShellServerSettings *settings) |
Initialize settings with default values. More... | |
error_t | shellServerInit (ShellServerContext *context, const ShellServerSettings *settings) |
Initialize shell server context. More... | |
error_t | shellServerStart (ShellServerContext *context) |
Start shell server. More... | |
error_t | shellServerSetBanner (ShellServerSession *session, const char_t *banner) |
Set welcome banner. More... | |
error_t | shellServerSetPrompt (ShellServerSession *session, const char_t *prompt) |
Set shell prompt. More... | |
error_t | shellServerSetTimeout (ShellServerSession *session, systime_t timeout) |
Set timeout for read/write operations. More... | |
error_t | shellServerWriteStream (ShellServerSession *session, const void *data, size_t length, size_t *written, uint_t flags) |
Write to stdout stream. More... | |
error_t | shellServerReadStream (ShellServerSession *session, void *data, size_t size, size_t *received, uint_t flags) |
Read from stdin stream. More... | |
error_t | shellServerSaveHistory (ShellServerSession *session, char_t *history, size_t size, size_t *length) |
Save command history. More... | |
error_t | shellServerRestoreHistory (ShellServerSession *session, const char_t *history, size_t length) |
Restore command history. More... | |
error_t | shellServerClearHistory (ShellServerSession *session) |
Clear command history. More... | |
void | shellServerTask (void *param) |
Shell server task. More... | |
Detailed Description
SSH secure shell server.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2019-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneSSH Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file shell_server.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL SHELL_TRACE_LEVEL |
Definition at line 32 of file shell_server.c.
Function Documentation
◆ shellServerClearHistory()
error_t shellServerClearHistory | ( | ShellServerSession * | session | ) |
Clear command history.
- Parameters
-
[in] session Handle referencing a shell session
- Returns
- Error code
Definition at line 469 of file shell_server.c.
◆ shellServerGetDefaultSettings()
void shellServerGetDefaultSettings | ( | ShellServerSettings * | settings | ) |
Initialize settings with default values.
- Parameters
-
[out] settings Structure that contains shell server settings
Definition at line 50 of file shell_server.c.
◆ shellServerInit()
error_t shellServerInit | ( | ShellServerContext * | context, |
const ShellServerSettings * | settings | ||
) |
Initialize shell server context.
- Parameters
-
[in] context Pointer to the shell server context [in] settings Shell server specific settings
- Returns
- Error code
Definition at line 86 of file shell_server.c.
◆ shellServerReadStream()
error_t shellServerReadStream | ( | ShellServerSession * | session, |
void * | data, | ||
size_t | size, | ||
size_t * | received, | ||
uint_t | flags | ||
) |
Read from stdin stream.
- Parameters
-
[in] session Handle referencing a shell session [out] data Buffer where to store the incoming data [in] size Maximum number of bytes that can be read [out] received Actual number of bytes that have been read [in] flags Set of flags that influences the behavior of this function
- Returns
- Error code
Definition at line 334 of file shell_server.c.
◆ shellServerRestoreHistory()
error_t shellServerRestoreHistory | ( | ShellServerSession * | session, |
const char_t * | history, | ||
size_t | length | ||
) |
Restore command history.
- Parameters
-
[in] session Handle referencing a shell session [in] history Pointer to the buffer that contains the command history [in] length Length of the command history, in bytes
- Returns
- Error code
Definition at line 414 of file shell_server.c.
◆ shellServerSaveHistory()
error_t shellServerSaveHistory | ( | ShellServerSession * | session, |
char_t * | history, | ||
size_t | size, | ||
size_t * | length | ||
) |
Save command history.
- Parameters
-
[in] session Handle referencing a shell session [out] history Output buffer where to store the command history [in] size Size of the buffer, in bytes [out] length Actual length of the command history, in bytes
- Returns
- Error code
Definition at line 365 of file shell_server.c.
◆ shellServerSetBanner()
error_t shellServerSetBanner | ( | ShellServerSession * | session, |
const char_t * | banner | ||
) |
Set welcome banner.
- Parameters
-
[in] session Handle referencing a shell session [in] banner NULL-terminated string containing the banner message
- Returns
- Error code
Definition at line 208 of file shell_server.c.
◆ shellServerSetPrompt()
error_t shellServerSetPrompt | ( | ShellServerSession * | session, |
const char_t * | prompt | ||
) |
Set shell prompt.
- Parameters
-
[in] session Handle referencing a shell session [in] prompt NULL-terminated string containing the prompt to be used
- Returns
- Error code
Definition at line 243 of file shell_server.c.
◆ shellServerSetTimeout()
error_t shellServerSetTimeout | ( | ShellServerSession * | session, |
systime_t | timeout | ||
) |
Set timeout for read/write operations.
- Parameters
-
[in] session Handle referencing a shell session [in] timeout Maximum time to wait
- Returns
- Error code
Definition at line 271 of file shell_server.c.
◆ shellServerStart()
error_t shellServerStart | ( | ShellServerContext * | context | ) |
Start shell server.
- Parameters
-
[in] context Pointer to the shell server context
- Returns
- Error code
Definition at line 157 of file shell_server.c.
◆ shellServerTask()
void shellServerTask | ( | void * | param | ) |
Shell server task.
- Parameters
-
[in] param Pointer to the shell session
Definition at line 494 of file shell_server.c.
◆ shellServerWriteStream()
error_t shellServerWriteStream | ( | ShellServerSession * | session, |
const void * | data, | ||
size_t | length, | ||
size_t * | written, | ||
uint_t | flags | ||
) |
Write to stdout stream.
- Parameters
-
[in] session Handle referencing a shell session [in] data Pointer to a buffer containing the data to be written [in] length Number of data bytes to write [in] written Number of bytes that have been written (optional parameter) [in] flags Set of flags that influences the behavior of this function
- Returns
- Error code
Definition at line 302 of file shell_server.c.