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) 1993, 2000 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include "med_local.h"
39 struct svc_req
*rqstp
/* RPC stuff */
50 * Update the mediator data file.
55 med_upd_data_args_t
*argp
,
57 struct svc_req
*rqstp
/* RPC stuff */
65 /* setup, check permissions */
66 if ((err
= med_init(rqstp
, W_OK
, res
)) < 0)
75 (void) med_db_put_data(&argp
->med
, &argp
->med_data
, res
);
82 * Get the mediator data
88 med_get_data_res_t
*res
,
89 struct svc_req
*rqstp
/* RPC stuff */
94 med_err_t
*medep
= &res
->med_status
;
97 (void) memset(res
, 0, sizeof (*res
));
98 *medep
= med_null_err
;
100 /* setup, check permissions */
101 if ((err
= med_init(rqstp
, R_OK
, medep
)) < 0)
107 if (med_db_init(medep
))
110 if ((meddp
= med_db_get_data(&argp
->med
, medep
)) == NULL
)
113 res
->med_data
= *meddp
; /* structure assignment */
120 * Update the mediator record.
125 med_upd_rec_args_t
*argp
,
127 struct svc_req
*rqstp
/* RPC stuff */
135 /* setup, check permissions */
136 if ((err
= med_init(rqstp
, W_OK
, res
)) < 0)
142 if (med_db_init(res
))
145 (void) med_db_put_rec(&argp
->med
, &argp
->med_rec
, res
);
152 * Get the mediator record
158 med_get_rec_res_t
*res
,
159 struct svc_req
*rqstp
/* RPC stuff */
164 med_err_t
*medep
= &res
->med_status
;
167 (void) memset(res
, 0, sizeof (*res
));
168 *medep
= med_null_err
;
170 /* setup, check permissions */
171 if ((err
= med_init(rqstp
, R_OK
, medep
)) < 0)
177 if (med_db_init(medep
))
180 if ((medrp
= med_db_get_rec(&argp
->med
, medep
)) == NULL
)
183 res
->med_rec
= *medrp
; /* structure assignment */
190 * return the official host name for the callee
197 struct svc_req
*rqstp
/* RPC stuff */
200 med_err_t
*medep
= &res
->med_status
;
204 (void) memset(res
, 0, sizeof (*res
));
205 *medep
= med_null_err
;
207 /* setup, check permissions */
208 if ((err
= med_init(rqstp
, R_OK
, medep
)) < 0)
214 res
->med_hnm
= Strdup(mynode());