/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*
*/
// SLPV1Manager.java: Manages V1 Compatibility
// Author: James Kempf
// Created On: Wed Sep 9 09:51:40 1998
// Last Modified By: James Kempf
// Last Modified On: Thu Mar 4 10:39:11 1999
// Update Count: 46
//
/**
* The SLPV1Manager manages access between the DA and the V1 compatibility
* framework. The DA calls into the SLPV1Manager to initialize
* active and passive DA advertising, and to decode an incoming V1
* message. However, the ServiceTable does *not* call into SLPV1Manager
* to handle an outgoing message, since each individual message type is
* handled separately. SLPV1Manager also handles V1 defaults.
*
* @author James Kempf
*/
// V1 Header class.
// V1 multicast addresses.
/**
* The SLPV1Advertiser implements the SLPv1 DAAdvert xid incrementing
* algorithm. In SLPv1, the xid of an unsolicited DAAdvert is only
* 0 if it came up stateless. If it comes up with preexisting state,
* it sets the counter to 0x100. Also, when the xid counter wraps,
* it must wrap to 0x100 and not 0x0.
*/
// For implementing the V1 xid algorithm.
// Service table.
// Scopes to use. We need to map from V2, so default corresponds to
// the empty scope.
// Create an SLPv1 Advertiser and start it running.
throws ServiceLocationException {
super();
initialize();
// There will be NO listener on this multicast address,
// so the superclass will simply create a scoket for it.
// We don't want to create a new Listener
// because we are not interested in multicast requests since
// only SAs answer multicast requests.
}
// Initialize the xid for passive advertising. We need to determine
// whether we came up stateless or not. We do this by asking the
// the service store for the stateless reboot time. If the
// stateless reboot time is within the last 5 minutes, we
// assume we came up stateless. Otherwise, we're stateful.
// We also initialize the URL and scopes.
// Initialize the xid.
xid = STATEFUL_XID;
}
// Initialize the scopes.
}
// Return the output buffer for a passive advert. We need to create
// the advert, rolling over the xid if necessary for the next one.
protected byte[] getOutbuf() {
try {
xid,
config);
bumpXid();
return outbuf;
} catch (ServiceLocationException ex) {
"v1_advert_error",
new Object[0]);
}
return null;
}
private void bumpXid() {
xid = STATEFUL_XID;
} else {
}
}
}
// Start up listener, active and passive listeners for SLPv1.
static public void
// We do not handle SLPv1 if security is enabled, because SLPv1
// security is not implemented.
if (config.getHasSecurity()) {
config.traceDATraffic()) {
new Object[0]);
}
return;
}
try {
// Get address for DA discovery multicast.
// Add all listeners onto the SLPv1 DA multicast address and
// create a DAAdvertiser on all network interfaces for the
// general multicast group.
for (i = 0; i < n; i++) {
// Listen for SLPv1 multicast DA service requests. Only DA
// service requests are multicast on this address.
// We don't need to listen to the SLPv1 general multicast
// address because we never want any multicast service
// requests. But we do need to advertise as an SLPv1 DA.
// So we have a special DAAdvertiser subclass to do it.
}
// Let admin know we are running in SLPv1 compatibility mode
// if tracing is on
config.traceDATraffic()) {
}
return;
} catch (ServiceLocationException ex) {
} catch (UnknownHostException ex) {
}
// Remove Listeners from multicast group, stop DAAdvertisers.
// An error occured.
int j;
for (j = 0; j < i; i++) {
if (dss instanceof MulticastSocket) {
try {
} catch (IOException ex) {
// Ignore it.
}
ad.stopThread();
}
}
}
// Initialize CSrvReg, CSrvDereg, CSrvMsg, and SDAAdvert classes for SLPv1,
// also V1 header class.
static {
}
}