ncsi: return interface info from Interface::getInfo()
Rather than expecting the ncsi_util callback to print the interface
info, return the interface info, and print that.
This allows for a specific output formatting function in
ncsi_netlink_main.c, rather than printing directly from the libnl
callback. We reformat for a more structured display of the
package/channel layouts.
We use std::optional for the return value here; it would be nice to use
std::expected instead, and get a full error code, but that's not quite
working with clang-18 at present. Even if we have an error code though,
we're just going to return EXIT_FAILURE anyway.
Tested: Invoked on a simlated dual-channel NCSI package:
# ncsi-netlink -x 2 --info
<7> Get Info , PACKAGE : 0xffffffffffffffff, INTERFACE: 0x7e8bf9bc
<7> Package id : 0
<7> package is forced
<7> Channel id : 0
<7> version 1.2 (p0c00)
<7> link state 0x40022f
<7> Channel id : 1
<7> version 1.2 (p0c01)
<7> link state 0x40022f
Change-Id: Idb62cc6695da67f4415ed9b0e7950c506018d630
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 files changed