mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Moving to root below branch label
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2005 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
package org.alfresco.filesys.netbios.server;
|
||||
|
||||
/**
|
||||
* NetBIOS add name listener interface.
|
||||
*/
|
||||
public interface AddNameListener
|
||||
{
|
||||
/**
|
||||
* Signal that a NetBIOS name has been added, or an error occurred whilst trying to add a new
|
||||
* NetBIOS name.
|
||||
*
|
||||
* @param evt NetBIOSNameEvent
|
||||
*/
|
||||
public void netbiosNameAdded(NetBIOSNameEvent evt);
|
||||
}
|
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
package org.alfresco.filesys.netbios.server;
|
||||
|
||||
import org.alfresco.filesys.netbios.NetBIOSName;
|
||||
|
||||
/**
|
||||
* NetBIOS name server event class.
|
||||
*/
|
||||
public class NetBIOSNameEvent
|
||||
{
|
||||
/*
|
||||
* NetBIOS name event status codes
|
||||
*/
|
||||
|
||||
public static final int ADD_SUCCESS = 0; // local name added successfully
|
||||
public static final int ADD_FAILED = 1; // local name add failure
|
||||
public static final int ADD_DUPLICATE = 2; // local name already in use
|
||||
public static final int ADD_IOERROR = 3; // I/O error during add name broadcast
|
||||
public static final int QUERY_NAME = 4; // query for local name
|
||||
public static final int REGISTER_NAME = 5; // remote name registered
|
||||
public static final int REFRESH_NAME = 6; // name refresh
|
||||
public static final int REFRESH_IOERROR = 7; // refresh name I/O error
|
||||
|
||||
/**
|
||||
* NetBIOS name details
|
||||
*/
|
||||
|
||||
private NetBIOSName m_name;
|
||||
|
||||
/**
|
||||
* Name status
|
||||
*/
|
||||
|
||||
private int m_status;
|
||||
|
||||
/**
|
||||
* Create a NetBIOS name event.
|
||||
*
|
||||
* @param name NetBIOSName
|
||||
* @param sts int
|
||||
*/
|
||||
protected NetBIOSNameEvent(NetBIOSName name, int sts)
|
||||
{
|
||||
m_name = name;
|
||||
m_status = sts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the NetBIOS name details.
|
||||
*
|
||||
* @return NetBIOSName
|
||||
*/
|
||||
public final NetBIOSName getNetBIOSName()
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the NetBIOS name status.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getStatus()
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
package org.alfresco.filesys.netbios.server;
|
||||
|
||||
import org.alfresco.filesys.netbios.NetBIOSName;
|
||||
|
||||
/**
|
||||
* NetBIOS Request Class
|
||||
* <p>
|
||||
* Contains the details of NetBIOS server request, such as an add name request.
|
||||
*/
|
||||
class NetBIOSRequest
|
||||
{
|
||||
|
||||
// Request types
|
||||
|
||||
public final static int AddName = 0;
|
||||
public final static int DeleteName = 1;
|
||||
public final static int RefreshName = 2;
|
||||
|
||||
// Default retry count and interval
|
||||
|
||||
public final static int DefaultRetries = 5;
|
||||
public final static long DefaultInterval = 2000; // ms
|
||||
|
||||
// Requets type strings
|
||||
|
||||
private final static String[] _typeNames = { "AddName", "DelName", "RefreshName" };
|
||||
|
||||
// Request type
|
||||
|
||||
private int m_type;
|
||||
|
||||
// NetBIOS name details
|
||||
|
||||
private NetBIOSName m_nbName;
|
||||
|
||||
// Retry count and interval
|
||||
|
||||
private int m_retry;
|
||||
private long m_retryIntvl;
|
||||
|
||||
// Response status
|
||||
|
||||
private boolean m_error;
|
||||
|
||||
// Transaction id for this request
|
||||
|
||||
private int m_tranId;
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param typ int
|
||||
* @param nbName NetBIOSName
|
||||
* @param tranId int
|
||||
*/
|
||||
public NetBIOSRequest(int typ, NetBIOSName nbName, int tranId)
|
||||
{
|
||||
m_type = typ;
|
||||
m_nbName = nbName;
|
||||
m_tranId = tranId;
|
||||
|
||||
m_retry = DefaultRetries;
|
||||
m_retryIntvl = DefaultInterval;
|
||||
|
||||
m_error = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param typ int
|
||||
* @param nbName NetBIOSName
|
||||
* @param tranId int
|
||||
* @param retry int
|
||||
*/
|
||||
public NetBIOSRequest(int typ, NetBIOSName nbName, int tranId, int retry)
|
||||
{
|
||||
m_type = typ;
|
||||
m_nbName = nbName;
|
||||
m_tranId = tranId;
|
||||
|
||||
m_retry = retry;
|
||||
m_retryIntvl = DefaultInterval;
|
||||
|
||||
m_error = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the request type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int isType()
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type as a string
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public final String getTypeAsString()
|
||||
{
|
||||
if (m_type < 0 || m_type >= _typeNames.length)
|
||||
return "";
|
||||
return _typeNames[m_type];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the NetBIOS name details
|
||||
*
|
||||
* @return NetBIOSName
|
||||
*/
|
||||
public final NetBIOSName getNetBIOSName()
|
||||
{
|
||||
return m_nbName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the retry count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getRetryCount()
|
||||
{
|
||||
return m_retry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the retry interval
|
||||
*
|
||||
* @return long
|
||||
*/
|
||||
public final long getRetryInterval()
|
||||
{
|
||||
return m_retryIntvl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the transaction id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getTransactionId()
|
||||
{
|
||||
return m_tranId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the request has an error status
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public final boolean hasErrorStatus()
|
||||
{
|
||||
return m_error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrement the retry count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected final int decrementRetryCount()
|
||||
{
|
||||
return m_retry--;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the error status
|
||||
*
|
||||
* @param sts boolean
|
||||
*/
|
||||
protected final void setErrorStatus(boolean sts)
|
||||
{
|
||||
m_error = sts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the request retry count
|
||||
*
|
||||
* @param retry int
|
||||
*/
|
||||
public final void setRetryCount(int retry)
|
||||
{
|
||||
m_retry = retry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the retry interval, in milliseconds
|
||||
*
|
||||
* @param interval long
|
||||
*/
|
||||
public final void setRetryInterval(long interval)
|
||||
{
|
||||
m_retryIntvl = interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the request as a string
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer str = new StringBuffer();
|
||||
|
||||
str.append("[");
|
||||
str.append(getTypeAsString());
|
||||
str.append(":");
|
||||
str.append(getNetBIOSName());
|
||||
str.append(",");
|
||||
str.append(getRetryCount());
|
||||
str.append(",");
|
||||
str.append(getRetryInterval());
|
||||
str.append(",");
|
||||
str.append(getTransactionId());
|
||||
str.append("]");
|
||||
|
||||
return str.toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
package org.alfresco.filesys.netbios.server;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.DatagramSocket;
|
||||
|
||||
/**
|
||||
* Interface for NetBIOS packet receivers.
|
||||
*/
|
||||
public interface PacketReceiver
|
||||
{
|
||||
|
||||
/**
|
||||
* Receive packets on the specified datagram socket.
|
||||
*
|
||||
* @param sock java.net.DatagramSocket
|
||||
* @exception java.io.IOException The exception description.
|
||||
*/
|
||||
void ReceivePacket(DatagramSocket sock) throws IOException;
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
package org.alfresco.filesys.netbios.server;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
||||
/**
|
||||
* NetBIOS name query listener interface.
|
||||
*/
|
||||
public interface QueryNameListener
|
||||
{
|
||||
|
||||
/**
|
||||
* Signal that a NetBIOS name query has been received, for the specified local NetBIOS name.
|
||||
*
|
||||
* @param evt Local NetBIOS name details.
|
||||
* @param addr IP address of the remote node that sent the name query request.
|
||||
*/
|
||||
public void netbiosNameQuery(NetBIOSNameEvent evt, InetAddress addr);
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
package org.alfresco.filesys.netbios.server;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
||||
/**
|
||||
* NetBIOS remote name listener interface.
|
||||
*/
|
||||
public interface RemoteNameListener
|
||||
{
|
||||
|
||||
/**
|
||||
* Signal that a remote host has added a new NetBIOS name.
|
||||
*
|
||||
* @param evt NetBIOSNameEvent
|
||||
* @param addr java.net.InetAddress
|
||||
*/
|
||||
public void netbiosAddRemoteName(NetBIOSNameEvent evt, InetAddress addr);
|
||||
|
||||
/**
|
||||
* Signal that a remote host has released a NetBIOS name.
|
||||
*
|
||||
* @param evt NetBIOSNameEvent
|
||||
* @param addr java.net.InetAddress
|
||||
*/
|
||||
public void netbiosReleaseRemoteName(NetBIOSNameEvent evt, InetAddress addr);
|
||||
}
|
Reference in New Issue
Block a user