5 #include <ipxe/interface.h>
6 #include <ipxe/iobuf.h>
10 * SUN ONC RPC protocol.
14 FILE_LICENCE ( GPL2_OR_LATER );
16 /** ONC RCP Version */
19 /** ONC RPC Null Authentication */
20 #define ONCRPC_AUTH_NONE 0
22 /** ONC RPC System Authentication (also called UNIX Authentication) */
23 #define ONCRPC_AUTH_SYS 1
25 /** Size of an ONC RPC header */
26 #define ONCRPC_HEADER_SIZE ( 11 * sizeof ( uint32_t ) )
28 #define ONCRPC_FIELD( type, value ) { oncrpc_ ## type, { .type = value } }
29 #define ONCRPC_SUBFIELD( type, args... ) \
30 { oncrpc_ ## type, { .type = { args } } }
32 #define ONCRPC_FIELD_END { oncrpc_none, { } }
34 /** Enusure that size is a multiple of four */
35 #define oncrpc_align( size ) ( ( (size) + 3 ) & ~3 )
38 * Calculate the length of a string, including padding bytes.
41 * @ret size Length of the padded string
43 #define oncrpc_strlen( str ) ( oncrpc_align ( strlen ( str ) ) + \
51 struct oncrpc_cred_sys {
52 struct oncrpc_cred credential;
63 struct oncrpc_cred *verifier;
66 uint32_t accept_state;
68 struct io_buffer *data;
71 struct oncrpc_session {
72 struct oncrpc_reply pending_reply;
73 struct oncrpc_cred *credential;
74 struct oncrpc_cred *verifier;
80 enum oncrpc_field_type {
90 union oncrpc_field_value {
104 const struct oncrpc_cred *cred;
107 struct oncrpc_field {
108 enum oncrpc_field_type type;
109 union oncrpc_field_value value;
112 extern struct oncrpc_cred oncrpc_auth_none;
114 int oncrpc_init_cred_sys ( struct oncrpc_cred_sys *auth_sys );
115 void oncrpc_init_session ( struct oncrpc_session *session,
116 struct oncrpc_cred *credential,
117 struct oncrpc_cred *verifier, uint32_t prog_name,
118 uint32_t prog_vers );
120 int oncrpc_call ( struct interface *intf, struct oncrpc_session *session,
121 uint32_t proc_name, const struct oncrpc_field fields[] );
123 size_t oncrpc_compute_size ( const struct oncrpc_field fields[] );
125 int oncrpc_get_reply ( struct oncrpc_session *session,
126 struct oncrpc_reply *reply, struct io_buffer *io_buf );
128 #endif /* _IPXE_ONCRPC_H */