![]() |
m2mb API docs
37.00.004.1
m2mb API sets documentation
|
Header file for m2mb_ftpc APIs. More...
Go to the source code of this file.
Data Structures | |
| struct | M2MB_FTPC_FILE_TAG |
| struct | M2MB_FTPC_BUFFER_TAG |
| struct | M2MB_FTPC_XFER_TAG |
Macros | |
| #define | MIN_FTPTO 10000 |
| #define | MAX_FTPTO 500000 |
| #define | DEFAULT_FTPTO MIN_FTPTO |
| #define | M2MB_FTPC_PATH_MAX_LEN 1000 /* file or folder path maximum length */ |
Typedefs | |
| typedef HANDLE | M2MB_FTPC_HANDLE |
| typedef struct M2MB_FTPC_FILE_TAG | M2MB_FTPC_FILE_T |
| typedef struct M2MB_FTPC_BUFFER_TAG | M2MB_FTPC_BUFFER_T |
| typedef struct M2MB_FTPC_XFER_TAG | M2MB_FTPC_XFER_T |
| typedef void(* | m2mb_ftpc_ind_callback) (M2MB_FTPC_HANDLE h, M2MB_FTPC_EVT_E ftpc_event, UINT16 resp_size, void *resp_struct, void *userdata) |
Functions | |
| M2MB_RESULT_E | m2mb_ftpc_init (M2MB_FTPC_HANDLE *pHandle, m2mb_ftpc_ind_callback callback, void *userdata) |
| m2mb_ftpc_init initializes FTP service for current client. More... | |
| M2MB_RESULT_E | m2mb_ftpc_deinit (M2MB_FTPC_HANDLE handle) |
| m2mb_ftpc_deinit deinitializes FTP service for current client. More... | |
| M2MB_RESULT_E | m2mb_ftpc_conf (M2MB_FTPC_HANDLE handle, UINT8 argc,...) |
| m2mb_ftpc_conf sets/gets some FTP parameters. More... | |
| M2MB_RESULT_E | m2mb_ftpc_connect (M2MB_FTPC_HANDLE handle, const CHAR *host) |
| m2mb_ftpc_connect sets a connection to a specific FTP server More... | |
| M2MB_RESULT_E | m2mb_ftpc_auth_tls (M2MB_FTPC_HANDLE handle) |
| m2mb_ftpc_auth_tls - establishes FTP-S connection. More... | |
| M2MB_RESULT_E | m2mb_ftpc_send_pbsz_prot_pair (M2MB_FTPC_HANDLE handle) |
| m2mb_ftpc_send_pbsz_prot_pair - establishes FTP-S connection. More... | |
| M2MB_RESULT_E | m2mb_ftpc_login (M2MB_FTPC_HANDLE handle, const CHAR *user, const CHAR *pass) |
| m2mb_ftpc_login log in to remote server More... | |
| M2MB_RESULT_E | m2mb_ftpc_abort (M2MB_FTPC_HANDLE handle) |
| m2mb_ftpc_abort disconnects from remote More... | |
| M2MB_RESULT_E | m2mb_ftpc_quit (M2MB_FTPC_HANDLE handle, M2MB_FTPC_QUIT_CMD_E send_quit) |
| m2mb_ftpc_quit disconnects from remote More... | |
| M2MB_RESULT_E | m2mb_ftpc_size (M2MB_FTPC_HANDLE handle, const CHAR *path, UINT32 *size, M2MB_FTPC_TRANSFER_MODE_E mode) |
| m2mb_ftpc_size retrieves the size of a specific file More... | |
| M2MB_RESULT_E | m2mb_ftpc_mod_date (M2MB_FTPC_HANDLE handle, const CHAR *path, CHAR *dt, INT32 max) |
| m2mb_ftpc_mod_date provides information about last file modification More... | |
| M2MB_RESULT_E | m2mb_ftpc_get (M2MB_FTPC_HANDLE handle, M2MB_FTPC_XFER_T *output, const CHAR *path, M2MB_FTPC_TRANSFER_MODE_E mode) |
| m2mb_ftpc_get retreives a file from remote server. More... | |
| M2MB_RESULT_E | m2mb_ftpc_put (M2MB_FTPC_HANDLE handle, M2MB_FTPC_XFER_T *input, const CHAR *path, M2MB_FTPC_TRANSFER_MODE_E mode) |
| m2mb_ftpc_put - uploads local data to remote server (file is overwritten if it already exists). More... | |
| M2MB_RESULT_E | m2mb_ftpc_append (M2MB_FTPC_HANDLE handle, M2MB_FTPC_XFER_T *input, const CHAR *path, M2MB_FTPC_TRANSFER_MODE_E mode) |
| m2mb_ftpc_append uploads local data to remote server (data is append, if file exists). More... | |
| M2MB_RESULT_E | m2mb_ftpc_cdup (M2MB_FTPC_HANDLE handle) |
| m2mb_ftpc_cdup moves to parent directory More... | |
| M2MB_RESULT_E | m2mb_ftpc_chdir (M2MB_FTPC_HANDLE handle, const CHAR *path) |
| m2mb_ftpc_chdir changes path More... | |
| CHAR * | m2mb_ftpc_last_response (M2MB_FTPC_HANDLE handle) |
| m2mb_ftpc_last_response returns a pointer to the last response received More... | |
| M2MB_RESULT_E | m2mb_ftpc_mkdir (M2MB_FTPC_HANDLE handle, const CHAR *path) |
| m2mb_ftpc_mkdir creates a new directory More... | |
| M2MB_RESULT_E | m2mb_ftpc_nlst (M2MB_FTPC_HANDLE handle, M2MB_FTPC_XFER_T *output, const CHAR *path) |
| m2mb_ftpc_nlst asks the file list More... | |
| M2MB_RESULT_E | m2mb_ftpc_list (M2MB_FTPC_HANDLE handle, M2MB_FTPC_XFER_T *output, const CHAR *path, M2MB_FTPC_TRANSFER_MODE_E mode) |
| m2mb_ftpc_list - downloads a list of file from a given path More... | |
| M2MB_RESULT_E | m2mb_ftpc_pwd (M2MB_FTPC_HANDLE handle, CHAR *path, INT32 max) |
| m2mb_ftpc_pwd gets working directory More... | |
| M2MB_RESULT_E | m2mb_ftpc_pwd_verbose (M2MB_FTPC_HANDLE handle, CHAR *path, INT32 max) |
| m2mb_ftpc_pwd_verbose gets the response from "PWD" command More... | |
| M2MB_RESULT_E | m2mb_ftpc_rename (M2MB_FTPC_HANDLE handle, const CHAR *src, const CHAR *dst) |
| m2mb_ftpc_rename renames a file at remote More... | |
| M2MB_RESULT_E | m2mb_ftpc_rmdir (M2MB_FTPC_HANDLE handle, const CHAR *path) |
| m2mb_ftpc_rmdir removes a directory More... | |
| M2MB_RESULT_E | m2mb_ftpc_dele (M2MB_FTPC_HANDLE handle, const CHAR *path) |
| m2mb_ftpc_dele removes a file More... | |
Header file for m2mb_ftpc APIs.
m2m/m2m_generic/common/m2mb_inc/m2mb_ftpc.h
m2mb_ftpc APIs provide actions and events for FTP client management.
@notes
| #define DEFAULT_FTPTO MIN_FTPTO |
Default FTP timeout.
| #define MAX_FTPTO 500000 |
Maximum FTP timeout in ms.
| #define MIN_FTPTO 10000 |
Minimum FTP timeout in ms.
| M2MB_RESULT_E m2mb_ftpc_abort | ( | M2MB_FTPC_HANDLE | handle | ) |
m2mb_ftpc_abort disconnects from remote
m2mb_ftpc_abort terminates an active FTP data connection.
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
m2mb_ftpc_abort(h);
| M2MB_RESULT_E m2mb_ftpc_append | ( | M2MB_FTPC_HANDLE | handle, |
| M2MB_FTPC_XFER_T * | input, | ||
| const CHAR * | path, | ||
| M2MB_FTPC_TRANSFER_MODE_E | mode | ||
| ) |
m2mb_ftpc_append uploads local data to remote server (data is append, if file exists).
m2mb_ftpc_append - sends a local data specified by *input to remote server and saves it to the file specified by *path (if the file already exists, the new data is appended to it).
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *input | location where the file or data (in a buffer) is located on the module. |
| [in] | *path | full path where the file will be stored on a remote server. |
| [in] | mode | file access mode |
m2mb_ftpc_get(h, "output.ext", "filefromserver.ext", M2MB_FTPC_TRANSFER_BINARY);
| M2MB_RESULT_E m2mb_ftpc_auth_tls | ( | M2MB_FTPC_HANDLE | handle | ) |
m2mb_ftpc_auth_tls - establishes FTP-S connection.
m2mb_ftpc_auth_tls - sends 'AUTH TLS' command to server and establishes an explicit FTP-S connection.
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
m2mb_ftpc_auth_tls( h );
| M2MB_RESULT_E m2mb_ftpc_cdup | ( | M2MB_FTPC_HANDLE | handle | ) |
m2mb_ftpc_cdup moves to parent directory
m2mb_ftpc_cdup moves to parent directory in remote server
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
m2mb_ftpc_cdup(h);
| M2MB_RESULT_E m2mb_ftpc_chdir | ( | M2MB_FTPC_HANDLE | handle, |
| const CHAR * | path | ||
| ) |
m2mb_ftpc_chdir changes path
m2mb_ftpc_chdir changes path in remote server
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *path | new path in remote server |
m2mb_ftpc_chdir(h, "mynew/dir");
| M2MB_RESULT_E m2mb_ftpc_conf | ( | M2MB_FTPC_HANDLE | handle, |
| UINT8 | argc, | ||
| ... | |||
| ) |
m2mb_ftpc_conf sets/gets some FTP parameters.
m2mb_ftpc_conf sets/gets FTP parameters listed in the M2MB_FTPC_ACTION_E enum.
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | determines | the number of parameters that follows |
| [in] | determines | the action (among the ones listed in M2MB_FTPC_ACTION_E), while the parameters that follow depend on the action (see following note for further details) |
Params(in): h(M2MB_FTPC_HANDLE), action(M2MB_FTPC_ACTION_E), format(INT32) Example: set CID to 2 m2mb_ftpc_conf(h, 2, M2MB_FTPC_SET_CID, 2);
Action: M2MB_FTPC_GET_CID Description: get the current CID. Params(in): h(M2MB_FTPC_HANDLE), action(M2MB_FTPC_ACTION_E), format(INT32*)
Example: get current CID value
INT32 cid; m2mb_ftpc_conf(h, 2, M2MB_FTPC_GET_CID, &cid);
| M2MB_RESULT_E m2mb_ftpc_connect | ( | M2MB_FTPC_HANDLE | handle, |
| const CHAR * | host | ||
| ) |
m2mb_ftpc_connect sets a connection to a specific FTP server
m2mb_ftpc_connect performs a FTP connection to the URL specified in host
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *host | FTP url that the FTP client needs to connect to ("ftp.telit.com:21") |
m2mb_ftpc_connect(h, "ftp.telit.com:21");
| M2MB_RESULT_E m2mb_ftpc_deinit | ( | M2MB_FTPC_HANDLE | handle | ) |
m2mb_ftpc_deinit deinitializes FTP service for current client.
m2mb_ftpc_deinit deinitialize FTP service for current client freeing the handle passed as first parameter. Must be called when FTP service is no longer needed, to release the memory resources.
| [in] | handle | FTP service handle that will be deinitialized by the function. |
m2mb_ftpc_deinit(h);
| M2MB_RESULT_E m2mb_ftpc_dele | ( | M2MB_FTPC_HANDLE | handle, |
| const CHAR * | path | ||
| ) |
m2mb_ftpc_dele removes a file
m2mb_ftpc_dele removes a file from remote server
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *path | full path of the removing file |
m2mb_ftpc_dele(h, "currentdir/FileToRemove");
| M2MB_RESULT_E m2mb_ftpc_get | ( | M2MB_FTPC_HANDLE | handle, |
| M2MB_FTPC_XFER_T * | output, | ||
| const CHAR * | path, | ||
| M2MB_FTPC_TRANSFER_MODE_E | mode | ||
| ) |
m2mb_ftpc_get retreives a file from remote server.
m2mb_ftpc_get retreives a file from remote and writes it in a specific output path.
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *output | location where the file or data (in a buffer) will be stored in the module. |
| [in] | *path | full path where the file is in remote server |
| [in] | mode | file access mode |
m2mb_ftpc_get(h, "output.ext", "filefromserver.ext", M2MB_FTPC_TRANSFER_BINARY);
| M2MB_RESULT_E m2mb_ftpc_init | ( | M2MB_FTPC_HANDLE * | pHandle, |
| m2mb_ftpc_ind_callback | callback, | ||
| void * | userdata | ||
| ) |
m2mb_ftpc_init initializes FTP service for current client.
m2mb_ftpc_init initializes FTP service for current client returning the handle that must be passed as first parameter for all FTP actions. Calling the m2mb_ftpc_init is mandatory before using the FTP client service.
| [out] | *pHandle | FTP service handle that will be initialized by the function. The caller must set pHandle=NULL. |
| [in] | callback | callback that will be called if an event or a response happens. |
| [in] | userdata | pointer to generic user data that will be returned as it is in the callback. |
m2mb_ftpc_init(&h, myCallback, myUserdata);
| CHAR* m2mb_ftpc_last_response | ( | M2MB_FTPC_HANDLE | handle | ) |
m2mb_ftpc_last_response returns a pointer to the last response received
m2mb_ftpc_last_response returns a pointer to the last response received from remote server
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
m2mb_ftpc_last_response(h);
| M2MB_RESULT_E m2mb_ftpc_list | ( | M2MB_FTPC_HANDLE | handle, |
| M2MB_FTPC_XFER_T * | output, | ||
| const CHAR * | path, | ||
| M2MB_FTPC_TRANSFER_MODE_E | mode | ||
| ) |
m2mb_ftpc_list - downloads a list of file from a given path
m2mb_ftpc_list retrieves a list of files from the server over a previously established data connection. The server will send only the list of files with all the information available about those files.
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *output | path where the answer will be stored as a file |
| [in] | *path | path where the files are stored in remote server |
| [in] | mode | file access mode |
m2mb_ftpc_nlst(h, "myoutuput/file.txt", "mydir/filesdirectory");
| M2MB_RESULT_E m2mb_ftpc_login | ( | M2MB_FTPC_HANDLE | handle, |
| const CHAR * | user, | ||
| const CHAR * | pass | ||
| ) |
m2mb_ftpc_login log in to remote server
m2mb_ftpc_login log in to remote server using specific user and password
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *user | user name |
| [in] | *pass | password for FTP server |
m2mb_ftpc_login(h, usr, pwd);
| M2MB_RESULT_E m2mb_ftpc_mkdir | ( | M2MB_FTPC_HANDLE | handle, |
| const CHAR * | path | ||
| ) |
m2mb_ftpc_mkdir creates a new directory
m2mb_ftpc_mkdir creates a new directory in remote server
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *path | full path of the new directory |
m2mb_ftpc_mkdir(h, "currentdir/mynewdir");
| M2MB_RESULT_E m2mb_ftpc_mod_date | ( | M2MB_FTPC_HANDLE | handle, |
| const CHAR * | path, | ||
| CHAR * | dt, | ||
| INT32 | max | ||
| ) |
m2mb_ftpc_mod_date provides information about last file modification
m2mb_ftpc_mod_date provides information about last file modification
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *path | full path of a file in the FTP server |
| [out] | *dt | string where information will be stored |
| [in] | max | maximum size allowed of dt |
m2mb_ftpc_mod_date(h, "dir/file.est", output, sizeof(output));
| M2MB_RESULT_E m2mb_ftpc_nlst | ( | M2MB_FTPC_HANDLE | handle, |
| M2MB_FTPC_XFER_T * | output, | ||
| const CHAR * | path | ||
| ) |
m2mb_ftpc_nlst asks the file list
m2mb_ftpc_nlst retrieves a list of files from the server over a previously established data connection. The server will send only the list of files and no other information on those files.
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *output | path where the answer will be stored as a file |
| [in] | *path | path where the files are stored in remote server |
m2mb_ftpc_nlst(h, "myoutuput/file.txt", "mydir/filesdirectory");
| M2MB_RESULT_E m2mb_ftpc_put | ( | M2MB_FTPC_HANDLE | handle, |
| M2MB_FTPC_XFER_T * | input, | ||
| const CHAR * | path, | ||
| M2MB_FTPC_TRANSFER_MODE_E | mode | ||
| ) |
m2mb_ftpc_put - uploads local data to remote server (file is overwritten if it already exists).
m2mb_ftpc_put - sends a local data specified by *input to remote server and saves it to the file specified by *path (if the file already exists, it is overwritten).
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *input | location where the file or data (in a buffer) is located on the module. |
| [in] | *path | full path where the file will be stored in remote server |
| [in] | mode | file access mode |
m2mb_ftpc_get(h, "output.ext", "filefromserver.ext", M2MB_FTPC_TRANSFER_BINARY);
| M2MB_RESULT_E m2mb_ftpc_pwd | ( | M2MB_FTPC_HANDLE | handle, |
| CHAR * | path, | ||
| INT32 | max | ||
| ) |
m2mb_ftpc_pwd gets working directory
m2mb_ftpc_pwd gets working directory at remote
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [out] | *path | pointer to an array where the server answer will be stored |
| [in] | max | array size |
m2mb_ftpc_pwd(h, array, sizeof(array));
| M2MB_RESULT_E m2mb_ftpc_pwd_verbose | ( | M2MB_FTPC_HANDLE | handle, |
| CHAR * | path, | ||
| INT32 | max | ||
| ) |
m2mb_ftpc_pwd_verbose gets the response from "PWD" command
m2mb_ftpc_pwd_verbose gets the working directory. It prints the whole response from "PWD" command.
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [out] | *path | pointer to an array where the server answer will be stored |
| [in] | max | array size |
m2mb_ftpc_pwd(h, array, sizeof(array));
| M2MB_RESULT_E m2mb_ftpc_quit | ( | M2MB_FTPC_HANDLE | handle, |
| M2MB_FTPC_QUIT_CMD_E | send_quit | ||
| ) |
m2mb_ftpc_quit disconnects from remote
m2mb_ftpc_quit disconnects from remote server. It performs the opposite action of m2mb_ftpc_connect
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | send_quit | enum to select if QUIT command is sent to server or skipped. |
m2mb_ftpc_quit(h, send_quit);
| M2MB_RESULT_E m2mb_ftpc_rename | ( | M2MB_FTPC_HANDLE | handle, |
| const CHAR * | src, | ||
| const CHAR * | dst | ||
| ) |
m2mb_ftpc_rename renames a file at remote
2mb_ftpc_rename renames a file at remote
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *src | file name that the user wants to change |
| [in] | *dst | new file name |
m2mb_ftpc_rename(h, "currentdir/oldName.txt", "currentdir/newName.txt");
| M2MB_RESULT_E m2mb_ftpc_rmdir | ( | M2MB_FTPC_HANDLE | handle, |
| const CHAR * | path | ||
| ) |
m2mb_ftpc_rmdir removes a directory
m2mb_ftpc_rmdir removes a directory in remote server
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *path | full path of the removing directory |
m2mb_ftpc_rmdir(h, "currentdir/directoryToRemove");
| M2MB_RESULT_E m2mb_ftpc_send_pbsz_prot_pair | ( | M2MB_FTPC_HANDLE | handle | ) |
m2mb_ftpc_send_pbsz_prot_pair - establishes FTP-S connection.
m2mb_ftpc_send_pbsz_prot_pair - sends 'AUTH TLS' command to server and establishes an explicit FTP-S connection.
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
m2mb_ftpc_send_pbsz_prot_pair( h );
| M2MB_RESULT_E m2mb_ftpc_size | ( | M2MB_FTPC_HANDLE | handle, |
| const CHAR * | path, | ||
| UINT32 * | size, | ||
| M2MB_FTPC_TRANSFER_MODE_E | mode | ||
| ) |
m2mb_ftpc_size retrieves the size of a specific file
m2mb_ftpc_size retrieves the size of a specific file specified in path
| [in] | handle | FTP service handle, previously initialized by the m2mb_ftpc_init function. |
| [in] | *path | full path of a file in the FTP server |
| [out] | *size | pointer of the result |
| [in] | mode | file access mode |
m2mb_ftpc_size(h, "dir/file.est", &size, M2MB_FTPC_TRANSFER_BINARY);