ncsi: Pass command header to response handlers

This change passes the command header as an additional read-only parameter
to each response handler so that they can make more response handling
descisions based on the command header fields. This is especially useful for
handling OEM NC-SI commands, or any protocol that's encapsulated in an NC-SI
header.

Signed-off-by: Peter Delevoryas <pdel@fb.com>
diff --git a/src/ncsi.c b/src/ncsi.c
index 5bf731b..bfe3088 100644
--- a/src/ncsi.c
+++ b/src/ncsi.c
@@ -56,7 +56,8 @@
 }
 
 /* Get Version ID */
-static int ncsi_rsp_handler_gvi(Slirp *slirp, struct ncsi_rsp_pkt_hdr *rnh)
+static int ncsi_rsp_handler_gvi(Slirp *slirp, const struct ncsi_pkt_hdr *nh,
+                                struct ncsi_rsp_pkt_hdr *rnh)
 {
     struct ncsi_rsp_gvi_pkt *rsp = (struct ncsi_rsp_gvi_pkt *)rnh;
 
@@ -67,7 +68,8 @@
 }
 
 /* Get Capabilities */
-static int ncsi_rsp_handler_gc(Slirp *slirp, struct ncsi_rsp_pkt_hdr *rnh)
+static int ncsi_rsp_handler_gc(Slirp *slirp, const struct ncsi_pkt_hdr *nh,
+                               struct ncsi_rsp_pkt_hdr *rnh)
 {
     struct ncsi_rsp_gc_pkt *rsp = (struct ncsi_rsp_gc_pkt *)rnh;
 
@@ -82,7 +84,8 @@
 }
 
 /* Get Link status */
-static int ncsi_rsp_handler_gls(Slirp *slirp, struct ncsi_rsp_pkt_hdr *rnh)
+static int ncsi_rsp_handler_gls(Slirp *slirp, const struct ncsi_pkt_hdr *nh,
+                                struct ncsi_rsp_pkt_hdr *rnh)
 {
     struct ncsi_rsp_gls_pkt *rsp = (struct ncsi_rsp_gls_pkt *)rnh;
 
@@ -91,7 +94,8 @@
 }
 
 /* Get Parameters */
-static int ncsi_rsp_handler_gp(Slirp *slirp, struct ncsi_rsp_pkt_hdr *rnh)
+static int ncsi_rsp_handler_gp(Slirp *slirp, const struct ncsi_pkt_hdr *nh,
+                               struct ncsi_rsp_pkt_hdr *rnh)
 {
     struct ncsi_rsp_gp_pkt *rsp = (struct ncsi_rsp_gp_pkt *)rnh;
 
@@ -107,7 +111,8 @@
 static const struct ncsi_rsp_handler {
     unsigned char type;
     int payload;
-    int (*handler)(Slirp *slirp, struct ncsi_rsp_pkt_hdr *rnh);
+    int (*handler)(Slirp *slirp, const struct ncsi_pkt_hdr *nh,
+                   struct ncsi_rsp_pkt_hdr *rnh);
 } ncsi_rsp_handlers[] = { { NCSI_PKT_RSP_CIS, 4, NULL },
                           { NCSI_PKT_RSP_SP, 4, NULL },
                           { NCSI_PKT_RSP_DP, 4, NULL },
@@ -188,8 +193,7 @@
         rnh->reason = htons(NCSI_PKT_RSP_R_NO_ERROR);
 
         if (handler->handler) {
-            /* TODO: handle errors */
-            handler->handler(slirp, rnh);
+            handler->handler(slirp, nh, rnh);
         }
         ncsi_rsp_len += handler->payload;
     } else {