PUBLIC: Send-Buffer object
[PUBLIC: struct MqLinkS]

Collect and send data using a LibMsgque package. More...

Collaboration diagram for PUBLIC: Send-Buffer object:

Functions

MQ_EXTERN enum MqErrorE MqSendY (struct MqS *const context, const MQ_BYT val)
 append a native typed value to the Send-Buffer object
MQ_EXTERN enum MqErrorE MqSendO (struct MqS *const context, const MQ_BOL val)
MQ_EXTERN enum MqErrorE MqSendS (struct MqS *const context, const MQ_SRT val)
MQ_EXTERN enum MqErrorE MqSendI (struct MqS *const context, const MQ_INT val)
MQ_EXTERN enum MqErrorE MqSendF (struct MqS *const context, const MQ_FLT val)
MQ_EXTERN enum MqErrorE MqSendW (struct MqS *const context, const MQ_WID val)
MQ_EXTERN enum MqErrorE MqSendD (struct MqS *const context, const MQ_DBL val)
MQ_EXTERN enum MqErrorE MqSendC (struct MqS *const context, MQ_CST const in)
 append a MQ_STR object to the Send-Buffer object
MQ_EXTERN enum MqErrorE MqSendB (struct MqS *const context, MQ_BINB const *const in, MQ_SIZE const len)
 append a MQ_BIN object to the Send-Buffer object
MQ_EXTERN enum MqErrorE MqSendU (struct MqS *const context, struct MqBufferS *const in)
 append a MQ_BUF object to the Send-Buffer object
MQ_EXTERN enum MqErrorE MqSendL (struct MqS *const context, struct MqBufferLS const *const in)
 append a MqBufferLS object to the Send-Buffer object
MQ_EXTERN enum MqErrorE MqSendV (struct MqS *const context, MQ_CST const fmt,...)
 append a vararg string to the Send-Buffer object
MQ_EXTERN enum MqErrorE MqSendVL (struct MqS *const context, MQ_CST const fmt, va_list var_list)
 append a vararg string as va_list to the Send-Buffer object
MQ_EXTERN enum MqErrorE MqSendSTART (struct MqS *const context)
 initialize the Send-Buffer object and start to create a Msgque package
MQ_EXTERN enum MqErrorE MqSendEND (struct MqS *const context, MQ_CST const token)
 finish and send a service Msgque packet without waiting on return
MQ_EXTERN enum MqErrorE MqSendEND_AND_WAIT (struct MqS *const context, MQ_CST const token, MQ_TIME_T const timeout)
 send a service Msgque packet and waiting on return
MQ_EXTERN enum MqErrorE MqSendEND_AND_CALLBACK (struct MqS *const context, MQ_CST const token, MqTokenF const proc, MQ_PTR data, MqTokenDataFreeF datafreeF)
 send a service Msgque packet with a callback function defined
MQ_EXTERN enum MqErrorE MqSendRETURN (struct MqS *const context)
 send a return Msgque packet with data from the current MqErrorS object
MQ_EXTERN enum MqErrorE MqSendERROR (register struct MqS *const context)
 send a msgque error from a server to a client
MQ_EXTERN enum MqErrorE MqSendFTR (struct MqS *const context, MQ_TIME_T const timeout)
 send a _FTR filter package
MQ_EXTERN enum MqErrorE MqSendEOF (struct MqS *const context, MQ_TIME_T const timeout)
 send a _EOF filter package
MQ_EXTERN enum MqErrorE MqSendL_START (struct MqS *const context)
 start to append an embedded list item to the Send-Buffer object
MQ_EXTERN enum MqErrorE MqSendL_END (struct MqS *const context)
 end to append an embedded list item to the Send-Buffer object

Detailed Description

Collect and send data using a LibMsgque package.

the management is done by a Send-Buffer object using an Io object for doing the socket io. Every msgque object has only one Send-Buffer object and every Send-Buffer object has only one link to a MqS object.

example 1: in the client, calling the service and wait for an answer

void MyServiceCall(struct MqS * const context) { // the libmsgque object
    ...
    MqSendSTART(context);                          // init the Send-Buffer object
    MqSendI(context,int_value);                    // 1. argument: a MQ_INT value
    MqSendV(context,"num:%x",num);                 // 2. argument: a vararg string value
    MqSendB(context,mypicture,size);               // 3. argument: a binary picture of size length
    // call service "SRV1" and wait maximum 60 seconds for the results
    MqErrorCheck(MqSendEND_AND_WAIT(context,"SRV1",60);
    // ... get the results
    MqErrorCheck(MqReadI(context, ???);
    ...
}

example 2: in the server, answer the service call

static MqErrorE Ot_WAR1(struct MqS * const context, MQ_PTR data) {
  // ... do some int work
    MqSendSTART(context);                       // init the Send-Buffer object
    MqErrorCheck(MqReadI(context,&myInt);       // read a MQ_INT value
    MqErrorCheck(MqReadC(context,&myStr);       // read a MQ_STR value
    MqErrorCheck(MqReadU(context,&myPic);       // read a MqBufferS object to store the picture data
  // ... do some processing
  error:                                        // something is wrong, error back
    return MqSendRETURN(context);               // send the package as an answer of a previous service-call
}

Function Documentation

MQ_EXTERN enum MqErrorE MqSendB ( struct MqS *const   context,
MQ_BINB const *const   in,
MQ_SIZE const   len 
)

append a MQ_BIN object to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
in the binary data to send
len the size of the binary data to send

Definition at line 481 of file send.c.

References MqBufferU::B, MqSendS::buf, BUFFER_P2_PRENUM, MqS::config, MqBufferS::cur, MqConfigS::isString, MqS::link, MQ_BINT, MQ_ERROR_CONNECTED, MQ_OK, MqErrorDbV, pBufferAddSize, MqLinkS::send, sSendLen(), and unlikely.

Referenced by MqSendU().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendC ( struct MqS *const   context,
MQ_CST const   in 
)

append a MQ_STR object to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
in the string data to send

Definition at line 461 of file send.c.

References MqBufferU::B, MqSendS::buf, BUFFER_P2_PRENUM, MqBufferU::C, MqS::config, MqBufferS::cur, MqConfigS::isString, MqS::link, MQ_ERROR_CONNECTED, MQ_OK, MQ_STRT, MqErrorDbV, pBufferAddSize, MqLinkS::send, sSendLen(), and unlikely.

Referenced by MqLinkCreate(), MqSendERROR(), MqSendRETURN(), MqSendU(), and pMqShutdown().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendD ( struct MqS *const   context,
const MQ_DBL  val 
)

append a native typed value to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] val the value to send
Attention:
In binary mode the data will be send as binary, in string mode as string.

Definition at line 450 of file send.c.

References MqS::config, MqBufferAtomU::D, MqConfigS::isString, MqS::link, MQ_DBLT, MqLinkS::send, and sSendA8().

Referenced by MqSendU().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendEND ( struct MqS *const   context,
MQ_CST const   token 
)

finish and send a service Msgque packet without waiting on return

This function is used to call a remote service or answer a service-call.

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] token a 4 byte string used to identify the remote service
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 655 of file send.c.

References pMqSendEND(), and pSendL_CLEANUP().

Referenced by MqProcessEvent(), and MqSendERROR().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendEND_AND_CALLBACK ( struct MqS *const   context,
MQ_CST const   token,
MqTokenF const   proc,
MQ_PTR  data,
MqTokenDataFreeF  datafreeF 
)

send a service Msgque packet with a callback function defined

This function is used to call a remote service and don't wait for an answer. The answer will be processed asynchronous in MqProcessEvent.

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] token a 4 byte string used to identify the remote service
[in] proc A service procedure called with the results of the transaction
[in] data A user defined additional data
[in] datafreeF A function to free data after use
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE (without MQ_CONTINUE)
Attention:
This function will never block.

Definition at line 831 of file send.c.

References MqS::link, MqErrorReturn, pMqSendEND(), pSendL_CLEANUP(), pTransPop(), and MqLinkS::trans.

MQ_EXTERN enum MqErrorE MqSendEND_AND_WAIT ( struct MqS *const   context,
MQ_CST const   token,
MQ_TIME_T const   timeout 
)

send a service Msgque packet and waiting on return

This function is used to call a remote service and wait for an answer.

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] token a 4 byte string used to identify the remote service
timeout time_t type value for timeout in seconds
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE (without MQ_CONTINUE)

Definition at line 735 of file send.c.

References MqLinkS::_trans, MqS::link, MQ_CONTINUE, MQ_ERROR, MQ_EXIT, MQ_OK, MQ_RETURN_ERROR, MQ_RETURN_OK, MQ_TRANS_CANCEL, MQ_TRANS_END, MQ_TRANS_START, MQ_WAIT_ONCE, MqDLogC, MqErrorC(), MqErrorCheck, MqErrorStack, MqErrorV, MqPanicC, MqProcessEvent(), MqReadC(), MqReadItemExists(), pCachePush(), pErrorAppendC(), pMqSendEND(), pRead_RET_END, pRead_RET_START(), pReadGetReturnCode(), pReadGetReturnNum(), pSendL_CLEANUP(), pTransCheckStart(), pTransGetLast(), pTransGetResult(), pTransGetStatus(), pTransPop(), pTransPush(), MqLinkS::read, MqLinkS::readCache, and MqLinkS::trans.

Referenced by MqLinkCreate(), MqSendEOF(), MqSendFTR(), and pMqShutdown().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendEOF ( struct MqS *const   context,
MQ_TIME_T const   timeout 
)

send a _EOF filter package

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] timeout timeout used for send data
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE
Attention:

Definition at line 868 of file send.c.

References MqSendS::context, MqS::link, MQ_ERROR_EXPECT_FILTER, MQ_IS_SERVER, MqErrorDbV, MqErrorReturn, MqSendEND_AND_WAIT(), MqSendSTART(), and MqLinkS::send.

Referenced by pTokenCheckSystem().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendERROR ( register struct MqS *const   context  ) 

send a msgque error from a server to a client

Utility function to simplify the send task for a service handle.

Parameters:
[in] context the initial MqS object created by MqContextCreate
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 1043 of file send.c.

References MqErrorCheck, MqErrorGetNum(), MqErrorGetText(), MqErrorReset(), MqErrorStack, MqSendC(), MqSendEND(), MqSendI(), MqSendSTART(), pReadL_CLEANUP(), and pSendL_CLEANUP().

Referenced by MqSendRETURN(), pErrorReport(), pEventStart(), pSlaveBqError(), and sMqEventStart().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendF ( struct MqS *const   context,
const MQ_FLT  val 
)

append a native typed value to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] val the value to send
Attention:
In binary mode the data will be send as binary, in string mode as string.

Definition at line 428 of file send.c.

References MqS::config, MqBufferAtomU::F, MqConfigS::isString, MqS::link, MQ_FLTT, MqLinkS::send, and sSendA4().

Referenced by MqSendU().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendFTR ( struct MqS *const   context,
MQ_TIME_T const   timeout 
)

send a _FTR filter package

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] timeout timeout used for send data
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE
Attention:

Definition at line 855 of file send.c.

References MqSendS::context, MqS::link, MQ_ERROR_EXPECT_FILTER, MQ_IS_SERVER, MqErrorDbV, MqErrorReturn, MqSendEND_AND_WAIT(), pReadL_CLEANUP(), and MqLinkS::send.

Referenced by pTokenCheckSystem().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendI ( struct MqS *const   context,
const MQ_INT  val 
)

append a native typed value to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] val the value to send
Attention:
In binary mode the data will be send as binary, in string mode as string.

Definition at line 417 of file send.c.

References MqS::config, MqBufferAtomU::I, MqConfigS::isString, MqS::link, MQ_INTT, MqLinkS::send, and sSendA4().

Referenced by MqLinkCreate(), MqSendERROR(), and MqSendU().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendL ( struct MqS *const   context,
struct MqBufferLS const *const   in 
)

append a MqBufferLS object to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
in the pointer to an MqBufferLS object to send
Attention:
all items of in are appended as single arguments to the call using MqSendU

Definition at line 542 of file send.c.

References MqBufferLS::cursize, MqBufferLS::data, MqS::link, MQ_ERROR_CONNECTED, MQ_OK, MqErrorDbV, MqSendU(), MqLinkS::send, and unlikely.

MQ_EXTERN enum MqErrorE MqSendL_END ( struct MqS *const   context  ) 

end to append an embedded list item to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate

Definition at line 920 of file send.c.

References MqBufferU::B, MqSendS::buf, MqSendS::cache, MqS::config, MqBufferS::cur, SendSaveS::cursize, MqBufferS::cursize, MqBufferS::data, MqConfigS::isString, MqS::link, MQ_ERROR_CONNECTED, MQ_LSTT, MQ_OK, MqErrorDbV, SendSaveS::numItems, MqBufferS::numItems, pCachePush(), MqSendS::save, SendSaveS::save, MqLinkS::send, SEND_I, sSendLen(), and unlikely.

Referenced by MqSendU(), and pSendL_CLEANUP().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendL_START ( struct MqS *const   context  ) 

start to append an embedded list item to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
example: create a list item
MqSendL_START(send);     // start a LST item
MqSendI(send,myInt);        // first LST sub-item
MqSendC(send,"myString");   // second LST sub-item
// ... do additional MqSend?
MqSendL_END(send);       // finish a LST item

Definition at line 887 of file send.c.

References MqBufferU::B, MqSendS::buf, BUFFER_P2_PRENUM, MqSendS::cache, MqBufferS::cur, SendSaveS::cursize, MqBufferS::cursize, HDR_INT_LEN, MqS::link, MQ_ERROR_CONNECTED, MQ_OK, MqErrorDbV, MqBufferS::numItems, SendSaveS::numItems, pBufferAddSize, pCachePop(), MqSendS::save, SendSaveS::save, and MqLinkS::send.

Referenced by MqSendU().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendO ( struct MqS *const   context,
const MQ_BOL  val 
)

append a native typed value to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] val the value to send
Attention:
In binary mode the data will be send as binary, in string mode as string.

Definition at line 395 of file send.c.

References MqS::config, MqConfigS::isString, MqS::link, MQ_BOLT, MqBufferAtomU::O, MqLinkS::send, and sSendA1().

Referenced by MqLinkCreate(), MqSendU(), and pTokenCheckSystem().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendRETURN ( struct MqS *const   context  ) 

send a return Msgque packet with data from the current MqErrorS object

Utility function to simplify the send task for a service handle.

Parameters:
[in] context the initial MqS object created by MqContextCreate
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 1059 of file send.c.

References MqLinkS::_trans, MqS::link, MQ_CONTINUE, MQ_ERROR, MQ_ERROR_RETURN_WITHOUT_TRANSACTION, MQ_EXIT, MQ_OK, MQ_RETURN_ERROR, MqDLogC, MqErrorCheck, MqErrorDb, MqErrorGetCode(), MqErrorGetNum(), MqErrorGetText(), MqErrorReset(), MqErrorStack, MqPanicSYS, MqSendC(), MqSendERROR(), MqSendSTART(), pMqSendEND(), pReadL_CLEANUP(), pSendL_CLEANUP(), sSend_RET_END(), and sSend_RET_START().

Referenced by pEventStart(), pMqShutdown(), pTokenCheckSystem(), and sMqEventStart().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendS ( struct MqS *const   context,
const MQ_SRT  val 
)

append a native typed value to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] val the value to send
Attention:
In binary mode the data will be send as binary, in string mode as string.

Definition at line 406 of file send.c.

References MqS::config, MqConfigS::isString, MqS::link, MQ_SRTT, MqBufferAtomU::S, MqLinkS::send, and sSendA2().

Referenced by MqSendU().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendSTART ( struct MqS *const   context  ) 

MQ_EXTERN enum MqErrorE MqSendU ( struct MqS *const   context,
struct MqBufferS *const   in 
)

MQ_EXTERN enum MqErrorE MqSendV ( struct MqS *const   context,
MQ_CST const   fmt,
  ... 
)

append a vararg string to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
fmt a printf like format string

Definition at line 584 of file send.c.

References MqSendVL().

MQ_EXTERN enum MqErrorE MqSendVL ( struct MqS *const   context,
MQ_CST const   fmt,
va_list  var_list 
)

append a vararg string as va_list to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
fmt a printf like format string
var_list a variable argument list object

Definition at line 561 of file send.c.

References MqBufferU::B, MqSendS::buf, BUFFER_P2_PRENUM, MqS::config, MqBufferS::cur, MqBufferS::cursize, MqConfigS::isString, MqS::link, MQ_ERROR_CONNECTED, MQ_OK, MQ_STRT, MqBufferAppendVL(), MqErrorDbV, pBufferAddSize, MqLinkS::send, sSendLen(), and unlikely.

Referenced by MqSendV().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendW ( struct MqS *const   context,
const MQ_WID  val 
)

append a native typed value to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] val the value to send
Attention:
In binary mode the data will be send as binary, in string mode as string.

Definition at line 439 of file send.c.

References MqS::config, MqConfigS::isString, MqS::link, MQ_WIDT, MqLinkS::send, sSendA8(), and MqBufferAtomU::W.

Referenced by MqSendU().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqSendY ( struct MqS *const   context,
const MQ_BYT  val 
)

append a native typed value to the Send-Buffer object

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] val the value to send
Attention:
In binary mode the data will be send as binary, in string mode as string.

Definition at line 384 of file send.c.

References MqS::config, MqConfigS::isString, MqS::link, MQ_BYTT, MqLinkS::send, sSendA1(), and MqBufferAtomU::Y.

Referenced by MqSendU().

Here is the caller graph for this function:


libmsgque project on SF: Get libmsgque at SourceForge.net. Fast, secure and Free Open Source software downloads    Generated on Mon Nov 9 16:57:14 2009 by doxygen 1.5.8