cniIsTerminalAttached

Checks whether a terminal is attached to another node by a connector. It returns an integer value that specifies whether the specified terminal object is attached to one or more terminals on other message flow nodes. You can use it to test whether a message can be propagated to a terminal. However, it is not necessary to call this function before propagating a message with the cniPropagate utility function. Using the cniIsTerminalAttached function, a node can modify its behavior when a terminal is not connected.

Syntax

int cniIsTerminalAttached(
  int*          returnCode,
  CciTerminal*  terminalObject);

Parameters

returnCode
The return code from the function (output).
Possible return codes are:
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_TERMINAL_OBJECT
terminalObject
The address of the input or output terminal to be checked for an attached connector (input). The address is returned from cniCreateOutputTerminal.

Return values

  • If the terminal is attached to another node by a connector, a value of 1 is returned.
  • If the terminal is not attached, or a failure occurred, a value of zero is returned.
  • If a failure occurred, the value of the returnCode parameter indicates the reason for the error.

Example

  if (terminalObject) {
    if (cniIsTerminalAttached(&rc, terminalObject)) {
      if (rc == CCI_SUCCESS) {
        retvalue = cniPropagate(
                                &rc, 
                                terminalObject, 
                                destinationList, 
                                exceptionList, 
                                message);