4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1991, 1999 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ident "%Z%%M% %I% %E% SMI" /* SunOS */
29 #include <sys/types.h>
30 #include <sys/errno.h>
34 #include <netinet/in.h>
35 #include <rpc/types.h>
40 #include <rpc/rpc_msg.h>
41 #include <rpcsvc/bootparam_prot.h>
44 extern char *dlc_header
;
45 extern jmp_buf xdr_err
;
47 static void show_address(char *);
48 static char *sum_address(void);
50 static char *procnames_short
[] = {
56 static char *procnames_long
[] = {
57 "Null procedure", /* 0 */
59 "Get file name", /* 2 */
65 interpret_bparam(flags
, type
, xid
, vers
, proc
, data
, len
)
66 int flags
, type
, xid
, vers
, proc
;
71 char buff
[MAX_PATH_LEN
+ 1];
72 char buff2
[MAX_MACHINE_NAME
+ 1];
74 if (proc
< 0 || proc
> MAXPROC
)
78 if (setjmp(xdr_err
)) {
82 line
= get_sum_line();
87 procnames_short
[proc
]);
91 case BOOTPARAMPROC_WHOAMI
:
92 (void) sprintf(line
, " %s",
95 case BOOTPARAMPROC_GETFILE
:
96 (void) getxdr_string(buff
,
98 (void) sprintf(line
, " %s",
104 check_retransmit(line
, xid
);
106 (void) sprintf(line
, "BPARAM R %s ",
107 procnames_short
[proc
]);
108 line
+= strlen(line
);
110 case BOOTPARAMPROC_WHOAMI
:
111 (void) getxdr_string(buff
,
113 (void) getxdr_string(buff2
,
115 (void) sprintf(line
, "%s in %s",
118 case BOOTPARAMPROC_GETFILE
:
119 (void) getxdr_string(buff
,
121 (void) sum_address();
122 (void) sprintf(line
, "File=%s",
130 if (flags
& F_DTAIL
) {
131 show_header("BPARAM: ", "Boot Parameters", len
);
133 if (setjmp(xdr_err
)) {
136 (void) sprintf(get_line(0, 0),
138 proc
, procnames_long
[proc
]);
142 case BOOTPARAMPROC_WHOAMI
:
143 show_address("Client address");
146 case BOOTPARAMPROC_GETFILE
:
147 (void) showxdr_string(MAX_MACHINE_NAME
,
149 (void) showxdr_string(MAX_FILEID
,
155 case BOOTPARAMPROC_WHOAMI
:
156 (void) showxdr_string(MAX_MACHINE_NAME
,
158 (void) showxdr_string(MAX_MACHINE_NAME
,
160 show_address("Router addr");
163 case BOOTPARAMPROC_GETFILE
:
164 (void) showxdr_string(MAX_MACHINE_NAME
,
166 show_address("Server addr");
167 (void) showxdr_string(MAX_PATH_LEN
,
181 extern char *inet_ntoa();
184 atype
= getxdr_u_long();
185 if (atype
!= IP_ADDR_TYPE
)
188 host
.S_un
.S_un_b
.s_b1
= getxdr_char();
189 host
.S_un
.S_un_b
.s_b2
= getxdr_char();
190 host
.S_un
.S_un_b
.s_b3
= getxdr_char();
191 host
.S_un
.S_un_b
.s_b4
= getxdr_char();
193 return (inet_ntoa(host
));
201 extern char *inet_ntoa();
204 atype
= getxdr_u_long();
205 if (atype
== IP_ADDR_TYPE
) {
206 host
.S_un
.S_un_b
.s_b1
= getxdr_char();
207 host
.S_un
.S_un_b
.s_b2
= getxdr_char();
208 host
.S_un
.S_un_b
.s_b3
= getxdr_char();
209 host
.S_un
.S_un_b
.s_b4
= getxdr_char();
211 (void) sprintf(get_line(0, 0),
215 addrtoname(AF_INET
, &host
));
217 (void) sprintf(get_line(0, 0),
218 "Router addr = ? (type not known)");