component_connector
is implemented by components
that use connector objects for handling connections between components.
The connection setup is made in two stages, the check stage and the connect stage. The check stage is often not needed, but it can be used to make sure that the later connect step will not fail. Each connection is handled by a connector object. The connector object will both handle the connection in both direction, i.e. sending connect information and receiving connector information. Two components that should be connected must implement one connector object each.
The get_check_data and get_connect_data will
be called from the connector object to get connection data to send
to the other part of the connection, i.e. to the destination. The
data sent must be an attr_value_t
type.
The check, connect, and disconnect functions are called from the connector object when another connector wants to connect to this connection. The connection data is passed as the attr argument.
SIM_INTERFACE(component_connector) { attr_value_t (*get_check_data)(conf_object_t *obj, conf_object_t *NOTNULL connector); attr_value_t (*get_connect_data)(conf_object_t *obj, conf_object_t *NOTNULL connector); bool (*check)(conf_object_t *obj, conf_object_t *NOTNULL connector, attr_value_t attr); void (*connect)(conf_object_t *obj, conf_object_t *NOTNULL connector, attr_value_t attr); void (*disconnect)(conf_object_t *obj, conf_object_t *NOTNULL connector); }; #define COMPONENT_CONNECTOR_INTERFACE "component_connector"