scp_server_misc.h File Reference

Helper functions for SCP server. More...

#include "scp/scp_server.h"
#include "ssh/ssh_request.h"

Go to the source code of this file.

Functions

void scpServerTick (ScpServerContext *context)
 Handle periodic operations. More...
 
error_t scpServerChannelRequestCallback (SshChannel *channel, const SshString *type, const uint8_t *data, size_t length, void *param)
 SSH channel request callback. More...
 
void scpServerParseCommandLine (ScpServerSession *session, const SshExecParams *requestParams)
 SCP command line parsing. More...
 
ScpServerSessionscpServerFindSession (ScpServerContext *context, SshChannel *channel)
 Find the SCP session that matches a given SSH channel. More...
 
ScpServerSessionscpServerOpenSession (ScpServerContext *context, SshChannel *channel)
 Open a new SCP session. More...
 
void scpServerCloseSession (ScpServerSession *session)
 Close an SCP session. More...
 
void scpServerRegisterSessionEvents (ScpServerSession *session, SshChannelEventDesc *eventDesc)
 Register session events. More...
 
void scpServerProcessSessionEvents (ScpServerSession *session)
 Session event handler. More...
 
error_t scpServerSendDirective (ScpServerSession *session, const ScpDirective *directive)
 Send a SCP directive to the client. More...
 
error_t scpServerReceiveDirective (ScpServerSession *session, ScpDirective *directive)
 Receive a SCP directive from the client. More...
 
void scpServerProcessDirective (ScpServerSession *session, const ScpDirective *directive)
 Process SCP directive. More...
 
uint_t scpServerGetFilePermissions (ScpServerSession *session, const char_t *path)
 Get permissions for the specified file or directory. More...
 
error_t scpServerGetPath (ScpServerSession *session, const SshString *path, char_t *fullPath, size_t maxLen)
 Retrieve the full pathname. More...
 
const char_tscpServerStripRootDir (ScpServerSession *session, const char_t *path)
 Strip root dir from specified pathname. More...
 

Detailed Description

Helper functions for SCP 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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file scp_server_misc.h.

Function Documentation

◆ scpServerChannelRequestCallback()

error_t scpServerChannelRequestCallback ( SshChannel channel,
const SshString type,
const uint8_t *  data,
size_t  length,
void *  param 
)

SSH channel request callback.

Parameters
[in]channelHandle referencing an SSH channel
[in]typeRequest type
[in]dataRequest-specific data
[in]lengthLength of the request-specific data, in bytes
[in]paramPointer to the SCP server context
Returns
Error code

Definition at line 69 of file scp_server_misc.c.

◆ scpServerCloseSession()

void scpServerCloseSession ( ScpServerSession session)

Close an SCP session.

Parameters
[in]sessionHandle referencing an SCP session

Definition at line 389 of file scp_server_misc.c.

◆ scpServerFindSession()

ScpServerSession* scpServerFindSession ( ScpServerContext context,
SshChannel channel 
)

Find the SCP session that matches a given SSH channel.

Parameters
[in]contextPointer to the SCP server context
[in]channelHandle referencing an SSH channel
Returns
Pointer to the matching SCP session

Definition at line 308 of file scp_server_misc.c.

◆ scpServerGetFilePermissions()

uint_t scpServerGetFilePermissions ( ScpServerSession session,
const char_t path 
)

Get permissions for the specified file or directory.

Parameters
[in]sessionHandle referencing an SCP session
[in]pathCanonical path of the file
Returns
Access rights for the specified file

Definition at line 1125 of file scp_server_misc.c.

◆ scpServerGetPath()

error_t scpServerGetPath ( ScpServerSession session,
const SshString path,
char_t fullPath,
size_t  maxLen 
)

Retrieve the full pathname.

Parameters
[in]sessionHandle referencing an SCP session
[in]pathRelative or absolute path
[out]fullPathResulting full path
[in]maxLenMaximum acceptable path length
Returns
Error code

Definition at line 1178 of file scp_server_misc.c.

◆ scpServerOpenSession()

ScpServerSession* scpServerOpenSession ( ScpServerContext context,
SshChannel channel 
)

Open a new SCP session.

Parameters
[in]contextPointer to the SCP server context
[in]channelHandle referencing an SSH channel
Returns
Pointer to the newly created SCP session

Definition at line 343 of file scp_server_misc.c.

◆ scpServerParseCommandLine()

void scpServerParseCommandLine ( ScpServerSession session,
const SshExecParams requestParams 
)

SCP command line parsing.

Parameters
[in]sessionHandle referencing an SCP session
[in]requestParamsPointer to the "exec" request parameters

Definition at line 170 of file scp_server_misc.c.

◆ scpServerProcessDirective()

void scpServerProcessDirective ( ScpServerSession session,
const ScpDirective directive 
)

Process SCP directive.

Parameters
[in]sessionHandle referencing an SCP session
[in]directiveSCP directive sent by the client

Definition at line 1008 of file scp_server_misc.c.

◆ scpServerProcessSessionEvents()

void scpServerProcessSessionEvents ( ScpServerSession session)

Session event handler.

Parameters
[in]sessionHandle referencing an SCP session

Definition at line 501 of file scp_server_misc.c.

◆ scpServerReceiveDirective()

error_t scpServerReceiveDirective ( ScpServerSession session,
ScpDirective directive 
)

Receive a SCP directive from the client.

Parameters
[in]sessionHandle referencing an SCP session
[in]directiveSCP directive parameters
Returns
Error code

Definition at line 896 of file scp_server_misc.c.

◆ scpServerRegisterSessionEvents()

void scpServerRegisterSessionEvents ( ScpServerSession session,
SshChannelEventDesc eventDesc 
)

Register session events.

Parameters
[in]sessionHandle referencing an SCP session
[in]eventDescSSH channel events to be registered

Definition at line 429 of file scp_server_misc.c.

◆ scpServerSendDirective()

error_t scpServerSendDirective ( ScpServerSession session,
const ScpDirective directive 
)

Send a SCP directive to the client.

Parameters
[in]sessionHandle referencing an SCP session
[in]directiveSCP directive parameters
Returns
Error code

Definition at line 837 of file scp_server_misc.c.

◆ scpServerStripRootDir()

const char_t* scpServerStripRootDir ( ScpServerSession session,
const char_t path 
)

Strip root dir from specified pathname.

Parameters
[in]sessionHandle referencing an SCP session
[in]pathinput pathname
Returns
Resulting pathname with root dir stripped

Definition at line 1246 of file scp_server_misc.c.

◆ scpServerTick()

void scpServerTick ( ScpServerContext context)

Handle periodic operations.

Parameters
[in]contextPointer to the SCP server context

Definition at line 54 of file scp_server_misc.c.