| Elektra 0.11.0

Functions
notification.c File Reference

Implementation of notification functions as defined in kdbnotification.h. More...

`#include <kdbassert.h>`
`#include <kdbease.h>`
`#include <kdbhelper.h>`
`#include <kdbinvoke.h>`
`#include <kdbioprivate.h>`
`#include <kdblogger.h>`
`#include <kdbnotification.h>`
`#include <kdbnotificationinternal.h>`
`#include <kdbplugin.h>`
`#include <kdbprivate.h>`
`#include <stdio.h>`

## Functions
int | elektraNotificationContract (KeySet *contract)
| Creates a contract for use with kdbOpen() that sets up notifications.
int | elektraNotificationRegisterCallback (KDB *kdb, Key *key, ElektraNotificationChangeCallback callback, void *context)
| Subscribe for updates via callback when a given key value is changed.
int | elektraNotificationRegisterCallbackSameOrBelow (KDB *kdb, Key *key, ElektraNotificationChangeCallback callback, void *context)
| Subscribe for updates via callback when a given key or a key below changed.

## Detailed Description

Implementation of notification functions as defined in kdbnotification.h.

Copyright
  BSD License (see LICENSE.md or https://www.libelektra.org)

## Function Documentation

## ◆ elektraNotificationContract()

int elektraNotificationContract | ( | KeySet * | contract | ) |

Creates a contract for use with kdbOpen() that sets up notifications.

When you call kdbOpen() with this contract, the `internalnotification` plugin will be mounted automatically. This allows you to call other `elektraNotification*` functions.

If you need to configure notification transport plugins, you should manually add the relevant keys to `contract`.

Parameters

  contract | The keyset into which the contract is written.

Return values

  -1 | if `contract` is NULL
  0 | on success