This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm wondering if the ntp community would be open to incorporating my libxo into ntp source code. | |
libxo is a library I wrote for FreeBSD that makes text, HTML, XML, JSON, CSV, CBOR, and other formats using a single code path. It's be added to the base OS for FreeBSD, and allows normal command line utilities to produce these alternative structured output formats (see below). Documentation is available at https://libxo.readthedocs.io/en/latest/ and source code is on GitHub https://github.com/Juniper/libxo | |
For embedded platforms that want to expose an API (like Juniper Networks' JUNOS software), this is an important feature. JUNOS currently exposes only text output from nap-related commands, but we would like to do better. This would involve making patches for ntp source code that would allow the same code to emit these structured formats. | |
I'd be signing up for the following work: | |
- publish linux packages for libxo (which I should be doing anyway) | |
- create an acceptable patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libxo/libxo.c b/libxo/libxo.c | |
index c45ed49..1df5114 100644 | |
--- a/libxo/libxo.c | |
+++ b/libxo/libxo.c | |
@@ -258,8 +258,8 @@ struct xo_handle_s { | |
ssize_t xo_units_offset; /* Start of units insertion point */ | |
ssize_t xo_columns; /* Columns emitted during this xo_emit call */ | |
#ifndef LIBXO_TEXT_ONLY | |
- uint8_t xo_color_map_fg[XO_NUM_COLORS]; /* Foreground color mappings */ | |
- uint8_t xo_color_map_bg[XO_NUM_COLORS]; /* Background color mappings */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <fcntl.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <sys/stat.h> | |
#include <sys/types.h> | |
#include <sys/sysctl.h> | |
#include <libxo/xo.h> | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[edit interfaces xe-1/1/1] | |
phil@dent# set unit 0 disable | |
[edit interfaces xe-1/1/1] | |
phil@dent# commit confirmed 2 | |
commit confirmed will be automatically rolled back in 2 minutes unless confirmed | |
commit complete | |
# commit confirmed will be rolled back in 2 minutes | |
[edit interfaces xe-1/1/1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcpe { | |
interfaces { | |
fe-0/2/0 { | |
unit 1 { | |
apply-macro vcpe { | |
customer test; | |
address 3.3.3.3; | |
vlan-id 345; | |
security default; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The apply-groups statement can be given at any level of the | |
configuration hierarchy, listing group names in priority | |
order. Groups listed in nested apply-groups statements take priority | |
over groups in outer statements: | |
apply-groups [ eight nine ten ]; | |
protocols { | |
apply-groups seven; | |
bgp { | |
apply-groups [ five six ]; |