yp_prot.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#ifndef _RPCSVC_YP_PROT_H
#define _RPCSVC_YP_PROT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <ndbm.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file contains symbols and structures defining the rpc protocol
* between the YP clients and the YP servers. The servers are the YP
* database servers, and the YP.
*/
/*
* The following procedures are supported by the protocol:
*
* YPPROC_NULL() returns () takes nothing, returns nothing. This indicates
* that the yp server is alive.
*
* YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the
* responding yp server does serve the named domain; FALSE indicates no
* support.
*
* YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the yp server does serve
* the named domain, otherwise does not return. Used in the broadcast case.
*
* YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the
* right-hand value for a passed left-hand key, within a named map and
* domain.
*
* YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val).
* Returns the first key-value pair from a named domain and map.
*
* YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns
* the key-value pair following a passed key-value pair within a named
* domain and map.
*
* YPPROC_XFR (struct ypreq_xfr) returns nothing. Indicates to a server that
* a map should be updated.
*
* YPPROC_NEWXFR (struct ypreq_newxfr) returns nothing. Indicates to a server
* that a map should be updated. Uses protocol independent request struct.
*
* YPPROC_CLEAR takes nothing, returns nothing. Instructs a yp server to
* close the current map, so that old versions of the disk file don't get
* held open.
*
* YPPROC_ALL (struct ypreq_nokey), returns
* union switch (bool more) {
* TRUE: (struct ypresp_key_val);
* FALSE: (struct) {};
* }
*
* YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master)
*
* YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order)
*
* YPPROC_MAPLIST (char *), returns (struct ypmaplist *)
*/
/* 'bool' is a built-in type for g++ */
#ifndef BOOL_DEFINED
typedef unsigned int bool;
#define BOOL_DEFINED
#endif
#endif
/* Program and version symbols, magic numbers */
/* byte size of a large yp packet */
#define YPMSGSZ 1600
struct ypmap_parms {
char *domain; /* Null string means not available */
char *map; /* Null string means not available */
unsigned int ordernum; /* 0 means not available */
char *owner; /* Null string means not available */
};
/*
* Request parameter structures
*/
struct ypreq_key {
char *domain;
char *map;
};
struct ypreq_nokey {
char *domain;
char *map;
};
struct ypreq_xfr {
struct ypmap_parms map_parms;
unsigned int transid;
unsigned int proto;
unsigned short port;
};
struct ypreq_newxfr {
struct ypmap_parms map_parms;
unsigned int transid;
unsigned int proto;
char *name;
};
/*
* Response parameter structures
*/
struct ypresp_val {
unsigned int status;
};
struct ypresp_key_val {
unsigned int status;
};
struct ypresp_master {
unsigned int status;
char *master;
};
struct ypresp_order {
unsigned int status;
unsigned int ordernum;
};
struct ypmaplist {
};
struct ypresp_maplist {
unsigned int status;
};
/*
* Procedure symbols. YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK
* must keep the same values (0, 1, and 2) that they had in the first version
* of the protocol.
*/
#define YPPROC_NULL ((rpcproc_t)0)
/* Return status values */
#define YP_FALSE (0) /* General purpose failure code */
/* can't supply requested service. */
struct yprequest {
enum ypreqtype yp_reqtype;
union {
struct ypreq_key yp_req_keytype;
struct ypreq_nokey yp_req_nokeytype;
struct ypmap_parms yp_req_map_parmstype;
};
#define YPMATCH_REQTYPE YPREQ_KEY
#define YPFIRST_REQTYPE YPREQ_NOKEY
#define YPNEXT_REQTYPE YPREQ_KEY
#define YPPUSH_REQTYPE YPREQ_NOKEY
#define YPPULL_REQTYPE YPREQ_NOKEY
#define YPPOLL_REQTYPE YPREQ_NOKEY
#define YPGET_REQTYPE YPREQ_MAP_PARMS
struct ypresponse {
enum ypresptype yp_resptype;
union {
struct ypresp_val yp_resp_valtype;
struct ypresp_key_val yp_resp_key_valtype;
struct ypmap_parms yp_resp_map_parmstype;
} yp_respbody;
};
#define YPMATCH_RESPTYPE YPRESP_VAL
#define YPFIRST_RESPTYPE YPRESP_KEY_VAL
#define YPNEXT_RESPTYPE YPRESP_KEY_VAL
#define YPPOLL_RESPTYPE YPRESP_MAP_PARMS
extern bool _xdr_yprequest();
extern bool _xdr_ypresponse();
/*
* Protocol between clients (ypxfr, only) and yppush
* yppush speaks a protocol in the transient range, which
* is supplied to ypxfr as a command-line parameter when it
* is activated by ypserv.
*/
/* Procedure symbols */
#define YPPUSHPROC_NULL ((rpcproc_t)0)
struct yppushresp_xfr {
unsigned int transid;
unsigned int status;
};
/* Status values for yppushresp_xfr.status */
/* ypserv */
/* use -f flag. */
#ifdef __STDC__
extern bool xdr_ypdomain_wrap_string(XDR *, char **);
extern bool xdr_ypmap_wrap_string(XDR *, char **);
extern bool xdr_ypowner_wrap_string(XDR *, char **);
#else
extern bool xdr_datum();
extern bool xdr_ypdomain_wrap_string();
extern bool xdr_ypmap_wrap_string();
extern bool xdr_ypreq_key();
extern bool xdr_ypreq_nokey();
extern bool xdr_ypreq_xfr();
extern bool xdr_ypreq_newxfr();
extern bool xdr_ypresp_val();
extern bool xdr_ypresp_key_val();
extern bool xdr_yp_inaddr();
extern bool xdr_ypmap_parms();
extern bool xdr_ypowner_wrap_string();
extern bool xdr_yppushresp_xfr();
extern bool xdr_ypresp_order();
extern bool xdr_ypresp_master();
extern bool xdr_ypall();
extern bool xdr_ypresp_maplist();
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _RPCSVC_YP_PROT_H */