1
0

Source code upload

This commit is contained in:
calmsacibis995
2022-09-29 17:59:04 +03:00
parent 72fa9da3d7
commit 8fc8fa8089
33399 changed files with 11964078 additions and 0 deletions
@@ -0,0 +1,40 @@
#!smake
#
#
SRC_DEPTH = ../../..
include $(ROOT)/usr/include/make/commondefs
include $(SRC_DEPTH)/include/ssscommondefs
LOCALINCS = -nostdinc -I$(ROOT)/usr/include/sss -I$(ROOT)/usr/include \
-I../include
LLDLIBS= -delay_load -lssdb -lSSC -leventmon
OBJECT_STYLE=N32
LCDEFS =
LCOPTS =
LCINCS = $(LOCALINCS)
CFILES = uiserver.c uiactions.c uievents.c uielements.c uireports.c uiarchive.c
LD_QUICKSTART_INFO=
COMMONPREF = SSS
LIBPATH = /usr/lib32/internal
TARGETS = libsemserver.so
IDB_TAG=-idb $(SSS_EOE)
default: $(TARGETS)
include $(COMMONRULES)
clobber clean:
rm -f *.o $(TARGETS)
rm -f *.so so_locations Makedepend
libsemserver.so: $(OBJECTS)
cc $(OBJECTS) ../semd_config/semd_config.o \
$(LDFLAGS) -shared -all -soname $@ \
-exports_file $(ROOT)/usr/include/sss/rgPluginServer.export \
-o $@ -g -woff 1048 -no_unresolved
install: default
${INSTALL} $(IDB_TAG) -F $(LIBPATH) $(TARGETS)
@@ -0,0 +1,241 @@
#ifndef H_UI_H
#define H_UI_H
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <ssdbapi.h>
#include <ssdberr.h>
#include <sys/types.h>
#include <pwd.h>
#include <stddef.h>
#include "rgPluginAPI.h"
#include "sscHTMLGen.h"
#include "sscPair.h"
#include <time.h>
#include <eventmonapi.h>
#include <sys/stat.h>
#define START 0
#define END 1
#define MAXNUMBERS_OF_KEYS 512
#define MAX_ACTIONS 512
#define MAX_CLASSES 512
#define CHARTYPE 0
#define INTTYPE 1
#define HTMLHEAD 1
#define NOHEAD 0
/* --------------------------------------------------------------------------- */
#ifdef __TIME__
#ifdef __DATE__
#define INCLUDE_TIME_DATE_STRINGS 1
#endif
#endif
/* --------------------------------------------------------------------------- */
#define MYVERSION_MAJOR 1 /* Report Generator PlugIn Major Version number */
#define MYVERSION_MINOR 0 /* Report Generator PlugIn Minor Version number */
/* --------------------------------------------------------------------------- */
/* globals for parsing input */
static char szDefaultUserName[] = ""; /* Default user name */
static char szDefaultPassword[] = ""; /* Default password */
static char szDefaultHostName[] = "localhost"; /* Default host name */
static char szDefaultDatabaseName[] = "ssdb"; /* Default db name */
enum REQUEST {
ACTIONLIST=1, /* Creates an action list */
EVENTLIST, /* Creates an event list */
TYPELIST, /* Creates a tyelist */
MULTISELECT, /* Flag for single select or multiselect */
UPDATEACTION, /* Creates the update action screen with values loaded. If multiselect, new entry screen */
UPDTACTCONFIRM, /* Creates the action screen with values loaded for confirmation. */
RETURNHOSTNAME, /* Returns the hostname */
GETSYSID, /* Returns the sysid */
GETSYSID_UNHID,
DELETEACTION, /* Delete an action screen */
DELETELISTSET, /* Set of events from which action will be deleted */
SETUPDATE, /* Seup screen for update events if MULTISELECT = 1 or entry screen for events if 0 */
UPDATE_EVENT, /* Update the event after getting new parameters */
EVENT_ADD_PAGE,
EVENT_VIEW_PAGE,
EVENT_VIEW_PAGE_CONT,
EVENT_VIEW_CLASS_PAGE_CONT,
EVENT_VIEW_TYPE_PAGE,
EVENT_VIEW_REPORT_PAGE,
EVENT_REPORT_PAGE,
EVREPORT_CONT,
CLASSREPORT_CONT,
TYPEREPORT_CONT,
EVENT_ADD_INFO,
EVENT_REPORT_BY_HOST,
EVENT_REPORT_TYPE_PAGE,
EVENT_REPORT_BY_TYPE_HOST,
EVENT_REPORT_BY_CLASS_HOST,
EVENT_ADD_CONFIRM,
EVENT_UPDT_INFO,
EVENT_UPDT_CONFIRM,
EVENT_UPDATE_ACTION_LIST,
EVENT_ACTION_AUD,
EVENT_ACTION_ADD_CONFIRM,
EVENT_ACTION_UPD_CONFIRM,
EVENT_DELETE,
EVENT_DELETE_LIST,
CREATE_CLASS_LIST,
ACTION_REPORT_BY_ACTION,
ACTIONS_PAGE,
ACTION_VIEW_CONT,
EVENT_ACTION_SPECIFIC_REPORT,
EVENT_ACTIONS_PAGE,
ACTION_TAKEN_REPORT,
ARCHIVE_LIST,
DELETE_ARCHIVE,
ARCHIVE_TABLE
};
/* Local "Session" structure */
typedef struct sss_s_MYSESSION {
unsigned long signature; /* sizeof(mySession) */
struct sss_s_MYSESSION *next; /* next pointer */
int textonly; /* text mode only flag */
int report_type;
} mySession;
static char myTitle[] = "Event Reports";
static const char myLogo[] = "System Event Manager Plugin Server";
static const char szVersion[] = "Version";
static const char szTitle[] = "Title";
static const char szThreadSafe[] = "ThreadSafe";
static const char szUnloadable[] = "Unloadable";
static const char szUnloadTime[] = "UnloadTime";
static const char szAcceptRawCmdString[] = "AcceptRawCmdString"; /* Obligatory attribute name: how plugin will process cmd parameters */
static char szServerNameErrorPrefix[] = "SSS WEB Config Server Error: %s";
static char szVersionStr[64];
static pthread_mutex_t seshFreeListmutex;
static const char szUnloadTimeValue[] = "120"; /* Unload time for this plug in (sec.) */
static const char szThreadSafeValue[] = "0"; /* "Thread Safe" flag value - this plugin is thread safe */
static const char szUnloadableValue[] = "1"; /* "Unloadable" flag value - RG core might unload this plugin from memory */
static const char szAcceptRawCmdStringValue[] = "1"; /* RG server accept "raw" command string like key=value&key2=value&... */
static const char szUserAgent[] = "User-Agent";
static int volatile mutex_inited = 0; /* seshFreeListmutex mutex inited flag */
static mySession *sesFreeList = 0; /* Session free list */
/* UI elements */
void create_action_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle, CMDPAIR *cmdp);
void create_type_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void create_event_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
/* Setup > actions */
void action_parameters(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void update_action_params(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
int deletelistset(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void get_event_set_update(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle);
void delete_action(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void update_eventsetup(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle);
void generate_hostname(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle);
void generate_sysid(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle);
void generate_sysid_unhidden(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle);
int getnumrecords (sscErrorHandle hError,ssdb_Error_Handle error_handle,ssdb_Request_Handle req_handle);
/* Reports */
void event_report_by_host(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_report_by_class_host(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
int generate_system_info(sscErrorHandle hError , mySession *session,char *sysid,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle);
void event_reports_specific(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_reports_byclass(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp,int event_select);
void event_report_type_page(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
/* Action reports */
void event_actions_page(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_action_report(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_action_specific_report(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void view_action_page(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void action_report_by_action(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void view_action_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
/* Event setup */
void event_view_page(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_description_view(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_description_class(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_view_configuration(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_view_type_configuration(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_view_report_page(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_add_page(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle);
void event_add_info(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_add_confirm(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_updt_info(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_updt_confirm(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_update_action_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_action_delete(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_action_add(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_action_update(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_action_update_confirm(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void create_custom_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void delete_event(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void event_delete(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void delete_class(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void archive_db_confirm(mySession *session, char *name,int type);
void archive_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void delete_archive(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
void generate_class_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection, ssdb_Error_Handle error_handle);
void drop_temp_table(sscErrorHandle hError,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle);
void archive_table(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp);
/* utility functions */
int read_java_scritps(const char *screen_name,const char *screen_end);
long maketime(const char *dateval,int startend);
void makedate (time_t timeval, char *dateout, char *event_time);
void print_error(void);
void create_help(sscErrorHandle hError,char *helpfile);
int get_variable(sscErrorHandle hError,CMDPAIR *cmdp,int type, char *varname,char *string,int *intval,int errornum);
#endif /* endif H_UI_H */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,291 @@
#include "ui.h"
#include <errno.h>
void archive_db_confirm(mySession *session, char *name, int type)
{
if ( session->textonly == 0 )
{
Body("<html><head><title>SGI Embedded Support Partner - ver.1.0</title>\n");
Body("<body bgcolor=\"#E3E6D8\">\n");
TableBegin("border=0 cellpadding=0 cellspacing=0 width=100%");
RowBegin("");
CellBegin("bgcolor=\"#C7CDB5\" width=\"15\"");
Body("&nbsp;&nbsp;&nbsp;&nbsp;\n");
CellEnd();
CellBegin("bgcolor=\"#C7CDB5\"");
Body("Archive Database\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("colspan=2");
Body("&nbsp;<p>&nbsp;\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("");
Body("&nbsp;\n");
CellEnd();
CellBegin("");
FormatedBody("Archive <b>%s</b> was successfully removed.",name);
CellEnd();
RowEnd();
TableEnd();
Body("</body></html>\n");
}
else
{
Body("<html><head><title>SGI Embedded Support Partner - ver.1.0</title>\n");
Body("<body bgcolor=\"#E3E6D8\">\n");
Body("<pre> Archive Database</pre>\n");
Body("<hr width=100%>\n");
FormatedBody("<p>Archive <b>%s</b> was successfully removed.",name);
Body("</body></html>\n");
}
}
void archive_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
const char **vector;
int number_of_records,rec_sequence;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select arc_id,dbname,startdate,enddate from archive_list order by arc_id")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if((number_of_records = getnumrecords(hError,error_handle,req_handle)) > 0)
{
if ( session->textonly == 0 )
{
Body("Choose the database to be deleted:&nbsp;\n");
Body("<select name=\"ssdbs\">\n");
Body("<option value=0>Database Archive Name(s)\n");
}
else
{
Body("Choose the database to be deleted:\n");
Body("<p><select name=\"ssdbs\">\n");
Body("<option value=0>Database Archive Name(s)\n\n");
}
for (rec_sequence=0; rec_sequence < number_of_records; rec_sequence++)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
FormatedBody("<option value=\"%s\">%s (%s - %s)\n",vector[1],vector[1],vector[2],vector[3]);
}
ssdbFreeRequest(error_handle,req_handle);
Body("</select>\n");
Body("<p><INPUT TYPE=\"SUBMIT\" VALUE=\" Delete Database \">\n");
}
else
{
if ( session->textonly == 0 )
{
Body("<b>There are no archives at this time.</b>\n");
}
else
{
Body("<p>There are no archives at this time.\n");
}
}
}
void archive_table(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
const char **vector;
int number_of_records,rec_sequence;
char startdate[40],event_time[16],enddate[40];
if ( session->textonly == 0 )
{
TableBegin("border=4 cellpadding=6 cellspacing=1");
RowBegin("align=center");
CellBegin("colspan=2 ");
Body("<b>Database Name</b>\n");
CellEnd();
CellBegin("");
Body("<b>Start Date</b>\n");
CellEnd();
CellBegin("");
Body("<b>End Date</b>\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("");
Body("<input type=\"radio\" name=\"dbname\" value=\"ssdb\" checked>\n");
CellEnd();
CellBegin("");
Body("Active Database\n");
CellEnd();
CellBegin("");
}
else
{
Body("<p><pre>\n");
FormatedBody(" -------------------------------------------------------\n");
FormatedBody(" | Database Name | Start Date | End Date |\n");
FormatedBody(" |-----------------------------------------------------|\n");
FormatedBody(" |<input type=\"radio\" name=\"dbname\" value=\"ssdb\"> | Active Database |");
}
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select event_start from event where event_id=1")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if((number_of_records = getnumrecords(hError,error_handle,req_handle)) > 0)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
{
makedate(atoi(vector[0]),startdate,event_time);
if ( session->textonly == 0 )
FormatedBody("%s",startdate);
else
FormatedBody(" %-10.10s |",startdate);
}
else
{
if ( session->textonly == 0 )
Body("Current \n");
else
FormatedBody(" Current |");
}
}
else
{
if ( session->textonly == 0 )
Body("Current \n");
else
FormatedBody(" Current |");
}
ssdbFreeRequest(error_handle,req_handle);
if ( session->textonly == 0 )
{
CellEnd();
CellBegin("");
Body("Current\n");
CellEnd();
RowEnd();
}
else
{
FormatedBody(" Current |\n");
}
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select arc_id,dbname,startdate,enddate from archive_list order by arc_id")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if((number_of_records = getnumrecords(hError,error_handle,req_handle)) > 0)
{
for(rec_sequence = 0; rec_sequence < number_of_records; rec_sequence++)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
{
if ( session->textonly == 0 )
{
RowBegin("");
CellBegin("");
FormatedBody("<input type=\"radio\" name=\"dbname\" value=\"%s\">",vector[1]);
CellEnd();
CellBegin("");
FormatedBody("%s",vector[1]);
CellEnd();
CellBegin("");
FormatedBody("%s",vector[2]);
CellEnd();
CellBegin("");
FormatedBody("%s",vector[3]);
CellEnd();
RowEnd();
}
else
{
FormatedBody(" |-----------------------------------------------------|\n");
FormatedBody(" |<input type=\"radio\" name=\"dbname\" value=\"%s\"> |",vector[1]);
FormatedBody(" %-15.15s |",vector[1]);
FormatedBody(" %-10.10s |",vector[2]);
FormatedBody(" %-10.10s |\n",vector[3]);
}
}
}
ssdbFreeRequest(error_handle,req_handle);
}
if ( session->textonly == 0 )
{
TableEnd();
}
else
{
FormatedBody(" -------------------------------------------------------</pre>\n");
}
}
void delete_archive(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
const char **vector;
int number_of_records,rec_sequence,common_int;
char dbnames[80];
if(!get_variable(hError,cmdp,CHARTYPE,"ssdbs",dbnames,&common_int,1000))
return;
/* We are going to delete archive logicaly */
req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_DELETE,
"delete from archive_list where dbname='%s'",dbnames);
if ( req_handle == NULL )
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
ssdbFreeRequest(error_handle,req_handle);
/* Then physicaly */
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_DROPDATABASE,
"drop database if exists %s",dbnames)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
ssdbFreeRequest(error_handle,req_handle);
/* Then References */
req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_DELETE,
"delete from mysql.db where Db='%s'",dbnames);
if ( req_handle == NULL )
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
ssdbFreeRequest(error_handle,req_handle);
req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_DELETE,
"delete from mysql.host where Db='%s'",dbnames);
if (req_handle == NULL )
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
ssdbFreeRequest(error_handle,req_handle);
system("/usr/sbin/ssdbadmin reload");
archive_db_confirm(session,dbnames,0);
}
@@ -0,0 +1,291 @@
#include "ui.h"
#include <errno.h>
void archive_db_confirm(mySession *session, char *name, int type)
{
if ( session->textonly == 0 )
{
@ <html><head><title>SGI Embedded Support Partner - ver.1.0</title>
@ <body bgcolor="#E3E6D8">
@table border=0 cellpadding=0 cellspacing=0 width=100%
@row
@cell bgcolor="#C7CDB5" width="15"
@ &nbsp;&nbsp;&nbsp;&nbsp;
@endcell
@cell bgcolor="#C7CDB5"
@ Archive Database
@endcell
@endrow
@row
@cell colspan=2
@ &nbsp;<p>&nbsp;
@endcell
@endrow
@row
@cell
@ &nbsp;
@endcell
@cell
@format "Archive <b>%s</b> was successfully removed." name
@endcell
@endrow
@endtable
@ </body></html>
}
else
{
@ <html><head><title>SGI Embedded Support Partner - ver.1.0</title>
@ <body bgcolor="#E3E6D8">
@ <pre> Archive Database</pre>
@ <hr width=100%>
@format "<p>Archive <b>%s</b> was successfully removed." name
@ </body></html>
}
}
void archive_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
const char **vector;
int number_of_records,rec_sequence;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select arc_id,dbname,startdate,enddate from archive_list order by arc_id")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if((number_of_records = getnumrecords(hError,error_handle,req_handle)) > 0)
{
if ( session->textonly == 0 )
{
@ Choose the database to be deleted:&nbsp;
@ <select name="ssdbs">
@ <option value=0>Database Archive Name(s)
}
else
{
@ Choose the database to be deleted:
@ <p><select name="ssdbs">
@ <option value=0>Database Archive Name(s)\n
}
for (rec_sequence=0; rec_sequence < number_of_records; rec_sequence++)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
@format "<option value=\"%s\">%s (%s - %s)\n" vector[1] vector[1] vector[2] vector[3]
}
ssdbFreeRequest(error_handle,req_handle);
@ </select>
@ <p><INPUT TYPE="SUBMIT" VALUE=" Delete Database ">
}
else
{
if ( session->textonly == 0 )
{
@ <b>There are no archives at this time.</b>
}
else
{
@ <p>There are no archives at this time.
}
}
}
void archive_table(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
const char **vector;
int number_of_records,rec_sequence;
char startdate[40],event_time[16],enddate[40];
if ( session->textonly == 0 )
{
@table border=4 cellpadding=6 cellspacing=1
@row align=center
@cell colspan=2
@ <b>Database Name</b>
@endcell
@cell
@ <b>Start Date</b>
@endcell
@cell
@ <b>End Date</b>
@endcell
@endrow
@row
@cell
@ <input type="radio" name="dbname" value="ssdb" checked>
@endcell
@cell
@ Active Database
@endcell
@cell
}
else
{
@ <p><pre>
@format " -------------------------------------------------------\n"
@format " | Database Name | Start Date | End Date |\n"
@format " |-----------------------------------------------------|\n"
@format " |<input type=\"radio\" name=\"dbname\" value=\"ssdb\"> | Active Database |"
}
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select event_start from event where event_id=1")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if((number_of_records = getnumrecords(hError,error_handle,req_handle)) > 0)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
{
makedate(atoi(vector[0]),startdate,event_time);
if ( session->textonly == 0 )
@format "%s" startdate
else
@format " %-10.10s |" startdate
}
else
{
if ( session->textonly == 0 )
@ Current
else
@format " Current |"
}
}
else
{
if ( session->textonly == 0 )
@ Current
else
@format " Current |"
}
ssdbFreeRequest(error_handle,req_handle);
if ( session->textonly == 0 )
{
@endcell
@cell
@ Current
@endcell
@endrow
}
else
{
@format " Current |\n"
}
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select arc_id,dbname,startdate,enddate from archive_list order by arc_id")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if((number_of_records = getnumrecords(hError,error_handle,req_handle)) > 0)
{
for(rec_sequence = 0; rec_sequence < number_of_records; rec_sequence++)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
{
if ( session->textonly == 0 )
{
@row
@cell
@format "<input type=\"radio\" name=\"dbname\" value=\"%s\">" vector[1]
@endcell
@cell
@format "%s" vector[1]
@endcell
@cell
@format "%s" vector[2]
@endcell
@cell
@format "%s" vector[3]
@endcell
@endrow
}
else
{
@format " |-----------------------------------------------------|\n"
@format " |<input type=\"radio\" name=\"dbname\" value=\"%s\"> |" vector[1]
@format " %-15.15s |" vector[1]
@format " %-10.10s |" vector[2]
@format " %-10.10s |\n" vector[3]
}
}
}
ssdbFreeRequest(error_handle,req_handle);
}
if ( session->textonly == 0 )
{
@endtable
}
else
{
@format " -------------------------------------------------------</pre>\n"
}
}
void delete_archive(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
const char **vector;
int number_of_records,rec_sequence,common_int;
char dbnames[80];
if(!get_variable(hError,cmdp,CHARTYPE,"ssdbs",dbnames,&common_int,1000))
return;
/* We are going to delete archive logicaly */
req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_DELETE,
"delete from archive_list where dbname='%s'",dbnames);
if ( req_handle == NULL )
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
ssdbFreeRequest(error_handle,req_handle);
/* Then physicaly */
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_DROPDATABASE,
"drop database if exists %s",dbnames)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
ssdbFreeRequest(error_handle,req_handle);
/* Then References */
req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_DELETE,
"delete from mysql.db where Db='%s'",dbnames);
if ( req_handle == NULL )
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
ssdbFreeRequest(error_handle,req_handle);
req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_DELETE,
"delete from mysql.host where Db='%s'",dbnames);
if (req_handle == NULL )
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
ssdbFreeRequest(error_handle,req_handle);
system("/usr/sbin/ssdbadmin reload");
archive_db_confirm(session,dbnames,0);
}
@@ -0,0 +1,567 @@
#include "ui.h"
void create_event_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
int number_of_records,rec_sequence,common_int;
const char **vector;
int key;
char sys_id[32];
if(!get_variable(hError,cmdp,CHARTYPE,"sys_id",sys_id,&common_int,200))
return;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select distinct class_id,class_desc from event_class where sys_id = '%s' order by class_desc",sys_id)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
Body("<b>There are no events in the database.</b>\n");
ssdbFreeRequest(error_handle,req_handle);
return ;
}
else
{
Body("<select name=ev_class size=5>\n");
for (rec_sequence = 0; rec_sequence < number_of_records; rec_sequence++)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
FormatedBody("<option value = %d>%s",atoi(vector[0]),vector[1]);
}
Body("</select><p><INPUT TYPE=\"SUBMIT\" VALUE=\" Accept \">\n");
}
ssdbFreeRequest(error_handle,req_handle);
}
void create_action_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
int number_of_records,rec_sequence;
const char **vector;
int action_id,key,multiselect;
char common_string[2];
if(!get_variable(hError,cmdp,INTTYPE,"multiselect",common_string,&multiselect,201))
return;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select action_id,action_desc from event_action where private = 0 order by action_desc")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
Body("<b>There are no actions in the database.</b>\n");
ssdbFreeRequest(error_handle,req_handle);
return ;
}
else
{
if (multiselect)
Body("<select name=actionid multiple size=5>\n");
else
Body("<select name=actionid size=5>\n");
for (rec_sequence = 0; rec_sequence < number_of_records; rec_sequence++)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
FormatedBody("<option value = %d > %s",atoi(vector[0]),vector[1]);
}
Body("</select>\n");
Body("<p> <input type = \"submit\" value = \" Accept \">\n");
}
ssdbFreeRequest(error_handle,req_handle);
}
void create_type_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
int number_of_records,rec_sequence;
const char **vector;
int action_id,key,multiselect,selectvar,classidtype,common_int;
char class_desc[80],sys_id[32],common_string[2];
classidtype = 0;
if(!get_variable(hError,cmdp,CHARTYPE,"sys_id",sys_id,&common_int,202))
return;
if(!get_variable(hError,cmdp,INTTYPE,"multiselect",common_string,&multiselect,203))
return;
if ((key = sscFindPairByKey(cmdp,0,"ev_class")) < 0)
{
if ((key = sscFindPairByKey(cmdp,0,"actionid")) < 0)
{
sscError(hError,"Invalid Request Parameter1\n");
return;
}
if (sscanf(cmdp[key].value,"%d",&selectvar) != 1)
{
sscError(hError,"Invalid Request Parameter2\n");
return;
}
}
else
{
if (sscanf(cmdp[key].value,"%d",&selectvar) != 1)
{
sscError(hError,"Invalid Request Parameter\n");
return;
}
classidtype = 1;
}
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select class_desc from event_class where class_id = %d and sys_id='%s'",selectvar,sys_id)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
Body("<b>The event class description could not be read</b>\n");
ssdbFreeRequest(error_handle,req_handle);
return ;
}
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
strcpy(class_desc,vector[0]);
else
strcpy(class_desc,"Unknown");
ssdbFreeRequest(error_handle,req_handle);
if (classidtype)
{
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select distinct type_id,type_desc from event_type where class_id = %d and sys_id='%s' order by type_desc",selectvar,sys_id)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
}
else
{
if(!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select DISTINCT event_class.class_id, event_class.class_desc,"
"event_type.type_id, event_type.type_desc "
"from event_class,event_type,event_actionref "
"where event_actionref.action_id = %d "
"and event_type.type_id = event_actionref.type_id "
"and event_class.class_id = event_type.class_id "
"and event_class.sys_id = '%s' "
"and event_type.sys_id = '%s' "
"and event_actionref.sys_id = '%s' "
"order by event_class.class_id, event_type.type_id",selectvar,sys_id,sys_id,sys_id)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
Body("<b>There are no events in the database.</b>\n");
ssdbFreeRequest(error_handle,req_handle);
return ;
}
else
{
FormatedBody("Choose an event from class <b>%s</b>:<p>",class_desc);
if (multiselect)
Body("<select name=event_type multiple size=10>\n");
else
Body("<select name=event_type size=10>\n");
for (rec_sequence = 0; rec_sequence < number_of_records; rec_sequence++)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
{
if (classidtype)
FormatedBody("<option value = %d > %s",atoi(vector[0]),vector[1]);
else
FormatedBody("<option value = %d > %s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%s",atoi(vector[2]),vector[1],vector[3]);
}
}
Body("</select>\n");
Body("<p><input type = \"submit\" value = \" Accept \">\n");
ssdbFreeRequest(error_handle,req_handle);
}
}
void generate_hostname(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle)
{
ssdb_Request_Handle req_handle;
int number_of_records;
const char **vector;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select hostname from system where active = 1 and local = 1")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
Body("<b>There are no records in the database.</b>\n");
ssdbFreeRequest(error_handle,req_handle);
return ;
}
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
FormatedBody("%s",vector[0]);
ssdbFreeRequest(error_handle,req_handle);
}
void generate_sysid(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle)
{
ssdb_Request_Handle req_handle;
int number_of_records;
const char **vector;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select sys_id from system where active = 1 and local = 1")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
Body("<b>There are no records in the database.</b>\n");
ssdbFreeRequest(error_handle,req_handle);
return;
}
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
FormatedBody("<input type=\"hidden\" name=sys_id value=%s>",vector[0]);
ssdbFreeRequest(error_handle,req_handle);
}
void generate_sysid_unhidden(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle)
{
ssdb_Request_Handle req_handle;
int number_of_records;
const char **vector;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select sys_id from system where active = 1 and local = 1")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
Body("<b>There are no records in the database.</b>\n");
ssdbFreeRequest(error_handle,req_handle);
return;
}
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
FormatedBody("%s",vector[0]);
ssdbFreeRequest(error_handle,req_handle);
}
int read_java_scritps(const char *screen_name,const char *screen_end)
{
FILE *fp;
char buffer[256];
fp = fopen("/var/esp/ssc/javascripts","r");
if ( fp == NULL )
return 0;
memset(buffer,0,256);
while (strcasecmp(buffer,screen_name) && !feof(fp))
{
fgets(buffer,256,fp);
buffer[strlen(buffer)-1] = '\0';
}
if (feof(fp))
return 0;
fgets(buffer,256,fp);
buffer[strlen(buffer)-1] = '\0';
while (strcasecmp(buffer,screen_end))
{
FormatedBody("%s\n",buffer);
fgets(buffer,256,fp);
buffer[strlen(buffer)-1] = '\0';
}
fclose(fp);
return 1;
}
int getnumrecords (sscErrorHandle hError,ssdb_Error_Handle error_handle,ssdb_Request_Handle req_handle)
{
int number_of_records;
number_of_records = ssdbGetNumRecords(error_handle,req_handle);
if(ssdbGetLastErrorCode(error_handle) != SSDBERR_SUCCESS)
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return 0;
}
return number_of_records;
}
void create_help(sscErrorHandle hError,char *helpfile)
{
int fd;
char buffer[1024];
memset(buffer,0,1024);
unlink("/var/esp/ssc/help.html");
if ((fd = open("/var/esp/ssc/help.html",O_CREAT | O_RDWR,0777)) < 0)
return;
sprintf(buffer,"<html> <head> <title>SGI Embedded Support Partner - Help</title></head>\n"
"<frameset cols=\"170,*\" border=0>\n"
"<frame src=\"/help_navigator.html\" name=\"help_index\" scrolling=\"auto\"\n"
"marginheight=8 marginwidth=8 border=0 frameborder=0 framespacing=0>\n"
"<frame src=\"/help_contents.html#%s\" name=\"help_main\"\n"
"scrolling=\"auto\" marginheight=8 marginwidth=8 border=0 frameborder=0 framespacing=0>\n"
"<noframes>\n"
"<body bgcolor=\"#FFFFFF\">Your browser does not support frames. "
"Please install a browser that supports frames.\n"
"</body>\n"
"</noframes>\n"
"</frameset> </html>\n",helpfile);
write(fd,buffer,strlen(buffer));
close(fd);
}
int get_variable(sscErrorHandle hError,CMDPAIR *cmdp,int type, char *varname,char *string,int *intval,int errornum)
{
int key;
if ((key = sscFindPairByKey(cmdp,0,varname)) < 0)
{
Body("<HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>\n");
Body("<body bgcolor=\"#ffffcc\">\n");
TableBegin("border=0 cellpadding=0 cellspacing=0 width=100%");
RowBegin("");
CellBegin("bgcolor=\"#cccc99\" width=15");
Body("&nbsp;&nbsp;&nbsp;&nbsp;\n");
CellEnd();
CellBegin("bgcolor=\"#cccc99\"");
Body("<B>SERVER ERROR</B>\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("colspan=2");
Body("&nbsp;<p>&nbsp;\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("");
Body("&nbsp;\n");
CellEnd();
CellBegin("");
FormatedBody("System event manager plugin server error. Error #: %d",errornum);
CellEnd();
RowEnd();
TableEnd();
Body("</body></html>\n");
return 0;
}
if(type)
{
if (sscanf(cmdp[key].value,"%d",intval) != 1)
{
Body("<HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>\n");
Body("<body bgcolor=\"#ffffcc\">\n");
TableBegin("border=0 cellpadding=0 cellspacing=0 width=100%");
RowBegin("");
CellBegin("bgcolor=\"#cccc99\" width=15");
Body("&nbsp;&nbsp;&nbsp;&nbsp;\n");
CellEnd();
CellBegin("bgcolor=\"#cccc99\"");
Body("<B>SERVER ERROR</B>\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("colspan=2");
Body("&nbsp;<p>&nbsp;\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("");
Body("&nbsp;\n");
CellEnd();
CellBegin("");
FormatedBody("System event manager plugin server error. Error #: %d",errornum);
CellEnd();
RowEnd();
TableEnd();
Body("</body></html>\n");
return 0;
}
}
else
{
if (cmdp[key].value && cmdp[key].value[0])
strcpy(string,cmdp[key].value);
else
{
Body("<HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>\n");
Body("<body bgcolor=\"#ffffcc\">\n");
TableBegin("border=0 cellpadding=0 cellspacing=0 width=100%");
RowBegin("");
CellBegin("bgcolor=\"#cccc99\" width=15");
Body("&nbsp;&nbsp;&nbsp;&nbsp;\n");
CellEnd();
CellBegin("bgcolor=\"#cccc99\"");
Body("<B>SERVER ERROR</B>\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("colspan=2");
Body("&nbsp;<p>&nbsp;\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("");
Body("&nbsp;\n");
CellEnd();
CellBegin("");
FormatedBody("System event manager plugin server error. Error #: %d",errornum);
CellEnd();
RowEnd();
TableEnd();
Body("</body></html>\n");
return 0;
}
}
return 1;
}
int get_variable_variable(sscErrorHandle hError,CMDPAIR *cmdp,int type, char *varname,char *string,int *intval,int errornum)
{
int key;
if ((key = sscFindPairByKey(cmdp,0,varname)) < 0)
{
Body("<HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>\n");
Body("<body bgcolor=\"#ffffcc\">\n");
TableBegin("border=0 cellpadding=0 cellspacing=0 width=100%");
RowBegin("");
CellBegin("bgcolor=\"#cccc99\" width=15");
Body("&nbsp;&nbsp;&nbsp;&nbsp;\n");
CellEnd();
CellBegin("bgcolor=\"#cccc99\"");
Body("<B>SERVER ERROR</B>\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("colspan=2");
Body("&nbsp;<p>&nbsp;\n");
CellEnd();
RowEnd();
RowBegin("");
CellBegin("");
Body("&nbsp;\n");
CellEnd();
CellBegin("");
FormatedBody("System event manager plugin server error. Error #: %d",errornum);
CellEnd();
RowEnd();
TableEnd();
Body("</body></html>\n");
return 0;
}
if(type)
{
if (sscanf(cmdp[key].value,"%d",intval) != 1)
{
return -1;
}
}
else
{
if (cmdp[key].value && cmdp[key].value[0])
strcpy(string,cmdp[key].value);
else
strcpy(string,"");
}
return 1;
}
void create_custom_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
int number_of_records,rec_sequence;
const char **vector;
int action_id,key,multiselect,selectvar,classidtype,ev_class,common_int;
char class_desc[80],sys_id[32],common_string[2];
if(!get_variable(hError,cmdp,INTTYPE,"ev_class",common_string,&ev_class,204))
return;
if(!get_variable(hError,cmdp,CHARTYPE,"sys_id",sys_id,&common_int,205))
return;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select class_desc from event_class where class_id = %d and sys_id = '%s'",ev_class,sys_id)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
Body("<b>The event class description could not be read</b>\n");
ssdbFreeRequest(error_handle,req_handle);
return ;
}
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
strcpy(class_desc,vector[0]);
else
strcpy(class_desc,"Unknown");
ssdbFreeRequest(error_handle,req_handle);
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select type_id,type_desc from event_type where class_id = %d and type_id >= 8400000 and sys_id = '%s'",ev_class,sys_id)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
FormatedBody("There are no custom events in the <b>%s</b> class that can be deleted.",class_desc);
ssdbFreeRequest(error_handle,req_handle);
return ;
}
else
{
FormatedBody("Choose event(s) from class <b>%s</b>:<p>",class_desc);
Body("<select name=event_type multiselect size=10>\n");
for (rec_sequence = 0; rec_sequence < number_of_records; rec_sequence++)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
FormatedBody("<option value = %d>%s",atoi(vector[0]),vector[1]);
}
ssdbFreeRequest(error_handle,req_handle);
Body("</select>\n");
Body("<p><input type=\"SUBMIT\" value=\" Accept \">\n");
}
}
@@ -0,0 +1,567 @@
#include "ui.h"
void create_event_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
int number_of_records,rec_sequence,common_int;
const char **vector;
int key;
char sys_id[32];
if(!get_variable(hError,cmdp,CHARTYPE,"sys_id",sys_id,&common_int,200))
return;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select distinct class_id,class_desc from event_class where sys_id = '%s' order by class_desc",sys_id)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
@ <b>There are no events in the database.</b>
ssdbFreeRequest(error_handle,req_handle);
return ;
}
else
{
@ <select name=ev_class size=5>
for (rec_sequence = 0; rec_sequence < number_of_records; rec_sequence++)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
@format "<option value = %d>%s" atoi(vector[0]) vector[1]
}
@ </select><p><INPUT TYPE="SUBMIT" VALUE=" Accept ">
}
ssdbFreeRequest(error_handle,req_handle);
}
void create_action_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
int number_of_records,rec_sequence;
const char **vector;
int action_id,key,multiselect;
char common_string[2];
if(!get_variable(hError,cmdp,INTTYPE,"multiselect",common_string,&multiselect,201))
return;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select action_id,action_desc from event_action where private = 0 order by action_desc")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
@ <b>There are no actions in the database.</b>
ssdbFreeRequest(error_handle,req_handle);
return ;
}
else
{
if (multiselect)
@ <select name=actionid multiple size=5>
else
@ <select name=actionid size=5>
for (rec_sequence = 0; rec_sequence < number_of_records; rec_sequence++)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
@format "<option value = %d > %s" atoi(vector[0]) vector[1]
}
@ </select>
@ <p> <input type = "submit" value = " Accept ">
}
ssdbFreeRequest(error_handle,req_handle);
}
void create_type_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
int number_of_records,rec_sequence;
const char **vector;
int action_id,key,multiselect,selectvar,classidtype,common_int;
char class_desc[80],sys_id[32],common_string[2];
classidtype = 0;
if(!get_variable(hError,cmdp,CHARTYPE,"sys_id",sys_id,&common_int,202))
return;
if(!get_variable(hError,cmdp,INTTYPE,"multiselect",common_string,&multiselect,203))
return;
if ((key = sscFindPairByKey(cmdp,0,"ev_class")) < 0)
{
if ((key = sscFindPairByKey(cmdp,0,"actionid")) < 0)
{
sscError(hError,"Invalid Request Parameter1\n");
return;
}
if (sscanf(cmdp[key].value,"%d",&selectvar) != 1)
{
sscError(hError,"Invalid Request Parameter2\n");
return;
}
}
else
{
if (sscanf(cmdp[key].value,"%d",&selectvar) != 1)
{
sscError(hError,"Invalid Request Parameter\n");
return;
}
classidtype = 1;
}
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select class_desc from event_class where class_id = %d and sys_id='%s'",selectvar,sys_id)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
@ <b>The event class description could not be read</b>
ssdbFreeRequest(error_handle,req_handle);
return ;
}
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
strcpy(class_desc,vector[0]);
else
strcpy(class_desc,"Unknown");
ssdbFreeRequest(error_handle,req_handle);
if (classidtype)
{
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select distinct type_id,type_desc from event_type where class_id = %d and sys_id='%s' order by type_desc",selectvar,sys_id)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
}
else
{
if(!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select DISTINCT event_class.class_id, event_class.class_desc,"
"event_type.type_id, event_type.type_desc "
"from event_class,event_type,event_actionref "
"where event_actionref.action_id = %d "
"and event_type.type_id = event_actionref.type_id "
"and event_class.class_id = event_type.class_id "
"and event_class.sys_id = '%s' "
"and event_type.sys_id = '%s' "
"and event_actionref.sys_id = '%s' "
"order by event_class.class_id, event_type.type_id",selectvar,sys_id,sys_id,sys_id)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
@ <b>There are no events in the database.</b>
ssdbFreeRequest(error_handle,req_handle);
return ;
}
else
{
@format "Choose an event from class <b>%s</b>:<p>" class_desc
if (multiselect)
@ <select name=event_type multiple size=10>
else
@ <select name=event_type size=10>
for (rec_sequence = 0; rec_sequence < number_of_records; rec_sequence++)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
{
if (classidtype)
@format "<option value = %d > %s" atoi(vector[0]) vector[1]
else
@format "<option value = %d > %s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%s" atoi(vector[2]) vector[1] vector[3]
}
}
@ </select>
@ <p><input type = "submit" value = " Accept ">
ssdbFreeRequest(error_handle,req_handle);
}
}
void generate_hostname(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle)
{
ssdb_Request_Handle req_handle;
int number_of_records;
const char **vector;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select hostname from system where active = 1 and local = 1")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
@ <b>There are no records in the database.</b>
ssdbFreeRequest(error_handle,req_handle);
return ;
}
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
@format "%s" vector[0]
ssdbFreeRequest(error_handle,req_handle);
}
void generate_sysid(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle)
{
ssdb_Request_Handle req_handle;
int number_of_records;
const char **vector;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select sys_id from system where active = 1 and local = 1")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
@ <b>There are no records in the database.</b>
ssdbFreeRequest(error_handle,req_handle);
return;
}
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
@format "<input type=\"hidden\" name=sys_id value=%s>" vector[0]
ssdbFreeRequest(error_handle,req_handle);
}
void generate_sysid_unhidden(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,ssdb_Error_Handle error_handle)
{
ssdb_Request_Handle req_handle;
int number_of_records;
const char **vector;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select sys_id from system where active = 1 and local = 1")))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
@ <b>There are no records in the database.</b>
ssdbFreeRequest(error_handle,req_handle);
return;
}
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
@format "%s" vector[0]
ssdbFreeRequest(error_handle,req_handle);
}
int read_java_scritps(const char *screen_name,const char *screen_end)
{
FILE *fp;
char buffer[256];
fp = fopen("/var/esp/ssc/javascripts","r");
if ( fp == NULL )
return 0;
memset(buffer,0,256);
while (strcasecmp(buffer,screen_name) && !feof(fp))
{
fgets(buffer,256,fp);
buffer[strlen(buffer)-1] = '\0';
}
if (feof(fp))
return 0;
fgets(buffer,256,fp);
buffer[strlen(buffer)-1] = '\0';
while (strcasecmp(buffer,screen_end))
{
@format "%s\n" buffer
fgets(buffer,256,fp);
buffer[strlen(buffer)-1] = '\0';
}
fclose(fp);
return 1;
}
int getnumrecords (sscErrorHandle hError,ssdb_Error_Handle error_handle,ssdb_Request_Handle req_handle)
{
int number_of_records;
number_of_records = ssdbGetNumRecords(error_handle,req_handle);
if(ssdbGetLastErrorCode(error_handle) != SSDBERR_SUCCESS)
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return 0;
}
return number_of_records;
}
void create_help(sscErrorHandle hError,char *helpfile)
{
int fd;
char buffer[1024];
memset(buffer,0,1024);
unlink("/var/esp/ssc/help.html");
if ((fd = open("/var/esp/ssc/help.html",O_CREAT | O_RDWR,0777)) < 0)
return;
sprintf(buffer,"<html> <head> <title>SGI Embedded Support Partner - Help</title></head>\n"
"<frameset cols=\"170,*\" border=0>\n"
"<frame src=\"/help_navigator.html\" name=\"help_index\" scrolling=\"auto\"\n"
"marginheight=8 marginwidth=8 border=0 frameborder=0 framespacing=0>\n"
"<frame src=\"/help_contents.html#%s\" name=\"help_main\"\n"
"scrolling=\"auto\" marginheight=8 marginwidth=8 border=0 frameborder=0 framespacing=0>\n"
"<noframes>\n"
"<body bgcolor=\"#FFFFFF\">Your browser does not support frames. "
"Please install a browser that supports frames.\n"
"</body>\n"
"</noframes>\n"
"</frameset> </html>\n",helpfile);
write(fd,buffer,strlen(buffer));
close(fd);
}
int get_variable(sscErrorHandle hError,CMDPAIR *cmdp,int type, char *varname,char *string,int *intval,int errornum)
{
int key;
if ((key = sscFindPairByKey(cmdp,0,varname)) < 0)
{
@ <HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>
@ <body bgcolor="#ffffcc">
@table border=0 cellpadding=0 cellspacing=0 width=100%
@row
@cell bgcolor="#cccc99" width=15
@ &nbsp;&nbsp;&nbsp;&nbsp;
@endcell
@cell bgcolor="#cccc99"
@ <B>SERVER ERROR</B>
@endcell
@endrow
@row
@cell colspan=2
@ &nbsp;<p>&nbsp;
@endcell
@endrow
@row
@cell
@ &nbsp;
@endcell
@cell
@format "System event manager plugin server error. Error #: %d" errornum
@endcell
@endrow
@endtable
@ </body></html>
return 0;
}
if(type)
{
if (sscanf(cmdp[key].value,"%d",intval) != 1)
{
@ <HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>
@ <body bgcolor="#ffffcc">
@table border=0 cellpadding=0 cellspacing=0 width=100%
@row
@cell bgcolor="#cccc99" width=15
@ &nbsp;&nbsp;&nbsp;&nbsp;
@endcell
@cell bgcolor="#cccc99"
@ <B>SERVER ERROR</B>
@endcell
@endrow
@row
@cell colspan=2
@ &nbsp;<p>&nbsp;
@endcell
@endrow
@row
@cell
@ &nbsp;
@endcell
@cell
@format "System event manager plugin server error. Error #: %d" errornum
@endcell
@endrow
@endtable
@ </body></html>
return 0;
}
}
else
{
if (cmdp[key].value && cmdp[key].value[0])
strcpy(string,cmdp[key].value);
else
{
@ <HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>
@ <body bgcolor="#ffffcc">
@table border=0 cellpadding=0 cellspacing=0 width=100%
@row
@cell bgcolor="#cccc99" width=15
@ &nbsp;&nbsp;&nbsp;&nbsp;
@endcell
@cell bgcolor="#cccc99"
@ <B>SERVER ERROR</B>
@endcell
@endrow
@row
@cell colspan=2
@ &nbsp;<p>&nbsp;
@endcell
@endrow
@row
@cell
@ &nbsp;
@endcell
@cell
@format "System event manager plugin server error. Error #: %d" errornum
@endcell
@endrow
@endtable
@ </body></html>
return 0;
}
}
return 1;
}
int get_variable_variable(sscErrorHandle hError,CMDPAIR *cmdp,int type, char *varname,char *string,int *intval,int errornum)
{
int key;
if ((key = sscFindPairByKey(cmdp,0,varname)) < 0)
{
@ <HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE> </HEAD>
@ <body bgcolor="#ffffcc">
@table border=0 cellpadding=0 cellspacing=0 width=100%
@row
@cell bgcolor="#cccc99" width=15
@ &nbsp;&nbsp;&nbsp;&nbsp;
@endcell
@cell bgcolor="#cccc99"
@ <B>SERVER ERROR</B>
@endcell
@endrow
@row
@cell colspan=2
@ &nbsp;<p>&nbsp;
@endcell
@endrow
@row
@cell
@ &nbsp;
@endcell
@cell
@format "System event manager plugin server error. Error #: %d" errornum
@endcell
@endrow
@endtable
@ </body></html>
return 0;
}
if(type)
{
if (sscanf(cmdp[key].value,"%d",intval) != 1)
{
return -1;
}
}
else
{
if (cmdp[key].value && cmdp[key].value[0])
strcpy(string,cmdp[key].value);
else
strcpy(string,"");
}
return 1;
}
void create_custom_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
{
ssdb_Request_Handle req_handle;
int number_of_records,rec_sequence;
const char **vector;
int action_id,key,multiselect,selectvar,classidtype,ev_class,common_int;
char class_desc[80],sys_id[32],common_string[2];
if(!get_variable(hError,cmdp,INTTYPE,"ev_class",common_string,&ev_class,204))
return;
if(!get_variable(hError,cmdp,CHARTYPE,"sys_id",sys_id,&common_int,205))
return;
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select class_desc from event_class where class_id = %d and sys_id = '%s'",ev_class,sys_id)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
@ <b>The event class description could not be read</b>
ssdbFreeRequest(error_handle,req_handle);
return ;
}
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
strcpy(class_desc,vector[0]);
else
strcpy(class_desc,"Unknown");
ssdbFreeRequest(error_handle,req_handle);
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
"select type_id,type_desc from event_type where class_id = %d and type_id >= 8400000 and sys_id = '%s'",ev_class,sys_id)))
{
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
return;
}
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
{
@format "There are no custom events in the <b>%s</b> class that can be deleted." class_desc
ssdbFreeRequest(error_handle,req_handle);
return ;
}
else
{
@format "Choose event(s) from class <b>%s</b>:<p>" class_desc
@ <select name=event_type multiselect size=10>
for (rec_sequence = 0; rec_sequence < number_of_records; rec_sequence++)
{
vector = ssdbGetRow(error_handle,req_handle);
if(vector)
@format "<option value = %d>%s" atoi(vector[0]) vector[1]
}
ssdbFreeRequest(error_handle,req_handle);
@ </select>
@ <p><input type="SUBMIT" value=" Accept ">
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,427 @@
#include "ui.h"
/* ----------------------------- rgpgInit ------------------------------------ */
int RGPGAPI rgpgInit(sscErrorHandle hError)
{ /* Try initialize "free list of mySession" mutex */
if(pthread_mutex_init(&seshFreeListmutex,0))
{ sscError(hError,szServerNameErrorPrefix,"Can't initialize mutex");
return 0; /* error */
}
mutex_inited++;
#ifdef INCLUDE_TIME_DATE_STRINGS
sprintf(szVersionStr,"%d.%d %s %s",MYVERSION_MAJOR,MYVERSION_MINOR,__DATE__,__TIME__);
#else
sprintf(szVersionStr,"%d.%d",MYVERSION_MAJOR,MYVERSION_MINOR);
#endif
return 1; /* success */
}
/* ----------------------------- rgpgDone ------------------------------------ */
int RGPGAPI rgpgDone(sscErrorHandle hError)
{ mySession *s;
if(mutex_inited)
{ pthread_mutex_destroy(&seshFreeListmutex);
mutex_inited = 0;
while((s = sesFreeList) != 0)
{ sesFreeList = s->next;
free(s);
}
return 1; /* success */
}
return 0; /* error - not inited */
}
/* -------------------------- rgpgCreateSesion ------------------------------- */
rgpgSessionID RGPGAPI rgpgCreateSesion(sscErrorHandle hError)
{ mySession *s;
pthread_mutex_lock(&seshFreeListmutex);
if((s = sesFreeList) != 0) sesFreeList = s->next;
pthread_mutex_unlock(&seshFreeListmutex);
if(!s) s = (mySession*)malloc(sizeof(mySession));
if(!s)
{ sscError(hError,szServerNameErrorPrefix,"No memory to create session in rgpgCreateSesion()");
return 0;
}
memset(s,0,sizeof(mySession));
s->signature = sizeof(mySession);
return (rgpgSessionID)s;
}
/* ------------------------- rgpgDeleteSesion -------------------------------- */
void RGPGAPI rgpgDeleteSesion(sscErrorHandle hError,rgpgSessionID _s)
{ mySession *s = (mySession *)_s;
if(!s || s->signature != sizeof(mySession))
{ sscError(hError,szServerNameErrorPrefix,"Incorrect session id in rgpgDeleteSesion()");
}
else
{
pthread_mutex_lock(&seshFreeListmutex);
s->next = sesFreeList; sesFreeList = s; s->signature = 0;
pthread_mutex_unlock(&seshFreeListmutex);
}
}
/* ------------------------ rgpgGetAttribute --------------------------------- */
char *RGPGAPI rgpgGetAttribute(sscErrorHandle hError,rgpgSessionID session, const char *attributeID, const char *extraAttrSpec,int *typeattr)
{ char *s;
if(typeattr) *typeattr = RGATTRTYPE_STATIC;
if(!strcasecmp(attributeID,szVersion)) s = (char*)szVersionStr;
else if(!strcasecmp(attributeID,szTitle)) s = (char*)myLogo;
else if(!strcasecmp(attributeID,szUnloadTime)) s = (char*)szUnloadTimeValue;
else if(!strcasecmp(attributeID,szThreadSafe)) s = (char*)szThreadSafeValue;
else if(!strcasecmp(attributeID,szUnloadable)) s = (char*)szUnloadableValue;
else if(!strcasecmp(attributeID,szAcceptRawCmdString)) s = (char*)szAcceptRawCmdStringValue;
else
{ sscError(hError,"%s No such attribute '%s' in rgpgGetAttribute()",szServerNameErrorPrefix,attributeID);
return 0;
}
if(!s) sscError(hError,szServerNameErrorPrefix,"No memory in rgpgGetAttribute()");
return s;
}
/* --------------------- rgpgFreeAttributeString ------------------------------ */
void RGPGAPI rgpgFreeAttributeString(sscErrorHandle hError,rgpgSessionID session,const char *attributeID,const char *extraAttrSpec,
char *attrString,int restype)
{
if(((restype == RGATTRTYPE_SPECIALALLOC) || (restype == RGATTRTYPE_MALLOCED)) && attrString) free(attrString);
}
/*----------------------------------------rgpgSetAttribute---------------------------------------------*/
void RGPGAPI rgpgSetAttribute(sscErrorHandle hError, rgpgSessionID session, const char *attributeID, const char *extraAttrSpec, const char *value)
{ char buff[128]; mySession *sess = session;
if(!strcasecmp(attributeID,szVersion) || !strcasecmp(attributeID,szTitle) ||
!strcasecmp(attributeID,szThreadSafe) || !strcasecmp(attributeID,szUnloadable) ||
!strcasecmp(attributeID,szUnloadTime))
{ sscError(hError,szServerNameErrorPrefix,"Attempt to set read only attribute in rgpgSetAttribute()");
return;
}
if(!strcasecmp(attributeID,"User-Agent") && value)
{ sess->textonly = (strcasecmp(value,"Lynx") == 0) ? 1 : 0;
return;
}
if(!sess || sess->signature != sizeof(mySession))
{ sscError(hError,szServerNameErrorPrefix,"Incorrect session id in rgpgGetAttribute()");
return;
}
}
/*----------------------------------------rgpgGenerateReport---------------------------------------------*/
int RGPGAPI rgpgGenerateReport(sscErrorHandle hError, rgpgSessionID _session, int argc, char* argv[],char *rawCommandString, streamHandle result,
char *accessmask)
{
ssdb_Client_Handle client;
ssdb_Connection_Handle connection;
ssdb_Request_Handle req_handle;
ssdb_Error_Handle error_handle;
int i,cmdpsize,SQL_TYPE;
CMDPAIR cmdp[MAXNUMBERS_OF_KEYS];
mySession *session = _session;
if ((error_handle = ssdbCreateErrorHandle()) == NULL)
{
sscError(hError,"Database API Error: \"%s\" - can't create error handle\n",ssdbGetLastErrorString(0));
return 0;
}
if ((client = ssdbNewClient(error_handle,szDefaultUserName,szDefaultPassword,0)) == NULL)
{
sscError(hError,"Database API Error: \"%s\" - can't create new client handle\n",ssdbGetLastErrorString(error_handle));
ssdbDeleteErrorHandle(error_handle);
return 0;
}
/* Establish a connection to a database */
if ((connection = ssdbOpenConnection(error_handle,client,szDefaultHostName,szDefaultDatabaseName,0)) == NULL)
{
sscError(hError,"Database API Error: \"%s\" - can't open connection\n",ssdbGetLastErrorString(error_handle));
ssdbDeleteErrorHandle(error_handle);
return 0;
}
/* Initialize The HTML Generator */
i = createMyHTMLGenerator(result);
if (i != 0)
{
sscError(hError, "Sample server: Can't open the HTML generator");
ssdbDeleteErrorHandle(error_handle);
return 0;
}
if (argc < 2)
{
sscError(hError, "Invalid Request\n");
ssdbDeleteErrorHandle(error_handle);
return 0;
}
cmdpsize = sscInitPair(rawCommandString,cmdp,MAXNUMBERS_OF_KEYS);
/* Check WEB browser type (Lynx is only tex based) */
for(i = 0;(i = sscFindPairByKey(cmdp,i,szUserAgent)) >= 0;i++)
if(!strcasecmp(cmdp[i].value,"Lynx")) session->textonly = 1;
/* Utility functions */
if (!strcasecmp(argv[1], "actionlist"))
session->report_type = ACTIONLIST;
else if (!strcasecmp(argv[1],"typelist"))
session->report_type = TYPELIST;
else if (!strcasecmp(argv[1],"eventlist"))
session->report_type = EVENTLIST;
else if (!strcasecmp(argv[1],"GETSYSID"))
session->report_type = GETSYSID;
else if (!strcasecmp(argv[1],"GETSYSID_UNHID"))
session->report_type = GETSYSID_UNHID;
/* Action setup */
else if (!strcasecmp(argv[1],"updateaction"))
session->report_type = UPDATEACTION;
else if (!strcasecmp(argv[1],"updtactconfirm"))
session->report_type = UPDTACTCONFIRM;
else if (!strcasecmp(argv[1],"setupdate"))
session->report_type = SETUPDATE;
else if (!strcasecmp(argv[1],"deleteaction"))
session->report_type = DELETEACTION;
else if (!strcasecmp(argv[1],"UPDATE_EVENT"))
session->report_type = UPDATE_EVENT;
else if (!strcasecmp(argv[1],"RETURNHOSTNAME"))
session->report_type = RETURNHOSTNAME;
else if (!strcasecmp(argv[1],"DELETELISTSET"))
session->report_type = DELETELISTSET;
/* Event Reports */
else if (!strcasecmp(argv[1],"EVENT_REPORT_BY_HOST"))
session->report_type = EVENT_REPORT_BY_HOST;
else if (!strcasecmp(argv[1],"EVENT_REPORT_BY_TYPE_HOST"))
session->report_type = EVENT_REPORT_BY_TYPE_HOST;
else if (!strcasecmp(argv[1],"EVENT_REPORT_PAGE"))
session->report_type = EVENT_REPORT_PAGE;
else if (!strcasecmp(argv[1],"EVENT_REPORT_BY_CLASS_HOST"))
session->report_type = EVENT_REPORT_BY_CLASS_HOST;
else if (!strcasecmp(argv[1],"EVENT_REPORT_TYPE_PAGE"))
session->report_type = EVENT_REPORT_TYPE_PAGE;
else if (!strcasecmp(argv[1],"EVREPORT_CONT"))
session->report_type = EVREPORT_CONT;
else if (!strcasecmp(argv[1],"CLASSREPORT_CONT"))
session->report_type = CLASSREPORT_CONT;
else if (!strcasecmp(argv[1],"TYPEREPORT_CONT"))
session->report_type = TYPEREPORT_CONT;
else if (!strcasecmp(argv[1],"EVENT_VIEW_PAGE_CONT"))
session->report_type = EVENT_VIEW_PAGE_CONT;
else if (!strcasecmp(argv[1],"EVENT_VIEW_CLASS_PAGE_CONT"))
session->report_type = EVENT_VIEW_CLASS_PAGE_CONT;
/* Actions Reports */
else if (!strcasecmp(argv[1],"ACTION_VIEW_CONT"))
session->report_type = ACTION_VIEW_CONT;
else if (!strcasecmp(argv[1],"ACTION_TAKEN_REPORT"))
session->report_type = ACTION_TAKEN_REPORT;
else if (!strcasecmp(argv[1],"ACTION_REPORT_BY_ACTION"))
session->report_type = ACTION_REPORT_BY_ACTION;
else if (!strcasecmp(argv[1],"ACTIONS_PAGE"))
session->report_type = ACTIONS_PAGE;
else if (!strcasecmp(argv[1],"EVENT_ACTION_SPECIFIC_REPORT"))
session->report_type = EVENT_ACTION_SPECIFIC_REPORT;
else if (!strcasecmp(argv[1],"EVENT_ACTIONS_PAGE"))
session->report_type = EVENT_ACTIONS_PAGE;
/* Event Setup */
else if (!strcasecmp(argv[1],"EVENT_VIEW_PAGE"))
session->report_type = EVENT_VIEW_PAGE;
else if (!strcasecmp(argv[1],"EVENT_VIEW_TYPE_PAGE"))
session->report_type = EVENT_VIEW_TYPE_PAGE;
else if (!strcasecmp(argv[1],"EVENT_VIEW_REPORT_PAGE"))
session->report_type = EVENT_VIEW_REPORT_PAGE;
else if (!strcasecmp(argv[1],"EVENT_ADD_INFO"))
session->report_type = EVENT_ADD_INFO;
else if (!strcasecmp(argv[1],"EVENT_ADD_CONFIRM"))
session->report_type = EVENT_ADD_CONFIRM;
else if (!strcasecmp(argv[1],"CREATE_CLASS_LIST"))
session->report_type = CREATE_CLASS_LIST;
else if (!strcasecmp(argv[1],"EVENT_UPDT_INFO"))
session->report_type = EVENT_UPDT_INFO;
else if (!strcasecmp(argv[1],"EVENT_UPDT_CONFIRM"))
session->report_type = EVENT_UPDT_CONFIRM;
else if (!strcasecmp(argv[1],"EVENT_UPDATE_ACTION_LIST"))
session->report_type = EVENT_UPDATE_ACTION_LIST;
else if (!strcasecmp(argv[1],"EVENT_ACTION_AUD"))
session->report_type = EVENT_ACTION_AUD;
else if (!strcasecmp(argv[1],"EVENT_ACTION_ADD_CONFIRM"))
session->report_type = EVENT_ACTION_ADD_CONFIRM;
else if (!strcasecmp(argv[1],"EVENT_ACTION_UPD_CONFIRM"))
session->report_type = EVENT_ACTION_UPD_CONFIRM;
else if (!strcasecmp(argv[1],"EVENT_DELETE"))
session->report_type = EVENT_DELETE;
else if (!strcasecmp(argv[1],"EVENT_DELETE_LIST"))
session->report_type = EVENT_DELETE_LIST;
else if (!strcasecmp(argv[1],"ARCHIVE_LIST"))
session->report_type = ARCHIVE_LIST;
else if (!strcasecmp(argv[1],"DELETE_ARCHIVE"))
session->report_type = DELETE_ARCHIVE;
else if (!strcasecmp(argv[1],"ARCHIVE_TABLE"))
session->report_type = ARCHIVE_TABLE;
else
{
sscError(hError, "Invalid Report Request %s",argv[1]);
}
switch (session->report_type)
{
case ACTIONLIST :
create_action_list(hError,session,connection,error_handle,cmdp);
break;
case EVENTLIST :
create_event_list(hError,session,connection,error_handle,cmdp);
break;
case TYPELIST :
create_type_list(hError,session,connection,error_handle,cmdp);
break;
case UPDATEACTION :
action_parameters(hError,session,connection,error_handle,cmdp);
break;
case UPDTACTCONFIRM :
update_action_params(hError,session,connection,error_handle,cmdp);
break;
case DELETEACTION :
delete_action(hError,session,connection,error_handle,cmdp);
break;
case RETURNHOSTNAME :
generate_hostname(hError,session,connection,error_handle);
break;
case GETSYSID:
generate_sysid(hError,session,connection,error_handle);
break;
case GETSYSID_UNHID:
generate_sysid_unhidden(hError,session,connection,error_handle);
break;
case DELETELISTSET:
deletelistset(hError,session,connection,error_handle,cmdp);
break;
case EVENT_REPORT_BY_HOST:
event_report_by_host(hError,session,connection,error_handle,cmdp);
break;
case EVREPORT_CONT:
event_report_by_host(hError,session,connection,error_handle,cmdp);
break;
case CLASSREPORT_CONT:
event_report_by_class_host(hError,session,connection,error_handle,cmdp);
break;
case TYPEREPORT_CONT:
event_report_by_type_host(hError,session,connection,error_handle,cmdp);
break;
case EVENT_REPORT_BY_CLASS_HOST:
event_report_by_class_host(hError,session,connection,error_handle,cmdp);
break;
case EVENT_REPORT_BY_TYPE_HOST:
event_report_by_type_host(hError,session,connection,error_handle,cmdp);
break;
case EVENT_REPORT_PAGE:
event_report_page(hError,session,connection,error_handle,cmdp);
break;
case EVENT_REPORT_TYPE_PAGE:
event_report_type_page(hError,session,connection,error_handle,cmdp);
break;
case ACTION_TAKEN_REPORT:
event_action_report(hError,session,connection,error_handle,cmdp);
break;
case EVENT_ACTION_SPECIFIC_REPORT:
event_action_specific_report(hError,session,connection,error_handle,cmdp);
break;
case EVENT_ACTIONS_PAGE:
event_actions_page(hError, session,connection,error_handle,cmdp);
break;
case ACTION_VIEW_CONT:
view_action_page(hError,session,connection,error_handle,cmdp);
break;
case ACTIONS_PAGE:
view_action_page(hError, session,connection,error_handle,cmdp);
break;
case ACTION_REPORT_BY_ACTION:
action_report_by_action(hError, session,connection,error_handle,cmdp);
break;
case EVENT_VIEW_PAGE:
event_view_page(hError, session,connection,error_handle,cmdp);
break;
case EVENT_VIEW_PAGE_CONT:
event_description_view(hError, session,connection,error_handle,cmdp);
break;
case EVENT_VIEW_CLASS_PAGE_CONT:
event_description_class(hError, session,connection,error_handle,cmdp);
break;
case EVENT_VIEW_TYPE_PAGE:
event_view_type_configuration(hError, session,connection,error_handle,cmdp);
break;
case EVENT_VIEW_REPORT_PAGE:
event_view_report_page(hError, session,connection,error_handle,cmdp);
break;
case EVENT_ADD_INFO:
event_add_info(hError, session,connection,error_handle,cmdp);
break;
case EVENT_ADD_CONFIRM:
event_add_confirm(hError, session,connection,error_handle,cmdp);
break;
case CREATE_CLASS_LIST:
generate_class_list(hError,session,connection,error_handle);
break;
case EVENT_UPDT_INFO:
event_updt_info(hError,session,connection,error_handle,cmdp);
break;
case EVENT_UPDT_CONFIRM:
event_updt_confirm(hError,session,connection,error_handle,cmdp);
break;
case EVENT_UPDATE_ACTION_LIST:
event_update_action_list(hError,session,connection,error_handle,cmdp);
break;
case EVENT_ACTION_AUD:
event_action_aud(hError,session,connection,error_handle,cmdp);
break;
case EVENT_ACTION_ADD_CONFIRM:
event_action_add_confirm(hError,session,connection,error_handle,cmdp);
break;
case EVENT_ACTION_UPD_CONFIRM:
event_action_update_confirm(hError,session,connection,error_handle,cmdp);
break;
case EVENT_DELETE:
event_delete(hError,session,connection,error_handle,cmdp);
break;
case EVENT_DELETE_LIST:
event_delete_list(hError,session,connection,error_handle,cmdp);
break;
case ARCHIVE_LIST:
archive_list(hError,session,connection,error_handle,cmdp);
break;
case DELETE_ARCHIVE:
delete_archive(hError,session,connection,error_handle,cmdp);
break;
case ARCHIVE_TABLE:
archive_table(hError,session,connection,error_handle,cmdp);
break;
}
/* Destroy The HTML Generator */
i = deleteMyHTMLGenerator();
if (i != 0)
{
sscError(hError, "Sample server: Can't destroy the HTML generator");
ssdbDeleteErrorHandle(error_handle);
return 0;
}
if (ssdbIsConnectionValid(error_handle,connection))
ssdbCloseConnection (error_handle,connection);
if (ssdbIsClientValid(error_handle,client))
ssdbDeleteClient(error_handle,client);
if (error_handle)
ssdbDeleteErrorHandle(error_handle);
return 0;
}
@@ -0,0 +1,427 @@
#include "ui.h"
/* ----------------------------- rgpgInit ------------------------------------ */
int RGPGAPI rgpgInit(sscErrorHandle hError)
{ /* Try initialize "free list of mySession" mutex */
if(pthread_mutex_init(&seshFreeListmutex,0))
{ sscError(hError,szServerNameErrorPrefix,"Can't initialize mutex");
return 0; /* error */
}
mutex_inited++;
#ifdef INCLUDE_TIME_DATE_STRINGS
sprintf(szVersionStr,"%d.%d %s %s",MYVERSION_MAJOR,MYVERSION_MINOR,__DATE__,__TIME__);
#else
sprintf(szVersionStr,"%d.%d",MYVERSION_MAJOR,MYVERSION_MINOR);
#endif
return 1; /* success */
}
/* ----------------------------- rgpgDone ------------------------------------ */
int RGPGAPI rgpgDone(sscErrorHandle hError)
{ mySession *s;
if(mutex_inited)
{ pthread_mutex_destroy(&seshFreeListmutex);
mutex_inited = 0;
while((s = sesFreeList) != 0)
{ sesFreeList = s->next;
free(s);
}
return 1; /* success */
}
return 0; /* error - not inited */
}
/* -------------------------- rgpgCreateSesion ------------------------------- */
rgpgSessionID RGPGAPI rgpgCreateSesion(sscErrorHandle hError)
{ mySession *s;
pthread_mutex_lock(&seshFreeListmutex);
if((s = sesFreeList) != 0) sesFreeList = s->next;
pthread_mutex_unlock(&seshFreeListmutex);
if(!s) s = (mySession*)malloc(sizeof(mySession));
if(!s)
{ sscError(hError,szServerNameErrorPrefix,"No memory to create session in rgpgCreateSesion()");
return 0;
}
memset(s,0,sizeof(mySession));
s->signature = sizeof(mySession);
return (rgpgSessionID)s;
}
/* ------------------------- rgpgDeleteSesion -------------------------------- */
void RGPGAPI rgpgDeleteSesion(sscErrorHandle hError,rgpgSessionID _s)
{ mySession *s = (mySession *)_s;
if(!s || s->signature != sizeof(mySession))
{ sscError(hError,szServerNameErrorPrefix,"Incorrect session id in rgpgDeleteSesion()");
}
else
{
pthread_mutex_lock(&seshFreeListmutex);
s->next = sesFreeList; sesFreeList = s; s->signature = 0;
pthread_mutex_unlock(&seshFreeListmutex);
}
}
/* ------------------------ rgpgGetAttribute --------------------------------- */
char *RGPGAPI rgpgGetAttribute(sscErrorHandle hError,rgpgSessionID session, const char *attributeID, const char *extraAttrSpec,int *typeattr)
{ char *s;
if(typeattr) *typeattr = RGATTRTYPE_STATIC;
if(!strcasecmp(attributeID,szVersion)) s = (char*)szVersionStr;
else if(!strcasecmp(attributeID,szTitle)) s = (char*)myLogo;
else if(!strcasecmp(attributeID,szUnloadTime)) s = (char*)szUnloadTimeValue;
else if(!strcasecmp(attributeID,szThreadSafe)) s = (char*)szThreadSafeValue;
else if(!strcasecmp(attributeID,szUnloadable)) s = (char*)szUnloadableValue;
else if(!strcasecmp(attributeID,szAcceptRawCmdString)) s = (char*)szAcceptRawCmdStringValue;
else
{ sscError(hError,"%s No such attribute '%s' in rgpgGetAttribute()",szServerNameErrorPrefix,attributeID);
return 0;
}
if(!s) sscError(hError,szServerNameErrorPrefix,"No memory in rgpgGetAttribute()");
return s;
}
/* --------------------- rgpgFreeAttributeString ------------------------------ */
void RGPGAPI rgpgFreeAttributeString(sscErrorHandle hError,rgpgSessionID session,const char *attributeID,const char *extraAttrSpec,
char *attrString,int restype)
{
if(((restype == RGATTRTYPE_SPECIALALLOC) || (restype == RGATTRTYPE_MALLOCED)) && attrString) free(attrString);
}
/*----------------------------------------rgpgSetAttribute---------------------------------------------*/
void RGPGAPI rgpgSetAttribute(sscErrorHandle hError, rgpgSessionID session, const char *attributeID, const char *extraAttrSpec, const char *value)
{ char buff[128]; mySession *sess = session;
if(!strcasecmp(attributeID,szVersion) || !strcasecmp(attributeID,szTitle) ||
!strcasecmp(attributeID,szThreadSafe) || !strcasecmp(attributeID,szUnloadable) ||
!strcasecmp(attributeID,szUnloadTime))
{ sscError(hError,szServerNameErrorPrefix,"Attempt to set read only attribute in rgpgSetAttribute()");
return;
}
if(!strcasecmp(attributeID,"User-Agent") && value)
{ sess->textonly = (strcasecmp(value,"Lynx") == 0) ? 1 : 0;
return;
}
if(!sess || sess->signature != sizeof(mySession))
{ sscError(hError,szServerNameErrorPrefix,"Incorrect session id in rgpgGetAttribute()");
return;
}
}
/*----------------------------------------rgpgGenerateReport---------------------------------------------*/
int RGPGAPI rgpgGenerateReport(sscErrorHandle hError, rgpgSessionID _session, int argc, char* argv[],char *rawCommandString, streamHandle result,
char *accessmask)
{
ssdb_Client_Handle client;
ssdb_Connection_Handle connection;
ssdb_Request_Handle req_handle;
ssdb_Error_Handle error_handle;
int i,cmdpsize,SQL_TYPE;
CMDPAIR cmdp[MAXNUMBERS_OF_KEYS];
mySession *session = _session;
if ((error_handle = ssdbCreateErrorHandle()) == NULL)
{
sscError(hError,"Database API Error: \"%s\" - can't create error handle\n",ssdbGetLastErrorString(0));
return 0;
}
if ((client = ssdbNewClient(error_handle,szDefaultUserName,szDefaultPassword,0)) == NULL)
{
sscError(hError,"Database API Error: \"%s\" - can't create new client handle\n",ssdbGetLastErrorString(error_handle));
ssdbDeleteErrorHandle(error_handle);
return 0;
}
/* Establish a connection to a database */
if ((connection = ssdbOpenConnection(error_handle,client,szDefaultHostName,szDefaultDatabaseName,0)) == NULL)
{
sscError(hError,"Database API Error: \"%s\" - can't open connection\n",ssdbGetLastErrorString(error_handle));
ssdbDeleteErrorHandle(error_handle);
return 0;
}
/* Initialize The HTML Generator */
i = createMyHTMLGenerator(result);
if (i != 0)
{
sscError(hError, "Sample server: Can't open the HTML generator");
ssdbDeleteErrorHandle(error_handle);
return 0;
}
if (argc < 2)
{
sscError(hError, "Invalid Request\n");
ssdbDeleteErrorHandle(error_handle);
return 0;
}
cmdpsize = sscInitPair(rawCommandString,cmdp,MAXNUMBERS_OF_KEYS);
/* Check WEB browser type (Lynx is only tex based) */
for(i = 0;(i = sscFindPairByKey(cmdp,i,szUserAgent)) >= 0;i++)
if(!strcasecmp(cmdp[i].value,"Lynx")) session->textonly = 1;
/* Utility functions */
if (!strcasecmp(argv[1], "actionlist"))
session->report_type = ACTIONLIST;
else if (!strcasecmp(argv[1],"typelist"))
session->report_type = TYPELIST;
else if (!strcasecmp(argv[1],"eventlist"))
session->report_type = EVENTLIST;
else if (!strcasecmp(argv[1],"GETSYSID"))
session->report_type = GETSYSID;
else if (!strcasecmp(argv[1],"GETSYSID_UNHID"))
session->report_type = GETSYSID_UNHID;
/* Action setup */
else if (!strcasecmp(argv[1],"updateaction"))
session->report_type = UPDATEACTION;
else if (!strcasecmp(argv[1],"updtactconfirm"))
session->report_type = UPDTACTCONFIRM;
else if (!strcasecmp(argv[1],"setupdate"))
session->report_type = SETUPDATE;
else if (!strcasecmp(argv[1],"deleteaction"))
session->report_type = DELETEACTION;
else if (!strcasecmp(argv[1],"UPDATE_EVENT"))
session->report_type = UPDATE_EVENT;
else if (!strcasecmp(argv[1],"RETURNHOSTNAME"))
session->report_type = RETURNHOSTNAME;
else if (!strcasecmp(argv[1],"DELETELISTSET"))
session->report_type = DELETELISTSET;
/* Event Reports */
else if (!strcasecmp(argv[1],"EVENT_REPORT_BY_HOST"))
session->report_type = EVENT_REPORT_BY_HOST;
else if (!strcasecmp(argv[1],"EVENT_REPORT_BY_TYPE_HOST"))
session->report_type = EVENT_REPORT_BY_TYPE_HOST;
else if (!strcasecmp(argv[1],"EVENT_REPORT_PAGE"))
session->report_type = EVENT_REPORT_PAGE;
else if (!strcasecmp(argv[1],"EVENT_REPORT_BY_CLASS_HOST"))
session->report_type = EVENT_REPORT_BY_CLASS_HOST;
else if (!strcasecmp(argv[1],"EVENT_REPORT_TYPE_PAGE"))
session->report_type = EVENT_REPORT_TYPE_PAGE;
else if (!strcasecmp(argv[1],"EVREPORT_CONT"))
session->report_type = EVREPORT_CONT;
else if (!strcasecmp(argv[1],"CLASSREPORT_CONT"))
session->report_type = CLASSREPORT_CONT;
else if (!strcasecmp(argv[1],"TYPEREPORT_CONT"))
session->report_type = TYPEREPORT_CONT;
else if (!strcasecmp(argv[1],"EVENT_VIEW_PAGE_CONT"))
session->report_type = EVENT_VIEW_PAGE_CONT;
else if (!strcasecmp(argv[1],"EVENT_VIEW_CLASS_PAGE_CONT"))
session->report_type = EVENT_VIEW_CLASS_PAGE_CONT;
/* Actions Reports */
else if (!strcasecmp(argv[1],"ACTION_VIEW_CONT"))
session->report_type = ACTION_VIEW_CONT;
else if (!strcasecmp(argv[1],"ACTION_TAKEN_REPORT"))
session->report_type = ACTION_TAKEN_REPORT;
else if (!strcasecmp(argv[1],"ACTION_REPORT_BY_ACTION"))
session->report_type = ACTION_REPORT_BY_ACTION;
else if (!strcasecmp(argv[1],"ACTIONS_PAGE"))
session->report_type = ACTIONS_PAGE;
else if (!strcasecmp(argv[1],"EVENT_ACTION_SPECIFIC_REPORT"))
session->report_type = EVENT_ACTION_SPECIFIC_REPORT;
else if (!strcasecmp(argv[1],"EVENT_ACTIONS_PAGE"))
session->report_type = EVENT_ACTIONS_PAGE;
/* Event Setup */
else if (!strcasecmp(argv[1],"EVENT_VIEW_PAGE"))
session->report_type = EVENT_VIEW_PAGE;
else if (!strcasecmp(argv[1],"EVENT_VIEW_TYPE_PAGE"))
session->report_type = EVENT_VIEW_TYPE_PAGE;
else if (!strcasecmp(argv[1],"EVENT_VIEW_REPORT_PAGE"))
session->report_type = EVENT_VIEW_REPORT_PAGE;
else if (!strcasecmp(argv[1],"EVENT_ADD_INFO"))
session->report_type = EVENT_ADD_INFO;
else if (!strcasecmp(argv[1],"EVENT_ADD_CONFIRM"))
session->report_type = EVENT_ADD_CONFIRM;
else if (!strcasecmp(argv[1],"CREATE_CLASS_LIST"))
session->report_type = CREATE_CLASS_LIST;
else if (!strcasecmp(argv[1],"EVENT_UPDT_INFO"))
session->report_type = EVENT_UPDT_INFO;
else if (!strcasecmp(argv[1],"EVENT_UPDT_CONFIRM"))
session->report_type = EVENT_UPDT_CONFIRM;
else if (!strcasecmp(argv[1],"EVENT_UPDATE_ACTION_LIST"))
session->report_type = EVENT_UPDATE_ACTION_LIST;
else if (!strcasecmp(argv[1],"EVENT_ACTION_AUD"))
session->report_type = EVENT_ACTION_AUD;
else if (!strcasecmp(argv[1],"EVENT_ACTION_ADD_CONFIRM"))
session->report_type = EVENT_ACTION_ADD_CONFIRM;
else if (!strcasecmp(argv[1],"EVENT_ACTION_UPD_CONFIRM"))
session->report_type = EVENT_ACTION_UPD_CONFIRM;
else if (!strcasecmp(argv[1],"EVENT_DELETE"))
session->report_type = EVENT_DELETE;
else if (!strcasecmp(argv[1],"EVENT_DELETE_LIST"))
session->report_type = EVENT_DELETE_LIST;
else if (!strcasecmp(argv[1],"ARCHIVE_LIST"))
session->report_type = ARCHIVE_LIST;
else if (!strcasecmp(argv[1],"DELETE_ARCHIVE"))
session->report_type = DELETE_ARCHIVE;
else if (!strcasecmp(argv[1],"ARCHIVE_TABLE"))
session->report_type = ARCHIVE_TABLE;
else
{
sscError(hError, "Invalid Report Request %s",argv[1]);
}
switch (session->report_type)
{
case ACTIONLIST :
create_action_list(hError,session,connection,error_handle,cmdp);
break;
case EVENTLIST :
create_event_list(hError,session,connection,error_handle,cmdp);
break;
case TYPELIST :
create_type_list(hError,session,connection,error_handle,cmdp);
break;
case UPDATEACTION :
action_parameters(hError,session,connection,error_handle,cmdp);
break;
case UPDTACTCONFIRM :
update_action_params(hError,session,connection,error_handle,cmdp);
break;
case DELETEACTION :
delete_action(hError,session,connection,error_handle,cmdp);
break;
case RETURNHOSTNAME :
generate_hostname(hError,session,connection,error_handle);
break;
case GETSYSID:
generate_sysid(hError,session,connection,error_handle);
break;
case GETSYSID_UNHID:
generate_sysid_unhidden(hError,session,connection,error_handle);
break;
case DELETELISTSET:
deletelistset(hError,session,connection,error_handle,cmdp);
break;
case EVENT_REPORT_BY_HOST:
event_report_by_host(hError,session,connection,error_handle,cmdp);
break;
case EVREPORT_CONT:
event_report_by_host(hError,session,connection,error_handle,cmdp);
break;
case CLASSREPORT_CONT:
event_report_by_class_host(hError,session,connection,error_handle,cmdp);
break;
case TYPEREPORT_CONT:
event_report_by_type_host(hError,session,connection,error_handle,cmdp);
break;
case EVENT_REPORT_BY_CLASS_HOST:
event_report_by_class_host(hError,session,connection,error_handle,cmdp);
break;
case EVENT_REPORT_BY_TYPE_HOST:
event_report_by_type_host(hError,session,connection,error_handle,cmdp);
break;
case EVENT_REPORT_PAGE:
event_report_page(hError,session,connection,error_handle,cmdp);
break;
case EVENT_REPORT_TYPE_PAGE:
event_report_type_page(hError,session,connection,error_handle,cmdp);
break;
case ACTION_TAKEN_REPORT:
event_action_report(hError,session,connection,error_handle,cmdp);
break;
case EVENT_ACTION_SPECIFIC_REPORT:
event_action_specific_report(hError,session,connection,error_handle,cmdp);
break;
case EVENT_ACTIONS_PAGE:
event_actions_page(hError, session,connection,error_handle,cmdp);
break;
case ACTION_VIEW_CONT:
view_action_page(hError,session,connection,error_handle,cmdp);
break;
case ACTIONS_PAGE:
view_action_page(hError, session,connection,error_handle,cmdp);
break;
case ACTION_REPORT_BY_ACTION:
action_report_by_action(hError, session,connection,error_handle,cmdp);
break;
case EVENT_VIEW_PAGE:
event_view_page(hError, session,connection,error_handle,cmdp);
break;
case EVENT_VIEW_PAGE_CONT:
event_description_view(hError, session,connection,error_handle,cmdp);
break;
case EVENT_VIEW_CLASS_PAGE_CONT:
event_description_class(hError, session,connection,error_handle,cmdp);
break;
case EVENT_VIEW_TYPE_PAGE:
event_view_type_configuration(hError, session,connection,error_handle,cmdp);
break;
case EVENT_VIEW_REPORT_PAGE:
event_view_report_page(hError, session,connection,error_handle,cmdp);
break;
case EVENT_ADD_INFO:
event_add_info(hError, session,connection,error_handle,cmdp);
break;
case EVENT_ADD_CONFIRM:
event_add_confirm(hError, session,connection,error_handle,cmdp);
break;
case CREATE_CLASS_LIST:
generate_class_list(hError,session,connection,error_handle);
break;
case EVENT_UPDT_INFO:
event_updt_info(hError,session,connection,error_handle,cmdp);
break;
case EVENT_UPDT_CONFIRM:
event_updt_confirm(hError,session,connection,error_handle,cmdp);
break;
case EVENT_UPDATE_ACTION_LIST:
event_update_action_list(hError,session,connection,error_handle,cmdp);
break;
case EVENT_ACTION_AUD:
event_action_aud(hError,session,connection,error_handle,cmdp);
break;
case EVENT_ACTION_ADD_CONFIRM:
event_action_add_confirm(hError,session,connection,error_handle,cmdp);
break;
case EVENT_ACTION_UPD_CONFIRM:
event_action_update_confirm(hError,session,connection,error_handle,cmdp);
break;
case EVENT_DELETE:
event_delete(hError,session,connection,error_handle,cmdp);
break;
case EVENT_DELETE_LIST:
event_delete_list(hError,session,connection,error_handle,cmdp);
break;
case ARCHIVE_LIST:
archive_list(hError,session,connection,error_handle,cmdp);
break;
case DELETE_ARCHIVE:
delete_archive(hError,session,connection,error_handle,cmdp);
break;
case ARCHIVE_TABLE:
archive_table(hError,session,connection,error_handle,cmdp);
break;
}
/* Destroy The HTML Generator */
i = deleteMyHTMLGenerator();
if (i != 0)
{
sscError(hError, "Sample server: Can't destroy the HTML generator");
ssdbDeleteErrorHandle(error_handle);
return 0;
}
if (ssdbIsConnectionValid(error_handle,connection))
ssdbCloseConnection (error_handle,connection);
if (ssdbIsClientValid(error_handle,client))
ssdbDeleteClient(error_handle,client);
if (error_handle)
ssdbDeleteErrorHandle(error_handle);
return 0;
}