/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <slp-internal.h>
struct surl_node {
char *surl;
unsigned short lifetime;
};
struct caller_bundle {
void *cookie;
};
static char *collate_surls(char *, unsigned short, void **);
static void process_surl_node(void *, VISIT, int, void *);
SLPSrvURLCallback, void *,
void **, int *);
SLPSrvURLCallback, void *,
void **, int *);
const char *pcScope, const char *pcSearchFilter,
int wantSAAdvert =
int wantDAAdvert =
!pcSearchFilter || !callback) {
return (SLP_PARAMETER_BAD);
}
return (SLP_PARAMETER_BAD);
}
return (err);
/* Special unpacker for DA and SA solicitations */
if (wantDAAdvert) {
} else if (wantSAAdvert) {
} else {
/* normal service request */
}
return (err);
}
void **collator, int *numResults) {
int i;
if (!reply) {
/* no more results */
/* traverse_surls:invoke cb for sync case,and free resources */
}
return (SLP_FALSE);
}
/* err code */
return (SLP_TRUE);
/* internal errors should have been filtered out by the net code */
}
/* url entry count */
return (SLP_TRUE);
/* for each srvRply, unpack and pass to CB */
char *pcSrvURL;
unsigned short sLifetime;
int nURLAuthBlocks;
char *url_tbv;
/* parse URL entry into params */
off++; /* skip reserved byte */
/* lifetime */
return (SLP_TRUE);
/* URL itself; keep track of it in case we need to verify */
return (SLP_TRUE);
/* number of url auths */
goto cleanup;
/* get and verify auth blocks */
nURLAuthBlocks > 0) {
goto cleanup;
}
}
/* collate the srv urls for sync behavior */
if (!pcSrvURL)
continue;
}
(*numResults)++;
/* invoke cb */
cookie);
/* cleanup */
/* check maxResults */
}
if (!cont) break;
}
return (cont);
}
/*
* unpackDAAdvert_srv follows the same same logic flow as slp_unpackSrvReply
* with two differences: the message in reply is a DAAdvert, and
* this function is not used internally, so hp is never NULL. Although
* all info from a DAAdvert is returned by slp_unpackDAAdvert, here
* the recipient (the user-supplied SLPSrvURLCallback) is interested
* only in the DA service URL.
*/
void **collator, int *numResults) {
if (!reply) {
/* no more results */
/* traverse_surls:invoke cb for sync case,and free resources */
}
return (SLP_FALSE);
}
!= SLP_OK) {
return (SLP_TRUE);
}
}
/* collate the urls */
if (!surl) {
return (SLP_TRUE);
}
(*numResults)++;
}
/* cleanup */
/* check maxResults */
return (SLP_FALSE);
}
return (cont);
}
/*
* unpackSAAdvert_srv follows the same same logic flow as slp_unpackSrvReply
* with two differences: the message in reply is a SAAdvert, and
* this function is not used internally, so hp is never NULL. Although
* all info from an SAAdvert is returned by slp_unpackSAAdvert, here
* the recipient (the user-supplied SLPSrvURLCallback) is interested
* only in the SA service URL.
*/
void **collator, int *numResults) {
if (!reply) {
/* no more results */
/* traverse_surls:invoke cb for sync case,and free resources */
/* sync case */
}
return (SLP_FALSE);
}
return (SLP_TRUE);
}
/* collate the urls */
if (!surl) {
return (SLP_TRUE);
}
(*numResults)++;
}
/* cleanup */
/* check maxResults */
return (SLP_FALSE);
}
return (cont);
}
const char *filter,
slp_handle_impl_t *hp) {
if (slp_get_security_on()) {
}
spi = "";
}
/*
* Allocate iovec for the messge. A SrvRqst is layed out thus:
* 0: header
* 1: prlist length
* 2: prlist (filled in later by networking code)
* 3: service type string
* 4: scopes length
* 5: scopes (filled in later by networking code)
* 6: predicate string and SPI string
*/
return (SLP_MEMORY_ALLOC_FAILED);
}
/* calculate msg length */
2 + /* scope list 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;
/* Add type string */
goto error;
/* Add search filter */
goto error;
return (err);
}
/* else error */
return (err);
}
/*
* Caller must free msg
*/
const char *scopes,
const char *filter,
char **msg,
const char *lang) {
msgLen =
2; /* No SPI string for internal calls */
"out of memory");
return (SLP_MEMORY_ALLOC_FAILED);
}
len = 0;
/* empty SPI string */
return (err);
}
}
/*
* Using the collator, determine if this URL has already been processed.
* If so, free surl and return NULL, else return the URL.
*/
if (!(n = malloc(sizeof (*n)))) {
return (NULL);
}
free(n);
return (NULL);
}
(int (*)(const void *, const void *)) compare_surls);
if (*res == n) {
/* first time we've encountered this url */
return (surl);
}
/* else already in tree */
free(n);
return (NULL);
}
if (!collator)
return;
}
/*ARGSUSED*/
struct surl_node *n;
/* invoke cb */
h, n->surl,
n->lifetime,
free(n);
}
}