Morse Micro IoT SDK  2.11.2
Module socket: Socket IO, supports secure connections using

Detailed Description

TLS.

Data Structures

struct  mmagic_core_socket_connect_cmd_args
 Command arguments structure for socket_connect. More...
 
struct  mmagic_core_socket_connect_rsp_args
 Response arguments structure for socket_connect. More...
 
struct  mmagic_core_socket_bind_cmd_args
 Command arguments structure for socket_bind. More...
 
struct  mmagic_core_socket_bind_rsp_args
 Response arguments structure for socket_bind. More...
 
struct  mmagic_core_socket_recv_cmd_args
 Command arguments structure for socket_recv. More...
 
struct  mmagic_core_socket_recv_rsp_args
 Response arguments structure for socket_recv. More...
 
struct  mmagic_core_socket_send_cmd_args
 Command arguments structure for socket_send. More...
 
struct  mmagic_core_socket_read_poll_cmd_args
 Command arguments structure for socket_read_poll. More...
 
struct  mmagic_core_socket_write_poll_cmd_args
 Command arguments structure for socket_write_poll. More...
 
struct  mmagic_core_socket_accept_cmd_args
 Command arguments structure for socket_accept. More...
 
struct  mmagic_core_socket_accept_rsp_args
 Response arguments structure for socket_accept. More...
 
struct  mmagic_core_socket_close_cmd_args
 Command arguments structure for socket_close. More...
 
struct  mmagic_core_socket_set_rx_ready_evt_enabled_cmd_args
 Command arguments structure for socket_set_rx_ready_evt_enabled. More...
 
struct  mmagic_socket_rx_ready_event_args
 Event arguments structure for socket_rx_ready. More...
 

Typedefs

typedef void(* mmagic_socket_rx_ready_event_handler_t) (const struct mmagic_socket_rx_ready_event_args *event_args, void *arg)
 Handler for the socket-rx_ready event. More...
 

Functions

static enum mmagic_status mmagic_controller_socket_connect (struct mmagic_controller *controller, struct mmagic_core_socket_connect_cmd_args *cmd_args, struct mmagic_core_socket_connect_rsp_args *rsp_args)
 Opens a client socket and returns its stream ID. More...
 
static enum mmagic_status mmagic_controller_socket_bind (struct mmagic_controller *controller, struct mmagic_core_socket_bind_cmd_args *cmd_args, struct mmagic_core_socket_bind_rsp_args *rsp_args)
 Opens a server socket and returns its stream ID. More...
 
static enum mmagic_status mmagic_controller_socket_recv (struct mmagic_controller *controller, struct mmagic_core_socket_recv_cmd_args *cmd_args, struct mmagic_core_socket_recv_rsp_args *rsp_args)
 Reads from a socket. More...
 
static enum mmagic_status mmagic_controller_socket_send (struct mmagic_controller *controller, struct mmagic_core_socket_send_cmd_args *cmd_args)
 Writes to a socket. More...
 
static enum mmagic_status mmagic_controller_socket_read_poll (struct mmagic_controller *controller, struct mmagic_core_socket_read_poll_cmd_args *cmd_args)
 Polls the socket till it is ready for reading. More...
 
static enum mmagic_status mmagic_controller_socket_write_poll (struct mmagic_controller *controller, struct mmagic_core_socket_write_poll_cmd_args *cmd_args)
 Polls the socket till it is ready for writing. More...
 
static enum mmagic_status mmagic_controller_socket_accept (struct mmagic_controller *controller, struct mmagic_core_socket_accept_cmd_args *cmd_args, struct mmagic_core_socket_accept_rsp_args *rsp_args)
 Waits for an incoming socket connection and returns a new stream ID. More...
 
static enum mmagic_status mmagic_controller_socket_close (struct mmagic_controller *controller, struct mmagic_core_socket_close_cmd_args *cmd_args)
 Closes and frees the socket. More...
 
static enum mmagic_status mmagic_controller_socket_set_rx_ready_evt_enabled (struct mmagic_controller *controller, struct mmagic_core_socket_set_rx_ready_evt_enabled_cmd_args *cmd_args)
 Sets whether the RX ready event should be enabled for the given socket. More...
 
void mmagic_controller_register_socket_rx_ready_handler (struct mmagic_controller *controller, mmagic_socket_rx_ready_event_handler_t handler, void *arg)
 Register a handler for the socket-rx_ready event. More...
 

Typedef Documentation

◆ mmagic_socket_rx_ready_event_handler_t

typedef void(* mmagic_socket_rx_ready_event_handler_t) (const struct mmagic_socket_rx_ready_event_args *event_args, void *arg)

Handler for the socket-rx_ready event.

If enabled, this event is triggered when data becomes ready for receive.

Note
This function will be invoked in the context of the controller data link thread and should perform minimal processing.
Warning
This function must not invoke any mmagic API functions.
Parameters
event_argsNotification arguments received from the agent.
argOpaque argument that was provided when the callback was registered.

Definition at line 6007 of file mmagic_controller.h.

Function Documentation

◆ mmagic_controller_register_socket_rx_ready_handler()

void mmagic_controller_register_socket_rx_ready_handler ( struct mmagic_controller *  controller,
mmagic_socket_rx_ready_event_handler_t  handler,
void *  arg 
)

Register a handler for the socket-rx_ready event.

If enabled, this event is triggered when data becomes ready for receive.

Note
The handler callbacks will be invoked in the context of the controller data link thread. The handler should perform minimal processing.
Warning
The handler callback must not invoke any mmagic API functions.
Parameters
controllerReference to the the controller handle.
handlerThe handler function to register.
argOpaque argument to be passed to the handler when it is invoked.

◆ mmagic_controller_socket_accept()

static enum mmagic_status mmagic_controller_socket_accept ( struct mmagic_controller *  controller,
struct mmagic_core_socket_accept_cmd_args cmd_args,
struct mmagic_core_socket_accept_rsp_args rsp_args 
)
inlinestatic

Waits for an incoming socket connection and returns a new stream ID.

Parameters
controllerReference to the controller handle.
[in]cmd_argsCommand arguments
[out]rsp_argsPointer to the data structure to be filled out with the result. If the return code is not MMAGIC_STATUS_OK then the contents of this structure will be undefined.
Returns
MMAGIC_STATUS_OK else an appropriate error code.

Definition at line 5863 of file mmagic_controller.h.

◆ mmagic_controller_socket_bind()

static enum mmagic_status mmagic_controller_socket_bind ( struct mmagic_controller *  controller,
struct mmagic_core_socket_bind_cmd_args cmd_args,
struct mmagic_core_socket_bind_rsp_args rsp_args 
)
inlinestatic

Opens a server socket and returns its stream ID.

Parameters
controllerReference to the controller handle.
[in]cmd_argsCommand arguments
[out]rsp_argsPointer to the data structure to be filled out with the result. If the return code is not MMAGIC_STATUS_OK then the contents of this structure will be undefined.
Returns
MMAGIC_STATUS_OK else an appropriate error code.

Definition at line 5576 of file mmagic_controller.h.

◆ mmagic_controller_socket_close()

static enum mmagic_status mmagic_controller_socket_close ( struct mmagic_controller *  controller,
struct mmagic_core_socket_close_cmd_args cmd_args 
)
inlinestatic

Closes and frees the socket.

Parameters
controllerReference to the controller handle.
[in]cmd_argsCommand arguments
Returns
MMAGIC_STATUS_OK else an appropriate error code.

Definition at line 5909 of file mmagic_controller.h.

◆ mmagic_controller_socket_connect()

static enum mmagic_status mmagic_controller_socket_connect ( struct mmagic_controller *  controller,
struct mmagic_core_socket_connect_cmd_args cmd_args,
struct mmagic_core_socket_connect_rsp_args rsp_args 
)
inlinestatic

Opens a client socket and returns its stream ID.

Parameters
controllerReference to the controller handle.
[in]cmd_argsCommand arguments
[out]rsp_argsPointer to the data structure to be filled out with the result. If the return code is not MMAGIC_STATUS_OK then the contents of this structure will be undefined.
Returns
MMAGIC_STATUS_OK else an appropriate error code.

Definition at line 5518 of file mmagic_controller.h.

◆ mmagic_controller_socket_read_poll()

static enum mmagic_status mmagic_controller_socket_read_poll ( struct mmagic_controller *  controller,
struct mmagic_core_socket_read_poll_cmd_args cmd_args 
)
inlinestatic

Polls the socket till it is ready for reading.

Parameters
controllerReference to the controller handle.
[in]cmd_argsCommand arguments
Returns
MMAGIC_STATUS_OK else an appropriate error code.

Definition at line 5741 of file mmagic_controller.h.

◆ mmagic_controller_socket_recv()

static enum mmagic_status mmagic_controller_socket_recv ( struct mmagic_controller *  controller,
struct mmagic_core_socket_recv_cmd_args cmd_args,
struct mmagic_core_socket_recv_rsp_args rsp_args 
)
inlinestatic

Reads from a socket.

Parameters
controllerReference to the controller handle.
[in]cmd_argsCommand arguments
[out]rsp_argsPointer to the data structure to be filled out with the result. If the return code is not MMAGIC_STATUS_OK then the contents of this structure will be undefined.
Returns
MMAGIC_STATUS_OK else an appropriate error code.

Definition at line 5636 of file mmagic_controller.h.

◆ mmagic_controller_socket_send()

static enum mmagic_status mmagic_controller_socket_send ( struct mmagic_controller *  controller,
struct mmagic_core_socket_send_cmd_args cmd_args 
)
inlinestatic

Writes to a socket.

Parameters
controllerReference to the controller handle.
[in]cmd_argsCommand arguments
Returns
MMAGIC_STATUS_OK else an appropriate error code.

Definition at line 5694 of file mmagic_controller.h.

◆ mmagic_controller_socket_set_rx_ready_evt_enabled()

static enum mmagic_status mmagic_controller_socket_set_rx_ready_evt_enabled ( struct mmagic_controller *  controller,
struct mmagic_core_socket_set_rx_ready_evt_enabled_cmd_args cmd_args 
)
inlinestatic

Sets whether the RX ready event should be enabled for the given socket.

Note that the RX ready event is currently only supported for TCP sockets and that behavior with TLS sockets undefined.

Parameters
controllerReference to the controller handle.
[in]cmd_argsCommand arguments
Returns
MMAGIC_STATUS_OK else an appropriate error code.

Definition at line 5957 of file mmagic_controller.h.

◆ mmagic_controller_socket_write_poll()

static enum mmagic_status mmagic_controller_socket_write_poll ( struct mmagic_controller *  controller,
struct mmagic_core_socket_write_poll_cmd_args cmd_args 
)
inlinestatic

Polls the socket till it is ready for writing.

Parameters
controllerReference to the controller handle.
[in]cmd_argsCommand arguments
Returns
MMAGIC_STATUS_OK else an appropriate error code.

Definition at line 5798 of file mmagic_controller.h.