Skip to main content

Module rpc

Module rpc 

Source
Expand description

Constructs NFSv4.2 compound RPC payloads and parses server replies.

Implements the minimal ONC RPC + NFSv4.2 wire format needed for atomic file creation via compound operations.

Structs§

CompoundReply
Parsed NFSv4.2 compound reply.
OpResult
Parsed result of a single operation in a compound reply.
RpcMessage
An RPC message separated from transport framing.
StateId
Represents an NFSv4 state identifier (returned by OPEN, used by WRITE/SETATTR/CLOSE).

Enums§

Nfs4Op
A single NFSv4.2 compound operation.
WriteStable
Write stability level.

Constants§

AUTH_NONE
ONC RPC AUTH_NONE authentication flavor (no credentials).
AUTH_RPCSEC_GSS
ONC RPC RPCSEC_GSS authentication flavor (RFC 2203).
AUTH_SYS
ONC RPC AUTH_SYS authentication flavor (Unix uid/gid credentials).
AUTH_TLS
ONC RPC AUTH_TLS authentication flavor (RFC 9289 S4.1).
CLAIM_NULL
OPEN claim type: open by filename in the current directory.
CREATEMODE4_UNCHECKED
Create mode: unchecked (overwrite existing attributes).
DATA_SYNC4
Write stability: data flushed to stable storage, metadata may be cached.
FATTR4_MODE
FATTR4 bitmap position for file mode/permissions (bit 33, word 1).
FATTR4_OWNER
FATTR4 bitmap position for file owner (bit 36, word 1).
FATTR4_OWNER_GROUP
FATTR4 bitmap position for file owner group (bit 37, word 1).
FATTR4_SIZE
FATTR4 bitmap position for file size (bit 4, word 0).
FATTR4_TIME_MODIFY
FATTR4 bitmap position for modification time (bit 53, word 1).
FATTR4_TIME_MODIFY_SET
FATTR4 bitmap position for settable modification time (bit 52, word 1).
FILE_SYNC4
Write stability: data and metadata flushed to stable storage.
MSG_ACCEPTED
RPC reply status: message accepted by the server.
NFS4ERR_ACCESS
NFS4 error: permission denied.
NFS4ERR_BADSEQ
NFS4 error: bad sequence ID in a stateful operation.
NFS4ERR_BADSESSION
NFS4 error: session ID is invalid or expired.
NFS4ERR_BAD_STATEID
NFS4 error: bad stateid (expired or wrong open).
NFS4ERR_DELAY
NFS4 error: server is busy, client should retry.
NFS4ERR_EXIST
NFS4 error: file already exists.
NFS4ERR_FBIG
NFS4 error: file too large.
NFS4ERR_INVAL
NFS4 error: invalid argument (e.g. bad attribute value, nseconds out of range).
NFS4ERR_ISDIR
NFS4 error: is a directory (write to directory attempted).
NFS4ERR_NAMETOOLONG
NFS4 error: filename too long.
NFS4ERR_NOENT
NFS4 error: file or directory not found.
NFS4ERR_NOSPC
NFS4 error: no space on device.
NFS4ERR_NOTDIR
NFS4 error: not a directory.
NFS4ERR_NOTEMPTY
NFS4 error: directory not empty.
NFS4ERR_ROFS
NFS4 error: read-only filesystem.
NFS4ERR_SEQ_MISORDERED
NFS4 error: sequence operations arrived out of order.
NFS4ERR_STALE
NFS4 error: stale filehandle (target was deleted or renamed).
NFS4_OK
NFS4 status: operation succeeded.
NFSPROC4_COMPOUND
NFS procedure number for COMPOUND (batched operations).
NFSPROC4_NULL
NFS procedure number for NULL (liveness probe).
NFS_PROGRAM
ONC RPC program number for NFS.
NFS_V4
NFS protocol major version (4).
OPEN4_CREATE
OPEN type: create the file if it doesn’t exist.
OPEN4_NOCREATE
OPEN type: fail if the file doesn’t exist.
OPEN4_SHARE_ACCESS_BOTH
OPEN share access: read and write.
OPEN4_SHARE_ACCESS_READ
OPEN share access: read only.
OPEN4_SHARE_ACCESS_WRITE
OPEN share access: write only.
OPEN4_SHARE_DENY_NONE
OPEN share deny: no deny (allow concurrent access).
OP_CLOSE
NFSv4 CLOSE operation code: release an open stateid (RFC 8881 S18.2).
OP_CREATE_SESSION
NFSv4.1 CREATE_SESSION operation code: create a session (RFC 8881 S18.36).
OP_DESTROY_SESSION
NFSv4.1 DESTROY_SESSION operation code: tear down a session (RFC 8881 S18.37).
OP_EXCHANGE_ID
NFSv4.1 EXCHANGE_ID operation code: establish client identity (RFC 8881 S18.35).
OP_GETATTR
NFSv4 GETATTR operation code: retrieve file attributes (RFC 8881 S18.7).
OP_GETFH
NFSv4 GETFH operation code: retrieve the current filehandle (RFC 8881 S18.8).
OP_LOOKUP
NFSv4 LOOKUP operation code: look up a name in a directory (RFC 8881 S18.13).
OP_OPEN
NFSv4 OPEN operation code: open or create a file (RFC 8881 S18.16).
OP_PUTFH
NFSv4 PUTFH operation code: set the current filehandle (RFC 8881 S18.19).
OP_PUTROOTFH
NFSv4 PUTROOTFH operation code: set the current filehandle to the root (RFC 8881 S18.20).
OP_READ
NFSv4 READ operation code: read data from a file (RFC 7530 S16.23).
OP_RECLAIM_COMPLETE
NFSv4.1 RECLAIM_COMPLETE operation code: end grace period (RFC 8881 S18.51).
OP_SEQUENCE
NFSv4.2 SEQUENCE operation code (RFC 8881 S18.46).
OP_SETATTR
NFSv4 SETATTR operation code: set file attributes (RFC 8881 S18.30).
OP_WRITE
NFSv4 WRITE operation code: write data to a file (RFC 8881 S18.32).
RPCSEC_GSS_DATA
RPCSEC_GSS procedure: data exchange (after context established).
RPCSEC_GSS_VERSION
RPCSEC_GSS protocol version.
RPC_VERSION
ONC RPC protocol version (always 2).
SUCCESS
RPC accept status: procedure executed successfully.
UNSTABLE4
Write stability: server may cache, no durability guarantee.

Functions§

build_auth_tls_probe
Build an AUTH_TLS probe (RFC 9289 S4.1) to detect RPC-over-TLS support.
build_compound
Build an NFSv4.2 COMPOUND RPC call body (XDR, no record mark).
build_null_call
Build a minimal NFS NULL RPC call (zero-overhead server liveness check).
frame_rpc_message
Prepend a TCP record mark to an XDR body.
nfs4_error_name
Get the human-readable name for an NFS4 error code.
parse_auth_tls_reply
Parse an ONC RPC reply to an AUTH_TLS probe (RFC 9289 S4.1).
parse_compound_reply
Parse a compound reply, extracting status codes and the OPEN stateid.