xref: /illumos-gate/usr/src/lib/libslp/javalib/com/sun/slp/SLPServerHeaderV2.java (revision 9a70fc3be3b1e966bf78825cdb8d509963a6f0a1)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*9a70fc3bSMark J. Nelson  * Common Development and Distribution License (the "License").
6*9a70fc3bSMark J. Nelson  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
227c478bd9Sstevel@tonic-gate  * Copyright 2001-2002 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  *
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate //  SLPServerHeaderV2.java: SLPv2 Header Class for Server Side
287c478bd9Sstevel@tonic-gate //  Author:           James Kempf
297c478bd9Sstevel@tonic-gate //  Created On:       Wed Sep 16 08:44:31 1998
307c478bd9Sstevel@tonic-gate //  Last Modified By: James Kempf
317c478bd9Sstevel@tonic-gate //  Last Modified On: Mon Jan  4 15:26:33 1999
327c478bd9Sstevel@tonic-gate //  Update Count:     30
337c478bd9Sstevel@tonic-gate //
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate package com.sun.slp;
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate import java.util.*;
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate import java.net.*;
407c478bd9Sstevel@tonic-gate import java.io.*;
417c478bd9Sstevel@tonic-gate import java.security.*;
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /**
447c478bd9Sstevel@tonic-gate  * The SLPServerHeaderV2 class serves as the header class for all server side
457c478bd9Sstevel@tonic-gate  * SLPv2 messages.
467c478bd9Sstevel@tonic-gate  *
477c478bd9Sstevel@tonic-gate  * @author James Kempf
487c478bd9Sstevel@tonic-gate  */
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate class SLPServerHeaderV2 extends SLPHeaderV2  implements Cloneable {
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate     // Function code for message reply.
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate     int replyFunctionCode = SrvLocHeader.SrvAck;
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate     // For SrvLocHeader.newInstance().
577c478bd9Sstevel@tonic-gate 
SLPServerHeaderV2()587c478bd9Sstevel@tonic-gate     SLPServerHeaderV2() {
597c478bd9Sstevel@tonic-gate 	super();
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate     }
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate     // Construct a header for output. Used by the client side code to
647c478bd9Sstevel@tonic-gate     //  construct an initial request and the server side code to construct
657c478bd9Sstevel@tonic-gate     //  a reply.
667c478bd9Sstevel@tonic-gate 
SLPServerHeaderV2(int functionCode, boolean fresh, Locale locale)677c478bd9Sstevel@tonic-gate     SLPServerHeaderV2(int functionCode, boolean fresh, Locale locale)
687c478bd9Sstevel@tonic-gate 	throws ServiceLocationException {
697c478bd9Sstevel@tonic-gate 	super(functionCode, fresh, locale);
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate     }
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate     // Assign reply code based on function code type, then use superclass
747c478bd9Sstevel@tonic-gate     //  method to parse header.
757c478bd9Sstevel@tonic-gate 
parseHeader(int functionCode, DataInputStream dis)767c478bd9Sstevel@tonic-gate     void parseHeader(int functionCode, DataInputStream dis)
777c478bd9Sstevel@tonic-gate 	throws ServiceLocationException, IOException {
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate 	// We ignore the error case here.
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate 	switch (functionCode) {
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate 	case SrvLocHeader.SrvReq:
847c478bd9Sstevel@tonic-gate 	    replyFunctionCode = SrvLocHeader.SrvRply;
857c478bd9Sstevel@tonic-gate 	    break;
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate 	case SrvLocHeader.AttrRqst:
887c478bd9Sstevel@tonic-gate 	    replyFunctionCode = SrvLocHeader.AttrRply;
897c478bd9Sstevel@tonic-gate 	    break;
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate 	case SrvLocHeader.SrvTypeRqst:
927c478bd9Sstevel@tonic-gate 	    replyFunctionCode = SrvLocHeader.SrvTypeRply;
937c478bd9Sstevel@tonic-gate 	    break;
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate 	case SrvLocHeader.SrvReg: case SrvLocHeader.SrvDereg:
967c478bd9Sstevel@tonic-gate 	    replyFunctionCode = SrvLocHeader.SrvAck;
977c478bd9Sstevel@tonic-gate 	    break;
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate 	    // If we get an error during creating of the DAAdvert to
1007c478bd9Sstevel@tonic-gate 	    //  reply, we need to continue and reply with DAAdvert.
1017c478bd9Sstevel@tonic-gate 	    //  This is only true for a unicast DAAdvert, though.
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate 	case SrvLocHeader.DAAdvert:
1047c478bd9Sstevel@tonic-gate 	    replyFunctionCode = SrvLocHeader.DAAdvert;
1057c478bd9Sstevel@tonic-gate 	    break;
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate 	    // We ignore the header error code for SAAdvert because
1087c478bd9Sstevel@tonic-gate 	    //  it is always multicast.
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate 	}
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate 	// We are now set up to handle any errors that may come flying out
1137c478bd9Sstevel@tonic-gate 	//  of here.
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate 	super.parseHeader(functionCode, dis);
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate     }
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate     // Replace the superclass method with a method that parses the server
1207c478bd9Sstevel@tonic-gate     //  side.
1217c478bd9Sstevel@tonic-gate 
parseMsg(DataInputStream dis)1227c478bd9Sstevel@tonic-gate     SrvLocMsg parseMsg(DataInputStream dis)
1237c478bd9Sstevel@tonic-gate 	throws ServiceLocationException,
1247c478bd9Sstevel@tonic-gate 	       IOException,
1257c478bd9Sstevel@tonic-gate 	       IllegalArgumentException {
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate 	SrvLocMsg msg = null;
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate 	// DAAdvert needs to get it's error code parsed here because
1307c478bd9Sstevel@tonic-gate 	//  error codes are always handled in parseMsg() and it is
1317c478bd9Sstevel@tonic-gate 	//  the only server side message that has one.
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate 	if (functionCode == SrvLocHeader.DAAdvert) {
1347c478bd9Sstevel@tonic-gate 	    errCode = (short)getInt(dis);
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate 	}
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate 	// Switch and convert according to function code.
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate 	switch (functionCode) {
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate 	case SrvLocHeader.SrvReg:
1437c478bd9Sstevel@tonic-gate 	    msg = new SSrvReg(this, dis);
1447c478bd9Sstevel@tonic-gate 	    break;
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate 	case SrvLocHeader.SrvDereg:
1477c478bd9Sstevel@tonic-gate 	    msg = new SSrvDereg(this, dis);
1487c478bd9Sstevel@tonic-gate 	    break;
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate 	case SrvLocHeader.SrvReq:
1517c478bd9Sstevel@tonic-gate 	    msg = new SSrvMsg(this, dis);
1527c478bd9Sstevel@tonic-gate 	    break;
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate 	case SrvLocHeader.AttrRqst:
1557c478bd9Sstevel@tonic-gate 	    msg = new SAttrMsg(this, dis);
1567c478bd9Sstevel@tonic-gate 	    break;
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate 	case SrvLocHeader.SrvAck:
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate 	    // We function as our own message.
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate 	    msg = this;
1637c478bd9Sstevel@tonic-gate 	    iNumReplies = 1;
1647c478bd9Sstevel@tonic-gate 	    break;
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate 	case SrvLocHeader.SrvTypeRqst:
1677c478bd9Sstevel@tonic-gate 	    msg = new SSrvTypeMsg(this, dis);
1687c478bd9Sstevel@tonic-gate 	    break;
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate 	case SrvLocHeader.DAAdvert:
1717c478bd9Sstevel@tonic-gate 	    msg = new CDAAdvert(this, dis);
1727c478bd9Sstevel@tonic-gate 	    break;
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate 	case SrvLocHeader.SAAdvert:
1757c478bd9Sstevel@tonic-gate 	    msg = new CSAAdvert(this, dis);
1767c478bd9Sstevel@tonic-gate 	    break;
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate 	default:
1797c478bd9Sstevel@tonic-gate 	    throw
1807c478bd9Sstevel@tonic-gate 		new ServiceLocationException(
1817c478bd9Sstevel@tonic-gate 				ServiceLocationException.PARSE_ERROR,
1827c478bd9Sstevel@tonic-gate 				"function_code_error",
1837c478bd9Sstevel@tonic-gate 				new Object[] {
1847c478bd9Sstevel@tonic-gate 		    new Integer(functionCode)});
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate 	}
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate 	// Check for size overflow.
1897c478bd9Sstevel@tonic-gate 
1907c478bd9Sstevel@tonic-gate 	if (nbytes > length) {
1917c478bd9Sstevel@tonic-gate 	    throw
1927c478bd9Sstevel@tonic-gate 		new ServiceLocationException(
1937c478bd9Sstevel@tonic-gate 				ServiceLocationException.PARSE_ERROR,
1947c478bd9Sstevel@tonic-gate 				"length_overflow",
1957c478bd9Sstevel@tonic-gate 				new Object[] {
1967c478bd9Sstevel@tonic-gate 		    new Integer(nbytes), new Integer(length)});
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate 	}
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate 	return msg;
2017c478bd9Sstevel@tonic-gate 
2027c478bd9Sstevel@tonic-gate     }
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate     // Create an error reply using the reply code. Calculate the
2057c478bd9Sstevel@tonic-gate     //  error code using the exception.
2067c478bd9Sstevel@tonic-gate 
makeErrorReply(Exception ex)2077c478bd9Sstevel@tonic-gate     SrvLocMsg makeErrorReply(Exception ex) {
2087c478bd9Sstevel@tonic-gate 
2097c478bd9Sstevel@tonic-gate 	SrvLocHeader hdr = null;
2107c478bd9Sstevel@tonic-gate 
2117c478bd9Sstevel@tonic-gate 	// Clone the header to make sure that everything else is the same.
2127c478bd9Sstevel@tonic-gate 	//  We don't want to use the same header because it may be tested
2137c478bd9Sstevel@tonic-gate 	//  elsewhere.
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate 	try {
2167c478bd9Sstevel@tonic-gate 	    hdr = (SrvLocHeader)this.clone();
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate 	} catch (CloneNotSupportedException exx) {
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate 	    // We support it, so no-op.
2217c478bd9Sstevel@tonic-gate 
2227c478bd9Sstevel@tonic-gate 	}
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate 	// Re-initialize flags but not multicast, since we need to filter on it
2257c478bd9Sstevel@tonic-gate 
2267c478bd9Sstevel@tonic-gate 	hdr.fresh = false;
2277c478bd9Sstevel@tonic-gate 	hdr.overflow = false;
2287c478bd9Sstevel@tonic-gate 	hdr.functionCode = replyFunctionCode;
2297c478bd9Sstevel@tonic-gate 
2307c478bd9Sstevel@tonic-gate 	// We should *not* be getting a null exception down this path!
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate 	Assert.slpassert(ex != null,
2337c478bd9Sstevel@tonic-gate 		      "null_parameter",
2347c478bd9Sstevel@tonic-gate 		      new Object[] {ex});
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate 	if (ex instanceof ServiceLocationException) {
2377c478bd9Sstevel@tonic-gate 
2387c478bd9Sstevel@tonic-gate 	    hdr.errCode = ((ServiceLocationException)ex).getErrorCode();
2397c478bd9Sstevel@tonic-gate 
2407c478bd9Sstevel@tonic-gate 	    if (!ServiceLocationException.validWireErrorCode(hdr.errCode)) {
2417c478bd9Sstevel@tonic-gate 		hdr.errCode = ServiceLocationException.INTERNAL_ERROR;
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate 	    }
2447c478bd9Sstevel@tonic-gate 
2457c478bd9Sstevel@tonic-gate 	} else if (ex instanceof IllegalArgumentException ||
2467c478bd9Sstevel@tonic-gate 		   ex instanceof IOException) {
2477c478bd9Sstevel@tonic-gate 	    hdr.errCode = ServiceLocationException.PARSE_ERROR;
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate 	} else {
2507c478bd9Sstevel@tonic-gate 	    hdr.errCode = ServiceLocationException.INTERNAL_ERROR;
2517c478bd9Sstevel@tonic-gate 
2527c478bd9Sstevel@tonic-gate 	}
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate 	// Construct header description.
2557c478bd9Sstevel@tonic-gate 
2567c478bd9Sstevel@tonic-gate 	constructDescription("SrvLocMsg", "");
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate 	return hdr;
2597c478bd9Sstevel@tonic-gate     }
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate     // Return a reply header with flags properly set.
2627c478bd9Sstevel@tonic-gate 
makeReplyHeader()2637c478bd9Sstevel@tonic-gate     SLPServerHeaderV2 makeReplyHeader() {
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate 	SLPServerHeaderV2 hdr = null;
2667c478bd9Sstevel@tonic-gate 
2677c478bd9Sstevel@tonic-gate 	try {
2687c478bd9Sstevel@tonic-gate 	    hdr = (SLPServerHeaderV2)this.clone();
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate 	} catch (CloneNotSupportedException ex) {
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate 	    // No-op, since we support it.
2737c478bd9Sstevel@tonic-gate 
2747c478bd9Sstevel@tonic-gate 	}
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate 	hdr.functionCode = replyFunctionCode;
2777c478bd9Sstevel@tonic-gate 	hdr.length = 0;
2787c478bd9Sstevel@tonic-gate 	hdr.previousResponders = null;
2797c478bd9Sstevel@tonic-gate 	hdr.scopes = null;
2807c478bd9Sstevel@tonic-gate 	hdr.overflow = false;
2817c478bd9Sstevel@tonic-gate 	hdr.fresh = false;
2827c478bd9Sstevel@tonic-gate 	hdr.mcast = false;
2837c478bd9Sstevel@tonic-gate 	hdr.nbytes = 0;
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate 	return hdr;
2867c478bd9Sstevel@tonic-gate     }
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate     // Return display string.
2897c478bd9Sstevel@tonic-gate 
toString()2907c478bd9Sstevel@tonic-gate     public String toString() {
2917c478bd9Sstevel@tonic-gate 	return
2927c478bd9Sstevel@tonic-gate 	    getMsgType() + ":version=``" + version + "''\n" +
2937c478bd9Sstevel@tonic-gate 	    "       functionCode=``" + functionCode + "''\n" +
2947c478bd9Sstevel@tonic-gate 	    "       length=``" + length + "''" + "''\n" +
2957c478bd9Sstevel@tonic-gate 	    "       overflow=``" + overflow + "''\n" +
2967c478bd9Sstevel@tonic-gate 	    "       mcast = ``" + mcast + "''\n" +
2977c478bd9Sstevel@tonic-gate 	    "       fresh=``" + fresh + "''\n" +
2987c478bd9Sstevel@tonic-gate 	    "       locale = ``" + locale + "''\n" +
2997c478bd9Sstevel@tonic-gate 	    "       xid=``0x" + Integer.toHexString(xid) + "''\n" +
3007c478bd9Sstevel@tonic-gate 	    "       errCode=``" + errCode + "''\n" +
3017c478bd9Sstevel@tonic-gate 	    "       previousResponders=``" + previousResponders + "''\n" +
3027c478bd9Sstevel@tonic-gate 	    "       scopes=``" + scopes + "''\n" +
3037c478bd9Sstevel@tonic-gate 	    getMsgDescription();
3047c478bd9Sstevel@tonic-gate     }
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate     //
3077c478bd9Sstevel@tonic-gate     // Parsing Utilities.
3087c478bd9Sstevel@tonic-gate     //
3097c478bd9Sstevel@tonic-gate 
3107c478bd9Sstevel@tonic-gate     // Parse in the scope list.
3117c478bd9Sstevel@tonic-gate 
parseScopesIn(DataInputStream dis)3127c478bd9Sstevel@tonic-gate     void parseScopesIn(DataInputStream dis)
3137c478bd9Sstevel@tonic-gate 	throws ServiceLocationException, IOException {
3147c478bd9Sstevel@tonic-gate 
3157c478bd9Sstevel@tonic-gate 	StringBuffer buf = new StringBuffer();
3167c478bd9Sstevel@tonic-gate 
3177c478bd9Sstevel@tonic-gate 	getString(buf, dis);
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate 	scopes = parseCommaSeparatedListIn(buf.toString(), true);
3207c478bd9Sstevel@tonic-gate 
3217c478bd9Sstevel@tonic-gate 	// Unescape scope strings.
3227c478bd9Sstevel@tonic-gate 
3237c478bd9Sstevel@tonic-gate 	unescapeScopeStrings(scopes);
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate 	// Validate.
3267c478bd9Sstevel@tonic-gate 
3277c478bd9Sstevel@tonic-gate 	DATable.validateScopes(scopes, locale);
3287c478bd9Sstevel@tonic-gate 
3297c478bd9Sstevel@tonic-gate     }
3307c478bd9Sstevel@tonic-gate 
parsePreviousRespondersIn(DataInputStream dis)3317c478bd9Sstevel@tonic-gate     void parsePreviousRespondersIn(DataInputStream dis)
3327c478bd9Sstevel@tonic-gate 	throws ServiceLocationException, IOException {
3337c478bd9Sstevel@tonic-gate 
3347c478bd9Sstevel@tonic-gate 	StringBuffer buf = new StringBuffer();
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate 	getString(buf, dis);
3377c478bd9Sstevel@tonic-gate 
3387c478bd9Sstevel@tonic-gate 	previousResponders =
3397c478bd9Sstevel@tonic-gate 	    parseCommaSeparatedListIn(buf.toString(), true);
3407c478bd9Sstevel@tonic-gate 
3417c478bd9Sstevel@tonic-gate     }
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate     // Return an SLPv2 DAAdvert.
3447c478bd9Sstevel@tonic-gate 
3457c478bd9Sstevel@tonic-gate     SDAAdvert
getDAAdvert(short xid, long timestamp, ServiceURL url, Vector scopes, Vector attrs)3467c478bd9Sstevel@tonic-gate 	getDAAdvert(short xid,
3477c478bd9Sstevel@tonic-gate 		    long timestamp,
3487c478bd9Sstevel@tonic-gate 		    ServiceURL url,
3497c478bd9Sstevel@tonic-gate 		    Vector scopes,
3507c478bd9Sstevel@tonic-gate 		    Vector attrs)
3517c478bd9Sstevel@tonic-gate 	throws ServiceLocationException {
3527c478bd9Sstevel@tonic-gate 
3537c478bd9Sstevel@tonic-gate 	// If scopes vector is null, then return all scopes for this
3547c478bd9Sstevel@tonic-gate 	//  DA.
3557c478bd9Sstevel@tonic-gate 
3567c478bd9Sstevel@tonic-gate 	if (scopes.size() <= 0) {
3577c478bd9Sstevel@tonic-gate 	    scopes = SLPConfig.getSLPConfig().getSAConfiguredScopes();
3587c478bd9Sstevel@tonic-gate 
3597c478bd9Sstevel@tonic-gate 	}
3607c478bd9Sstevel@tonic-gate 
3617c478bd9Sstevel@tonic-gate 	return new SDAAdvert(this, xid, timestamp, url, scopes, attrs);
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate     }
3647c478bd9Sstevel@tonic-gate 
3657c478bd9Sstevel@tonic-gate }
366