Added Cipher Suite priv param-24 to set/get LanCfg

IPMI Spec. 23.1(Set lan configuration) and 23.2(get lan configuration)
refers to set and get (write and read) privileges through set and get
lan configuration command using parameter 24 (0x18, RMCP+ Messaging
Cipher Suite Privilege Levels).

This patch allows us to create/update user setting Cipher Suite
privilege levels file.

This patch makes set/get Cipher Suite Privilege Level parameter data
to be persistent. Supports set and get Cipher Suite privilege levels
command for any channel.

Tested:
Set Lan config:
Command: ipmitool raw 0x0c 0x01 0x03 0x18 0x00 0x34 0x43 0x44 0x33 0x44
         0x44 0x44 0x44
Response:                       //Success

Get Lan config:
Command:  ipmitool  raw 0x0c 0x02 0x03 0x18 0x01 0x01
Response: 11 00 34 43 44 33 44 44 44 44

Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: I1357af820bd1082bda208aef3918be8c31bf1af3
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 4479489..d570996 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -1,4 +1,5 @@
 #include "app/channel.hpp"
+#include "user_channel/cipher_mgmt.hpp"
 
 #include <arpa/inet.h>
 #include <netinet/ether.h>
@@ -185,6 +186,7 @@
     VLANId = 20,
     CiphersuiteSupport = 22,
     CiphersuiteEntries = 23,
+    cipherSuitePrivilegeLevels = 24,
     IPFamilySupport = 50,
     IPFamilyEnables = 51,
     IPv6Status = 55,
@@ -1672,6 +1674,34 @@
             // Accept any prefix value since our prefix length has to be 0
             return responseSuccess();
         }
+        case LanParam::cipherSuitePrivilegeLevels:
+        {
+            uint8_t reserved;
+            std::array<uint4_t, ipmi::maxCSRecords> cipherSuitePrivs;
+
+            if (req.unpack(reserved, cipherSuitePrivs) || !req.fullyUnpacked())
+            {
+                return responseReqDataLenInvalid();
+            }
+
+            if (reserved)
+            {
+                return responseInvalidFieldRequest();
+            }
+
+            uint8_t resp =
+                getCipherConfigObject(csPrivFileName, csPrivDefaultFileName)
+                    .setCSPrivilegeLevels(channel, cipherSuitePrivs);
+            if (!resp)
+            {
+                return responseSuccess();
+            }
+            else
+            {
+                req.trailingOk = true;
+                return response(resp);
+            }
+        }
     }
 
     if ((parameter >= oemCmdStart) && (parameter <= oemCmdEnd))
@@ -1930,6 +1960,24 @@
             ret.pack(dataRef(prefix));
             return responseSuccess(std::move(ret));
         }
+        case LanParam::cipherSuitePrivilegeLevels:
+        {
+            std::array<uint4_t, ipmi::maxCSRecords> csPrivilegeLevels;
+
+            uint8_t resp =
+                getCipherConfigObject(csPrivFileName, csPrivDefaultFileName)
+                    .getCSPrivilegeLevels(channel, csPrivilegeLevels);
+            if (!resp)
+            {
+                constexpr uint8_t reserved1 = 0x00;
+                ret.pack(reserved1, csPrivilegeLevels);
+                return responseSuccess(std::move(ret));
+            }
+            else
+            {
+                return response(resp);
+            }
+        }
     }
 
     if ((parameter >= oemCmdStart) && (parameter <= oemCmdEnd))