Prevention of modification or deletion of a record of list

I need to prevent modification or deletion of a record of a list under a condition to another leaf in the data tree.

The list is:

container servers {
 // tailf:callpoint mycp;
             list server {
             key name;
     max-elements 64;
     leaf name {
        type string;
     leaf ip { 
        type inet:ip-address;
     leaf port {
        type inet:port-number;

Lets assume that the leaf ‘filter’ in another module shall be true in order to modify or delete a record of list server.

Should I use callpoint or validation point in order to achieve this?
Which function can I use to read the record for which the check will be done.
Is there any similar example?


Validation point. Callpoints are for external data providers. Not for validating configuration changes.
See ConfD 6.3.1 UG Chapter 9.7. Validating Data in C

If you are interested in the use-case for callpoints, see ConfD 6.3.1 UG Chapter 6.3. Callpoints and Callbacks.

While at it, to be aware of all your options, you may want to learn about the two-phase commit subscriber mechanism that ConfD support and can be used when you need to validated more than the configuration changes, e.g. some external resource such as a HW register. See examples.confd/cdb_subscription/twophase
However for your use-case, a validation point is likely the best solution.


int b_val;
maapi_get_bool_elem(maapi_socket, tctx->thandle, &b_val, "/filter");
if(b_val) ...

validate() in examples.confd/validate/c/more_a_than_b.c
Since your leaf is in another YANG module, include its generated header file, i.e. the generated ns file, for that YANG module.

It seems that a validation point is the right one.
Is there a way to identify that a new record in list server is been created or one is deleted during a transaction (edit-config)?

See for example maapi_diff_iterate() in the examples.confd/c_dependency/more_a_than_b.c example and in the confd_lib_maapi(3) man page.