ncsi: move ncsi operations to Interface class

The existing NCSI operations are quite Interface-specific (ie., rely on
netlink-specific constructs), so move these to methods on the Interface
class.

We'll add alternative implementations in a future change.

Change-Id: I3ea5fcd64969a2c164503057e35881010ad141a0
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
diff --git a/src/ncsi_util.hpp b/src/ncsi_util.hpp
index a04e249..aa2051c 100644
--- a/src/ncsi_util.hpp
+++ b/src/ncsi_util.hpp
@@ -15,74 +15,67 @@
 
 struct Interface
 {
+    /* @brief  This function will ask underlying NCSI driver
+     *         to send an OEM command (command type 0x50) with
+     *         the specified payload as the OEM data.
+     *         This function talks with the NCSI driver over
+     *         netlink messages.
+     * @param[in] package - NCSI Package.
+     * @param[in] channel - Channel number with in the package.
+     * @param[in] opcode  - NCSI Send Command sub-operation
+     * @param[in] payload - OEM data to send.
+     * @returns 0 on success and negative value for failure.
+     */
+    int sendOemCommand(int package, int channel, int opcode,
+                       std::span<const unsigned char> payload);
+
+    /* @brief  This function will ask underlying NCSI driver
+     *         to set a specific  package or package/channel
+     *         combination as the preferred choice.
+     *         This function talks with the NCSI driver over
+     *         netlink messages.
+     * @param[in] package - NCSI Package.
+     * @param[in] channel - Channel number with in the package.
+     * @returns 0 on success and negative value for failure.
+     */
+    int setChannel(int package, int channel);
+
+    /* @brief  This function will ask underlying NCSI driver
+     *         to clear any preferred setting from the interface.
+     *         This function talks with the NCSI driver over
+     *         netlink messages.
+     * @returns 0 on success and negative value for failure.
+     */
+    int clearInterface();
+
+    /* @brief  This function is used to dump all the info
+     *         of the package and the channels underlying
+     *         the package.
+     * @param[in] package - NCSI Package.
+     * @returns 0 on success and negative value for failure.
+     */
+    int getInfo(int package);
+
+    /* @brief  This function assigns a mask controlling responses to AEN from a
+     * package.
+     * @param[in] mask - A 32-bit mask integer
+     * @returns 0 on success and negative value for failure.
+     */
+    int setPackageMask(unsigned int mask);
+
+    /* @brief  This function sets the AEN mask for the channels inside the
+     * selected package.
+     * @param[in] package - NCSI Package.
+     * @param[in] mask - A 32-bit mask integer
+     * @returns 0 on success and negative value for failure.
+     */
+    int setChannelMask(int package, unsigned int mask);
+
     int ifindex;
 };
 
 std::string to_string(Interface& interface);
 
-/* @brief  This function will ask underlying NCSI driver
- *         to send an OEM command (command type 0x50) with
- *         the specified payload as the OEM data.
- *         This function talks with the NCSI driver over
- *         netlink messages.
- * @param[in] interface - Interface
- * @param[in] package - NCSI Package.
- * @param[in] channel - Channel number with in the package.
- * @param[in] opcode  - NCSI Send Command sub-operation
- * @param[in] payload - OEM data to send.
- * @returns 0 on success and negative value for failure.
- */
-int sendOemCommand(Interface& interface, int package, int channel, int opcode,
-                   std::span<const unsigned char> payload);
-
-/* @brief  This function will ask underlying NCSI driver
- *         to set a specific  package or package/channel
- *         combination as the preferred choice.
- *         This function talks with the NCSI driver over
- *         netlink messages.
- * @param[in] interface - Interface
- * @param[in] package - NCSI Package.
- * @param[in] channel - Channel number with in the package.
- * @returns 0 on success and negative value for failure.
- */
-int setChannel(Interface& interface, int package, int channel);
-
-/* @brief  This function will ask underlying NCSI driver
- *         to clear any preferred setting from the given
- *         interface.
- *         This function talks with the NCSI driver over
- *         netlink messages.
- * @param[in] interface - Interface
- * @returns 0 on success and negative value for failure.
- */
-int clearInterface(Interface& interface);
-
-/* @brief  This function is used to dump all the info
- *         of the package and the channels underlying
- *         the package.
- * @param[in] interface - Interface
- * @param[in] package - NCSI Package.
- * @returns 0 on success and negative value for failure.
- */
-int getInfo(Interface& interface, int package);
-
-/* @brief  This function assigns a mask controlling responses to AEN from a
- * package.
- * @param[in] ifindex - Interface Index.
- * @param[in] mask - A 32-bit mask integer
- * @returns 0 on success and negative value for failure.
- */
-int setPackageMask(Interface& interface, unsigned int mask);
-
-/* @brief  This function sets the AEN mask for the channels inside the selected
- * package.
- * @param[in] ifindex - Interface Index.
- * @param[in] package - NCSI Package.
- * @param[in] mask - A 32-bit mask integer
- * @returns 0 on success and negative value for failure.
- */
-int setChannelMask(Interface& interface, int package, unsigned int mask);
-
 } // namespace ncsi
 } // namespace network
 } // namespace phosphor