Commit graph

12 commits

Author SHA1 Message Date
Christian Hopps d58653a5ba lib: northbound: improve xpath functionality
Allow user to leave keys off of a list entry node at the end of the xpath. This
will return all list entries. Previously there was no way to just get the list
entries. One had to leave off the last list entry node which would then return
all list nodes as well as all the siblings at the same level.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-28 17:52:57 +00:00
Christian Hopps a65cda16b2 mgmtd: simplify xpath registries
- move from client id indexed array of uints for register info
  per client to a u64 bitmask.
- add bit walking FOREACH macro

Walk the client IDs whose bits are set in a mask.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-11-06 17:44:58 -05:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Donatas Abraitis 061f5d1cb4 lib: Add PCRE2 support
Some results:

```
====
PCRE
====
% ./a.out "^65001" "65001"
comparing: ^65001 / 65001

ret status: 0
[14:31] donatas-pc donatas /home/donatas
% ./a.out "^65001_" "65001"
comparing: ^65001_ / 65001

ret status: 0

=====
PCRE2
=====
% ./a.out "^65001" "65001"
comparing: ^65001 / 65001

ret status: 0
[14:30] donatas-pc donatas /home/donatas
% ./a.out "^65001_" "65001"
comparing: ^65001_ / 65001

ret status: 1
```

Seems that if using PCRE2, we need to escape outer `()` chars and `|`. Sounds
like a bug.
But this is only with some older PCRE2 versions. With >= 10.36, I wasn't able
to reproduce this, everything is fine and working as expected.

Adding _FRR_PCRE2_POSIX definition because pcre2posix.h does not have
include's guard.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-07 21:23:53 +02:00
Quentin Young 0c0830c599 lib: add frrstr_hex to hexdump buffers
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-08-12 16:25:57 -04:00
Donald Sharp beee9b4a26 lib: Fix so that --enable-pcreposix actually compiles
The `--enable-pcreposix` configure option was not actually compiling
properly.  Follow pre-existing pattern for inclusion of regex.h
or the pcreposix.h header.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-16 14:14:04 -05:00
Quentin Young 90cf59eccf lib: replace begins_with, add frrstr_endswith
* Change 'begins_with' to 'frrstr_startswith' for consistency
* Add suffix checker, frrstr_endswith()
* Update vtysh to use the new function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-23 20:52:01 +00:00
Quentin Young ed1809c925 lib: add string replace function
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-06 22:38:10 +00:00
Renato Westphal 5e2444690b lib: add extern "C" {} blocks to all libfrr headers
These are necessary to use functions defined in these headers from C++.

Signed-off-by: David Lamparter <equinox@diac24.net>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-02-11 22:34:12 -02:00
paco 5d5ba0185d
bgpd, lib, ospfd, zebra: all_digit moved to frrstr
This solves a pending FIXME

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-19 17:59:53 +02:00
Quentin Young 2cddf2fff7 vtysh: add | support
* Rewrite pager implementation
* Replace fprintf() with vty_out()
* Modify vty_out() for better vtysh support
* Remove static global outputfile var
* Remove fp argument from many vtysh functions
* Add some docs for stuff along the way

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 16:16:10 +00:00
Quentin Young fe011935cd lib: add string utilities
I see lots of the same code being copy-pasted and slightly tweaked for
string processing all over the codebase. Time to start aggregating these
pieces into something consistent and correct.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 16:15:34 +00:00