1273188Shrs/*-
2273188Shrs * Copyright (c) 2010, Oracle America, Inc.
3273188Shrs *
4273188Shrs * Redistribution and use in source and binary forms, with or without
5273188Shrs * modification, are permitted provided that the following conditions are
6273188Shrs * met:
7273188Shrs *
8273188Shrs *     * Redistributions of source code must retain the above copyright
9273188Shrs *       notice, this list of conditions and the following disclaimer.
10273188Shrs *     * Redistributions in binary form must reproduce the above
11273188Shrs *       copyright notice, this list of conditions and the following
12273188Shrs *       disclaimer in the documentation and/or other materials
13273188Shrs *       provided with the distribution.
14273188Shrs *     * Neither the name of the "Oracle America, Inc." nor the names of its
15273188Shrs *       contributors may be used to endorse or promote products derived
16273188Shrs *       from this software without specific prior written permission.
17273188Shrs *
18273188Shrs *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19273188Shrs *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20273188Shrs *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21273188Shrs *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22273188Shrs *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23273188Shrs *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24273188Shrs *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25273188Shrs *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26273188Shrs *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27273188Shrs *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28273188Shrs *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29273188Shrs *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
301832Swollman */
311832Swollman
321832Swollman/*
331832Swollman * RPC for bootparms service.
341832Swollman * There are two procedures:
351832Swollman *   WHOAMI takes a net address and returns a client name and also a
361832Swollman *	likely net address for routing
371832Swollman *   GETFILE takes a client name and file identifier and returns the
381832Swollman *	server name, server net address and pathname for the file.
391832Swollman *   file identifiers typically include root, swap, pub and dump
401832Swollman */
411832Swollman
421832Swollman#ifdef RPC_HDR
431832Swollman%#include <rpc/types.h>
441832Swollman%#include <sys/time.h>
451832Swollman%#include <sys/errno.h>
466747Swpaul%#include <sys/param.h>
476747Swpaul%#include <sys/syslimits.h>
481832Swollman#else
491832Swollman%#ifndef lint
501832Swollman%/*static char sccsid[] = "from: @(#)bootparam_prot.x 1.2 87/06/24 Copyr 1987 Sun Micro";*/
511832Swollman%/*static char sccsid[] = "from: @(#)bootparam_prot.x	2.1 88/08/01 4.0 RPCSRC";*/
521832Swollman%#endif /* not lint */
53114629Sobrien%#include <sys/cdefs.h>
54114629Sobrien%__FBSDID("$FreeBSD$");
551832Swollman#endif
561832Swollman
571832Swollmanconst MAX_MACHINE_NAME  = 255;
581832Swollmanconst MAX_PATH_LEN	= 1024;
591832Swollmanconst MAX_FILEID	= 32;
601832Swollmanconst IP_ADDR_TYPE	= 1;
611832Swollman
621832Swollmantypedef	string	bp_machine_name_t<MAX_MACHINE_NAME>;
631832Swollmantypedef	string	bp_path_t<MAX_PATH_LEN>;
641832Swollmantypedef	string	bp_fileid_t<MAX_FILEID>;
651832Swollman
661832Swollmanstruct	ip_addr_t {
671832Swollman	char	net;
681832Swollman	char	host;
691832Swollman	char	lh;
701832Swollman	char	impno;
711832Swollman};
721832Swollman
731832Swollmanunion bp_address switch (int address_type) {
741832Swollman	case IP_ADDR_TYPE:
751832Swollman		ip_addr_t	ip_addr;
761832Swollman};
771832Swollman
781832Swollmanstruct bp_whoami_arg {
791832Swollman	bp_address		client_address;
801832Swollman};
811832Swollman
821832Swollmanstruct bp_whoami_res {
831832Swollman	bp_machine_name_t	client_name;
841832Swollman	bp_machine_name_t	domain_name;
851832Swollman	bp_address		router_address;
861832Swollman};
871832Swollman
881832Swollmanstruct bp_getfile_arg {
891832Swollman	bp_machine_name_t	client_name;
901832Swollman	bp_fileid_t		file_id;
911832Swollman};
921832Swollman
931832Swollmanstruct bp_getfile_res {
941832Swollman	bp_machine_name_t	server_name;
951832Swollman	bp_address		server_address;
961832Swollman	bp_path_t		server_path;
971832Swollman};
981832Swollman
991832Swollmanprogram BOOTPARAMPROG {
1001832Swollman	version BOOTPARAMVERS {
1011832Swollman		bp_whoami_res	BOOTPARAMPROC_WHOAMI(bp_whoami_arg) = 1;
1021832Swollman		bp_getfile_res	BOOTPARAMPROC_GETFILE(bp_getfile_arg) = 2;
1031832Swollman	} = 1;
1041832Swollman} = 100026;
105