TrustCore SDK NanoSSH API reference  version 7.0
sshc_filesys.h
Go to the documentation of this file.
1 /*
2  * sshc_filesys.h
3  *
4  * SFTPC File System Descriptor
5  *
6  * Copyright 2019-2024 DigiCert, Inc. All Rights Reserved.
7  * Proprietary and Confidential Material.
8  *
9  */
29 #ifndef __SSHC_FILESYS_HEADER__
30 #define __SSHC_FILESYS_HEADER__
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #ifdef __ENABLE_MOCANA_SSH_FTP_CLIENT__
37 
38 #ifndef SFTP_MAX_FILENAME_LENGTH
39 #define SFTP_MAX_FILENAME_LENGTH 64
40 #endif
41 
46 typedef struct
47 {
48  ubyte fileName[SFTP_MAX_FILENAME_LENGTH];
49  ubyte4 fileNameLength;
50 
51  ubyte4 readAccessGroup;
52  ubyte4 writeAccessGroup;
53  ubyte4 executeAccessGroup;
54 
55  sbyte4 isReadable;
56  sbyte4 isWriteable;
57 
58  sbyte4 fileSize; /* directories can assign this zero */
59 
60  /* if your file system does not support time, set to a default (date/)time */
61  sbyte4 fileAccessTime; /* file last accessed time */
62  sbyte4 fileCreationTime; /* file creation time */
63  sbyte4 fileModifyTime; /* file modify time */
64 
65  /* added functionality to support directory listings */
66  sbyte4 isDirectory;
67 
69 
70 
71 /*------------------------------------------------------------------*/
72 
73 #define SFTP_OPEN_FILE_READ_BINARY 1
74 #define SFTP_OPEN_FILE_WRITE_BINARY 2
75 
76 #define SSH_FTP_OK 0
77 #define SSH_FTP_EOF 1
78 #define SSH_FTP_NO_SUCH_FILE 2
79 #define SSH_FTP_PERMISSION_DENIED 3
80 #define SSH_FTP_FAILURE 4
81 #define SSH_FTP_BAD_MESSAGE 5
82 #define SSH_FTP_NO_CONNECTION 6
83 #define SSH_FTP_CONNECTION_LOST 7
84 #define SSH_FTP_OP_UNSUPPORTED 8
85 #define SSH_FTP_INVALID_HANDLE 9
86 #define SSH_FTP_NO_SUCH_PATH 10
87 #define SSH_FTP_FILE_ALREADY_EXISTS 11
88 #define SSH_FTP_WRITE_PROTECT 12
89 #define SSH_FTP_NO_MEDIA 13
90 
91 
92 /*------------------------------------------------------------------*/
93 
111 typedef struct
112 {
139  sbyte4 (*funcPtrReadFileUpcall) (sbyte4 connectionInstance, sftpcFileHandleDescr *p_sftpFileHandleDescr);
140 
167  sbyte4 (*funcPtrWriteFileUpcall) (sbyte4 connectionInstance, sftpcFileHandleDescr *p_sftpFileHandleDescr);
168 
195  sbyte4 (*funcPtrCloseFileUpcall) (sbyte4 connectionInstance, sftpcFileHandleDescr *p_sftpFileHandleDescr);
196 
223  sbyte4 (*funcPtrOpenFileClientUpcall) (sbyte4 connectionInstance, sftpcFileHandleDescr *p_sftpFileHandleDescr);
224 
266  void (*funcPtrStatus) (sbyte4 connectionInstance, ubyte4 statusCode, ubyte *message, ubyte4 messageLength, ubyte *pLanguage, ubyte4 languageLength);
267 
269 
270 
271 /*------------------------------------------------------------------*/
272 
273 MOC_EXTERN sftpClientSettings *SSHC_sftpClientSettings(void);
274 
275 #define SFTP_TRUE 1
276 #define SFTP_FALSE 0
277 
278 /*------------------------------------------------------------------*/
279 
287 MOC_EXTERN void SSHC_sftpSetWriteLocation(sftpcFileHandleDescr *p_sftpFileHandleDescr, sbyte4 location);
288 
319 MOC_EXTERN void SSHC_sftpSetWriteBuffer(sftpcFileHandleDescr *p_sftpFileHandleDescr, sbyte *pBuffer);
320 
352 MOC_EXTERN void SSHC_sftpSetWriteBufferSize(sftpcFileHandleDescr *p_sftpFileHandleDescr, sbyte4 bufSize);
360 MOC_EXTERN ubyte4 SSHC_sftpGetMaxWrite(sbyte4 connectionInstance);
361 
362 #endif /* __ENABLE_MOCANA_SSH_FTP_CLIENT__ */
363 
364 #ifdef __cplusplus
365 }
366 #endif
367 
368 #endif /* __SSHC_FILESYS_HEADER__ */
Callback function pointers for NanoSSH Client SFTP operations.
Definition: sshc_filesys.h:111
MOC_EXTERN void SSHC_sftpSetWriteBuffer(sftpcFileHandleDescr *p_sftpFileHandleDescr, sbyte *pBuffer)
Point a write buffer to a chunk of data to be transfered.
NanoSSH Client SFTP file handle descriptor.
Definition: sshc.h:217
MOC_EXTERN void SSHC_sftpSetWriteLocation(sftpcFileHandleDescr *p_sftpFileHandleDescr, sbyte4 location)
Definition: sshc_filesys.h:46
MOC_EXTERN void SSHC_sftpSetWriteBufferSize(sftpcFileHandleDescr *p_sftpFileHandleDescr, sbyte4 bufSize)
Set the size of a write buffer pointing to a chunk of data to be transfered.
MOC_EXTERN ubyte4 SSHC_sftpGetMaxWrite(sbyte4 connectionInstance)