iPXE
|
VMware GuestRPC mechanism. More...
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/vmware.h>
#include <ipxe/guestrpc.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
int | guestrpc_open (void) |
Open GuestRPC channel. More... | |
static int | guestrpc_command_len (int channel, size_t len) |
Send GuestRPC command length. More... | |
static int | guestrpc_command_data (int channel, uint32_t data) |
Send GuestRPC command data. More... | |
static int | guestrpc_reply_len (int channel, uint16_t *reply_id) |
Receive GuestRPC reply length. More... | |
static int | guestrpc_reply_data (int channel, uint16_t reply_id, uint32_t *data) |
Receive GuestRPC reply data. More... | |
static int | guestrpc_reply_finish (int channel, uint16_t reply_id) |
Finish receiving GuestRPC reply. More... | |
void | guestrpc_close (int channel) |
Close GuestRPC channel. More... | |
int | guestrpc_command (int channel, const char *command, char *reply, size_t reply_len) |
Issue GuestRPC command. More... | |
VMware GuestRPC mechanism.
Definition in file guestrpc.c.
#define EPROTO_OPEN __einfo_error ( EINFO_EPROTO_OPEN ) |
Definition at line 40 of file guestrpc.c.
#define EINFO_EPROTO_OPEN __einfo_uniqify ( EINFO_EPROTO, 0x00, "GuestRPC open failed" ) |
Definition at line 41 of file guestrpc.c.
#define EPROTO_COMMAND_LEN __einfo_error ( EINFO_EPROTO_COMMAND_LEN ) |
Definition at line 43 of file guestrpc.c.
#define EINFO_EPROTO_COMMAND_LEN __einfo_uniqify ( EINFO_EPROTO, 0x01, "GuestRPC command length failed" ) |
Definition at line 44 of file guestrpc.c.
#define EPROTO_COMMAND_DATA __einfo_error ( EINFO_EPROTO_COMMAND_DATA ) |
Definition at line 46 of file guestrpc.c.
#define EINFO_EPROTO_COMMAND_DATA __einfo_uniqify ( EINFO_EPROTO, 0x02, "GuestRPC command data failed" ) |
Definition at line 47 of file guestrpc.c.
#define EPROTO_REPLY_LEN __einfo_error ( EINFO_EPROTO_REPLY_LEN ) |
Definition at line 49 of file guestrpc.c.
#define EINFO_EPROTO_REPLY_LEN __einfo_uniqify ( EINFO_EPROTO, 0x03, "GuestRPC reply length failed" ) |
Definition at line 50 of file guestrpc.c.
#define EPROTO_REPLY_DATA __einfo_error ( EINFO_EPROTO_REPLY_DATA ) |
Definition at line 52 of file guestrpc.c.
#define EINFO_EPROTO_REPLY_DATA __einfo_uniqify ( EINFO_EPROTO, 0x04, "GuestRPC reply data failed" ) |
Definition at line 53 of file guestrpc.c.
#define EPROTO_REPLY_FINISH __einfo_error ( EINFO_EPROTO_REPLY_FINISH ) |
Definition at line 55 of file guestrpc.c.
#define EINFO_EPROTO_REPLY_FINISH __einfo_uniqify ( EINFO_EPROTO, 0x05, "GuestRPC reply finish failed" ) |
Definition at line 56 of file guestrpc.c.
#define EPROTO_CLOSE __einfo_error ( EINFO_EPROTO_CLOSE ) |
Definition at line 58 of file guestrpc.c.
#define EINFO_EPROTO_CLOSE __einfo_uniqify ( EINFO_EPROTO, 0x06, "GuestRPC close failed" ) |
Definition at line 59 of file guestrpc.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
int guestrpc_open | ( | void | ) |
Open GuestRPC channel.
channel | Channel number, or negative error |
Definition at line 67 of file guestrpc.c.
References channel, DBGC, EPROTO_OPEN, GUESTRPC_MAGIC, GUESTRPC_OPEN, GUESTRPC_OPEN_SUCCESS, and status.
Referenced by guestinfo_init(), and vmconsole_init().
|
static |
Send GuestRPC command length.
channel | Channel number |
len | Command length |
rc | Return status code |
Definition at line 92 of file guestrpc.c.
References channel, DBGC, EPROTO_COMMAND_LEN, GUESTRPC_COMMAND_LEN, GUESTRPC_COMMAND_LEN_SUCCESS, GUESTRPC_MAGIC, len, and status.
Referenced by guestrpc_command().
|
static |
Send GuestRPC command data.
channel | Channel number |
data | Command data |
rc | Return status code |
Definition at line 117 of file guestrpc.c.
References channel, data, DBGC, EPROTO_COMMAND_DATA, GUESTRPC_COMMAND_DATA, GUESTRPC_COMMAND_DATA_SUCCESS, GUESTRPC_MAGIC, and status.
Referenced by guestrpc_command().
|
static |
Receive GuestRPC reply length.
channel | Channel number |
reply_id | Reply ID |
len | Reply length, or negative error |
Definition at line 142 of file guestrpc.c.
References channel, DBGC, EPROTO_REPLY_LEN, GUESTRPC_MAGIC, GUESTRPC_REPLY_LEN, GUESTRPC_REPLY_LEN_SUCCESS, len, and status.
Referenced by guestrpc_command().
Receive GuestRPC reply data.
channel | Channel number |
reply_id | Reply ID |
data | Reply data |
rc | Return status code |
Definition at line 166 of file guestrpc.c.
References channel, data, DBGC, EPROTO_REPLY_DATA, GUESTRPC_MAGIC, GUESTRPC_REPLY_DATA, GUESTRPC_REPLY_DATA_SUCCESS, and status.
Referenced by guestrpc_command().
|
static |
Finish receiving GuestRPC reply.
channel | Channel number |
reply_id | Reply ID |
rc | Return status code |
Definition at line 191 of file guestrpc.c.
References channel, DBGC, EPROTO_REPLY_FINISH, GUESTRPC_MAGIC, GUESTRPC_REPLY_FINISH, GUESTRPC_REPLY_FINISH_SUCCESS, and status.
Referenced by guestrpc_command().
void guestrpc_close | ( | int | channel | ) |
Close GuestRPC channel.
channel | Channel number |
Definition at line 213 of file guestrpc.c.
References channel, DBGC, GUESTRPC_CLOSE, GUESTRPC_CLOSE_SUCCESS, GUESTRPC_MAGIC, and status.
int guestrpc_command | ( | int | channel, |
const char * | command, | ||
char * | reply, | ||
size_t | reply_len | ||
) |
Issue GuestRPC command.
channel | Channel number |
command | Command |
reply | Reply buffer |
reply_len | Length of reply buffer |
len | Length of reply, or negative error |
The actual length of the reply will be returned even if the buffer was too small.
Definition at line 242 of file guestrpc.c.
References assert(), channel, command_len, data, DBGC, DBGC2, DBGC2_HDA, DBGC_HDA, EIO, guestrpc_command_data(), guestrpc_command_len(), GUESTRPC_MAGIC, guestrpc_reply_data(), guestrpc_reply_finish(), guestrpc_reply_len(), GUESTRPC_SUCCESS, len, NULL, rc, status, and strlen().
Referenced by guestinfo_fetch_type(), and vmconsole_putchar().