package com.sun.slp;
import java.util.*;
import java.io.*;
class CSAAdvert extends SrvLocMsgImpl {
ServiceURL URL = null;
Hashtable authBlock = null;
Vector attrs = new Vector();
CSAAdvert(SLPHeaderV2 hdr, DataInputStream dis)
throws ServiceLocationException, IOException {
super(hdr, SrvLocHeader.SAAdvert);
StringBuffer buf = new StringBuffer();
byte[] urlBytes = hdr.getString(buf, dis);
try {
URL = new ServiceURL(buf.toString(), ServiceURL.LIFETIME_NONE);
} catch (IllegalArgumentException ex) {
throw
new ServiceLocationException(
ServiceLocationException.PARSE_ERROR,
"malformed_url",
new Object[] {ex.getMessage()});
}
ServiceType serviceType = URL.getServiceType();
if (!serviceType.equals(Defaults.SA_SERVICE_TYPE)) {
throw
new ServiceLocationException(
ServiceLocationException.PARSE_ERROR,
"not_right_url",
new Object[] {URL, "SA"});
}
byte[] scopeBytes = hdr.getString(buf, dis);
hdr.scopes =
hdr.parseCommaSeparatedListIn(buf.toString(), true);
hdr.unescapeScopeStrings(hdr.scopes);
DATable.validateScopes(hdr.scopes, hdr.locale);
byte attrBytes[] = hdr.parseAttributeVectorIn(attrs, dis, false);
Object[] message = new Object[6];
ByteArrayOutputStream abaos = new ByteArrayOutputStream();
hdr.putInteger(urlBytes.length, abaos);
message[0] = abaos.toByteArray();
message[1] = urlBytes;
abaos = new ByteArrayOutputStream();
hdr.putInteger(attrBytes.length, abaos);
message[2] = abaos.toByteArray();
message[3] = attrBytes;
abaos = new ByteArrayOutputStream();
hdr.putInteger(scopeBytes.length, abaos);
message[4] = abaos.toByteArray();
message[5] = scopeBytes;
authBlock = hdr.parseSignatureIn(message, dis);
hdr.iNumReplies = 1;
}
}