commit | ea2e6eeca15f4019923466f7c8ccc52c53a5ea94 | [log] [tgz] |
---|---|---|
author | Willy Tu <wltu@google.com> | Mon Jan 31 15:38:48 2022 -0800 |
committer | Ed Tanous <ed@tanous.net> | Tue Mar 01 00:00:11 2022 +0000 |
tree | de20cf21801883ace3ef3b887253c7dd407411e5 | |
parent | ad5d7e7130db7c99d6d4d3c3a465b28c33f9be21 [diff] |
json_utils: Add support for multiple level json read Added support for multiple level direct read. For example, we can now access `abc/xyz` directly instead of getting `abc` and then abc[`xyz`]. For extra element error, it will only be triggered if the element at the root level is not a parent of any of the requested elements. For example, { "abc": { "xyz": 12 } } Getting "abc/xyz" will satisfy the condition so it does not throw an error. This is accomplished in a reasonable way by moving the previously variadic templated code to a std::span<variant> that contains all possible types. This is a trick learned from the fmt library to reduce compile sizes, as the majority of the code doesn't get duplicated at template level, and is instead operating on the fixed variant type. This commit drops 7316 bytes (about half a percent of total) from the bmcweb binary size from the reduction in template usage. Later patches build on this patchset to simplify call sites even more and reduce the binary size further, but as is, this is still a win. Note: now that the UnpackVariant lists all possible unpack types, it was found that readJson would fail to compile for vector<bool>. This is a well known C++ deficiency in the std::vector<bool> type when compared to all other types, and will need special handling in the future. The two types for vector<bool> are left commented out in the typelist. Tested: Unit tests passing with reasonable coverage. Functional use in next commit in this series. Change-Id: Ifb247c9121c41ad8f1de26eb4bfc3d71484e6bd6 Signed-off-by: Willy Tu <wltu@google.com> Signed-off-by: Ed Tanous <edtanous@google.com>
This component attempts to be a "do everything" embedded webserver for openbmc.
At this time, the webserver implements a few interfaces:
BMCWeb is configured by setting -D
flags that correspond to options in bmcweb/meson_options.txt
and then compiling. For example, meson <builddir> -Dkvm=disabled ...
followed by ninja
in build directory. The option names become C++ preprocessor symbols that control which code is compiled into the program.
meson builddir ninja -C builddir
meson builddir -Dbuildtype=minsize -Db_lto=true -Dtests=disabled ninja -C buildir
If any of the dependencies are not found on the host system during configuration, meson automatically gets them via its wrap dependencies mentioned in bmcweb/subprojects
.
meson builddir -Dwrap_mode=nofallback ninja -C builddir
meson builddir -Dbuildtype=debug ninja -C builddir
meson builddir -Db_coverage=true -Dtests=enabled ninja coverage -C builddir test
When BMCWeb starts running, it reads persistent configuration data (such as UUID and session data) from a local file. If this is not usable, it generates a new configuration.
When BMCWeb SSL support is enabled and a usable certificate is not found, it will generate a self-sign a certificate before launching the server. The keys are generated by the secp384r1
algorithm. The certificate
C=US, O=OpenBMC, CN=testhost
,SHA-256
algorithm.