Loading...
Searching...
No Matches
netconf_acm.h File Reference

NACM functionality header. More...

`#include "../sysrepo.h"`
Include dependency graph for netconf_acm.h:

Go to the source code of this file.

## Functions

int | sr_nacm_check_operation (sr_session_ctx_t *session, const struct lyd_node *op)
| Explicitly check NACM access of an operation.
void | sr_nacm_destroy (void)
| Destroy NACM.
const char * | sr_nacm_get_recovery_user (void)
| Get username of the NACM recovery user with unrestricted access.
const char * | sr_nacm_get_user (sr_session_ctx_t *session)
| Get the NACM user of the session.
int | sr_nacm_glob_stats_subscribe (sr_session_ctx_t *session, sr_subscr_options_t opts, sr_subscription_ctx_t **sub)
| Subscribe for providing global NACM stats. These include triggering subscriptions made by sr_nacm_init() so another subscription structure is required.
int | sr_nacm_init (sr_session_ctx_t *session, sr_subscr_options_t opts, sr_subscription_ctx_t **sub)
| Initialize NACM and its callbacks.
int | sr_nacm_set_user (sr_session_ctx_t *session, const char *user)
| Set the NACM user for this session, which enables NACM for all operations on this session.

## Detailed Description

NACM functionality header.

Author
  Michal Vasko mvask.nosp@m.o@ce.nosp@m.snet..nosp@m.cz

Copyright
  Copyright (c) 2019 - 2025 Deutsche Telekom AG. Copyright (c) 2017 - 2025 CESNET, z.s.p.o.

This source code is licensed under BSD 3-Clause License (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at

    https://opensource.org/licenses/BSD-3-Clause

Definition in file netconf_acm.h.

## Function Documentation

## sr_nacm_check_operation()

int sr_nacm_check_operation | ( | sr_session_ctx_t * | session,
|  | const struct lyd_node * | op )

Explicitly check NACM access of an operation.

Parameters

  [in] | session | Session to use, must have NACM username set for the check to be performed.
  [in] | op | Operation to check.

Returns
  Error code (SR_ERR_OK on success).

## sr_nacm_destroy()

void sr_nacm_destroy | ( | void |  | ) |

Destroy NACM.

## sr_nacm_get_recovery_user()

const char * sr_nacm_get_recovery_user | ( | void |  | ) |

Get username of the NACM recovery user with unrestricted access.

Returns
  Username of NACM recovery session.

## sr_nacm_get_user()

const char * sr_nacm_get_user | ( | sr_session_ctx_t * | session | ) |

Get the NACM user of the session.

Returns
  Session NACM user.

## sr_nacm_glob_stats_subscribe()

int sr_nacm_glob_stats_subscribe | ( | sr_session_ctx_t * | session,
|  | sr_subscr_options_t | opts,
|  | sr_subscription_ctx_t ** | sub )

Subscribe for providing global NACM stats. These include triggering subscriptions made by sr_nacm_init() so another subscription structure is required.

There can be only a single provider of these data on a system and in case there already is, this function returns success but does not modify `sub`.

Parameters

  [in] | session | Session to use.
  [in] | opts | Optionally, SR_SUBSCR_NO_THREAD can be specified. No other flags are allowed.
  [out] | sub | Subscription context, must be different from the one used in sr_nacm_init()!

Returns
  Error code (SR_ERR_OK on success).

## sr_nacm_init()

int sr_nacm_init | ( | sr_session_ctx_t * | session,
|  | sr_subscr_options_t | opts,
|  | sr_subscription_ctx_t ** | sub )

Initialize NACM and its callbacks.

Needs to be called only once in each process. Subscriptions created in `sub` need to be unsubscribed separately and before calling sr_nacm_destroy().

Parameters

  [in] | session | Session to use.
  [in] | opts | Optionally, SR_SUBSCR_NO_THREAD can be specified. No other flags are allowed.
  [out] | sub | Subscription context.

Returns
  Error code (SR_ERR_OK on success).

## sr_nacm_set_user()

int sr_nacm_set_user | ( | sr_session_ctx_t * | session,
|  | const char * | user )

Set the NACM user for this session, which enables NACM for all operations on this session.

Affected operations:

- reading data - unaccesible data are silently filtered out from the returned data;
- editing data - on an attempt to edit data without the proper access NETCONF error is returned;
- sending RPC/action - on an attempt to send RPC/action without the proper access NETCONF error is returned;
- receiving notifications - notifications without the proper access are silently dropped;
- subscribing to YANG Push - unreadable data are silently filtered out from the received notifications.

Parameters

  [in] | session | Session to use.
  [in] | user | NACM username to use. If NULL, the username is cleared disabling NACM.

Returns
  Error code (SR_ERR_OK on success).