Portable interface#

Functions#

void
sl_ftp_delay_ms(const uint32_t delay_ms)

Delay ms.

void
sl_ftp_dump_buff(const uint8_t *const data_ptr, const uint16_t data_size)

Dump buffer.

const char *

FTP get global IP address.

void

FTP Init.

bool

FTP network is connected.

int32_t
sl_ftp_socket_close(int32_t sockid)

FTP Close.

void

FTP wait for network connection.

__STATIC_INLINE void
sl_tftp_delay_ms(const uint32_t delay_ms)

TFTP Delay ms.

__STATIC_INLINE void
sl_tftp_dump_buff(const uint8_t *const data_ptr, const uint16_t data_size)

Define SL_TFTP_DEBUG.

__STATIC_INLINE const char *

TFTP get global IP address.

__STATIC_INLINE bool

TFTP network is connected.

__STATIC_INLINE int32_t
sl_tftp_socket_close(int32_t sockid)

TFTP Close.

void

Free address.

void *
sl_tftp_udp_get_addr(const char *host, uint16_t port)

Get UDP address structure.

int32_t
sl_tftp_udp_recvfrom(int32_t sockid, void *buff, uint32_t len, void *src_addr)

TFTP Receive messages on a UDP socket.

int32_t
sl_tftp_udp_sendto(int32_t sockid, const void *buff, uint32_t len, const void *dest_addr)

TFTP Send a message on a UDP socket.

int32_t

TFTP udp socket create.

__STATIC_INLINE void

TFTP wait for network connection.

Macros#

#define
sl_ftp_debug (format, ...)

FTP debug macro function.

#define
SL_FTP_ERROR SL_FTP_INVALID_SOCKID

FTP error value.

#define
SL_FTP_INVALID_SOCKID (-1)

FTP invalid socket ID.

#define
SL_FTP_LOCAL_HOST_STR "::"

FTP Localhost string.

#define
SL_TFTP_ERROR SL_FTP_ERROR

TFTP error value (alias)

#define
SL_TFTP_INVALID_SOCKID SL_FTP_INVALID_SOCKID

TFTP invalid socket ID (alias)

#define
SL_TFTP_LOCAL_HOST_STR SL_FTP_LOCAL_HOST_STR

TFTP Localhost string (alias)

Function Documentation#

sl_ftp_delay_ms#

void sl_ftp_delay_ms (const uint32_t delay_ms)

Delay ms.

Parameters
TypeDirectionArgument NameDescription
const uint32_tN/Adelay_ms

Milliseconds

Portable function


sl_ftp_dump_buff#

void sl_ftp_dump_buff (const uint8_t *const data_ptr, const uint16_t data_size)

Dump buffer.

Parameters
TypeDirectionArgument NameDescription
const uint8_t *const[in]data_ptr

Data ptr

const uint16_t[in]data_size

Data size

Util function to dump buffer in hex format


sl_ftp_get_global_addr#

const char * sl_ftp_get_global_addr (void )

FTP get global IP address.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Portable function Returns

  • Global address string representation


sl_ftp_init#

void sl_ftp_init (void )

FTP Init.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Initialize FTP service


sl_ftp_is_network_connected#

bool sl_ftp_is_network_connected (void )

FTP network is connected.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Portable function Returns

  • true if network is connected, otherwise false


sl_ftp_socket_close#

int32_t sl_ftp_socket_close (int32_t sockid)

FTP Close.

Parameters
TypeDirectionArgument NameDescription
int32_tN/Asockid

Socket ID

Portable function Returns

  • int32_t Closed socket ID on success, -1 on error


sl_ftp_wait_for_connection#

void sl_ftp_wait_for_connection (void )

FTP wait for network connection.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Portable function


sl_tftp_delay_ms#

__STATIC_INLINE void sl_tftp_delay_ms (const uint32_t delay_ms)

TFTP Delay ms.

Parameters
TypeDirectionArgument NameDescription
const uint32_tN/Adelay_ms

Milliseconds

Alias function


sl_tftp_dump_buff#

__STATIC_INLINE void sl_tftp_dump_buff (const uint8_t *const data_ptr, const uint16_t data_size)

Define SL_TFTP_DEBUG.

Parameters
TypeDirectionArgument NameDescription
const uint8_t *const[in]data_ptr

Data ptr

const uint16_t[in]data_size

Data size

TFTP Dump buffer

Alias function


sl_tftp_get_global_addr#

__STATIC_INLINE const char * sl_tftp_get_global_addr (void )

TFTP get global IP address.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Portable function Returns

  • Global address string representation


sl_tftp_is_network_connected#

__STATIC_INLINE bool sl_tftp_is_network_connected (void )

TFTP network is connected.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Alias function Returns

  • true if network is connected, otherwise false


sl_tftp_socket_close#

__STATIC_INLINE int32_t sl_tftp_socket_close (int32_t sockid)

TFTP Close.

Parameters
TypeDirectionArgument NameDescription
int32_tN/Asockid

Socket ID

Alias function Returns

  • int32_t Closed socket ID on success, -1 on error


sl_tftp_udp_free_addr#

void sl_tftp_udp_free_addr (void * addr)

Free address.

Parameters
TypeDirectionArgument NameDescription
void *[in]addr

Address structure

Release the allocated address structure


sl_tftp_udp_get_addr#

void * sl_tftp_udp_get_addr (const char * host, uint16_t port)

Get UDP address structure.

Parameters
TypeDirectionArgument NameDescription
const char *[in]host

Host string

uint16_t[in]port

Port

Allocate address structure and set host address and port Returns

  • void * Address structure


sl_tftp_udp_recvfrom#

int32_t sl_tftp_udp_recvfrom (int32_t sockid, void * buff, uint32_t len, void * src_addr)

TFTP Receive messages on a UDP socket.

Parameters
TypeDirectionArgument NameDescription
int32_t[in]sockid

socket id

void *[out]buff

destination buffer ptr

uint32_t[in]len

length of data to read

void *[out]src_addr

Source address

Receives data on a socket whether or not it is connection-oriented. Returns

  • return the number of bytes received, or -1 if an error occurred


sl_tftp_udp_sendto#

int32_t sl_tftp_udp_sendto (int32_t sockid, const void * buff, uint32_t len, const void * dest_addr)

TFTP Send a message on a UDP socket.

Parameters
TypeDirectionArgument NameDescription
int32_t[in]sockid

socket ID

const void *[in]buff

buffer pointer to send

uint32_t[in]len

length of data to send

const void *[in]dest_addr

destination address ptr, the structure must be prepared for UDP sockets

Preferred in datagram mode (UDP). Returns

  • On success, these calls return the number of bytes sent. On error, -1 is returned


sl_tftp_udp_socket_create#

int32_t sl_tftp_udp_socket_create (void )

TFTP udp socket create.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Portable function Returns

  • int32_t Socket ID


sl_tftp_wait_for_connection#

__STATIC_INLINE void sl_tftp_wait_for_connection (void )

TFTP wait for network connection.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Alias function