iPXE
|
SUN ONC RPC protocol. More...
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/socket.h>
#include <ipxe/tcpip.h>
#include <ipxe/in.h>
#include <ipxe/iobuf.h>
#include <ipxe/dhcp.h>
#include <ipxe/xfer.h>
#include <ipxe/open.h>
#include <ipxe/uri.h>
#include <ipxe/features.h>
#include <ipxe/oncrpc.h>
#include <ipxe/oncrpc_iob.h>
#include <ipxe/init.h>
#include <ipxe/settings.h>
#include <ipxe/version.h>
Go to the source code of this file.
Macros | |
#define | SET_LAST_FRAME(x) ( (x) | 1 << 31 ) |
Set most significant bit to 1. More... | |
#define | GET_FRAME_SIZE(x) ( (x) & ~( 1 << 31 ) ) |
#define | ONCRPC_CALL 0 |
#define | ONCRPC_REPLY 1 |
Functions | |
const struct setting uid_setting | __setting (SETTING_AUTH, uid) |
const struct setting gid_setting | __setting (SETTING_AUTH, gid) |
int | oncrpc_init_cred_sys (struct oncrpc_cred_sys *auth_sys) |
Initialize an ONC RPC AUTH SYS credential structure. More... | |
void | oncrpc_init_session (struct oncrpc_session *session, struct oncrpc_cred *credential, struct oncrpc_cred *verifier, uint32_t prog_name, uint32_t prog_vers) |
Prepare an ONC RPC session structure to be used by the ONC RPC layer. More... | |
int | oncrpc_call (struct interface *intf, struct oncrpc_session *session, uint32_t proc_name, const struct oncrpc_field fields[]) |
size_t | oncrpc_compute_size (const struct oncrpc_field fields[]) |
int | oncrpc_get_reply (struct oncrpc_session *session __unused, struct oncrpc_reply *reply, struct io_buffer *io_buf) |
Parse an I/O buffer to extract a ONC RPC REPLY. More... | |
Variables | |
struct oncrpc_cred | oncrpc_auth_none |
AUTH NONE authentication flavor. More... | |
SUN ONC RPC protocol.
Definition in file oncrpc.c.
#define SET_LAST_FRAME | ( | x | ) | ( (x) | 1 << 31 ) |
const struct setting uid_setting __setting | ( | SETTING_AUTH | , |
uid | |||
) |
const struct setting gid_setting __setting | ( | SETTING_AUTH | , |
gid | |||
) |
int oncrpc_init_cred_sys | ( | struct oncrpc_cred_sys * | auth_sys | ) |
Initialize an ONC RPC AUTH SYS credential structure.
auth_sys | The structure to initialize |
The hostname field is filled with the value of the hostname setting, if the hostname setting is empty, PRODUCT_SHORT_NAME (usually "iPXE") is used instead.
Definition at line 84 of file oncrpc.c.
References oncrpc_cred_sys::aux_gid_len, oncrpc_cred_sys::credential, EINVAL, ENOMEM, fetch_string_setting_copy(), fetch_uintz_setting(), oncrpc_cred::flavor, oncrpc_cred_sys::gid, oncrpc_cred_sys::hostname, oncrpc_cred::length, NULL, ONCRPC_AUTH_SYS, oncrpc_strlen, product_short_name, oncrpc_cred_sys::stamp, strdup(), and oncrpc_cred_sys::uid.
Referenced by nfs_open().
void oncrpc_init_session | ( | struct oncrpc_session * | session, |
struct oncrpc_cred * | credential, | ||
struct oncrpc_cred * | verifier, | ||
uint32_t | prog_name, | ||
uint32_t | prog_vers | ||
) |
Prepare an ONC RPC session structure to be used by the ONC RPC layer.
session | ONC RPC session |
credential | Credential structure pointer |
verifier | Verifier structure pointer |
prog_name | ONC RPC program number |
prog_vers | ONC RPC program version number |
Definition at line 115 of file oncrpc.c.
References oncrpc_session::credential, oncrpc_session::prog_name, oncrpc_session::prog_vers, rand(), oncrpc_session::rpc_id, and oncrpc_session::verifier.
Referenced by mount_init_session(), nfs_init_session(), and portmap_init_session().
int oncrpc_call | ( | struct interface * | intf, |
struct oncrpc_session * | session, | ||
uint32_t | proc_name, | ||
const struct oncrpc_field | fields[] | ||
) |
Definition at line 129 of file oncrpc.c.
References alloc_iob(), oncrpc_session::credential, EINVAL, ENOBUFS, header, iob_disown, ONCRPC_CALL, oncrpc_compute_size(), ONCRPC_FIELD, ONCRPC_FIELD_END, oncrpc_iob_add_fields(), ONCRPC_VERS, oncrpc_session::prog_name, oncrpc_session::prog_vers, oncrpc_session::rpc_id, SET_LAST_FRAME, oncrpc_session::verifier, and xfer_deliver_iob().
Referenced by mount_mnt(), mount_umnt(), nfs_lookup(), nfs_read(), nfs_readlink(), and portmap_getport().
size_t oncrpc_compute_size | ( | const struct oncrpc_field | fields[] | ) |
Definition at line 166 of file oncrpc.c.
References oncrpc_field_value::cred, oncrpc_cred::length, oncrpc_align, oncrpc_array, oncrpc_cred, oncrpc_int32, oncrpc_int64, oncrpc_intarray, oncrpc_none, oncrpc_str, oncrpc_strlen, size, type, oncrpc_field::type, value, and oncrpc_field::value.
Referenced by oncrpc_call().
int oncrpc_get_reply | ( | struct oncrpc_session *session | __unused, |
struct oncrpc_reply * | reply, | ||
struct io_buffer * | io_buf | ||
) |
Parse an I/O buffer to extract a ONC RPC REPLY.
session | ONC RPC session |
reply | Reply structure where data will be saved |
io_buf | I/O buffer |
Definition at line 215 of file oncrpc.c.
References oncrpc_reply::accept_state, oncrpc_reply::data, EINVAL, ENOSYS, oncrpc_reply::frame_size, GET_FRAME_SIZE, iob_pull, oncrpc_auth_none, oncrpc_iob_get_int, ONCRPC_REPLY, oncrpc_reply::reply_state, oncrpc_reply::rpc_id, and oncrpc_reply::verifier.
Referenced by nfs_deliver(), nfs_mount_deliver(), and nfs_pm_deliver().
struct oncrpc_cred oncrpc_auth_none |
AUTH NONE authentication flavor.
Definition at line 56 of file oncrpc.c.
Referenced by mount_init_session(), nfs_init_session(), oncrpc_get_reply(), and portmap_init_session().