master
  1/*-
  2 * Copyright (c) 2010, Oracle America, Inc.
  3 *
  4 * Redistribution and use in source and binary forms, with or without
  5 * modification, are permitted provided that the following conditions are
  6 * met:
  7 *
  8 *     * Redistributions of source code must retain the above copyright
  9 *       notice, this list of conditions and the following disclaimer.
 10 *     * Redistributions in binary form must reproduce the above
 11 *       copyright notice, this list of conditions and the following
 12 *       disclaimer in the documentation and/or other materials
 13 *       provided with the distribution.
 14 *     * Neither the name of the "Oracle America, Inc." nor the names of its
 15 *       contributors may be used to endorse or promote products derived
 16 *       from this software without specific prior written permission.
 17 *
 18 *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 19 *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 20 *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 21 *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 22 *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 23 *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 24 *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 25 *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 26 *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 27 *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 28 *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 29 *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 30 */
 31
 32/*
 33 * RPC for bootparms service.
 34 * There are two procedures:
 35 *   WHOAMI takes a net address and returns a client name and also a
 36 *	likely net address for routing
 37 *   GETFILE takes a client name and file identifier and returns the
 38 *	server name, server net address and pathname for the file.
 39 *   file identifiers typically include root, swap, pub and dump
 40 */
 41
 42#ifdef RPC_HDR
 43%#include <rpc/types.h>
 44%#include <sys/time.h>
 45%#include <sys/errno.h>
 46%#include <sys/param.h>
 47%#include <sys/syslimits.h>
 48#else
 49%#ifndef lint
 50%/*static char sccsid[] = "from: @(#)bootparam_prot.x 1.2 87/06/24 Copyr 1987 Sun Micro";*/
 51%/*static char sccsid[] = "from: @(#)bootparam_prot.x	2.1 88/08/01 4.0 RPCSRC";*/
 52%#endif /* not lint */
 53%#include <sys/cdefs.h>
 54#endif
 55
 56const MAX_MACHINE_NAME  = 255;
 57const MAX_PATH_LEN	= 1024;
 58const MAX_FILEID	= 32;
 59const IP_ADDR_TYPE	= 1;
 60
 61typedef	string	bp_machine_name_t<MAX_MACHINE_NAME>;
 62typedef	string	bp_path_t<MAX_PATH_LEN>;
 63typedef	string	bp_fileid_t<MAX_FILEID>;
 64
 65struct	ip_addr_t {
 66	char	net;
 67	char	host;
 68	char	lh;
 69	char	impno;
 70};
 71
 72union bp_address switch (int address_type) {
 73	case IP_ADDR_TYPE:
 74		ip_addr_t	ip_addr;
 75};
 76
 77struct bp_whoami_arg {
 78	bp_address		client_address;
 79};
 80
 81struct bp_whoami_res {
 82	bp_machine_name_t	client_name;
 83	bp_machine_name_t	domain_name;
 84	bp_address		router_address;
 85};
 86
 87struct bp_getfile_arg {
 88	bp_machine_name_t	client_name;
 89	bp_fileid_t		file_id;
 90};
 91	
 92struct bp_getfile_res {
 93	bp_machine_name_t	server_name;
 94	bp_address		server_address;
 95	bp_path_t		server_path;
 96};
 97
 98program BOOTPARAMPROG {
 99	version BOOTPARAMVERS {
100		bp_whoami_res	BOOTPARAMPROC_WHOAMI(bp_whoami_arg) = 1;
101		bp_getfile_res	BOOTPARAMPROC_GETFILE(bp_getfile_arg) = 2;
102	} = 1;
103} = 100026;