#include <TransportMsg.hh>
Public Types | |
| enum | openflags { o_none, o_client = 1, o_async = 2 } |
Public Member Functions | |
| TransportMsg (void) | |
| ~TransportMsg (void) | |
| MsgAddr | getAddr (void) const |
| MsgAddr | getReplyAddr (void) const |
| bool | isConnected (void) const |
| bool | isOpen (void) const |
| index_type | getDebug (void) const |
| error_type | open (long flags, const MsgAddr *addr=0) |
| void | close (void) |
| error_type | connect (const MsgAddr &addr) |
| error_type | disconnect (void) |
| error_type | receive (MsgHeader &from, char *b, size_type maxlen, wtime_type timeout=-1.0) |
| error_type | receive (MsgHeader &from, Message &msg, wtime_type timeout=-1.0) |
| error_type | receive (Buffer **Data, wtime_type timeout=-1.0) |
| error_type | send (const MsgHeader &to, const char *b) |
| error_type | send (const MsgHeader &to, const Message &b) |
| error_type | waitMsg (wtime_type Timeout) const |
| void | Purge (void) |
| void | setSocketPool (SocketPool *pool) |
| void | setBufferPool (BufferPool *pool) |
| void | setDebug (index_type level) |
| set the debug level | |
| void | setReplyAddr (const MsgAddr &ad) |
| Set reply address. | |
Static Public Member Functions | |
| static error_type | waitAny (wtime_type Timeout, int N, const TransportMsg *list[]) |
Option codes for open operation.
| lmsg::TransportMsg::TransportMsg | ( | void | ) |
Construct a message transporter. brief TransportMsg constructor.
| lmsg::TransportMsg::~TransportMsg | ( | void | ) |
Close any open socket and destroy the message transporter. brief TransportMsg destructor.
| MsgAddr lmsg::TransportMsg::getAddr | ( | void | ) | const |
Get the address of the current socket. brief Get address.
| lmsg::MsgAddr lmsg::TransportMsg::getReplyAddr | ( | void | ) | const [inline] |
Get the reply address.
| bool lmsg::TransportMsg::isConnected | ( | void | ) | const |
Test whether transport is connected to a peer port. brief Test for connected socket.
| bool lmsg::TransportMsg::isOpen | ( | void | ) | const [inline] |
Test whether transport has an open socket. brief test for open socket.
| lmsg::index_type lmsg::TransportMsg::getDebug | ( | void | ) | const [inline] |
Get the current debugging level. brief Get debug level.
| error_type lmsg::TransportMsg::open | ( | long | flags, | |
| const MsgAddr * | addr = 0 | |||
| ) |
Open a socket with the specified option flags. An address to which the socket will be bound may be specified if desired. If no address is specified, the socket will be bound to an unused IP address. brief Open a socket.
| flags | Bit mask specifying socket handling options. | |
| addr | Optional IP address to which the socket is to be bound. |
| void lmsg::TransportMsg::close | ( | void | ) |
Return the socket to the appropriate pool. brief Close the socket.
| error_type lmsg::TransportMsg::connect | ( | const MsgAddr & | addr | ) |
Make a connection with the specified IP address. Once a connection has been made messages may only be sent to or received from the specified partner socket. brief Connect to an IP partner address.
| addr | Address of partner to which the connection will be made. |
| error_type lmsg::TransportMsg::disconnect | ( | void | ) |
Disconnect from a partner. brief Disconnect from a partner.
| error_type lmsg::TransportMsg::receive | ( | MsgHeader & | from, | |
| char * | b, | |||
| size_type | maxlen, | |||
| wtime_type | timeout = -1.0 | |||
| ) |
A message is received. The header of the message is copied to 'from' and the message text (up to the specified maximum length) is copied to 'b'. The buffer pointer may be coded as zero if the maximum length is zero. receive returns with a TimeOut error code if no message is received within 'timeout' seconds. If 'timeout' < 0, receive will not return until either a message is received, or the the wait is interrupted by a caught signal. brief Receive a message.
| from | Received message header. | |
| b | Pointer to the buffer to receive the message text; | |
| maxlen | Length of buffer 'b'. | |
| timeout | Maximum time in seconds to wait for a message. |
| error_type lmsg::TransportMsg::receive | ( | MsgHeader & | from, | |
| Message & | msg, | |||
| wtime_type | timeout = -1.0 | |||
| ) |
A message is received. The header of the message is copied to 'from' and the message text (up to the specified maximum length) is copied to 'msg'. receive returns with a TimeOut error code if no message is received within 'timeout' seconds. If 'timeout' < 0, receive will not return until either a message is received, or the the wait is interrupted by a caught signal. brief Receive a message.
| from | Received message header. | |
| msg | Message buffer to receive the message text; | |
| timeout | Maximum time in seconds to wait for a message. |
| error_type lmsg::TransportMsg::receive | ( | Buffer ** | Data, | |
| wtime_type | timeout = -1.0 | |||
| ) |
A message is received. The messge header and text are returned in a Buffer, the address of which is stored in 'Data'. The Buffer must be returned to the appropriate buffer pool with Data->Return() once the buffer is no longer needed. receive returns with a TimeOut error code if no message is received within 'timeout' seconds. If 'timeout' < 0, receive will not return until either a message is received, or it is interrupted by a caught signal. brief Receive a message.
| Data | Pointer to receive the filled buffer address. | |
| timeout | Maximum time in seconds to wait for a message. |
| error_type lmsg::TransportMsg::send | ( | const MsgHeader & | to, | |
| const char * | b | |||
| ) |
A message is sent. The header of the message to be sent is supplied by 'to' which must contain the destination address, the message type and the length of the message text. The message text is contained in 'b'. brief Send a message.
| to | Message header. | |
| b | Pointer to the buffer containing the message text; |
A message is sent. The header of the message to be sent is supplied by 'to' which must contain the destination address and the transaction and block IDs. The message text is contained in 'b'. brief Send a message.
| error_type lmsg::TransportMsg::waitMsg | ( | wtime_type | Timeout | ) | const |
Wait for a message or a timeout. brief Wait for a message.
| Timeout | Timeout time. |
| static error_type lmsg::TransportMsg::waitAny | ( | wtime_type | Timeout, | |
| int | N, | |||
| const TransportMsg * | list[] | |||
| ) | [static] |
Wait for a message in one or more transports or a timeout. brief Wait for a message.
| Timeout | Timeout time. | |
| N | Number of transports to wait on. | |
| list | List of transports to wait on. |
| void lmsg::TransportMsg::Purge | ( | void | ) |
Delete a socket. This method is to be used only for sockets that are broken in some way e.g. unexpected messages have been received over the buffer.
| void lmsg::TransportMsg::setSocketPool | ( | SocketPool * | pool | ) |
Specify the ool from which sockets will be allocated. brief Specify socket pool.
| pool | Point to the socket pool. |
| void lmsg::TransportMsg::setBufferPool | ( | BufferPool * | pool | ) |
Specify the pool from which buffers will be allocated to hold sent or received messages. brief Specify buffer pool.
| pool | Point to the buffer pool. |
| void lmsg::TransportMsg::setDebug | ( | index_type | level | ) |
set the debug level
Set the debugging level.
| level | Debug level. |
| void lmsg::TransportMsg::setReplyAddr | ( | const MsgAddr & | ad | ) |
Set reply address.
Set the reply address.
| ad | Address to which a reply message will be sent. |
1.5.4