dnxServerMain.h File Reference

Definitions and prototypes for main module functionality. More...

#include "dnxProtocol.h"
#include <time.h>

Go to the source code of this file.

Data Structures

struct  DnxNewJob
 A structure to manage new jobs dispatched to nodes. More...

Functions

char * versionText (void)
 Format version text to an allocated string buffer.
void dnxReconfigure (void)
 Configuration changes have been made; reread the config file.
int dnxPostResult (void *payload, unsigned long serial, time_t start_time, unsigned delta, int early_timeout, int res_code, char *res_data)
 Post a completed service request to the Nagios service result buffer.
void dnxJobCleanup (DnxNewJob *pJob)
 Release all resources associated with a job object.
int dnxAuditJob (DnxNewJob *pJob, char *action)
 Send an audit message to the dnx server audit log.


Detailed Description

Definitions and prototypes for main module functionality.

Author:
John Calcote (dnx-devel@lists.sourceforge.net)
Attention:
Please submit patches to http://dnx.sourceforge.net

Definition in file dnxServerMain.h.


Function Documentation

int dnxAuditJob ( DnxNewJob pJob,
char *  action 
)

Send an audit message to the dnx server audit log.

Parameters:
[in] pJob - the job to be audited.
[in] action - the audit action that we're logging.
Returns:
Zero on success or a non-zero error value.

Todo:
This conversion should take place in the dnxUdpRead function and the resultant address string stored in the DnxNewJob structure. This would have two benefits:
1. Encapsulates conversion at the protocol level. 2. Saves some time during logging.

Definition at line 953 of file dnxServerMain.c.

void dnxJobCleanup ( DnxNewJob pJob  ) 

Release all resources associated with a job object.

Parameters:
[in] pJob - the job to be freed.

Definition at line 942 of file dnxServerMain.c.

int dnxPostResult ( void *  payload,
unsigned long  serial,
time_t  start_time,
unsigned  delta,
int  early_timeout,
int  res_code,
char *  res_data 
)

Post a completed service request to the Nagios service result buffer.

If early_timeout is true (1), then res_code will be reset to STATE_UNKNOWN, so you might as well pass zero for res_code.

Parameters:
[in] payload - An opaque pointer to the nagios service structure and other relevant results data.
[in] serial - the job serial number.
[in] start_time - the nagios service object start time.
[in] delta - the running time of the nagios service object in seconds.
[in] early_timeout - boolean; true means the job DID time out.
[in] res_code - the result code of this job.
[in] res_data - the resulting STDOUT output text of this job.
Returns:
Zero on success, or a non-zero error code.

Definition at line 881 of file dnxServerMain.c.

References DnxResultTransfer::delta, DNX_ERR_MEMORY, DNX_MSG_RESULT_TRANSFER, DNX_MSG_SIGNATURE, DNX_PLGFD, dnxDebug(), dnxStatsInc(), DnxResultTransfer::early_timeout, DnxResultTransfer::hdr, DnxMsgHeader::msgtype, DnxResultTransfer::payload, POST_RESULTS_FAILED, POST_RESULTS_OK, DnxResultTransfer::res_code, DnxResultTransfer::res_data, RESULTS_FAILED, RESULTS_OK, RESULTS_TIMED_OUT, DnxResultTransfer::serial, DnxMsgHeader::signature, DnxResultTransfer::start_time, DnxMsgHeader::structsz, xfree, and xmalloc.

void dnxReconfigure ( void   ) 

Configuration changes have been made; reread the config file.

Normally, this routine would be called by the signal handler, but we may do things in here that are not legal in a signal handlers. So instead this routine is called from the agent thread, and the signal handler merely notifies the agent that a reconfigure should be done.

Definition at line 863 of file dnxServerMain.c.

References copyCfgData(), dnxCfgParserParse(), dnxErrorString(), dnxLog(), freeCfgData(), and logGblConfigChanges().

Referenced by dnxAgentServer().

char* versionText ( void   ) 

Format version text to an allocated string buffer.

Caller is responsible to free memory buffer returned, using xfree.

Returns:
An allocated string buffer containing version text.

Definition at line 836 of file dnxServerMain.c.


Generated on Tue Apr 13 15:48:08 2010 for DNX by  doxygen 1.5.6