notify filter

This commit is contained in:
Olof Hagsand 2016-05-22 17:37:28 +02:00
parent c3157690b9
commit eaaf1b83e8
3 changed files with 19 additions and 10 deletions

View file

@ -65,12 +65,13 @@
*/ */
static struct client_subscription * static struct client_subscription *
client_subscription_add(struct client_entry *ce, client_subscription_add(struct client_entry *ce,
char *stream, char *stream,
enum format_enum format, enum format_enum format,
char *filter) char *filter)
{ {
struct client_subscription *su = NULL; struct client_subscription *su = NULL;
clicon_debug(1, "%s stream:%s filter:%s", __FUNCTION__, stream, filter);
if ((su = malloc(sizeof(*su))) == NULL){ if ((su = malloc(sizeof(*su))) == NULL){
clicon_err(OE_PLUGIN, errno, "malloc"); clicon_err(OE_PLUGIN, errno, "malloc");
goto done; goto done;

View file

@ -872,7 +872,7 @@ cli_notify(clicon_handle h,
/*! Register log notification stream /*! Register log notification stream
* @param[in] h Clicon handle * @param[in] h Clicon handle
* @param[in] stream Event stream. CLICON is predefined, others are application-defined * @param[in] stream Event stream. CLICON is predefined, others are application-defined
* @param[in] filter Filter. For xml notification ie xpath: /[name=kalle] * @param[in] filter Filter. For xml notification ie xpath: .[name=kalle]
* @param[in] status 0 for stop, 1 to start * @param[in] status 0 for stop, 1 to start
* @param[in] fn Callback function called when notification occurs * @param[in] fn Callback function called when notification occurs
* @param[in] arg Argumnent to function * @param[in] arg Argumnent to function

View file

@ -72,7 +72,9 @@ static FILE *_debugfile = NULL;
* @endcode * @endcode
*/ */
int int
clicon_log_init(char *ident, int upto, int flags) clicon_log_init(char *ident,
int upto,
int flags)
{ {
if (setlogmask(LOG_UPTO(upto)) < 0) if (setlogmask(LOG_UPTO(upto)) < 0)
/* Cant syslog here */ /* Cant syslog here */
@ -85,7 +87,8 @@ clicon_log_init(char *ident, int upto, int flags)
/*! Register log callback, return old setting /*! Register log callback, return old setting
*/ */
clicon_log_notify_t * clicon_log_notify_t *
clicon_log_register_callback(clicon_log_notify_t *cb, void *arg) clicon_log_register_callback(clicon_log_notify_t *cb,
void *arg)
{ {
clicon_log_notify_t *old = _log_notify_cb; clicon_log_notify_t *old = _log_notify_cb;
_log_notify_cb = cb; _log_notify_cb = cb;
@ -144,7 +147,8 @@ slogtime(void)
* @param[in] msg Message to print as argv. * @param[in] msg Message to print as argv.
*/ */
int int
clicon_log_str(int level, char *msg) clicon_log_str(int level,
char *msg)
{ {
if (_logflags & CLICON_LOG_SYSLOG) if (_logflags & CLICON_LOG_SYSLOG)
syslog(LOG_MAKEPRI(LOG_USER, level), "%s", msg); syslog(LOG_MAKEPRI(LOG_USER, level), "%s", msg);
@ -194,7 +198,8 @@ clicon_log_str(int level, char *msg)
* @param[in] format Message to print as argv. * @param[in] format Message to print as argv.
*/ */
int int
clicon_log(int level, char *format, ...) clicon_log(int level,
char *format, ...)
{ {
va_list args; va_list args;
int len; int len;
@ -248,7 +253,8 @@ clicon_log(int level, char *format, ...)
debug messages are directed. debug messages are directed.
*/ */
int int
clicon_debug_init(int dbglevel, FILE *f) clicon_debug_init(int dbglevel,
FILE *f)
{ {
debug = dbglevel; /* Global variable */ debug = dbglevel; /* Global variable */
return 0; return 0;
@ -268,7 +274,8 @@ clicon_debug_init(int dbglevel, FILE *f)
* @param[in] format Message to print as argv. * @param[in] format Message to print as argv.
*/ */
int int
clicon_debug(int dbglevel, char *format, ...) clicon_debug(int dbglevel,
char *format, ...)
{ {
va_list args; va_list args;
int len; int len;
@ -310,6 +317,7 @@ clicon_debug(int dbglevel, char *format, ...)
} }
/*! Translate month number (0..11) to a three letter month name /*! Translate month number (0..11) to a three letter month name
* @param[in] md month number, where 0 is january
*/ */
char * char *
mon2name(int md) mon2name(int md)