mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.0 to HEAD
5910: Web Services getUsers 5913: Web Services admin user password change 5956: LDAP anon simple bind test 6133: WCM-486 6158: Merged V1.4 to V2.0 5600: Split person bootstrap 5642: AR-439 NetBIOS adaptor status request 6160: VersionHistoryPerformance patch with no versionedNodeId git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6166 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -114,14 +114,23 @@ public class NetBIOSPacket
|
||||
public static final int ACT_ERR = 0x06;
|
||||
public static final int CFT_ERR = 0x07;
|
||||
|
||||
// Name flags
|
||||
|
||||
public static final int NAME_PERM = 0x02;
|
||||
public static final int NAME_ACTIVE = 0x04;
|
||||
public static final int NAME_CONFLICT = 0x08;
|
||||
public static final int NAME_DEREG = 0x10;
|
||||
public static final int NAME_GROUP = 0x80;
|
||||
|
||||
// Name flags
|
||||
|
||||
public static final int NAME_PERM = 0x0200;
|
||||
public static final int NAME_ACTIVE = 0x0400;
|
||||
public static final int NAME_CONFLICT = 0x0800;
|
||||
public static final int NAME_DEREG = 0x1000;
|
||||
public static final int NAME_GROUP = 0x8000;
|
||||
|
||||
public static final int NAME_TYPE_BNODE = 0x0000;
|
||||
public static final int NAME_TYPE_PNODE = 0x2000;
|
||||
public static final int NAME_TYPE_MNODE = 0x4000;
|
||||
public static final int NAME_TYPE_RESVD = 0x6000;
|
||||
|
||||
// Adapter status name in encoded format
|
||||
|
||||
private static final String AdapterStatusNBName = "CKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
||||
|
||||
// NetBIOS packet buffer
|
||||
|
||||
private byte[] m_nbbuf;
|
||||
@@ -1252,4 +1261,75 @@ public class NetBIOSPacket
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an adapter status response
|
||||
*
|
||||
* @param nameList NetBIOSNameList
|
||||
* @param int nodeType
|
||||
* @return int
|
||||
*/
|
||||
public final int buildAdapterStatusResponse(NetBIOSNameList nameList, int nodeType) {
|
||||
|
||||
// Fill in the header
|
||||
|
||||
setOpcode(NetBIOSPacket.RESP_QUERY);
|
||||
setFlags(NetBIOSPacket.FLG_RECURSDES + NetBIOSPacket.FLG_AUTHANSWER);
|
||||
|
||||
setQuestionCount(0);
|
||||
setAnswerCount(1);
|
||||
setAdditionalCount(0);
|
||||
setNameServiceCount(0);
|
||||
|
||||
// Pack the encoded adapter status name into the NetBIOS packet
|
||||
|
||||
int pos = NB_DATA;
|
||||
m_nbbuf [ pos++] = ( byte) NAME_LEN;
|
||||
|
||||
pos = DataPacker.putString( AdapterStatusNBName, m_nbbuf, pos, true);
|
||||
|
||||
// Set the name type and class
|
||||
|
||||
DataPacker.putShort (( short) 0x21, m_nbbuf, pos);
|
||||
pos += 2;
|
||||
|
||||
DataPacker.putShort (( short) 0x01, m_nbbuf, pos);
|
||||
pos += 2;
|
||||
|
||||
pos = setTTL(pos, 10000);
|
||||
pos = setResourceDataLength(pos, (nameList.numberOfNames() * 18) + 42);
|
||||
|
||||
// Pack the names
|
||||
|
||||
m_nbbuf[pos++] = (byte) nameList.numberOfNames();
|
||||
|
||||
for ( int i = 0; i < nameList.numberOfNames(); i++) {
|
||||
|
||||
// Get the current name
|
||||
|
||||
NetBIOSName nbName = nameList.getName( i);
|
||||
|
||||
// Pack the NetBIOS name and flags
|
||||
|
||||
System.arraycopy( nbName.getNetBIOSName(), 0, m_nbbuf, pos, NetBIOSName.NameLength);
|
||||
pos += NetBIOSName.NameLength;
|
||||
|
||||
int flags = nodeType + NAME_ACTIVE;
|
||||
if ( nbName.isGroupName())
|
||||
flags += NAME_GROUP;
|
||||
|
||||
DataPacker.putShort(( short) flags, m_nbbuf, pos);
|
||||
pos += 2;
|
||||
}
|
||||
|
||||
// Zero out the statistics, MAC address area
|
||||
|
||||
for ( int i = 0; i < 42; i++)
|
||||
m_nbbuf[pos++] = (byte) 0;
|
||||
|
||||
// Set the packet length, and return the length
|
||||
|
||||
setLength(pos);
|
||||
return getLength();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user