SharkSshBasIo lets SharkSSH plugins use storage that an application already
exposes through the Barracuda App Server (BAS)
IoIntf
API. It converts an IoIntf object into the generic
SharkSshFileSystem callback table. The production
plugin's public header depends only on SharkSSH.h and
IoIntf.h;
it does not require
BaDiskIo.h,
HTTP/BWS headers, or a platform filesystem header.
Use this plugin only when the application already has an IoIntf. It is
normally compiled in the
BAS/BWS
SoDisp
configuration. The
plugin does not create a disk filesystem: the application constructs a
concrete IoIntf implementation and passes it to the adapter. For example,
the host demonstration constructs BAS
DiskIo,
while an embedded product may
provide a flash, ZIP, or product-specific IoIntf.
The generic filesystem guide documents the callback,
status, handle, concurrency, and namespace-security contracts. This document
covers the BAS-specific adapter and the capabilities exposed by IoIntf.
Compile these files with the application:
src/plugins/BasIo/SharkSshBasIo.c
src/plugins/BasIo/SharkSshBasIo.h
Add the SharkSSH public include directory, the plugin directory, and the BAS
directory containing IoIntf.h to the include path.
#include <SharkSshBasIo.h>
SharkSshBasIo fileSystemAdapter;
SharkSshConfig config;
SharkSshConfig_constructor(&config);
SharkSshBasIo_constructor(&fileSystemAdapter, myIoIntf);
config.fileSystem = SharkSshBasIo_getFileSystem(&fileSystemAdapter);myIoIntf, fileSystemAdapter, and config must outlive every subsystem
operation that can use the filesystem table. The adapter does not take
ownership of myIoIntf.
void SharkSshBasIo_constructor(SharkSshBasIo* adapter, IoIntfPtr io)
: Clears and initializes adapter for io. Passing a NULL adapter has no
effect. A NULL io creates an unusable table whose operations reject
requests.
const SharkSshFileSystem* SharkSshBasIo_getFileSystem(const SharkSshBasIo* adapter)
: Returns the callback table to assign to SharkSshConfig.fileSystem, or
NULL when adapter is NULL.
The SharkSshBasIo structure contains the generated SharkSshFileSystem and
the non-owning IoIntfPtr. Applications should initialize it with the
constructor and should not replace individual callback fields.
- Counted SSH paths are accepted up to
SHARKSSH_MAX_PATH_LENbytes. Embedded NUL bytes and longer paths are rejected. - File and directory handles are the underlying opaque
ResIntfPtrandDirIntfPtrvalues and are closed through their BAS interfaces. - Read end-of-file is reported as a successful read with zero bytes. Directory
end is reported as
SharkSshFsEnd. IoIntfwrite-open semantics always create and truncate. The adapter accepts that mode only when SharkSSH requests both create and truncate. A nontruncating write-open returnsSharkSshFsUnsupportedinstead of silently destroying existing content. Append plus create selects BAS write-open plus append; append without create is unsupported becauseIoIntfmay create the path.IoIntfhas no atomic exclusive-create flag, so exclusive open returnsSharkSshFsUnsupportedinstead of using a racy stat/open sequence.- The generic permissions argument cannot be applied by
IoIntfand is ignored when creating a directory. Returned stat permissions are zero. IoIntfhas no generic attribute-update operation, sosetStatis left unset. An SFTP client receivesSSH_FX_OP_UNSUPPORTEDfor explicit size, timestamp, or permission updates through this adapter.- Returned modification times are clamped to the 32-bit
SharkSshFsStat.modifiedTimerange.
Namespace confinement, .. handling, symlink behavior, and access policy are
properties of the selected IoIntf, its configured root, and the subsystem
that exposes it. Do not expose an unrestricted physical filesystem to an SSH
client.
For the adapter's internal mapping, see the BAS IoIntf adapter design.