xref: /freebsd/include/rpcsvc/bootparam_prot.x (revision 5b31cc94b10d4bb7109c6b27940a0fc76a44a331)
1*8785398fSHiroki Sato /*-
2*8785398fSHiroki Sato  * Copyright (c) 2010, Oracle America, Inc.
375b63130SGarrett Wollman  *
4*8785398fSHiroki Sato  * Redistribution and use in source and binary forms, with or without
5*8785398fSHiroki Sato  * modification, are permitted provided that the following conditions are
6*8785398fSHiroki Sato  * met:
775b63130SGarrett Wollman  *
8*8785398fSHiroki Sato  *     * Redistributions of source code must retain the above copyright
9*8785398fSHiroki Sato  *       notice, this list of conditions and the following disclaimer.
10*8785398fSHiroki Sato  *     * Redistributions in binary form must reproduce the above
11*8785398fSHiroki Sato  *       copyright notice, this list of conditions and the following
12*8785398fSHiroki Sato  *       disclaimer in the documentation and/or other materials
13*8785398fSHiroki Sato  *       provided with the distribution.
14*8785398fSHiroki Sato  *     * Neither the name of the "Oracle America, Inc." nor the names of its
15*8785398fSHiroki Sato  *       contributors may be used to endorse or promote products derived
16*8785398fSHiroki Sato  *       from this software without specific prior written permission.
1775b63130SGarrett Wollman  *
18*8785398fSHiroki Sato  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19*8785398fSHiroki Sato  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20*8785398fSHiroki Sato  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21*8785398fSHiroki Sato  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22*8785398fSHiroki Sato  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23*8785398fSHiroki Sato  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*8785398fSHiroki Sato  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25*8785398fSHiroki Sato  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*8785398fSHiroki Sato  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27*8785398fSHiroki Sato  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28*8785398fSHiroki Sato  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29*8785398fSHiroki Sato  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3075b63130SGarrett Wollman  */
3175b63130SGarrett Wollman 
3275b63130SGarrett Wollman /*
3375b63130SGarrett Wollman  * RPC for bootparms service.
3475b63130SGarrett Wollman  * There are two procedures:
3575b63130SGarrett Wollman  *   WHOAMI takes a net address and returns a client name and also a
3675b63130SGarrett Wollman  *	likely net address for routing
3775b63130SGarrett Wollman  *   GETFILE takes a client name and file identifier and returns the
3875b63130SGarrett Wollman  *	server name, server net address and pathname for the file.
3975b63130SGarrett Wollman  *   file identifiers typically include root, swap, pub and dump
4075b63130SGarrett Wollman  */
4175b63130SGarrett Wollman 
4275b63130SGarrett Wollman #ifdef RPC_HDR
4375b63130SGarrett Wollman %#include <rpc/types.h>
4475b63130SGarrett Wollman %#include <sys/time.h>
4575b63130SGarrett Wollman %#include <sys/errno.h>
463e38f896SBill Paul %#include <sys/param.h>
473e38f896SBill Paul %#include <sys/syslimits.h>
4875b63130SGarrett Wollman #endif
4975b63130SGarrett Wollman 
5075b63130SGarrett Wollman const MAX_MACHINE_NAME  = 255;
5175b63130SGarrett Wollman const MAX_PATH_LEN	= 1024;
5275b63130SGarrett Wollman const MAX_FILEID	= 32;
5375b63130SGarrett Wollman const IP_ADDR_TYPE	= 1;
5475b63130SGarrett Wollman 
5575b63130SGarrett Wollman typedef	string	bp_machine_name_t<MAX_MACHINE_NAME>;
5675b63130SGarrett Wollman typedef	string	bp_path_t<MAX_PATH_LEN>;
5775b63130SGarrett Wollman typedef	string	bp_fileid_t<MAX_FILEID>;
5875b63130SGarrett Wollman 
5975b63130SGarrett Wollman struct	ip_addr_t {
6075b63130SGarrett Wollman 	char	net;
6175b63130SGarrett Wollman 	char	host;
6275b63130SGarrett Wollman 	char	lh;
6375b63130SGarrett Wollman 	char	impno;
6475b63130SGarrett Wollman };
6575b63130SGarrett Wollman 
6675b63130SGarrett Wollman union bp_address switch (int address_type) {
6775b63130SGarrett Wollman 	case IP_ADDR_TYPE:
6875b63130SGarrett Wollman 		ip_addr_t	ip_addr;
6975b63130SGarrett Wollman };
7075b63130SGarrett Wollman 
7175b63130SGarrett Wollman struct bp_whoami_arg {
7275b63130SGarrett Wollman 	bp_address		client_address;
7375b63130SGarrett Wollman };
7475b63130SGarrett Wollman 
7575b63130SGarrett Wollman struct bp_whoami_res {
7675b63130SGarrett Wollman 	bp_machine_name_t	client_name;
7775b63130SGarrett Wollman 	bp_machine_name_t	domain_name;
7875b63130SGarrett Wollman 	bp_address		router_address;
7975b63130SGarrett Wollman };
8075b63130SGarrett Wollman 
8175b63130SGarrett Wollman struct bp_getfile_arg {
8275b63130SGarrett Wollman 	bp_machine_name_t	client_name;
8375b63130SGarrett Wollman 	bp_fileid_t		file_id;
8475b63130SGarrett Wollman };
8575b63130SGarrett Wollman 
8675b63130SGarrett Wollman struct bp_getfile_res {
8775b63130SGarrett Wollman 	bp_machine_name_t	server_name;
8875b63130SGarrett Wollman 	bp_address		server_address;
8975b63130SGarrett Wollman 	bp_path_t		server_path;
9075b63130SGarrett Wollman };
9175b63130SGarrett Wollman 
9275b63130SGarrett Wollman program BOOTPARAMPROG {
9375b63130SGarrett Wollman 	version BOOTPARAMVERS {
9475b63130SGarrett Wollman 		bp_whoami_res	BOOTPARAMPROC_WHOAMI(bp_whoami_arg) = 1;
9575b63130SGarrett Wollman 		bp_getfile_res	BOOTPARAMPROC_GETFILE(bp_getfile_arg) = 2;
9675b63130SGarrett Wollman 	} = 1;
9775b63130SGarrett Wollman } = 100026;
98