mm_notify.c revision cee0fb94c0d4227de0a00efc162fb2739844b641
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <mms_list.h>
#include <mms_parser.h>
#include <libpq-fe.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
#include <errno.h>
#include <unistd.h>
#include <mms_trace.h>
#include <mms_strapp.h>
#include "mm_db.h"
#include "mm.h"
#include "mm_util.h"
#include "mm_sql.h"
#include "mm_commands.h"
#include "mm_sql.h"
/* Event table notification types */
#define ETABLE_STATUS 0
#define ETABLE_REQUEST 1
#define ETABLE_MESSAGE 2
#define ETABLE_CARTRIDGE 3
#define ETABLE_VOLUME 4
/* All possible Notification Levels */
#define NOTIFY_OFF 0
#define NOTIFY_GLOBAL 1
#define NOTIFY_APPLICATION 2
#define NOTIFY_INSTANCE 3
#define NOTIFY_SESSION 4
#define NOTIFY_HOST 5
struct notify {
char *n_uuid;
char *n_client;
char *n_inst;
char *n_cfgchg;
char *n_newdrive;
char *n_newcartridge;
char *n_volumeinject;
char *n_volumeeject;
char *n_volumeadd;
char *n_volumedelete;
char *n_dmup;
char *n_dmdown;
char *n_driveonline;
char *n_driveoffline;
char *n_lmup;
char *n_lmdown;
char *n_librarycreate;
char *n_librarydelete;
char *n_drivedelete;
};
static pthread_mutex_t notify_lock;
static mms_list_t notify_list;
static mm_data_t *notify_data;
static int notify_etable(int etable);
/* Initialize notify. */
int
{
notify_data = data;
notify_db.mm_db_has_list = 0;
notify_db.mm_db_resending = 0;
return (1);
}
return (0);
}
/* Close notify. */
void
mm_notify_close(void)
{
}
void
uuid,
}
void
uuid,
}
void
uuid,
}
void
name);
}
void
instance);
}
void
name);
}
void
instance);
}
void
host);
}
void
library);
}
void
cartid);
}
void
drive);
}
void
char *obj_name;
char *info1;
char *info2;
char *info3;
int i;
for (i = 0; i < num_events; i++) {
/* This ordering depends on the */
/* select statement in the funtion below */
/* library event */
/* drive event */
/* dm event */
/* lm event */
/* request event */
}
/* message event */
}
/* cartridge event */
}
/* message event */
}
}
"event request[\"%s\" \"%s\" \"%s\"];",
info3);
"event message[\"%s\" \"%s\" \"%s\"];",
info3);
"event cartridge[\"%s\" \"%s\"];",
info2);
"event volume[\"%s\" \"%s\" \"%s\"];",
info3);
} else {
"event status[\"%s\" \"%s\"];",
info1);
}
"Send event to %s %s, %s",
} else {
"bad status event");
}
if (event_buf) {
}
}
}
char *
PGresult *event_results, int i) {
int wrote_data = 0;
int j;
/* same wka */
"event tag[\"%s\"] "
"object[%s]",
for (j = 2; j < 7; j++) {
if (j == 2 &&
i, j), "") == 0) {
continue;
} else if (j == 2) {
wrote_data = 1;
"data[\"%s\" ",
i, j));
i, j), "") != 0) {
"\"%s\" ",
i, j));
}
}
if (wrote_data) {
}
return (event_buf);
}
int
/* LINTED:mm_data may be needed in the future */
int num_events = 0;
int i;
char *notify_id;
char *notify_obj;
/* Send all events in rule table */
"select distinct \"NotifyID\",\"NotifyObject\","
"\"Data1\",\"Data2\",\"Data3\",\"Data4\",\"Data5\" "
" from \"EVENTRULES\";") != MM_DB_DATA) {
"error getting events "
"from EVENTRULES");
return (1);
}
"%d events found",
if (num_events == 0) {
return (0);
}
for (i = 0; i < num_events; i ++) {
"select \"ConnectionID\",\"NotifyTag\""
" from \"NOTIFYRULES\" where \"NotifyID\" = '%s';",
notify_id) != MM_DB_DATA) {
"error getting results "
"from NOTIFYRULES");
return (1);
}
if (PQntuples(notify_results) == 0) {
/* no notify row for this */
if (mm_db_txn_savepoint(db,
"mm_notify_event_rules: "
"db error setting savepoint");
}
"drop rule \"%s\" on \"%s\";", notify_id,
notify_obj) !=
MM_DB_OK) {
"mm_notify_event_rules: "
"db error rollingback savepoint");
}
}
"mm_notify_event_rules: "
"db error releaseing savepoint");
}
} else {
"send event to %s, %s",
PQgetvalue(notify_results, 0, 0),
for (notify_wka =
notify_wka != NULL;
PQgetvalue(notify_results, 0, 0)) == 0) {
/* same wka */
if ((event_buf =
event_results, i)) == NULL) {
"error writing "
"event buffer");
} else {
}
}
}
}
"delete from \"EVENTRULES\""
" where \"NotifyID\" = '%s';",
"error deleting "
"from NOTIFYRULES");
return (1);
}
}
return (0);
}
int
/* LINTED:mm_data maybe used in the future */
int rc;
if (rc == 0) {
}
if (rc == 0) {
}
if (rc == 0) {
}
if (rc == 0) {
}
"clear event table of processed events");
"where \"Seen\" = 't';") != MM_DB_OK) {
rc = 1;
}
return (rc);
}
static int
notify_etable(int etable) {
/* Event results */
int num_events = 0;
/* Client results */
int num_clients = 0;
int i;
/* Wka lookup */
/* Event specific */
char *where;
char *what;
switch (etable) {
case ETABLE_STATUS:
where = "where (\"ObjectName\" = 'LIBRARY' or "
"\"ObjectName\" = 'LM' or "
"\"ObjectName\" = 'DRIVE' or "
"\"ObjectName\" = 'DM')";
what = "NotifyStatus";
break;
case ETABLE_REQUEST:
where = "where (\"ObjectName\" = 'REQUEST')";
what = "NotifyRequest";
break;
case ETABLE_MESSAGE:
where = "where (\"ObjectName\" = 'MESSAGE')";
what = "NotifyMessage";
break;
case ETABLE_CARTRIDGE:
where = "where (\"ObjectName\" = 'CARTRIDGE')";
what = "NotifyCartridge";
break;
case ETABLE_VOLUME:
where = "where (\"ObjectName\" = 'VOLUME')";
what = "NotifyVolume";
break;
default:
"unknown event table type %d", etable);
return (1);
}
/* flag events we're going to process */
"update \"EVENT\" set \"Seen\" = 't' %s;",
"error setting event seen");
return (1);
}
/* Get all the events */
/* send_status_event is dependent */
/* on the ordering of the */
/* attributes in this select */
"select distinct \"ObjectName\","
"\"Info1\",\"Info2\",\"Info3\",\"Info4\" from "
"\"EVENT\" %s and (\"Seen\" = 't');",
where) != MM_DB_DATA) {
"error getting event data from db");
return (1);
}
if (num_events == 0) {
"No events found in event table");
return (0);
}
/* Get all the subscribers */
"select \"ConnectionID\" from "
"\"NOTIFY\" where "
"\"%s\" != "
"error getting client data from db");
return (1);
}
if (num_clients == 0) {
"No clients subscribed to status events");
return (0);
}
/* Send the events to the subscribers */
notify_wka != NULL;
for (i = 0; i < num_clients; i ++) {
cur_uuid) == 0) {
/* This client needs the events */
}
}
}
return (0);
}
int
char *drivename) {
"drivename cannot be NULL, "
"mm_notify_add_driveonline");
return (1);
}
return (1);
} else {
}
return (0);
}
int
char *drivename) {
"drivename cannot be NULL, "
"mm_notify_add_driveoffline");
return (1);
}
return (1);
} else {
}
return (0);
}
void
} else {
} else {
}
}
}
int
/* This function is called by the main thread, not the worker */
/* So it will need to use the main thread's db connection */
/* If dm is in a ready state, add an event */
"select \"DMName\" from "
"\"DMCAPABILITYGROUP\" where "
"\"DMName\" = '%s';",
"db error, mm_notify_add_dmdown_dc");
return (1);
}
"rows != 1, mm_notify_add_dmdown_dc");
return (1);
}
return (0);
}
void
/* Get DMTargetHost and DriveName */
} else {
}
}
void
char *libraryname) {
libraryname)) == NULL) {
} else {
}
}
void
int rows;
int row;
char *libraryname = NULL;
" FROM \"LIBRARY\" %s",
"data base error getting library name");
return;
}
if (rows == 0) {
return;
}
libraryname)) == NULL) {
} else {
}
}
}
void
int rows;
int row;
" FROM \"DRIVE\" %s",
"data base error getting drive name");
return;
}
if (rows == 0) {
return;
}
} else {
}
}
}
void
char *cartridgepcl,
char *libraryname) {
libraryname)) == NULL) {
} else {
}
}
void
char *drivename, char *libraryname) {
libraryname)) == NULL) {
} else {
}
}
int
"cannot have null cartid"
", mm_notify_add_volumedelete");
return (1);
}
/* First find this cartridge type */
"select "
"\"CARTRIDGE\".\"CartridgeTypeName\","
"\"VOLUME\".\"VolumeName\" from "
"\"CARTRIDGE\",\"VOLUME\" where "
"\"VOLUME\".\"CartridgeID\" ="
"\"CARTRIDGE\".\"CartridgeID\" and "
"\"VOLUME\".\"CartridgeID\" = '%s';",
cartid) != MM_DB_DATA) {
"db error getting cartridge "
"type for %s, volumedelete event",
cartid);
return (1);
}
"db error getting cartridge type, "
"%d rows returned, volumedelete event",
return (1);
}
"volumedelete[\"%s\" \"%s\"];",
return (1);
} else {
cartid);
}
return (0);
}
int
int num_vols = 0;
int i;
"select "
"\"CARTRIDGE\".\"CartridgeTypeName\","
"\"VOLUME\".\"VolumeName\", "
"\"CARTRIDGE\".\"CartridgeID\" "
"from "
"\"CARTRIDGE\",\"VOLUME\" "
"where ( "
"(\"VOLUME\".\"CartridgeID\" = "
"\"CARTRIDGE\".\"CartridgeID\") "
"and "
"(\"CARTRIDGE\".\"LibraryName\" = '%s') "
"and "
"(\"CARTRIDGE\".\"CartridgePCL\" = '%s'));",
pcl) != MM_DB_DATA) {
"db error getting cartridge "
"type for %s, volumeeject event",
pcl);
return (1);
}
"%d volume(s) for cart, %s %s",
pcl,
for (i = 0; i < num_vols; i ++) {
"volumeeject[\"%s\" \"%s\"];",
return (1);
} else {
cartid);
volname);
}
}
return (0);
}
int
int num_vols = 0;
int i;
"select "
"\"CARTRIDGE\".\"CartridgeTypeName\","
"\"VOLUME\".\"VolumeName\", "
"\"CARTRIDGE\".\"CartridgeID\" "
"from "
"\"CARTRIDGE\",\"VOLUME\" "
"where ( "
"(\"VOLUME\".\"CartridgeID\" = "
"\"CARTRIDGE\".\"CartridgeID\") "
"and "
"(\"CARTRIDGE\".\"LibraryName\" = '%s') "
"and "
"(\"CARTRIDGE\".\"CartridgePCL\" = '%s'));",
pcl) != MM_DB_DATA) {
"db error getting cartridge "
"type for %s, volumeinject event",
pcl);
return (1);
}
"%d volume(s) for cart, %s %s",
pcl,
for (i = 0; i < num_vols; i ++) {
"volumeinject[\"%s\" \"%s\"];",
return (1);
} else {
cartid);
volname);
}
}
return (0);
}
int
if (volumename == NULL) {
"cannot have null volumename"
", mm_notify_add_volumeadd");
return (1);
}
"cannot have null cartid"
", mm_notify_add_volumeadd");
return (1);
}
/* First find this cartridge type */
"select "
"\"CARTRIDGE\".\"CartridgeTypeName\" "
"from \"CARTRIDGE\" "
"where "
"\"CARTRIDGE\".\"CartridgeID\" = '%s';",
cartid) != MM_DB_DATA) {
"db error getting cartridge "
"type for %s, volumeadd event",
return (1);
}
"db error getting cartridge type, "
"%d rows returned, volumeadd event",
return (1);
}
"volumeadd[\"%s\" \"%s\"];",
return (1);
} else {
cartid);
}
return (0);
}
int
/* This adds an lmready event to the event queue */
/* lm_wka should be the wka of the lm who is ready */
/* Library Ready event */
"lmup[\"%s\" \"%s\"];",
return (1);
} else {
}
return (0);
}
int
/* This function is called by the main thread, not the worker */
/* So it will need to use the main thread's db connection */
/* If lm is in a ready state, add an event */
"select \"LMStateSoft\" "
"from \"LM\" where "
"\"LMName\" = '%s';",
"db error, mm_notify_add_lmdown_dc");
return (1);
}
"rows != 1, mm_notify_add_lmdown_dc");
return (1);
}
"ready") == 0) {
"lm dissconnected in ready state, add event");
"mm_notify_add_lmdown_dc: "
"error adding lm down event");
}
}
return (0);
}
int
/* This adds an lmready event to the event queue */
/* lm_wka should be the wka of the lm who is ready */
/* Library Ready event */
"lmdown[\"%s\" \"%s\"];",
return (1);
} else {
} else {
}
}
return (0);
}
int
char *host) {
name,
return (1);
}
} else {
return (1);
}
}
return (0);
}
/* Add event to pending event list for client. */
mm_notify_add(char *event_fmt, ...)
{
sizeof (notify_cmd_t))) == NULL) {
return (NULL);
}
return (NULL);
}
event->evt_can_dispatch = 0;
"Added event, %s",
return (event);
}
void
/* clean up the event */
}
/* Command or action was successful, send client events. */
void
mm_notify_commit(char *cmd_uuid) {
"mm_notify_commit");
"commit event %s",
}
}
}
void
mm_notify_rollback(char *cmd_uuid) {
"mm_notify_rollback");
event = next_event) {
}
}
}
/* Send event now. */
int
{
sizeof (notify_cmd_t))) == NULL) {
return (1);
}
return (1);
}
if (cli_uuid) {
/* not mm event */
/* Find session, application and instance for this client */
}
"adding event for immediate dispatch, %s",
return (0);
}
int
{
int rows;
int print_message = 0;
"notify_send");
"send event %s",
if (cli_name)
" client name, %s",
cli_name);
if (cli_instance)
" client instance, %s",
if (obj_name)
" object name, %s",
obj_name);
if (obj_instance)
" object instance, %s",
if (obj_host)
" object host, %s",
obj_host);
if (obj_library)
" object library, %s",
if (obj_cartid)
" object cartid, %s",
if (obj_drive)
" object drive, %s",
/*
* Send event to mm subsribers.
*/
notify_wka != NULL;
if (print_message)
"\"ConnectionClientName\","
"\"ConnectionClientInstance\","
"\"NotifyConfigChange\","
"\"NotifyNewDrive\", "
"\"NotifyNewCartridge\", "
"\"NotifyVolumeAdd\", "
"\"NotifyVolumeDelete\", "
"\"NotifyDMUp\", "
"\"NotifyDMDown\", "
"\"NotifyDriveOnline\", "
"\"NotifyDriveOffline\", "
"\"NotifyLMUp\", "
"\"NotifyLMDown\", "
"\"NotifyVolumeInject\", "
"\"NotifyVolumeEject\", "
"\"NotifyLibraryCreate\", "
"\"NotifyLibraryDelete\", "
"\"NotifyDriveDelete\" "
"FROM \"NOTIFY\""
"where \"ConnectionID\" = '%s';",
return (1);
}
if (rows != 0) {
"notify a client");
/* NOTIFY entry for this connection */
/* Set up the notify struct */
/* Notify the client */
event);
} else {
"client has no notification settings");
}
}
return (0);
}
static void
{
}
int
notify_return_scope(char *scope) {
"passed a NULL scope");
return (NOTIFY_OFF);
}
return (NOTIFY_OFF);
return (NOTIFY_GLOBAL);
return (NOTIFY_APPLICATION);
return (NOTIFY_INSTANCE);
return (NOTIFY_SESSION);
return (NOTIFY_HOST);
} else {
"passed an unknown scope, %s",
scope);
return (NOTIFY_OFF);
}
}
int
/* LINTED: notify may be needed in the future */
int event_scope) {
"notify_check_session_event");
"%s",
/* Use this check for any event of this type */
/* Allowed scope values for a session event */
/* Global- all */
/* Application- application == client app */
/* Instance- app and inst == client app, inst */
/* Session- session id == client session */
/* Client does not have this event 'off' */
/* Check scope */
if (event_scope == NOTIFY_GLOBAL) {
} else if ((event_scope == NOTIFY_APPLICATION) &&
"client app is %s",
conn->cci_client);
conn->cci_client) == 0) {
/* App name matches */
} else {
return (0);
}
} else if ((event_scope == NOTIFY_INSTANCE) &&
"client app is %s %s",
conn->cci_instance);
conn->cci_client) == 0) &&
conn->cci_instance) == 0)) {
/* App and instance match */
} else {
return (0);
}
} else if ((event_scope == NOTIFY_SESSION) &&
" event session is %s, ",
" client session is %s",
mm_wka->session_uuid) != 0) {
/* Session ID does not match */
return (0);
}
/* Session ID matches */
} else {
"Passed an unsupported event "
"scope for this event type");
return (0);
}
return (1);
}
int
/* LINTED: notify may be needed in the future */
int event_scope) {
/* Event has global and host scope */
if (event_scope == NOTIFY_GLOBAL) {
return (1);
} else if (event_scope == NOTIFY_HOST) {
/* Confirm hosts are the same */
"select * from "
"pg_host_ident('%s') "
"where pg_host_ident('%s') = "
"pg_host_ident('%s');",
"db error, notify_check_dmup");
return (0);
}
"client host != dm host");
return (0);
}
return (1);
} else {
"unknown scope for dmup event");
return (0);
}
}
int
/* LINTED: notify may be needed in the future */
int event_scope) {
/* Event has global and host scope */
if (event_scope == NOTIFY_GLOBAL) {
return (1);
} else if (event_scope == NOTIFY_HOST) {
/* Confirm hosts are the same */
"select * from "
"pg_host_ident('%s') "
"where pg_host_ident('%s') = "
"pg_host_ident('%s');",
"db error, notify_check_dmup");
return (0);
}
"client host != dm host");
return (0);
}
return (1);
} else {
"unknown scope for dmup event");
return (0);
}
}
int
/* LINTED: notify may be needed in the future */
int event_scope) {
/* driveonline event */
/* global -all */
/* application - client has DRIVEGROUP access */
if (event_scope == NOTIFY_GLOBAL) {
return (1);
} else if (event_scope == NOTIFY_APPLICATION) {
/* Check this client and drive group */
"select distinct \"DRIVE\".* from \"DRIVE\" "
"cross join \"DRIVEGROUPAPPLICATION\" "
"where "
"(\"DRIVE\".\"DriveGroupName\" = "
"\"DRIVEGROUPAPPLICATION\".\"DriveGroupName\") "
"and "
"(\"DRIVE\".\"DriveName\" = '%s') AND "
"(\"DRIVEGROUPAPPLICATION\"."
"\"ApplicationName\" = '%s');",
"db error, notify_check_driveonline");
return (0);
}
"client does not have drive access");
return (0);
}
return (1);
} else {
"unknown scope for driveonline event");
return (0);
}
}
int
/* LINTED: notify may be needed in the future */
int event_scope) {
/* driveoffline event */
/* global -all */
/* application - client has DRIVEGROUP access */
if (event_scope == NOTIFY_GLOBAL) {
return (1);
} else if (event_scope == NOTIFY_APPLICATION) {
/* Check this client and drive group */
"select distinct \"DRIVE\".* from \"DRIVE\" "
"cross join \"DRIVEGROUPAPPLICATION\" "
"where "
"(\"DRIVE\".\"DriveGroupName\" = "
"\"DRIVEGROUPAPPLICATION\".\"DriveGroupName\") "
"and "
"(\"DRIVE\".\"DriveName\" = '%s') AND "
"(\"DRIVEGROUPAPPLICATION\"."
"\"ApplicationName\" = '%s');",
"db error, notify_check_driveoffline");
return (0);
}
"client does not have drive access");
return (0);
}
return (1);
} else {
"unknown scope for driveoffline event");
return (0);
}
}
int
/* LINTED: notify may be needed in the future */
int event_scope) {
int app_ok = 0;
int instance_ok = 0;
"notify_check_volumeevent");
"%s",
/* Allowed scope values for SIA volume event */
/* Global - all */
/* Application - VOLUME.AppName = cci_client */
/* Instance - VOLUME.AIName = cci_instance */
if (event_scope == NOTIFY_GLOBAL) {
} else if ((event_scope == NOTIFY_APPLICATION) ||
(event_scope == NOTIFY_INSTANCE)) {
/* This volume's application should match the clients app */
"select "
"\"VOLUME\".\"ApplicationName\", "
"\"VOLUME\".\"AIName\" "
"from \"VOLUME\" where "
"\"CartridgeID\" = '%s'",
cartid) != MM_DB_DATA) {
"db error getting app name for %s, "
"notify_check_volumeevent",
return (0);
}
"db returned %d rows != 1 "
"notify_check_volumeevent",
return (0);
}
/* compare the apps */
"app name matches");
app_ok = 1;
} else {
"app name does not match");
}
/* compare the instance */
"instance matches");
instance_ok = 1;
} else {
"instance does not match");
}
} else {
"Passed an unsupported event "
"scope for volumeevent");
return (0);
}
if (event_scope == NOTIFY_APPLICATION) {
if (app_ok) {
return (1);
} else {
return (0);
}
}
if (event_scope == NOTIFY_INSTANCE) {
if (app_ok && instance_ok) {
return (1);
} else {
return (0);
}
}
return (1);
}
int
/* LINTED: notify may be needed in the future */
int event_scope) {
/* Allowed scope for lmready */
/* Global- all */
"notify_check_lmup");
"%s",
if (event_scope == NOTIFY_GLOBAL) {
/* Global is the only scope currently implemeneted, */
return (1);
} else {
"unknown scope, notify_check_lmup");
return (0);
}
}
int
/* LINTED: notify may be needed in the future */
int event_scope) {
/* Allowed scope for lmready */
/* Global- all */
"notify_check_lmdown");
"%s",
/* Global is the only scope currently implemeneted, */
if (event_scope == NOTIFY_GLOBAL) {
/* Global is the only scope currently implemeneted, */
return (1);
} else {
"unknown scope, notify_check_lmdown");
return (0);
}
}
int
/* LINTED: notify may be needed in the future */
int event_scope) {
"notify_check_newdrive");
"%s",
"bad drivename or libraryname in event struct");
return (0);
}
/* Allowed scope values for a config change event */
/* Global- all */
/* Application- client application has DRIVEGROUPAPPLICATION */
if (event_scope == NOTIFY_GLOBAL) {
} else if (event_scope == NOTIFY_APPLICATION) {
"select distinct "
"\"DRIVEGROUPAPPLICATION\".* from "
"\"DRIVEGROUPAPPLICATION\" "
"cross join \"DRIVE\" where ( "
"(\"DRIVEGROUPAPPLICATION\"."
"\"DriveGroupName\" = "
"\"DRIVE\".\"DriveGroupName\") "
"and ((\"DRIVE\".\"DriveName\" = "
"'%s') AND "
"(\"DRIVE\".\"LibraryName\" = '%s') AND "
"(\"DRIVEGROUPAPPLICATION\"."
"\"ApplicationName\" = '%s')) "
");",
conn->cci_client);
"error getting db info");
return (0);
}
"%s has no access to %s, skip event",
return (0);
}
} else {
"Passed an unsupported event "
"scope for this event type");
return (0);
}
return (1);
}
int
/* LINTED: notify may be needed in the future */
int event_scope) {
"notify_check_newcartridge");
"%s",
"bad pcl or library name in event struct");
return (0);
}
/* Allowed scope values for a config change event */
/* Global- all */
/* Application- client application has CARTRIDGEGROUPAPPLICATION */
if (event_scope == NOTIFY_GLOBAL) {
} else if (event_scope == NOTIFY_APPLICATION) {
"select distinct "
"\"CARTRIDGEGROUPAPPLICATION\".* from "
"\"CARTRIDGEGROUPAPPLICATION\" "
"cross join \"CARTRIDGE\" where ( "
"(\"CARTRIDGEGROUPAPPLICATION\"."
"\"CartridgeGroupName\" = "
"\"CARTRIDGE\".\"CartridgeGroupName\") "
"and ((\"CARTRIDGE\".\"CartridgePCL\" = "
"'%s') AND "
"(\"CARTRIDGE\".\"LibraryName\" = '%s') AND "
"(\"CARTRIDGEGROUPAPPLICATION\"."
"\"ApplicationName\" = '%s')) "
");",
pcl,
conn->cci_client);
"error getting db info");
return (0);
}
"%s has no access to %s, skip event",
pcl);
return (0);
}
} else {
"Passed an unsupported event "
"scope for this event type");
return (0);
}
return (1);
}
int
/* LINTED: notify may be needed in the future */
int event_scope) {
"notify_check_cfgchg");
"%s",
/* Allowed scope values for a config change event */
/* Global- all */
if (event_scope == NOTIFY_GLOBAL) {
} else if (event_scope == NOTIFY_HOST) {
/* Check that our event has the proper struct */
/* This would be LM or DM */
"bad evt_obj_name "
"in notify_check_cfgchg");
return (0);
}
"bad evt_obj_instance "
"in notify_check_cfgchg");
return (0);
}
"bad evt_obj_host "
"in notify_check_cfgchg");
return (0);
}
/* Host of client we are */
/* sending event to */
"bad cci_host "
"in notify_check_cfgchg");
return (0);
}
/* is stored in event client instance */
/* Event type is in client name */
"select * from "
"pg_host_ident('%s') "
"where pg_host_ident('%s') = "
"pg_host_ident('%s')",
"error getting db info");
return (0);
}
"%s %s not configured of %s, skip event",
return (0);
}
} else {
"Passed an unsupported event "
"scope for this event type");
return (0);
}
return (1);
}
static void
{
int do_notify = 0;
int event_scope = 0;
conn->cci_instance);
mms_mmp_parse)) == NULL) {
if (event_text != NULL) {
} else {
"event_text was NULL, cannot parse");
}
return;
}
/* Match the event up with this connection's notify setting */
/* All working events must be listed here */
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
NULL) &&
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
((event_scope =
event_cmd, event_scope)) {
do_notify = 1;
}
MMS_PN_CLAUSE, NULL) &&
((event_scope =
do_notify = 1;
MMS_PN_CLAUSE, NULL) &&
((event_scope =
do_notify = 1;
MMS_PN_CLAUSE, NULL) &&
((event_scope =
do_notify = 1;
}
if (do_notify) {
/*
* Forward event to client.
*/
"Send event to %s %s, %s",
} else {
}
}