TipcConn


Name

TipcConn — user class for a dummy connection and base class for all other connection classes

Synopsis

TipcConn conn; 
TipcConn conn(connection); 
TipcConn conn(connection, destroy_flag); 

Inheritance

Description

The TipcConn class calls the C API function TipcConnCreate at construction. It manages the resulting T_IPC_CONN object internally.

Caution

None

Derived Classes

TipcConnServer, TipcConnClient

See Also

Tobj; see the TIBCO SmartSockets Application Programming Interface for information on TipcConnCreate

Construction/Destruction

TipcConn::TipcConn

Syntax:
TipcConn(); 
Remarks:
Create a TipcConn object.
 
 
Syntax:
TipcConn(T_IPC_CONN connection,  
         T_BOOL destroy_flag = TRUE); 
Remarks:
Create a TipcConn object with T_IPC_CONN. Optionally set the destroy_flag that controls calling the C API function TipcConnDestroy at object destruction. The destroy_flag parameter defaults to TRUE. This means that TipcConnDestroy is called when the object is destroyed.

Protected Data

TipcConn::_connection

Syntax:
T_IPC_CONN _connection; 
Remarks:
_connection is managed on behalf of derived classes. The setting of _connection is accomplished by the derived class constructor. The class destructor uses _connection when it calls TipcConnDestroy.

TipcConn::_destroy_flag

Syntax:
T_BOOL _destroy_flag; 
Remarks:
_destroy_flag is a flag used by derived classes to control the use of TipcConnDestroy in the class destructor.

TipcConn::_msg_referent

Syntax:
TipcMsg _msg_referent; 
Remarks:
_msg_referent is a holding place for TipcMsg objects returned by reference by member functions of this class.

Type Conversion Operators

TipcConn::operator T_IPC_CONN

Syntax:
operator T_IPC_CONN(); 
Remarks:
Converts a TipcConn to the C API T_IPC_CONN data type.

Member Functions

TipcConn::Arch

Syntax:
virtual T_STR Arch(); 
Remarks:
Get the architecture name of a connection’s peer process.
C API:
TipcConnGetArch

TipcConn::AutoFlushSize

Syntax:
virtual T_INT4 AutoFlushSize(); 
Remarks:
Get the automatic flush size of a connection.
C API:
TipcConnGetAutoFlushSize
 
 
Syntax:
virtual T_BOOL AutoFlushSize(T_INT4 auto_flush_size);
Remarks:
Set the automatic flush size of a connection.
C API:
TipcConnSetAutoFlushSize

TipcConn::BlockMode

Syntax:
virtual T_BOOL BlockMode(); 
Remarks:
Get the block mode of a connection.
C API:
TipcConnGetBlockMode
 
 
Syntax:
virtual T_BOOL BlockMode(T_BOOL block_mode); 
Remarks:
Set the block mode of a connection.
C API:
TipcConnSetBlockMode

TipcConn::Check

Syntax:
virtual T_BOOL Check(T_IO_CHECK_MODE check_mode,  
                     T_REAL8 timeout); 
Remarks:
Check if data can be read from or written to a connection.
C API:
TipcConnCheck

TipcConn::Connection

Syntax:
T_IPC_CONN Connection(); 
Remarks:
Return the C API T_IPC_CONN structure stored in the protected connection.
C API:
None

TipcConn::DecodeCbCreate

Syntax:
virtual T_CB 
DecodeCbCreate(T_IPC_CONN_DECODE_CB_FUNC func,  
               T_CB_ARG arg); 
Remarks:
Create a decode callback in a connection.
C API:
TipcConnDecodeCbCreate

TipcConn::DecodeCbLookup

Syntax:
virtual T_CB 
DecodeCbLookup(T_IPC_CONN_DECODE_CB_FUNC func,  
               T_CB_ARG arg); 
Remarks:
Look up a decode callback in a connection.
C API:
TipcConnDecodeCbLookup

TipcConn::DefaultCbCreate

Syntax:
virtual T_CB  
DefaultCbCreate(T_IPC_CONN_DEFAULT_CB_FUNC func,  
                T_CB_ARG arg); 
Remarks:
Create a default callback in a connection.
C API:
TipcConnDefaultCbCreate

TipcConn::DefaultCbLookup

Syntax:
virtual T_CB  
DefaultCbLookup(T_IPC_CONN_DEFAULT_CB_FUNC func,  
                T_CB_ARG arg); 
Remarks:
Look up a default callback in a connection.
C API:
TipcConnDefaultCbLookup

TipcConn::EncodeCbCreate

Syntax:
virtual T_CB  
EncodeCbCreate(T_IPC_CONN_ENCODE_CB_FUNC func, 
               T_CB_ARG arg); 
Remarks:
Create an encode callback in a connection.
C API:
TipcConnEncodeCbCreate

TipcConn::EncodeCbLookup

Syntax:
virtual T_CB 
EncodeCbLookup(T_IPC_CONN_ENCODE_CB_FUNC func,  
               T_CB_ARG arg); 
Remarks:
Look up an encode callback in a connection.
C API:
TipcConnEncodeCbLookup

TipcConn::Arch

Syntax:
virtual T_STR 		Arch(); 
Remarks:
Get the architecture name of a connection’s peer process.
C API:
TipcConnGetArch

TipcConn::ErrorCbCreate

Syntax:
virtual T_CB ErrorCbCreate(T_IPC_CONN_ERROR_CB_FUNC func, 
                           T_CB_ARG arg); 
Remarks:
Create an error callback in a connection.
C API:
TipcConnErrorCbCreate

TipcConn::ErrorCbLookup

Syntax:
virtual T_CB ErrorCbLookup(T_IPC_CONN_ERROR_CB_FUNC func, 
                           T_CB_ARG arg); 
Remarks:
Look up an error callback in a connection.
C API:
TipcConnErrorCbLookup

TipcConn::Flush

Syntax:
virtual T_BOOL Flush(); 
Remarks:
Flush buffered outgoing messages to connection’s socket.
C API:
TipcConnFlush

TipcConn::GmdFileCreate

Syntax:
virtual T_BOOL GmdFileCreate(); 
Remarks:
Create guaranteed message delivery area on a connection.
C API:
TipcConnGmdFileCreate

TipcConn::GmdFileDelete

Syntax:
virtual T_BOOL GmdFileDelete(); 
Remarks:
Delete guaranteed message delivery files for a connection.
C API:
TipcConnGmdFileDelete

TipcConn::GmdMaxSize

Syntax:
virtual T_UINT4 GmdMaxSize(); 
Remarks:
Get the GMD area maximum size of a connection.
C API:
TipcConnGetGmdMaxSize
 
 
Syntax:
virtual T_BOOL GmdMaxSize(T_UINT4 gmd_max_size); 
Remarks:
Set the GMD area maximum size of a connection.
C API:
TipcConnSetGmdMaxSize 

TipcConn::GmdMsgDelete

Syntax:
virtual T_BOOL GmdMsgDelete(TipcMsg& msg); 
Remarks:
Delete a message from GMD area after a GMD failure on a connection.
C API:
TipcConnGmdMsgDelete

TipcConn::GmdMsgResend

Syntax:
virtual T_BOOL GmdMsgResend(TipcMsg& msg); 
Remarks:
Resend a message after a GMD failure on a connection.
C API:
TipcConnGmdMsgResend

TipcConn::GmdNumPending

Syntax:
virtual T_INT4 GmdNumPending(); 
Remarks:
Get the number of outgoing guaranteed messages pending.
C API:
TipcConnGetGmdNumPending

TipcConn::GmdResend

Syntax:
virtual T_BOOL GmdResend(); 
Remarks:
Resend all guaranteed messages after a delivery failure on a connection.
C API:
TipcConnGmdResend

TipcConn::Insert

Syntax:
virtual T_BOOL Insert(TipcMsg& msg, T_INT4 pos); 
Remarks:
Insert a message into the message queue of a connection.
C API:
TipcConnMsgInsert

TipcConn::KeepAlive

Syntax:
virtual T_BOOL KeepAlive(); 
Remarks:
Check if the process at the other end of a connection is still alive.
C API:
TipcConnKeepAlive

TipcConn::Lock

Syntax:
virtual T_BOOL Lock(); 
Remarks:
Acquire exclusive access to a connection.
C API:
TipcConnLock

TipcConn::MainLoop

Syntax:
virtual T_BOOL MainLoop(T_REAL8 timeout); 
Remarks:
Read and process messages on a connection.
C API:
TipcConnMainLoop

TipcConn::Next

Syntax:
virtual TipcMsg& Next(T_REAL8 timeout); 
Remarks:
Get the next message from a connection.
C API:
TipcConnMsgNext

TipcConn::Node

Syntax:
virtual T_STR Node(); 
Remarks:
Get the node name of a connection’s peer process.
C API:
TipcConnGetNode

TipcConn::NumQueued

Syntax:
virtual T_INT4 NumQueued(); 
Remarks:
Get number of queued messages from a connection.
C API:
TipcConnGetNumQueued

TipcConn::Pid

Syntax:
virtual Pid(); 
Remarks:
Get the process ID of a connection’s peer process.
C API:
TipcConnGetPid

TipcConn::Process

Syntax:
virtual T_BOOL Process(TipcMsg& msg); 
Remarks:
Process a message in a connection.
C API:
TipcConnMsgProcess

TipcConn::ProcessCbCreate

Syntax:
virtual T_CB 
ProcessCbCreate(TipcMt& mt,  
                T_IPC_CONN_PROCESS_CB_FUNC func,  
                T_CB_ARG arg); 
Remarks:
Create a process callback in a connection.
C API:
TipcConnProcessCbCreate

TipcConn::ProcessCbLookup

Syntax:
virtual T_CB 
ProcessCbLookup(TipcMt& mt,  
                T_IPC_CONN_PROCESS_CB_FUNC func, 
                T_CB_ARG arg); 
Remarks:
Look up a process callback in a connection.
C API:
TipcConnProcessCbLookup

TipcConn::QueueCbCreate

Syntax: 
virtual T_CB QueueCbCreate(TipcMt& mt,  
                           T_IPC_CONN_QUEUE_CB_FUNC func,  
                           T_CB_ARG arg); 
Remarks:
Create a queue callback in a connection.
C API:
TipcConnQueueCbCreate

TipcConn::QueueCbLookup

Syntax:
virtual T_CB QueueCbLookup(TipcMt& mt,  
                           T_IPC_CONN_QUEUE_CB_FUNC func, 
                           T_CB_ARG arg); 
Remarks:
Look up a queue callback in a connection.
C API:
TipcConnQueueCbLookup

TipcConn::Read

Syntax:
virtual T_BOOL Read(T_REAL8 timeout); 
Remarks:
Read all available data from a connection and queue messages in priority order.
C API:
TipcConnRead

TipcConn::ReadCbCreate

Syntax:
virtual T_CB  
ReadCbCreate(TipcMt& mt, T_IPC_CONN_READ_CB_FUNC func, 
             T_CB_ARG arg); 
Remarks:
Create a read callback in a connection.
C API:
TipcConnReadCbCreate

TipcConn::ReadCbLookup

Syntax:
virtual T_CB  
ReadCbLookup(TipcMt& mt, T_IPC_CONN_READ_CB_FUNC func, 
             T_CB_ARG arg); 
Remarks:
Look up a read callback in a connection.
C API:
TipcConnReadCbLookup

TipcConn::Search

Syntax:
virtual TipcMsg& 
Search(T_REAL8 timeout, T_IPC_CONN_MSG_SEARCH_FUNC func, 
       T_PTR arg); 
Remarks:
Search the message queue of a connection for a specific message.
C API:
TipcConnMsgSearch

TipcConn::SearchType

Syntax:
virtual TipcMsg&(T_REAL8 timeout, TipcMt& mt); 
Remarks:
Search the message queue of a connection for a message with a specific type.
C API:
TipcConnMsgSearchType

TipcConn::Send

Syntax:
virtual T_BOOL Send(TipcMsg& msg, 
                    T_BOOL check_server_msg_send = FALSE); 
Remarks:
Send a message through a connection. For peer-to-peer connections, the check_server_msg_send flag is ignored. The TipcSrv derived class is the only connection class that uses the check_server_msg_send parameter.
C API:
TipcConnMsgSend

TipcConn::SendRpc

Syntax:
virtual TipcMsg& SendRpc(TipcMsg& msg, T_REAL8 timeout); 
Remarks:
Make a remote procedure call (RPC) with messages on a connection.
C API:
TipcConnMsgSendRpc

TipcConn::Socket

Syntax:
virtual T_INT4 Socket(); 
Remarks:
Get the socket of a connection.
C API:
TipcConnGetSocket

Syntax:
virtual T_BOOL Socket(T_INT4 socket); 
Remarks:
Set the socket of a connection.
C API:
TipcConnSetSocket

TipcConn::Timeout

Syntax:
virtual T_REAL8 Timeout(T_IPC_TIMEOUT timeout); 
Remarks:
Get a timeout property of a connection.
C API:
TipcConnGetTimeout

Syntax:
virtual T_BOOL Timeout(T_IPC_TIMEOUT timeout, T_REAL8 value); 
Remarks:
Set a timeout property of a connection.
C API:
TipcConnSetTimeout

TipcConn::UniqueSubject

Syntax:
virtual T_STR UniqueSubject(); 
Remarks:
Get the unique subject of a connection’s peer process.
C API:
TipcConnGetUniqueSubject

TipcConn::Unlock

Syntax:
virtual T_BOOL Unlock(); 
Remarks:
Release exclusive access to a connection.
C API:
TipcConnUnlock

TipcConn::User

Syntax:
virtual T_STR User(); 
Remarks:
Get the user name of a connection’s peer process.
C API:
TipcConnGetUser

TipcConn::Write

Syntax:
virtual T_BOOL Write(TipcMt& mt, ...); 
Remarks:
Construct a message and send it through a connection.
C API:
TipcConnMsgWrite

TipcConn::WriteCbCreate

Syntax:
virtual T_CB WriteCbCreate(TipcMt& mt,  
                           T_IPC_CONN_WRITE_CB_FUNC func, 
                           T_CB_ARG arg); 
Remarks:
Create a write callback in a connection.
C API:
TipcConnWriteCbCreate

TipcConn::WriteCbLookup

Syntax:
virtual T_CB WriteCbLookup(TipcMt& mt,  
                           T_IPC_CONN_WRITE_CB_FUNC func, 
                           T_CB_ARG arg); 
Remarks:
Look up a write callback in a connection.
C API:
TipcConnWriteCbLookup

TipcConn::WriteVa

Syntax:
virtual T_BOOL WriteVa(TipcMt& mt, va_list var_arg_list); 
Remarks:
Construct a message and send it through a connection.
C API:
TipcConnMsgWriteVa

TipcConn::XtSource

Syntax:
virtual T_INT4 XtSource(); 
Remarks:
Get source suitable for XtAppAddInput from a connection.
C API:
TipcConnGetXtSource

Static Public Member Functions

TipcConn::GmdDir

Syntax:
static T_STR GmdDir(); 
Remarks:
Get name of directory where files are written for guaranteed message delivery.
C API:
TipcGetGmdDir

Example

This code fragment creates a connection, creates process and default callbacks, then reads and processes messages from the message file data.msg:

// Construct a TipcConn 
TipcConn my_conn; 
 
// Create a process callback for TIME messages 
TipcMt mt_time(T_MT_TIME); 
if (!mt_time) { 
  // error 
} 
 
my_conn.ProcessCbCreate(mt_time, process_time, NULL); 
if (!my_conn) { 
  // error 
} 
 
// Create a process callback for NUMERIC_DATA messages  
TipcMt mt_numeric_data(T_MT_NUMERIC_DATA); 
if (!mt_numeric_data) { 
  // error 
} 
 
my_conn.ProcessCbCreate(mt_numeric_data, process_nd, NULL); 
if (!my_conn) { 
  // error 
} 
 
// Create a default callback for all other messages 
my_conn.DefaultCbCreate(process_default, NULL); 
if (!my_conn) { 
  // error 
} 
 
// Create a message file that is open for reading 
TipcMsgFile msg_file("data.msg", T_IPC_MSG_FILE_CREATE_READ); 
if (!msg_file) { 
  // error 
} 
 
// Read and process messages 
 
TipcMsg msg_read; 
while (1) { 
  msg_file >> msg_read; 
  if (!msg_file) { 
    break; 
  }   
  my_conn.Process(msg_read); 
  if (!my_conn) { 
    // error 
  } 
 
  // Explicitly destroy the message. This step could be skipped 
  // since the extraction operator will first destroy any message 
  // that msg_read is managing before assigning a new message to it. 
 
  msg_read.Destroy(); 
} 

TIBCO SmartSockets™ cxxipc Class Library
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com