bootparam_prot.x revision 6747
1213317Sgordon/*
2213317Sgordon * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3213317Sgordon * unrestricted use provided that this legend is included on all tape
4213317Sgordon * media and as a part of the software program in whole or part.  Users
5213317Sgordon * may copy or modify Sun RPC without charge, but are not authorized
6213317Sgordon * to license or distribute it to anyone else except as part of a product or
7213317Sgordon * program developed by the user.
8213317Sgordon *
9213317Sgordon * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10213317Sgordon * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11213317Sgordon * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12213317Sgordon *
13213317Sgordon * Sun RPC is provided with no support and without any obligation on the
14213317Sgordon * part of Sun Microsystems, Inc. to assist in its use, correction,
15213317Sgordon * modification or enhancement.
16213317Sgordon *
17213317Sgordon * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18213317Sgordon * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19213317Sgordon * OR ANY PART THEREOF.
20213317Sgordon *
21213317Sgordon * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22213317Sgordon * or profits or other special, indirect and consequential damages, even if
23213317Sgordon * Sun has been advised of the possibility of such damages.
24213317Sgordon *
25213317Sgordon * Sun Microsystems, Inc.
26213317Sgordon * 2550 Garcia Avenue
27213317Sgordon * Mountain View, California  94043
28281575Sallanjude */
29213317Sgordon
30213317Sgordon/*
31213317Sgordon * RPC for bootparms service.
32213317Sgordon * There are two procedures:
33213317Sgordon *   WHOAMI takes a net address and returns a client name and also a
34213317Sgordon *	likely net address for routing
35213317Sgordon *   GETFILE takes a client name and file identifier and returns the
36213317Sgordon *	server name, server net address and pathname for the file.
37224648Sru *   file identifiers typically include root, swap, pub and dump
38213317Sgordon */
39213317Sgordon
40213317Sgordon#ifdef RPC_HDR
41213317Sgordon%#include <rpc/types.h>
42213317Sgordon%#include <sys/time.h>
43213317Sgordon%#include <sys/errno.h>
44213317Sgordon%#include <sys/param.h>
45213317Sgordon%#include <sys/syslimits.h>
46213317Sgordon%#include <sys/ucred.h>
47213317Sgordon%#include <nfs/nfsv2.h>
48213317Sgordon%#include <nfs/nfs.h>
49213317Sgordon#else
50213317Sgordon%#ifndef lint
51213317Sgordon%/*static char sccsid[] = "from: @(#)bootparam_prot.x 1.2 87/06/24 Copyr 1987 Sun Micro";*/
52213317Sgordon%/*static char sccsid[] = "from: @(#)bootparam_prot.x	2.1 88/08/01 4.0 RPCSRC";*/
53213317Sgordon%static char rcsid[] = "bootparam_prot.x,v 1.1 1994/08/04 19:01:44 wollman Exp";
54213317Sgordon%#endif /* not lint */
55213317Sgordon#endif
56213317Sgordon
57213317Sgordonconst MAX_MACHINE_NAME  = 255;
58213317Sgordonconst MAX_PATH_LEN	= 1024;
59213317Sgordonconst MAX_FILEID	= 32;
60213317Sgordonconst IP_ADDR_TYPE	= 1;
61281575Sallanjude
62281575Sallanjudetypedef	string	bp_machine_name_t<MAX_MACHINE_NAME>;
63281575Sallanjudetypedef	string	bp_path_t<MAX_PATH_LEN>;
64282952Strasztypedef	string	bp_fileid_t<MAX_FILEID>;
65282952Strasz
66281575Sallanjudestruct	ip_addr_t {
67282952Strasz	char	net;
68282952Strasz	char	host;
69281575Sallanjude	char	lh;
70282952Strasz	char	impno;
71282952Strasz};
72281575Sallanjude
73282952Straszunion bp_address switch (int address_type) {
74282952Strasz	case IP_ADDR_TYPE:
75281575Sallanjude		ip_addr_t	ip_addr;
76282952Strasz};
77282952Strasz
78281575Sallanjudestruct bp_whoami_arg {
79282952Strasz	bp_address		client_address;
80282952Strasz};
81281575Sallanjude
82282952Straszstruct bp_whoami_res {
83282952Strasz	bp_machine_name_t	client_name;
84281575Sallanjude	bp_machine_name_t	domain_name;
85282952Strasz	bp_address		router_address;
86282952Strasz};
87281575Sallanjude
88282952Straszstruct bp_getfile_arg {
89282952Strasz	bp_machine_name_t	client_name;
90281575Sallanjude	bp_fileid_t		file_id;
91281575Sallanjude};
92213317Sgordon
93213317Sgordonstruct bp_getfile_res {
94213317Sgordon	bp_machine_name_t	server_name;
95213317Sgordon	bp_address		server_address;
96213317Sgordon	bp_path_t		server_path;
97213317Sgordon};
98213317Sgordon
99213317Sgordonprogram BOOTPARAMPROG {
100213317Sgordon	version BOOTPARAMVERS {
101213317Sgordon		bp_whoami_res	BOOTPARAMPROC_WHOAMI(bp_whoami_arg) = 1;
102213317Sgordon		bp_getfile_res	BOOTPARAMPROC_GETFILE(bp_getfile_arg) = 2;
103213317Sgordon	} = 1;
104213317Sgordon} = 100026;
105213317Sgordon