opensaf  5.21.09
About: OpenSAF is a project focused on Service Availability (SA) that develops middleware based on open and industry standard interfaces for applications requiring uninterrupted 24x7 service.
  Fossies Dox: opensaf-5.21.09.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ntfsubscribe.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <time.h>
#include <fcntl.h>
#include <ctype.h>
#include <poll.h>
#include <saAis.h>
#include <saAmf.h>
#include <saClm.h>
#include <saNtf.h>
#include "ntf/tools/ntfclient.h"
#include "ntf/tools/ntfconsumer.h"
Include dependency graph for ntfsubscribe.c:

Go to the source code of this file.

Classes

struct  s_filters_T
 

Enumerations

enum  { FD_NTF = 0 , FD_TERM , FD_INT , FD_MAX }
 

Functions

static void sigterm_handler (int sig)
 handler for TERM signal. More...
 
static void sigint_handler (int sig)
 handler for INT (Ctrl+c) signal. More...
 
static void saNtfNotificationDiscardedCallback (SaNtfSubscriptionIdT subscriptionId, SaNtfNotificationTypeT notificationType, SaUint32T numberDiscarded, const SaNtfIdentifierT *discardedNotificationIdentifiers)
 
static SaAisErrorT waitForNotifications (SaNtfHandleT myHandle, int selectionObject, int timeout_ms)
 
static void usage (void)
 
static void freeNtfFilter (SaNtfNotificationFilterHandleT *fh_ptr)
 
static SaAisErrorT subscribeForNotifications (const saNotificationFilterAllocationParamsT *notificationFilterAllocationParams, SaNtfSubscriptionIdT subscriptionId)
 
int main (int argc, char *argv[])
 

Variables

static SaNtfHandleT ntfHandle
 NTF subscriber command line program. More...
 
static SaNtfSubscriptionIdT my_subscriptionId = 1
 
static SaSelectionObjectT selObj
 
static NCS_SEL_OBJ term_sel_obj
 
static NCS_SEL_OBJ int_sel_obj
 
enum { ... }  NTFSUB_FDS
 
static nfds_t fds_num = FD_MAX
 
static char * progname
 
static SaVersionT version = {'A', 0x01, 0x02}
 
static struct s_filters_T used_filters = {1, 0, 0, 0, 0, 0}
 
static SaNtfCallbacksT ntfCallbacks
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FD_NTF 
FD_TERM 
FD_INT 
FD_MAX 

Definition at line 50 of file ntfsubscribe.c.

Function Documentation

◆ freeNtfFilter()

static void freeNtfFilter ( SaNtfNotificationFilterHandleT fh_ptr)
static

◆ main()

◆ saNtfNotificationDiscardedCallback()

static void saNtfNotificationDiscardedCallback ( SaNtfSubscriptionIdT  subscriptionId,
SaNtfNotificationTypeT  notificationType,
SaUint32T  numberDiscarded,
const SaNtfIdentifierT discardedNotificationIdentifiers 
)
static

Definition at line 93 of file ntfsubscribe.c.

References printf, and subscriptionId.

◆ sigint_handler()

static void sigint_handler ( int  sig)
static

handler for INT (Ctrl+c) signal.

Parameters
signalvalue

Definition at line 87 of file ntfsubscribe.c.

References int_sel_obj, and ncs_sel_obj_ind().

Referenced by main().

◆ sigterm_handler()

static void sigterm_handler ( int  sig)
static

handler for TERM signal.

Parameters
signalvalue

Definition at line 76 of file ntfsubscribe.c.

References ncs_sel_obj_ind(), and term_sel_obj.

Referenced by main().

◆ subscribeForNotifications()

static SaAisErrorT subscribeForNotifications ( const saNotificationFilterAllocationParamsT notificationFilterAllocationParams,
SaNtfSubscriptionIdT  subscriptionId 
)
static

Definition at line 251 of file ntfsubscribe.c.

References s_filters_T::alarm, SaNtfNotificationTypeFilterHandlesT::alarmFilterHandle, s_filters_T::all, s_filters_T::att_ch, SaNtfNotificationTypeFilterHandlesT::attributeChangeFilterHandle, error_output(), freeNtfFilter(), SaNtfObjectCreateDeleteNotificationFilterT::notificationFilterHandle, SaNtfAttributeChangeNotificationFilterT::notificationFilterHandle, SaNtfStateChangeNotificationFilterT::notificationFilterHandle, SaNtfAlarmNotificationFilterT::notificationFilterHandle, SaNtfSecurityAlarmNotificationFilterT::notificationFilterHandle, ntfHandle, ntftool_saNtfNotificationSubscribe(), saNotificationFilterAllocationParamsT::numEventTypes, saNotificationFilterAllocationParamsT::numNotificationClassIds, saNotificationFilterAllocationParamsT::numNotificationObjects, saNotificationFilterAllocationParamsT::numNotifyingObjects, saNotificationFilterAllocationParamsT::numPerceivedSeverities, saNotificationFilterAllocationParamsT::numProbableCauses, saNotificationFilterAllocationParamsT::numTrends, s_filters_T::obj_cr_del, SaNtfNotificationTypeFilterHandlesT::objectCreateDeleteFilterHandle, SA_AIS_OK, pyosaf.utils.ntf.agent::saNtfAlarmNotificationFilterAllocate, pyosaf.utils.ntf.agent::saNtfAttributeChangeNotificationFilterAllocate, pyosaf.utils.ntf.agent::saNtfObjectCreateDeleteNotificationFilterAllocate, pyosaf.utils.ntf.agent::saNtfSecurityAlarmNotificationFilterAllocate, pyosaf.utils.ntf.agent::saNtfStateChangeNotificationFilterAllocate, s_filters_T::sec_al, SaNtfNotificationTypeFilterHandlesT::securityAlarmFilterHandle, s_filters_T::st_ch, SaNtfNotificationTypeFilterHandlesT::stateChangeFilterHandle, subscriptionId, and used_filters.

Referenced by main().

◆ usage()

static void usage ( void  )
static

Definition at line 206 of file ntfsubscribe.c.

References printf, and progname.

Referenced by main().

◆ waitForNotifications()

Variable Documentation

◆ fds_num

nfds_t fds_num = FD_MAX
static

Definition at line 55 of file ntfsubscribe.c.

Referenced by waitForNotifications().

◆ int_sel_obj

NCS_SEL_OBJ int_sel_obj
static

Definition at line 48 of file ntfsubscribe.c.

Referenced by main(), sigint_handler(), and waitForNotifications().

◆ my_subscriptionId

SaNtfSubscriptionIdT my_subscriptionId = 1
static

Definition at line 45 of file ntfsubscribe.c.

Referenced by main(), and waitForNotifications().

◆ ntfCallbacks

SaNtfCallbacksT ntfCallbacks
static
Initial value:
void saNtfNotificationCallback(SaNtfSubscriptionIdT subscriptionId, const SaNtfNotificationsT *notification)
Definition: ntfclient.c:735
static void saNtfNotificationDiscardedCallback(SaNtfSubscriptionIdT subscriptionId, SaNtfNotificationTypeT notificationType, SaUint32T numberDiscarded, const SaNtfIdentifierT *discardedNotificationIdentifiers)
Definition: ntfsubscribe.c:93

Definition at line 112 of file ntfsubscribe.c.

Referenced by main().

◆ ntfHandle

SaNtfHandleT ntfHandle
static

NTF subscriber command line program.

Definition at line 44 of file ntfsubscribe.c.

Referenced by main(), subscribeForNotifications(), and waitForNotifications().

◆ 

enum { ... } NTFSUB_FDS

◆ progname

char* progname
static

Definition at line 57 of file ntfsubscribe.c.

Referenced by main(), and usage().

◆ selObj

SaSelectionObjectT selObj
static

Definition at line 46 of file ntfsubscribe.c.

Referenced by SmfImmUtils::adminOperationAsyncThread(), and main().

◆ term_sel_obj

NCS_SEL_OBJ term_sel_obj
static

Definition at line 47 of file ntfsubscribe.c.

Referenced by main(), sigterm_handler(), and waitForNotifications().

◆ used_filters

struct s_filters_T used_filters = {1, 0, 0, 0, 0, 0}
static

Referenced by main(), and subscribeForNotifications().

◆ version

SaVersionT version = {'A', 0x01, 0x02}
static

Definition at line 60 of file ntfsubscribe.c.

Referenced by main().