Defines | Functions

eurephiadm.c File Reference

Main part of the eurephiadm command line administration utility for eurephia. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <libgen.h>
#include <libxml/tree.h>
#include <eurephia_nullsafe.h>
#include <eurephia_context.h>
#include <eurephia_log.h>
#include <eurephia_values.h>
#include <eurephia_xml.h>
#include <eurephiadb_driver.h>
#include <eurephiadb_session_common.h>
#include <eurephiadb.h>
#include "argparser.h"
#include "client_context.h"
#include "client_config.h"
#include "client_session.h"
#include "get_console_input.h"
#include "commands.h"
Include dependency graph for eurephiadm.c:

Go to the source code of this file.

Defines

#define MODULE   "eurephiadm"

Functions

char * print_version (char *fprg)
void help_Help ()
int cmd_Help (eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int argc, char **argv)
int cmd_Logout (eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int argc, char **argv)
int cmd_ShowCfg (eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int argc, char **argv)
int eurephia_ConnectDB (eurephiaCTX *ctx, const char *argstr)
static eurephiaSESSIONdo_login (eurephiaCTX *ctx, eurephiaVALUES *cfg, const char *req_access)
static int validate_session (eurephiaCTX *ctx, const char *sesskey, const char *accesslvl)
char * args2string (int argc, char **argv)
int main (int argc, char **argv)

Detailed Description

Main part of the eurephiadm command line administration utility for eurephia.

Author:
David Sommerseth <dazo@users.sourceforge.net>
Date:
2008-11-28

Definition in file eurephiadm.c.


Define Documentation

#define MODULE   "eurephiadm"

Need to define the active module before including argparser.h

Definition at line 49 of file eurephiadm.c.


Function Documentation

char* args2string ( int  argc,
char **  argv 
)

Converts a argument table (char **) into a space separated string (char *)

Parameters:
argc argument counter
argv argument array
Returns:
String (char *) of all arguments, separated by space.

Definition at line 415 of file eurephiadm.c.

Here is the caller graph for this function:

int cmd_Help ( eurephiaCTX ctx,
eurephiaSESSION sess,
eurephiaVALUES cfg,
int  argc,
char **  argv 
)

Displays a generic help screen, if no arguments where given, or else the the help screen for the eurephiadm command if it was found.

Parameters:
ctx eurephiaCTX
sess eurephiaSESSION of the current logged in user
cfg eurephiaVALUES struct of the current configuration
argc argument count for the eurephiadm command
argv argument table for the eurephiadm command
Returns:
returns 0 on success, otherwise 1.

< Need to define the active module before including argparser.h

< Need to define the active module before including argparser.h

Definition at line 98 of file eurephiadm.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int cmd_Logout ( eurephiaCTX ctx,
eurephiaSESSION sess,
eurephiaVALUES cfg,
int  argc,
char **  argv 
)

eurephiadm logout command. Logs out the current active session.

Parameters:
ctx eurephiaCTX
sess eurephiaSESSION of the current logged in user
cfg eurephiaVALUES struct of the current configuration
argc argument count for the logout command
argv argument table for the logout command
Returns:
returns 0 on success, otherwise 1.

< Alias for LOG_FATAL

< Operation failed and cannot continue. Log level always < 2

< Need to define the active module before including argparser.h

< Need to define the active module before including argparser.h

Definition at line 158 of file eurephiadm.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int cmd_ShowCfg ( eurephiaCTX ctx,
eurephiaSESSION sess,
eurephiaVALUES cfg,
int  argc,
char **  argv 
)

eurephiadm show-config command. Dumps configuration to stdout. If the user is logged in, the configuration saved in the database is also dumped.

Parameters:
ctx eurephiaCTX
sess eurephiaSESSION of the current logged in user
cfg eurephiaVALUES struct of the current configuration
argc argument count for the show-config command
argv argument table for the show-config command
Returns:
returns 0 on success, otherwise 1.

Definition at line 202 of file eurephiadm.c.

Here is the caller graph for this function:

static eurephiaSESSION* do_login ( eurephiaCTX ctx,
eurephiaVALUES cfg,
const char *  req_access 
) [static]

Log in a user. The function will ask for user name and password and authenticate the user against the eurephia database and make sure the user is granted access to the requested access level.

Parameters:
ctx eurephiaCTX
cfg eurephiaVALUES with configuration settings
req_access String (const char *) containing the requested access level.
Returns:
Returns a eurephiaSESSION pointer to the authenticated user session on success, otherwise NULL.

< Need to define the active module before including argparser.h

< Alias for LOG_FATAL

< Operation failed and cannot continue. Log level always < 2

< Alias for LOG_FATAL

< Operation failed and cannot continue. Log level always < 2

< Need to define the active module before including argparser.h

Definition at line 278 of file eurephiadm.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int eurephia_ConnectDB ( eurephiaCTX ctx,
const char *  argstr 
)

Establish a connection to the database and register the database connection in the eurephiaCTX

Parameters:
ctx eurephiaCTX
argstr argument string for the database connection
Returns:
Returns 1 on success, otherwise 0.

< Defines the maximum arguments the parsers handles

< Alias for LOG_FATAL

< Operation failed and cannot continue. Log level always < 2

< Defines the maximum arguments the parsers handles

< Alias for LOG_PANIC

< Action failed an program could not continue to run. Log level always 0

Definition at line 236 of file eurephiadm.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void help_Help (  ) 

Wrapper function to be used by the command API in eurephiadm

< Need to define the active module before including argparser.h

Definition at line 79 of file eurephiadm.c.

Here is the call graph for this function:

int main ( int  argc,
char **  argv 
)

eurephiadm main function

Parameters:
argc argument counter
argv argument table
Returns:
returns 0 on success, otherwise a value > 0

< Defines the maximum arguments the parsers handles

< Need to define the active module before including argparser.h

< Defines the maximum arguments the parsers handles

< Alias for LOG_ERROR, in case it is not defined

< API errors but not sever, program can continue to run

< Informational messages. Log level should be < 5

Definition at line 442 of file eurephiadm.c.

Here is the call graph for this function:

char* print_version ( char *  fprg  ) 

Prints version and copyright info to stdout

Parameters:
fprg Full path to binary
Returns:
Returns the basename part of the binary file name

Definition at line 65 of file eurephiadm.c.

Here is the caller graph for this function:

static int validate_session ( eurephiaCTX ctx,
const char *  sesskey,
const char *  accesslvl 
) [static]

Validates an exisiting session key against a requested access level

Parameters:
ctx eurephiaCTX
sesskey String containing the session key
accesslvl String containing the requested access level
Returns:
Returns 1 if session is valid and access level is granted to the session, otherwise 0

< Need to define the active module before including argparser.h

Definition at line 373 of file eurephiadm.c.

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines