/*
* 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 (c) 1999 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <syslog.h>
#include <slp-internal.h>
SLPSrvTypeCallback, void *,
void **, int *);
static char *collate_types(char *, void **, int *, int);
static char *build_types_list(void *);
static void collect_types(void *, VISIT, int, void *);
const char *pcScopeList,
!*pcScopeList || !callback) {
return (SLP_PARAMETER_BAD);
}
return (SLP_PARAMETER_BAD);
}
return (err);
/* format params into msgBuf */
return (err);
}
void **collator, int *numResults) {
char *pcSrvTypes;
unsigned short protoErrCode;
if (!reply) {
/* no more results */
}
/* synchronous case */
}
return (SLP_FALSE);
}
/* parse reply into params */
/* error code */
return (SLP_TRUE);
/* internal errors should have been filtered out by the net code */
}
/* types string */
return (SLP_TRUE);
/* collate the types for sync behavior */
if (!pcSrvTypes)
return (SLP_TRUE);
} else {
/* async; invoke cb */
}
/* cleanup */
/* check maxResults */
return (SLP_FALSE);
}
return (cont);
}
int all_nas;
/*
* Allocate iovec for the message. A SrvTypeRqst is layed out thus:
* 0: header
* 1: prlist length
* 2: prlist (filled in later by networking code)
* 3: na
* 4: scopes length
* 5: scopes (filled in later by networking code)
*/
return (SLP_MEMORY_ALLOC_FAILED);
}
/* calculate msg length */
if (all_nas) {
nalen = 0;
} else {
}
nalen += 2;
nalen + /* NA string */
2; /* Scope string length */
return (SLP_MEMORY_ALLOC_FAILED);
}
/* set pointer to PR list and scope list length spaces */
/* set up the scopes and prlist pointers into iov */
len = 4;
/* set up NA string in iovec */
if (all_nas) {
} else {
}
return (SLP_OK);
}
/* else error */
return (err);
}
/*
* Using the collator, determines which types in the types list
* have already been recieved, and composes a new list of the remaining
* (unique) types. If there are no unique types, returns NULL;
* types is destructively modified.
*/
int *numResults, int maxResults) {
/* walk through the types list */
p = types;
p = slp_utf_strchr(s, ',');
if (p)
*p++ = 0;
if (!(s = strdup(s))) {
return (NULL);
}
/* search the tree for this type */
(int (*)(const void *, const void *)) slp_strcasecmp);
if (*res == s) {
/* first time we've encountered this type */
(*numResults)++;
} else {
/* else already in tree */
free(s);
}
}
return (utypes);
}
/*
* This is used after all types have been collated into the tree.
* It walks through the tree, composing a list from all the types in
* the tree, and freeing each node of the tree as it goes.
* Returns the list, or NULL if the tree is empty.
*/
/* the walk action function: */
/*ARGSUSED*/
char *t = *(char **)node;
free(t);
}
}
/* the walk driver: */
if (!collator)
return (NULL);
return (types);
}