external_connection_ctl freerun
API Reference Manual  /  5 Model-to-Simulator Interfaces  / 

external_connection_events

Description
This interface must be implemented by objects communicating with external connection servers.

/* Internal interface implemented by objects communicating
   with external connection servers. */
SIM_INTERFACE(external_connection_events) {
        void (*on_accept)(conf_object_t *NOTNULL obj,
                          conf_object_t *NOTNULL server, uint64 id);
        void (*on_input)(conf_object_t *NOTNULL obj,
                         ext_con_cookie_t *NOTNULL cookie);
        void (*can_write)(conf_object_t *NOTNULL obj,
                          ext_con_cookie_t *NOTNULL cookie);
};
#define EXTERNAL_CONNECTION_EVENTS_INTERFACE "external_connection_events"

The on_accept method is called on every incoming connection, when it is being set up. The server argument is the server object that is handling the connection. The id value identifies this connection in the server object. This value must be passed in the call to accept in the external_connection_ctl interface.

The on_input method is called on the connection identified by cookie when there is some data available to read on it.

The can_write method is called on the connection identified by cookie when some data can be written to it.

Execution Context
Global Context for on_accept, Threaded or Global Context for the others, depending on how notify was called.

external_connection_ctl freerun