#include "dnxProtocol.h"
#include "dnxError.h"
#include "dnxDebug.h"
#include "dnxTransport.h"
#include "dnxXml.h"
#include "dnxLogging.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <syslog.h>
#include <assert.h>
Go to the source code of this file.
Functions | |
int | dnxMakeXID (DnxXID *pxid, DnxObjType xType, unsigned long xSerial, unsigned long xSlot) |
Create a transaction id (XID) from a type, serial number and slot value. | |
int | dnxEqualXIDs (DnxXID *pxa, DnxXID *pxb) |
Compare two XID's for equality; return a boolean value. | |
int | dnxSendMgmtRequest (DnxChannel *channel, DnxMgmtRequest *pRequest) |
Issue a management request. | |
int | dnxSendMgmtReply (DnxChannel *channel, DnxMgmtReply *pReply, char *address) |
Issue a management reply. | |
int | dnxWaitForMgmtReply (DnxChannel *channel, DnxMgmtReply *pReply, int timeout) |
Wait for a management reply to come in (server). | |
int | dnxWaitForMgmtRequest (DnxChannel *channel, DnxMgmtRequest *pRequest, char *address, int timeout) |
Wait for a management request to come in (client). |
Definition in file dnxProtocol.c.
Compare two XID's for equality; return a boolean value.
[in] | pxa | - a reference to the first XID to be compared. |
[in] | pxb | - a reference to the second XID to be compared. |
pxa
is NOT equal to pxa
; true (!false) if pxa
IS equal to pxb
. Definition at line 76 of file dnxProtocol.c.
References DnxXID::objSerial, DnxXID::objSlot, and DnxXID::objType.
Referenced by dnxJobListCollect().
int dnxMakeXID | ( | DnxXID * | pxid, | |
DnxObjType | xType, | |||
unsigned long | xSerial, | |||
unsigned long | xSlot | |||
) |
Create a transaction id (XID) from a type, serial number and slot value.
[out] | pxid | - the address of storage for the XID to be returned. |
[in] | xType | - the request type to be stored in the XID. |
[in] | xSerial | - the serial number to be stored in the XID. |
[in] | xSlot | - the slot number to be stored in the XID. |
Definition at line 54 of file dnxProtocol.c.
References DNX_OBJ_MAX, DNX_OK, DnxXID::objSerial, DnxXID::objSlot, and DnxXID::objType.
Referenced by dnxPostNewJob(), dnxWorker(), and main().
int dnxSendMgmtReply | ( | DnxChannel * | channel, | |
DnxMgmtReply * | pReply, | |||
char * | address | |||
) |
Issue a management reply.
[in] | channel | - the channel on which to send the management request. |
[out] | pReply | - the management request to be sent. |
[out] | address | - the address to which the reply should be sent. |
Definition at line 126 of file dnxProtocol.c.
References DnxXmlBuf::buf, DNX_MAX_ADDRSTR, DNX_XML_INT, DNX_XML_STR, DNX_XML_XID, dnxDebug(), dnxNtop(), dnxPut(), dnxXmlAdd(), dnxXmlClose(), dnxXmlOpen(), DnxMgmtReply::reply, DnxXmlBuf::size, DnxMgmtReply::status, and DnxMgmtReply::xid.
Referenced by dnxAgentServer(), and processCommands().
int dnxSendMgmtRequest | ( | DnxChannel * | channel, | |
DnxMgmtRequest * | pRequest | |||
) |
Issue a management request.
The address may not be specified, as this method is only to be used on active, connected, client-side code. The address used is the one specified when the connection was established.
[in] | channel | - the channel on which to send the management request. |
[out] | pRequest | - the management request to be sent. |
Definition at line 96 of file dnxProtocol.c.
References DnxMgmtRequest::action, DnxXmlBuf::buf, DNX_XML_STR, DNX_XML_XID, dnxDebug(), dnxPut(), dnxXmlAdd(), dnxXmlClose(), dnxXmlOpen(), DnxXmlBuf::size, and DnxMgmtRequest::xid.
Referenced by main().
int dnxWaitForMgmtReply | ( | DnxChannel * | channel, | |
DnxMgmtReply * | pReply, | |||
int | timeout | |||
) |
Wait for a management reply to come in (server).
The address may not be retrieved as this command is only intended to be used by client code with an active, connected channel and we can only received data from one address.
[in] | channel | - the channel from which to read a management request. |
[out] | pReply | - the address of storage in which to return the management reply. |
[in] | timeout | - the maximum number of seconds the caller is willing to wait before accepting a timeout error. |
Definition at line 164 of file dnxProtocol.c.
References DnxXmlBuf::buf, DNX_OK, DNX_XML_INT, DNX_XML_STR, DNX_XML_XID, dnxDebug(), dnxGet(), dnxXmlCmpStr(), dnxXmlGet(), DnxMgmtReply::reply, DnxXmlBuf::size, DnxMgmtReply::status, and DnxMgmtReply::xid.
Referenced by main().
int dnxWaitForMgmtRequest | ( | DnxChannel * | channel, | |
DnxMgmtRequest * | pRequest, | |||
char * | address, | |||
int | timeout | |||
) |
Wait for a management request to come in (client).
[in] | channel | - the channel from which to read a management request. |
[out] | pRequest | - the address of storage in which to return the management request. |
[out] | address | - the address of storage in which to return the address of the sender. This parameter is optional and may be passed as NULL. If non-NULL, it should be large enough to store sockaddr_* data. |
[in] | timeout | - the maximum number of seconds the caller is willing to wait before accepting a timeout error. |
Definition at line 213 of file dnxProtocol.c.
References DnxMgmtRequest::action, DnxXmlBuf::buf, DNX_MAX_ADDRSTR, DNX_OK, DNX_XML_STR, DNX_XML_XID, dnxDebug(), dnxGet(), dnxNtop(), dnxXmlCmpStr(), dnxXmlGet(), DnxXmlBuf::size, and DnxMgmtRequest::xid.
Referenced by dnxAgentServer(), and processCommands().