aboutsummaryrefslogtreecommitdiff
path: root/src/ncsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ncsi.c')
-rw-r--r--src/ncsi.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/ncsi.c b/src/ncsi.c
index f3427bd..5bf731b 100644
--- a/src/ncsi.c
+++ b/src/ncsi.c
@@ -55,8 +55,19 @@ static uint32_t ncsi_calculate_checksum(uint8_t *data, int len)
return checksum;
}
+/* Get Version ID */
+static int ncsi_rsp_handler_gvi(Slirp *slirp, struct ncsi_rsp_pkt_hdr *rnh)
+{
+ struct ncsi_rsp_gvi_pkt *rsp = (struct ncsi_rsp_gvi_pkt *)rnh;
+
+ rsp->ncsi_version = htonl(0xF1F0F000);
+ rsp->mf_id = htonl(slirp->mfr_id);
+
+ return 0;
+}
+
/* Get Capabilities */
-static int ncsi_rsp_handler_gc(struct ncsi_rsp_pkt_hdr *rnh)
+static int ncsi_rsp_handler_gc(Slirp *slirp, struct ncsi_rsp_pkt_hdr *rnh)
{
struct ncsi_rsp_gc_pkt *rsp = (struct ncsi_rsp_gc_pkt *)rnh;
@@ -71,7 +82,7 @@ static int ncsi_rsp_handler_gc(struct ncsi_rsp_pkt_hdr *rnh)
}
/* Get Link status */
-static int ncsi_rsp_handler_gls(struct ncsi_rsp_pkt_hdr *rnh)
+static int ncsi_rsp_handler_gls(Slirp *slirp, struct ncsi_rsp_pkt_hdr *rnh)
{
struct ncsi_rsp_gls_pkt *rsp = (struct ncsi_rsp_gls_pkt *)rnh;
@@ -80,7 +91,7 @@ static int ncsi_rsp_handler_gls(struct ncsi_rsp_pkt_hdr *rnh)
}
/* Get Parameters */
-static int ncsi_rsp_handler_gp(struct ncsi_rsp_pkt_hdr *rnh)
+static int ncsi_rsp_handler_gp(Slirp *slirp, struct ncsi_rsp_pkt_hdr *rnh)
{
struct ncsi_rsp_gp_pkt *rsp = (struct ncsi_rsp_gp_pkt *)rnh;
@@ -96,7 +107,7 @@ static int ncsi_rsp_handler_gp(struct ncsi_rsp_pkt_hdr *rnh)
static const struct ncsi_rsp_handler {
unsigned char type;
int payload;
- int (*handler)(struct ncsi_rsp_pkt_hdr *rnh);
+ int (*handler)(Slirp *slirp, 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 },
@@ -117,7 +128,7 @@ static const struct ncsi_rsp_handler {
{ NCSI_PKT_RSP_EGMF, 4, NULL },
{ NCSI_PKT_RSP_DGMF, 4, NULL },
{ NCSI_PKT_RSP_SNFC, 4, NULL },
- { NCSI_PKT_RSP_GVI, 40, NULL },
+ { NCSI_PKT_RSP_GVI, 40, ncsi_rsp_handler_gvi },
{ NCSI_PKT_RSP_GC, 32, ncsi_rsp_handler_gc },
{ NCSI_PKT_RSP_GP, 40, ncsi_rsp_handler_gp },
{ NCSI_PKT_RSP_GCPS, 172, NULL },
@@ -178,7 +189,7 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
if (handler->handler) {
/* TODO: handle errors */
- handler->handler(rnh);
+ handler->handler(slirp, rnh);
}
ncsi_rsp_len += handler->payload;
} else {