Skip to content

Commit

Permalink
File wrapper functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ejohnstown committed Dec 12, 2023
1 parent 3905a05 commit 187e7f6
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/wolfssh_file.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifdef WOLFSSH_FILE_STREAM

WOLFSSH_FILE* wolfSSH_FILE_open(WOLFSSH_FILE* f)
{
file = fopen();
}
#elif WOLFSSH_FILE_FD

WOLFSSH_FILE* wolfSSH_FILE_open(WOLFSSH_FILE* f)
{
file = open();
}

#endif
57 changes: 57 additions & 0 deletions wolfssh/wolfssh_file.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#ifndef WOLFSSH_WOLFSSH_FILE_H
#define WOLFSSH_WOLFSSH_FILE_H

typedef struct WOLFSSH_FILE WOLFSSH_FILE;
typedef struct WOLFSSH_DIR WOLFSSH_DIR;


/*
1. NO_FILESYSTEM
2. WOLFSSH_NUCLEUS
3. FREESCALE_MQX
4. WOLFSSH_FATFS
5. WOLFSSH_ZEPHYR
*/


WOLFSSH_API WOLFSSH_FILE* wolfSSH_FILE_open(WOLFSSH_FILE* f);
WOLFSSH_API int wolfSSH_FILE_close(WOLFSSH_FILE* f);
WOLFSSH_API int wolfSSH_FILE_read(WOLFSSH_FILE* f);
WOLFSSH_API int wolfSSH_FILE_write(WOLFSSH_FILE* f);
WOLFSSH_API int wolfSSH_FILE_seek(WOLFSSH_FILE* f);
WOLFSSH_API int wolfSSH_FILE_tell(WOLFSSH_FILE* f);
WOLFSSH_API int wolfSSH_FILE_rewind(WOLFSSH_FILE* f);
WOLFSSH_API int wolfSSH_FILE_flush(WOLFSSH_FILE* f);
WOLFSSH_API int wolfSSH_FILE_stat(WOLFSSH_FILE* f);

wolfSSH_FILE_chmod(const char* fn);
#define WSETTIME(fs,f,a,m) (0)
#define WFSETTIME(fs,fd,a,m) (0)

/* From Zephyr */
#define WFGETS(b,s,f) NULL /* Not ported yet */
#define WFPUTS(b,s) EOF /* Not ported yet */
#define WUTIMES(a,b) (0) /* Not ported yet */
#define WCHDIR(fs,b) z_fs_chdir((b))

#define WS_DELIM '\\'
#define WOLFSSH_O_RDWR
#define WOLFSSH_O_RDONLY
#define WOLFSSH_O_WRONLY
#define WOLFSSH_O_APPEND
#define WOLFSSH_O_CREAT
#define WOLFSSH_O_TRUNC
#define WOLFSSH_O_EXCL
#define WOLFSSH_MAX_FILENAME
#define WBADFILE
#define WSEEK_SET 0
#define WSEEK_CUR 1
#define WSEEK_END 2

#if defined(USE_WINDOWS_API)
#elif defined(POSIX)
#else
/* USER DEFINED */
#endif

#endif /* WOLFSSH_WOLFSSH_FILE_H */

0 comments on commit 187e7f6

Please sign in to comment.