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) 1999 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * DAAdvert functionality. For all normal UA calls, libslp queries
31 * slpd for available DAs. This file contains functionality to handle
32 * DAAdverts explicitly requested by a call to SLPFindSrvs()
33 * or SLPFindAttrs() with service-type = "service:directory-agent".
37 #include <slp-internal.h>
39 SLPError
slp_unpackDAAdvert(char *reply
, char **surl
, char **scopes
,
40 char **attrs
, char **spis
, SLPError
*errCode
) {
41 unsigned short protoErrCode
, dummy
;
43 SLPError err
= SLP_OK
;
44 /* authentication components */
50 *surl
= *scopes
= *attrs
= *spis
= NULL
;
52 len
= slp_get_length(reply
);
53 off
= SLP_HDRLEN
+ slp_get_langlen(reply
);
55 if ((err
= slp_get_sht(reply
, len
, &off
, &protoErrCode
)) != SLP_OK
)
57 /* internal errors should have been filtered out by the net code */
58 *errCode
= slp_map_err(protoErrCode
);
59 if (*errCode
!= SLP_OK
) {
63 /* skip timestamp (4 bytes) */
64 iov
[0].iov_base
= reply
+ off
;
66 if ((err
= slp_get_sht(reply
, len
, &off
, &dummy
)) != SLP_OK
) {
69 if ((err
= slp_get_sht(reply
, len
, &off
, &dummy
)) != SLP_OK
) {
72 iov
[0].iov_len
= off
- tmp_off
;
75 iov
[1].iov_base
= reply
+ off
;
77 if ((err
= slp_get_string(reply
, len
, &off
, surl
)) != SLP_OK
) {
80 iov
[1].iov_len
= off
- tmp_off
;
83 iov
[3].iov_base
= reply
+ off
;
85 if ((err
= slp_get_string(reply
, len
, &off
, scopes
)) != SLP_OK
) {
88 iov
[3].iov_len
= off
- tmp_off
;
91 iov
[2].iov_base
= reply
+ off
;
93 if ((err
= slp_get_string(reply
, len
, &off
, attrs
)) != SLP_OK
) {
96 iov
[2].iov_len
= off
- tmp_off
;
99 iov
[4].iov_base
= reply
+ off
;
101 if ((err
= slp_get_string(reply
, len
, &off
, spis
)) != SLP_OK
) {
104 iov
[4].iov_len
= off
- tmp_off
;
107 if ((err
= slp_get_byte(reply
, len
, &off
, &auth_cnt
)) != SLP_OK
) {
110 if (slp_get_security_on() || auth_cnt
> 0) {
111 if ((err
= slp_verify(iov
, 5,
115 &abLen
)) != SLP_OK
) {
123 if (*surl
) free (*surl
);
124 if (*scopes
) free (*scopes
);
125 if (*attrs
) free (*attrs
);
126 if (*spis
) free (*spis
);