Net-NIS
view release on metacpan or search on metacpan
int
yp_bind(domain)
char * domain
void
yp_unbind(domain)
char * domain
void
yp_get_default_domain()
PPCODE:
{
char *domain;
yp_status = yp_get_default_domain(&domain);
YP_RETURN(newSVpv(domain, strlen(domain)));
}
#
# Looks up a key in a given map (this implements the FETCH part)
#
void
yp_match(domain, map, key)
char * domain
char * map
SV * key
PPCODE:
{
char *inkey;
STRLEN inkeylen;
char *outval;
int outvallen = 0;
if (SvPOK(key))
{
inkey = SvPV(key, inkeylen);
yp_status = YPERR_BADARGS;
}
YP_RETURN(newSVpv(outval, outvallen));
}
void
yp_first(domain, map)
char * domain
char * map
PPCODE:
{
char *outkey;
int outkeylen;
char *outval;
int outvallen;
yp_status = yp_first(domain, map, &outkey, &outkeylen,
&outval, &outvallen);
XPUSHs(sv_2mortal(newSViv(yp_status)));
if (yp_status == 0)
XPUSHs(sv_2mortal(newSVpv(outkey, outkeylen)));
XPUSHs(sv_2mortal(newSVpv(outval, outvallen)));
}
}
void
yp_next(domain, map, key)
char * domain
char * map
SV * key
PPCODE:
{
char *inkey;
STRLEN inkeylen;
char *outkey;
int outkeylen;
char *outval;
int outvallen;
if (SvPOK(key))
{
else
{
XPUSHs(sv_2mortal(newSViv(YPERR_BADARGS)));
}
}
void
yp_all(domain, map)
char * domain
char * map
PPCODE:
{
struct ypall_callback callback;
struct callbackdata data;
data.results = newRV((SV *) newHV());
data.status = 0;
callback.foreach = ypallcallback;
callback.data = (char *)&data;
yp_status = yp_all(domain, map, &callback);
}
}
YP_RETURN((SV*)data.results);
}
void
yp_order(domain, map)
char * domain
char * map
PPCODE:
{
unsigned long order;
yp_status = yp_order(domain, map, &order);
YP_RETURN(newSViv(order));
}
void
yp_master(domain, map)
char * domain
char * map
PPCODE:
{
char *name;
yp_status = yp_master(domain, map, &name);
YP_RETURN(newSVpv(name, strlen(name)));
}
char *
yperr_string(code)
int code
#
# Returns an array of all the YP map names
#
void
yp_maplist(domain)
char * domain
PREINIT:
int ret;
struct ypmaplist *ypmap = NULL;
AV *retval;
PPCODE:
{
ret = yp_maplist( domain, &ypmap );
if (ret == YPERR_SUCCESS) {
struct ypmaplist *y, *old;
for (y=ypmap; y;) {
// FIXME: check that y->map is not NULL?
XPUSHs(newSVpv(y->ypml_name,strlen(y->ypml_name)));
old = y;
}
}
}
#else /* Linux */
void
yp_maplist(domain)
char * domain
PPCODE:
{
warn("Net::NIS::yp_maplist() -- not implemented on this OS");
XSRETURN_EMPTY;
}
#endif
( run in 0.716 second using v1.01-cache-2.11-cpan-71847e10f99 )