#include "dnxMsgQ.h"
#include "dnxTSPI.h"
#include "dnxTransport.h"
#include "dnxError.h"
#include "dnxDebug.h"
#include "dnxLogging.h"
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
Go to the source code of this file.
Data Structures | |
struct | _dnxMsgBuf_ |
struct | iDnxMsgQChannel_ |
The implementation of the UDP low-level I/O transport. More... | |
Defines | |
#define | DNX_MSGQ_STANDARD 1 |
Typedefs | |
typedef struct _dnxMsgBuf_ | dnxMsgBuf |
typedef struct iDnxMsgQChannel_ | iDnxMsgQChannel |
The implementation of the UDP low-level I/O transport. | |
Functions | |
static int | dnxMsgQOpen (iDnxChannel *icp, int mode) |
Open a MSGQ channel object. | |
static int | dnxMsgQClose (iDnxChannel *icp) |
Close a MSGQ channel object. | |
static int | dnxMsgQRead (iDnxChannel *icp, char *buf, int *size, int timeout, char *src) |
Read data from a MSGQ channel object. | |
static int | dnxMsgQWrite (iDnxChannel *icp, char *buf, int size, int timeout, char *dst) |
Write data to a MSGQ channel object. | |
static void | dnxMsgQDelete (iDnxChannel *icp) |
Delete a MSGQ channel object. | |
static int | dnxMsgQNew (char *url, iDnxChannel **icpp) |
Create a new UDP transport. | |
int | dnxMsgQInit (int(**ptxAlloc)(char *url, iDnxChannel **icpp)) |
Initialize the MSGQ transport sub-system; return MSGQ channel contructor. | |
void | dnxMsgQDeInit (void) |
Clean up global resources allocated by the MSGQ transport sub-system. |
Definition in file dnxMsgQ.c.
#define DNX_MSGQ_STANDARD 1 |
typedef struct _dnxMsgBuf_ dnxMsgBuf |
typedef struct iDnxMsgQChannel_ iDnxMsgQChannel |
The implementation of the UDP low-level I/O transport.
static int dnxMsgQClose | ( | iDnxChannel * | icp | ) | [static] |
Close a MSGQ channel object.
[in] | icp | - the UDP channel object to be closed. |
Definition at line 100 of file dnxMsgQ.c.
References DNX_OK, and iDnxMsgQChannel_::queueid.
Referenced by dnxMsgQNew().
void dnxMsgQDeInit | ( | void | ) |
static void dnxMsgQDelete | ( | iDnxChannel * | icp | ) | [static] |
Delete a MSGQ channel object.
[in] | icp | - the MSGQ channel object to be deleted. |
Definition at line 196 of file dnxMsgQ.c.
References iDnxMsgQChannel_::queueid, and xfree.
Referenced by dnxMsgQNew().
int dnxMsgQInit | ( | int(**)(char *url, iDnxChannel **icpp) | ptxAlloc | ) |
Initialize the MSGQ transport sub-system; return MSGQ channel contructor.
[out] | ptxAlloc | - the address of storage in which to return the address of the MSGQ channel object constructor (dnxMsgQNew). |
Definition at line 271 of file dnxMsgQ.c.
References DNX_OK, and dnxMsgQNew().
static int dnxMsgQNew | ( | char * | url, | |
iDnxChannel ** | icpp | |||
) | [static] |
Create a new UDP transport.
[in] | url | - the URL containing the host name and port number. |
[out] | icpp | - the address of storage for returning the new low- level UDP transport object (as a generic transport object). |
Definition at line 216 of file dnxMsgQ.c.
References DNX_ERR_BADURL, DNX_ERR_MEMORY, DNX_OK, dnxMsgQClose(), dnxMsgQDelete(), dnxMsgQOpen(), dnxMsgQRead(), dnxMsgQWrite(), iDnxMsgQChannel_::ichan, iDnxMsgQChannel_::queuekey, iDnxChannel_::txClose, iDnxChannel_::txDelete, iDnxChannel_::txOpen, iDnxChannel_::txRead, iDnxChannel_::txWrite, and xmalloc.
Referenced by dnxMsgQInit().
static int dnxMsgQOpen | ( | iDnxChannel * | icp, | |
int | mode | |||
) | [static] |
Open a MSGQ channel object.
[in] | icp | - the UDP channel object to be opened. |
[in] | mode | - DNX_MODE_ACTIVE indicates the transport will be used in active mode (as a client); DNX_MODE_PASSIVE indicates the transport will be used in passive mode (as a server listen point). |
Definition at line 75 of file dnxMsgQ.c.
References DNX_ERR_OPEN, DNX_OK, iDnxMsgQChannel_::queueid, and iDnxMsgQChannel_::queuekey.
Referenced by dnxMsgQNew().
static int dnxMsgQRead | ( | iDnxChannel * | icp, | |
char * | buf, | |||
int * | size, | |||
int | timeout, | |||
char * | src | |||
) | [static] |
Read data from a MSGQ channel object.
[in] | icp | - the MSGQ channel object from which to read data. |
[out] | buf | - the address of storage into which data should be read. |
[in,out] | size | - on entry, the maximum number of bytes that may be read into buf ; on exit, returns the number of bytes stored in buf . |
[in] | timeout | - the maximum number of seconds we're willing to wait for data to become available on icp without returning a timeout error. |
[out] | src | - the address of storage for the sender's address if desired. This parameter is not used by this transport, however, it's optional, and so it may be passed as NULL by the caller. |
Definition at line 134 of file dnxMsgQ.c.
References DNX_ERR_RECEIVE, DNX_OK, _dnxMsgBuf_::mtext, and iDnxMsgQChannel_::queueid.
Referenced by dnxMsgQNew().
static int dnxMsgQWrite | ( | iDnxChannel * | icp, | |
char * | buf, | |||
int | size, | |||
int | timeout, | |||
char * | dst | |||
) | [static] |
Write data to a MSGQ channel object.
[in] | icp | - the MSGQ channel object on which to write data. |
[in] | buf | - a pointer to the data to be written. |
[in] | size | - the number of bytes to be written on icp . |
[in] | timeout | - the maximum number of seconds to wait for the write operation to complete without returning a timeout error. |
[in] | dst | - the address to which the data in buf should be sent using this channel. This parameter is not used by this transport, however, it's optional, and so it may be passed as NULL by the caller. |
Definition at line 169 of file dnxMsgQ.c.
References DNX_ERR_SEND, DNX_MSGQ_STANDARD, DNX_OK, _dnxMsgBuf_::mtext, _dnxMsgBuf_::mtype, and iDnxMsgQChannel_::queueid.
Referenced by dnxMsgQNew().