add keepalive function for lan interface

This commit is contained in:
Duncan Laurie 2004-09-03 18:58:59 +00:00
parent 72f6d0b977
commit bdf90c59bc
2 changed files with 20 additions and 0 deletions

View File

@ -156,6 +156,7 @@ struct ipmi_intf {
int (*sendrsp)(struct ipmi_intf * intf, struct ipmi_rs * rsp);
struct ipmi_rs *(*recv_sol)(struct ipmi_intf * intf);
struct ipmi_rs *(*send_sol)(struct ipmi_intf * intf, struct ipmi_v2_payload * payload);
int (*keepalive)(struct ipmi_intf * intf);
};
struct ipmi_intf * ipmi_intf_load(char * name);

View File

@ -79,6 +79,7 @@ static int ipmi_lan_send_packet(struct ipmi_intf * intf, unsigned char * data, i
static struct ipmi_rs * ipmi_lan_recv_packet(struct ipmi_intf * intf);
static struct ipmi_rs * ipmi_lan_poll_recv(struct ipmi_intf * intf);
static int ipmi_lan_setup(struct ipmi_intf * intf);
static int ipmi_lan_keepalive(struct ipmi_intf * intf);
struct ipmi_intf ipmi_lan_intf = {
name: "lan",
@ -88,6 +89,7 @@ struct ipmi_intf ipmi_lan_intf = {
close: ipmi_lan_close,
sendrecv: ipmi_lan_send_cmd,
sendrsp: ipmi_lan_send_rsp,
keepalive: ipmi_lan_keepalive,
target_addr: IPMI_BMC_SLAVE_ADDR,
};
@ -844,6 +846,23 @@ int ipmi_lan_send_rsp(struct ipmi_intf * intf, struct ipmi_rs * rsp)
return 0;
}
/* send a get device id command to keep session active */
static int
ipmi_lan_keepalive(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req = { msg: {
netfn: IPMI_NETFN_APP,
cmd: 1,
}};
if (!intf->opened)
return 0;
rsp = intf->sendrecv(intf, &req);
return (!rsp || rsp->ccode) ? -1 : 0;
}
/*
* IPMI Get Channel Authentication Capabilities Command
*/