PUBLIC: struct MqLinkS

the MqS API is used as libmsgque_private object. More...

Collaboration diagram for PUBLIC: struct MqLinkS:


Data Structures

struct  MqErrorS
struct  MqLinkS
 the main libmsgque_private object. More...
struct  MqS
 Prototype for a context object. More...

Modules

 PUBLIC: struct MqBufferS
 the Msgque Buffer API is used to manage dynamic, generic, mixed typed data.
 PUBLIC: struct MqBufferLS
 the Msgque Buffer List API is used to manage a list of MqBufferS objects.
 PUBLIC: struct MqErrorS
 the MqErrorS API is used to manage error messages.
 PUBLIC: Read-Buffer object
 Read and split a libmsgque_private package into several items.
 PUBLIC: Send-Buffer object
 Collect and send data using a LibMsgque package.
 PUBLIC: struct MqLinkSlaveS
 Access to the master / slave feature.

Defines

#define MQ_NO   0
 boolean NO
#define MQ_YES   1
 boolean YES
#define MQ_MqS_SIGNATURE   0x212CF91
#define MQ_PRIVATE_CONFIG_CONST   const

Enumerations

enum  MqIoSelectE { MQ_SELECT_RECV = (1 << 0), MQ_SELECT_SEND = (1 << 1) }
 'select' type for reading or writing More...

Functions

MQ_EXTERN struct MqBufferLSMqInitCreate (void)
 setup and return the init object
MQ_EXTERN void MqInitSysAPI (MqForkF forkF, MqVForkF vforkF)
MQ_EXTERN enum MqErrorE MqLinkCreate (struct MqS *const context, struct MqBufferLS **argsP)
 create a parent libmsgque_private object link
MQ_EXTERN enum MqErrorE MqLinkCreateChild (struct MqS *const context, struct MqS *const parent, struct MqBufferLS **argsP)
 create a child libmsgque_private object link
MQ_EXTERN enum MqErrorE MqDefaultLinkCreate (struct MqS *const context, struct MqBufferLS **argsP)
 wrapper for MqLinkCreate with argv error check
MQ_EXTERN void MqLinkDelete (struct MqS *const context)
 delete a libmsgque_private object
MQ_EXTERN void MqExit (struct MqS *context)
 exit the current process or thread
MQ_EXTERN MQ_STR MqHelp (MQ_CST tool)
 write libmsgque_private specific user-help to stderr
MQ_EXTERN enum MqErrorE MqCheckForLeftOverArguments (struct MqS *const context, struct MqBufferLS **argvP)
MQ_EXTERN enum MqErrorE MqServiceCreate (struct MqS *const context, MQ_CST const token, MqTokenF const proc, MQ_PTR data, MqTokenDataFreeF datafreeF)
 create a service handle
MQ_EXTERN enum MqErrorE MqServiceDelete (struct MqS const *const context, MQ_CST const token)
 delete service handle
MQ_EXTERN MQ_BOL MqIsTransaction (struct MqS const *const context)
 check if the ongoing service-call belongs to an transaction
MQ_EXTERN MQ_BOL MqCurrentTokenIs (struct MqS const *const context, char const *const token)
 check the current token

Detailed Description

the MqS API is used as libmsgque_private object.

the MqS object is created just after the MqContextS object usually in the function ContextCreate. every external MqContextS object has only one MqS object and every MqS object has only one MqContextS object. the MqS object will be created with the MqLinkCreate and will be deleted with the MqLinkDelete function. during creation of a MqS object additional objects will be created too:


Define Documentation

#define MQ_MqS_SIGNATURE   0x212CF91

Definition at line 1464 of file msgque.h.

Referenced by MqContextCreate().

#define MQ_NO   0

#define MQ_PRIVATE_CONFIG_CONST   const

Definition at line 1467 of file msgque.h.

#define MQ_YES   1


Enumeration Type Documentation

'select' type for reading or writing

Enumerator:
MQ_SELECT_RECV  'select' for reading
MQ_SELECT_SEND  'select' for writing

Definition at line 285 of file msgque.h.


Function Documentation

MQ_EXTERN enum MqErrorE MqCheckForLeftOverArguments ( struct MqS *const   context,
struct MqBufferLS **  argvP 
)

check for left over arguments from parameter argv of MqLinkCreate

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in,out] argvP a pointer to the argv, the memory will be freed and the value will be set to NULL
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE
This code is not part of MqLinkCreate because sometimes it is necessary to check for left over arguments after MqLinkCreate was called and after the calling function was able to process function specific arguments. By Default MqLinkCreate will delete all arguments belonging to libmsgque_private from the argv object. If the calling function does not expect additional arguments or arguments were added with spelling errors, a call to MqCheckForLeftOverArguments will detect this.

Definition at line 1170 of file msgque.c.

References MqBufferLS::cursize, MqBufferLS::data, MQ_ERROR, MQ_ERROR_INVALID_OPTION, MQ_OK, MqBufferGetC(), MqBufferLDelete(), MqErrorDb2, MqErrorGetCode(), MqErrorSAppendV(), and unlikely.

Referenced by MqDefaultLinkCreate(), and MqSlaveWorker().

Here is the caller graph for this function:

MQ_EXTERN MQ_BOL MqCurrentTokenIs ( struct MqS const *const   context,
char const *const   token 
)

check the current token

Parameters:
[in] context the current context
[in] token the token to compare with

Definition at line 1153 of file msgque.c.

References MqS::link, pTokenCheck(), and MqLinkS::srvT.

MQ_EXTERN enum MqErrorE MqDefaultLinkCreate ( struct MqS *const   context,
struct MqBufferLS **  argsP 
)

wrapper for MqLinkCreate with argv error check

create a parent libmsgque_private object link

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] argsP command-line arguments will be freed and set to NULL on error
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 725 of file msgque.c.

References MqS::error, MqBufferLDelete(), MqCheckForLeftOverArguments(), MqErrorCheck, MqErrorStack, and MqLinkCreate().

MQ_EXTERN void MqExit ( struct MqS context  ) 

exit the current process or thread

Parameters:
[in] context the initial MqS object created by MqContextCreate
Attention:
this function will never return
  1. Delete the context object using: MqLinkDelete
  2. If available call the context specific exit handler --fParentExit
  3. final call SysExit to exit the process
  4. It is an Panic error if MqExit is called twice for the same object

Definition at line 1245 of file msgque.c.

References MqSetupS::fProcessExit, MqSetupS::fThreadExit, MqS::link, MQ_ERROR_EXIT, MQ_IS_CHILD, MQ_STATUS_IS_THREAD, MQ_YES, MqDLogC, MqErrorCopy(), MqErrorGetNum(), MqLinkDelete(), MqPanicSYS, MqLinkS::onExit, pMqGetFirstParent(), MqS::setup, sEventFree(), MqS::statusIs, and SysExit().

Referenced by MqPanicVL(), sSysServerThreadCreate(), and SysServerFork().

Here is the caller graph for this function:

MQ_EXTERN MQ_STR MqHelp ( MQ_CST  tool  ) 

write libmsgque_private specific user-help to stderr

Parameters:
tool the name of the tool (e.g. argv[0]) or NULL.
Returns:
the help messages as string
If tool != NULL, the function will display a header like:
  tool [ARGUMENT]... syntax:
    aclient [OPTION]... @ tool [OPTION]... @...
on the help page.

Definition at line 78 of file msgque.c.

References MQ_ALFA, MqBufferAppendV(), and MqBufferCreateStatic.

MQ_EXTERN struct MqBufferLS* MqInitCreate ( void   )  [read]

setup and return the init object

Returns:
a pointer to the initialization buffer
Attention:
  • every usage of this function will free the data of the previous init object
  • the data have to fit to the underlying programming language
The data is used as prefix to setup the argument vector for spawn. The following example demonstrate the usage of MqInitCreate:
struct MqBufferLS * initB = MqInitCreate();
MqBufferLAppendC(initB, "myExec");
MqBufferLAppendC(initB, "myExecArgument_1");
...

Definition at line 403 of file msgque.c.

References MqBufferLCreate(), and MqBufferLDelete().

Referenced by sMqCheckArg().

Here is the caller graph for this function:

MQ_EXTERN void MqInitSysAPI ( MqForkF  forkF,
MqVForkF  vforkF 
)

Definition at line 86 of file sys.c.

References mq_fork, and mq_vfork.

MQ_EXTERN MQ_BOL MqIsTransaction ( struct MqS const *const   context  ) 

check if the ongoing service-call belongs to an transaction

Parameters:
[in] context the current context

Definition at line 1162 of file msgque.c.

References MqLinkS::_trans, MqS::link, MQ_NO, and MQ_YES.

Referenced by pEventStart().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqLinkCreate ( struct MqS *const   context,
struct MqBufferLS **  argsP 
)

create a parent libmsgque_private object link

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] argsP command-line arguments will be freed and set to NULL on error
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 434 of file msgque.c.

References MqBufferU::C, CacheCF, MqSetupS::Child, MqLinkS::childs, MqIoConfigS::com, MqS::config, pChildS::context, MqLinkS::ctxId, MqLinkS::ctxIdA, MqLinkS::ctxIdP, MqLinkS::ctxIdR, MqLinkS::ctxIdZ, MqBufferS::cur, MqBufferLS::cursize, MqCallbackS::data, MqBufferLS::data, MqConfigS::debug, MqLinkS::doFactoryCleanup, MqLinkS::endian, MqS::error, MqLinkSetupS::fCreate, MqCallbackS::fFunc, MqLinkS::flagServerSetup, MqLinkS::io, MqConfigS::io, MqConfigS::isSilent, MqConfigS::isString, MqLinkS::isWORKER, pChildS::left, MqS::link, MqConfigS::master, MQ_ALFA_STR, MQ_CONTINUE, MQ_ERROR, MQ_ERROR_CAN_NOT_START_SERVER, MQ_ERROR_CONNECTED, MQ_ERROR_PANIC, MQ_EXIT, MQ_IS_CHILD, MQ_IS_CLIENT, MQ_IS_PARENT, MQ_IS_SLAVE, MQ_NO, MQ_OK, MQ_START_SERVER_AS_PIPE, mq_strdup, MQ_TIMEOUT_USER, MQ_YES, MqBufferCreateC(), MqBufferLAppend(), MqBufferLAppendL(), MqBufferLDelete(), MqBufferLDeleteItem(), MqConfigSetIsString(), MqConfigSetMaster(), MqContextCreate(), MqContextDelete(), MqDLogV, MqDLogX(), MqErrorCheck, MqErrorCheckI, MqErrorCopy(), MqErrorDbV, MqErrorDbV2, MqErrorGetCode(), MqErrorReset(), MqErrorStack, MqInitGetFirst(), MqLinkCreate(), MqReadO(), MqSendC(), MqSendEND_AND_WAIT(), MqSendI(), MqSendO(), MqSendSTART(), MqSysCalloc(), MqSysFree, MqSysMalloc(), MqSysRealloc(), MqConfigS::name, MqLinkS::onCreate, MqSetupS::Parent, MqConfigS::parent, pBufferLSetError(), pBufferLSplitAlfa(), pCacheCreate(), pIoCloseSocket(), pIoConnect(), pIoCreate(), pIoIsRemote(), pIoLogCom(), pIoStartServer(), pReadCreate(), pReadDelete(), pSendCreate(), pSlaveCreate(), pTokenCreate(), pTransCreate(), pWaitForToken(), MqLinkS::read, MqLinkS::readCache, pChildS::right, MqLinkS::self, MqLinkS::send, MqSetupS::ServerSetup, MqS::setup, MqLinkS::slave, sMqCheckArg(), MqConfigS::srvname, MqLinkS::srvT, MqLinkS::trans, and unlikely.

Referenced by MqDefaultLinkCreate(), MqLinkCreate(), MqLinkCreateChild(), MqSlaveWorker(), pSlaveCreate(), pTokenCheckSystem(), sSysServerThreadCreate(), and SysServerFork().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqLinkCreateChild ( struct MqS *const   context,
struct MqS *const   parent,
struct MqBufferLS **  argsP 
)

create a child libmsgque_private object link

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] parent the parent object link
[in] argsP command-line arguments will be freed and set to NULL on error
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 417 of file msgque.c.

References MQ_ERROR_CONNECTED, MqBufferLDelete(), MqConfigDup(), MqConfigSetParent(), MqErrorDbV, MqLinkCreate(), and unlikely.

MQ_EXTERN void MqLinkDelete ( struct MqS *const   context  ) 

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

create a service handle

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] token a 4 byte string used to identify the remote service
proc an external (non libmsgque) function to provide the service
data an external (non libmsgque) pointer to a data structure linked to the MqTokenF function
datafreeF function to free data pointer
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 1205 of file msgque.c.

References HDR_TOK_LEN, MqS::link, MQ_ERROR_TOKEN_LENGTH, MqErrorDbV, pTokenAddHdl(), and MqLinkS::srvT.

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

delete service handle

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 1222 of file msgque.c.

References MqS::link, pTokenDelHdl(), and MqLinkS::srvT.


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