ET System  16.4
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Bridge

These routines are used both to configure a bridge between 2 ET systems and to actually run the bridge. More...

Functions

int et_bridge_config_init (et_bridgeconfig *config)
 This routine initializes a configuration used to establish a bridge between 2 ET systems. More...
 
int et_bridge_config_destroy (et_bridgeconfig sconfig)
 This routine frees the memory allocated when a bridge configuration is initialized by et_bridge_config_init. More...
 
int et_bridge_config_setmodefrom (et_bridgeconfig config, int val)
 This routine sets the mode of getting events from the "from" ET system. More...
 
int et_bridge_config_getmodefrom (et_bridgeconfig config, int *val)
 This routine gets the mode of getting events from the "from" ET system. More...
 
int et_bridge_config_setmodeto (et_bridgeconfig config, int val)
 This routine sets the mode of getting new events from the "to" ET system. More...
 
int et_bridge_config_getmodeto (et_bridgeconfig config, int *val)
 This routine gets the mode of getting new events from the "to" ET system. More...
 
int et_bridge_config_setchunkfrom (et_bridgeconfig config, int val)
 This routine sets the maximum number of events to get from the "from" ET system in a single call to et_events_get - the number of events to get in one chunk. More...
 
int et_bridge_config_getchunkfrom (et_bridgeconfig config, int *val)
 This routine gets the maximum number of events to get from the "from" ET system in a single call to et_events_get - the number of events to get in one chunk. More...
 
int et_bridge_config_setchunkto (et_bridgeconfig config, int val)
 This routine sets the maximum number of new events to get from the "to" ET system in a single call to et_events_new - the number of events to get in one chunk. More...
 
int et_bridge_config_getchunkto (et_bridgeconfig config, int *val)
 This routine gets the maximum number of new events to get from the "to" ET system in a single call to et_events_new - the number of events to get in one chunk. More...
 
int et_bridge_config_settimeoutfrom (et_bridgeconfig config, struct timespec val)
 This routine sets the time to wait for the "from" ET system during all et_events_get calls when the mode is set to ET_TIMED. More...
 
int et_bridge_config_gettimeoutfrom (et_bridgeconfig config, struct timespec *val)
 This routine gets the time to wait for the "from" ET system during all et_events_get calls when the mode is set to ET_TIMED. More...
 
int et_bridge_config_settimeoutto (et_bridgeconfig config, struct timespec val)
 This routine sets the time to wait for the "to" ET system during all et_events_new calls when the mode is set to ET_TIMED. More...
 
int et_bridge_config_gettimeoutto (et_bridgeconfig config, struct timespec *val)
 This routine gets the time to wait for the "to" ET system during all et_events_new calls when the mode is set to ET_TIMED. More...
 
int et_bridge_config_setfunc (et_bridgeconfig config, ET_SWAP_FUNCPTR func)
 This routine sets the function used to automatically swap data from one endian to another when bridging events between two ET systems. More...
 
int et_events_bridge (et_sys_id id_from, et_sys_id id_to, et_att_id att_from, et_att_id att_to, et_bridgeconfig bconfig, int num, int *ntransferred)
 This routine transfers events between two ET systems in which events are copied from the "from" ET system and placed into the "to" ET system. More...
 

Detailed Description

These routines are used both to configure a bridge between 2 ET systems and to actually run the bridge.

Function Documentation

int et_bridge_config_destroy ( et_bridgeconfig  sconfig)

This routine frees the memory allocated when a bridge configuration is initialized by et_bridge_config_init.

Parameters
sconfigbridge configuration.
Returns
ET_OK.

References ET_OK.

Referenced by et_events_bridge().

int et_bridge_config_getchunkfrom ( et_bridgeconfig  config,
int *  val 
)

This routine gets the maximum number of events to get from the "from" ET system in a single call to et_events_get - the number of events to get in one chunk.

Parameters
sconfigbridge configuration.
valint pointer that gets filled with chunk size.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL or config not initialized.

References et_bridge_config_t::chunk_from, ET_ERROR, ET_OK, ET_STRUCT_OK, and et_bridge_config_t::init.

int et_bridge_config_getchunkto ( et_bridgeconfig  config,
int *  val 
)

This routine gets the maximum number of new events to get from the "to" ET system in a single call to et_events_new - the number of events to get in one chunk.

Parameters
sconfigbridge configuration.
valint pointer that gets filled with chunk size.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL or config not initialized.

References et_bridge_config_t::chunk_to, ET_ERROR, ET_OK, ET_STRUCT_OK, and et_bridge_config_t::init.

int et_bridge_config_getmodefrom ( et_bridgeconfig  config,
int *  val 
)

This routine gets the mode of getting events from the "from" ET system.

Parameters
sconfigbridge configuration.
valint pointer that gets filled with either ET_SLEEP, ET_TIMED, or ET_ASYNC.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL or config not initialized.

References ET_ERROR, ET_OK, ET_STRUCT_OK, et_bridge_config_t::init, and et_bridge_config_t::mode_from.

int et_bridge_config_getmodeto ( et_bridgeconfig  config,
int *  val 
)

This routine gets the mode of getting new events from the "to" ET system.

Parameters
sconfigbridge configuration.
valint pointer that gets filled with either ET_SLEEP, ET_TIMED, or ET_ASYNC.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL or config not initialized.

References ET_ERROR, ET_OK, ET_STRUCT_OK, et_bridge_config_t::init, and et_bridge_config_t::mode_to.

int et_bridge_config_gettimeoutfrom ( et_bridgeconfig  config,
struct timespec *  val 
)

This routine gets the time to wait for the "from" ET system during all et_events_get calls when the mode is set to ET_TIMED.

Parameters
sconfigbridge configuration.
valpointer that gets filled with time to wait for events from the "from" ET system.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL or config not initialized.

References ET_ERROR, ET_OK, ET_STRUCT_OK, et_bridge_config_t::init, and et_bridge_config_t::timeout_from.

int et_bridge_config_gettimeoutto ( et_bridgeconfig  config,
struct timespec *  val 
)

This routine gets the time to wait for the "to" ET system during all et_events_new calls when the mode is set to ET_TIMED.

Parameters
sconfigbridge configuration.
valpointer that gets filled with time to wait for new events from the "to" ET system.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL or config not initialized.

References ET_ERROR, ET_OK, ET_STRUCT_OK, et_bridge_config_t::init, and et_bridge_config_t::timeout_to.

int et_bridge_config_init ( et_bridgeconfig config)

This routine initializes a configuration used to establish a bridge between 2 ET systems.

This MUST be done prior to setting any configuration parameters or all setting routines will return an error.

Parameters
configpointer to an bridge configuration variable
Returns
ET_OK if successful.
ET_ERROR if arg is NULL or failure to allocate memory for configuration data storage.

References et_bridge_config_t::chunk_from, et_bridge_config_t::chunk_to, ET_ERROR, ET_OK, ET_SLEEP, ET_STRUCT_OK, et_bridge_config_t::func, et_bridge_config_t::init, et_bridge_config_t::mode_from, et_bridge_config_t::mode_to, et_bridge_config_t::timeout_from, and et_bridge_config_t::timeout_to.

Referenced by et_events_bridge().

int et_bridge_config_setchunkfrom ( et_bridgeconfig  config,
int  val 
)

This routine sets the maximum number of events to get from the "from" ET system in a single call to et_events_get - the number of events to get in one chunk.

Parameters
sconfigbridge configuration.
valchunk size is any int > 0 with default being 100.
Returns
ET_OK if successful.
ET_ERROR if config is NULL or not initialized; if val is < 1.

References et_bridge_config_t::chunk_from, ET_ERROR, ET_OK, and ET_STRUCT_OK.

int et_bridge_config_setchunkto ( et_bridgeconfig  config,
int  val 
)

This routine sets the maximum number of new events to get from the "to" ET system in a single call to et_events_new - the number of events to get in one chunk.

Parameters
sconfigbridge configuration.
valchunk size is any int > 0 with default being 100.
Returns
ET_OK if successful.
ET_ERROR if config is NULL or not initialized; if val is < 1.

References et_bridge_config_t::chunk_to, ET_ERROR, ET_OK, and ET_STRUCT_OK.

int et_bridge_config_setfunc ( et_bridgeconfig  config,
ET_SWAP_FUNCPTR  func 
)

This routine sets the function used to automatically swap data from one endian to another when bridging events between two ET systems.

The function must be of the form: int func(et_event *src, et_event *dest, int bytes, int same_endian) and must return ET_OK if successful, else ET_ERROR. The arguments consists of: src which is a pointer to the event whose data is to be swapped, dest which is a pointer to the event where the swapped data goes, bytes which tells the length of the data in bytes, and same_endian which is a flag equalling one if the machine and the data are of the same endian and zero otherwise. This function must be able to work with src and dest being the same event. With this as a prototype, the user can write a routine which swaps data in the appropriate manner. Notice that the first two arguments are pointers to events and not data buffers. This allows the writer of such a routine to have access to any of the event's header information. In general, such functions should NOT call et_event_setendian in order to change the registered endian value of the data. This is already taken care of in et_events_bridge.

Parameters
sconfigbridge configuration.
valswapping function pointer.
Returns
ET_OK if successful.
ET_ERROR if config is NULL or not initialized.

References ET_ERROR, ET_OK, ET_STRUCT_OK, et_bridge_config_t::func, and et_bridge_config_t::init.

int et_bridge_config_setmodefrom ( et_bridgeconfig  config,
int  val 
)

This routine sets the mode of getting events from the "from" ET system.

Parameters
sconfigbridge configuration.
valis set to either ET_SLEEP, ET_TIMED, or ET_ASYNC and determines the mode of getting events from the "from" ET system. The default is ET_SLEEP.
Returns
ET_OK if successful.
ET_ERROR if config is NULL or not initialized; if val is not ET_SLEEP, ET_TIMED, or ET_ASYNC.

References ET_ASYNC, ET_ERROR, ET_OK, ET_SLEEP, ET_STRUCT_OK, ET_TIMED, et_bridge_config_t::init, and et_bridge_config_t::mode_from.

int et_bridge_config_setmodeto ( et_bridgeconfig  config,
int  val 
)

This routine sets the mode of getting new events from the "to" ET system.

Parameters
sconfigbridge configuration.
valis set to either ET_SLEEP, ET_TIMED, or ET_ASYNC and determines the mode of getting new events from the "to" ET system. The default is ET_SLEEP.
Returns
ET_OK if successful.
ET_ERROR if config is NULL or not initialized; if val is not ET_SLEEP, ET_TIMED, or ET_ASYNC.

References ET_ASYNC, ET_ERROR, ET_OK, ET_SLEEP, ET_STRUCT_OK, ET_TIMED, et_bridge_config_t::init, and et_bridge_config_t::mode_to.

int et_bridge_config_settimeoutfrom ( et_bridgeconfig  config,
struct timespec  val 
)

This routine sets the time to wait for the "from" ET system during all et_events_get calls when the mode is set to ET_TIMED.

Parameters
sconfigbridge configuration.
valtime to wait for events from the "from" ET system (default = 0 sec).
Returns
ET_OK if successful.
ET_ERROR if config is NULL or not initialized.

References ET_ERROR, ET_OK, ET_STRUCT_OK, et_bridge_config_t::init, and et_bridge_config_t::timeout_from.

int et_bridge_config_settimeoutto ( et_bridgeconfig  config,
struct timespec  val 
)

This routine sets the time to wait for the "to" ET system during all et_events_new calls when the mode is set to ET_TIMED.

Parameters
sconfigbridge configuration.
valtime to wait for new events from the "to" ET system (default = 0 sec).
Returns
ET_OK if successful.
ET_ERROR if config is NULL or not initialized.

References ET_ERROR, ET_OK, ET_STRUCT_OK, et_bridge_config_t::init, and et_bridge_config_t::timeout_to.

int et_events_bridge ( et_sys_id  id_from,
et_sys_id  id_to,
et_att_id  att_from,
et_att_id  att_to,
et_bridgeconfig  bconfig,
int  num,
int *  ntransferred 
)

This routine transfers events between two ET systems in which events are copied from the "from" ET system and placed into the "to" ET system.

A function may be provided to swap the data during the transfer. For the best performance, the process calling this routine should be on the same machine as either the "from" or "to" ET systems. Some experimentation is in order to determine which of the two machines will run the bridging faster. The author's experience suggests that placing the process on the machine with the most processors or computing power will probably give the best results.

Parameters
id_fromET system id from which the events are copied.
id_toET system id into which the events are placed.
att_fromattachment to a station on the "from" ET system.
att_toattachment to a station on the "to" ET system (usually GrandCentral).
bconfigconfiguration of the remaining transfer parameters.
numtotal number of events desired to be transferred.
ntransferredint pointer that gets filled with the total number of events that were actually transferred at the routine's return.
Returns
ET_OK if successful.
ET_ERROR if error.
ET_ERROR_REMOTE for a memory allocation error of a remote user.
ET_ERROR_READ for a remote user's network read error.
ET_ERROR_WRITE for a remote user's network write error.
ET_ERROR_DEAD if ET system is dead.
ET_ERROR_WAKEUP if told to stop sleeping while trying to get an event.
ET_ERROR_TIMEOUT if timeout on ET_TIMED option.
ET_ERROR_BUSY if cannot get access to events due to activity of other processes when in ET_ASYNC mode.
ET_ERROR_EMPTY if no events available in ET_ASYNC mode.

References et_id_t::debug, et_bridge_config_destroy(), et_bridge_config_init(), ET_DEBUG_ERROR, ET_ERROR, et_logmsg(), ET_REMOTE, and et_id_t::locality.