public class NetBIOSPacket extends Object
A NetBIOSPacket holds a single NetBIOS request or response. Contains methods for building the main NetBIOS request types (add name, delete name, name query, refresh and session setup).
Modifier and Type | Field and Description |
---|---|
static int |
ACT_ERR |
static int |
CFT_ERR |
static int |
DEFAULT_BUFSIZE |
static int |
FLG_AUTHANSWER |
static int |
FLG_BROADCAST |
static int |
FLG_RECURSDES |
static int |
FLG_RECURSION |
static int |
FLG_TRUNCATION |
static int |
FMT_ERR |
static int |
IMP_ERR |
static int |
MASK_NMFLAGS |
static int |
MASK_NOFLAGS |
static int |
MASK_NOOPCODE |
static int |
MASK_NORCODE |
static int |
MASK_OPCODE |
static int |
MASK_RCODE |
static int |
MASK_RESPONSE |
static int |
MIN_RXLEN |
static int |
NAME_ACTIVE |
static int |
NAME_CLASS_IN |
static int |
NAME_CONFLICT |
static int |
NAME_DEREG |
static int |
NAME_GROUP |
static int |
NAME_LEN |
static int |
NAME_PERM |
static int |
NAME_QUERY |
static int |
NAME_REGISTER |
static int |
NAME_REGISTER_MULTI |
static int |
NAME_RELEASE |
static int |
NAME_TYPE_BNODE |
static int |
NAME_TYPE_MNODE |
static int |
NAME_TYPE_NB |
static int |
NAME_TYPE_NBSTAT |
static int |
NAME_TYPE_PNODE |
static int |
NAME_TYPE_RESVD |
static int |
REFRESH |
static int |
RESP_QUERY |
static int |
RESP_REGISTER |
static int |
RESP_RELEASE |
static int |
RFS_ERR |
static int |
SRV_ERR |
static int |
WACK |
Constructor and Description |
---|
NetBIOSPacket()
Default constructor
|
NetBIOSPacket(byte[] buf)
Create a NetBIOS packet with the specified buffer.
|
NetBIOSPacket(int siz)
Create a NetBIOS packet with the specified buffer size.
|
Modifier and Type | Method and Description |
---|---|
int |
buildAdapterStatusResponse(NetBIOSNameList nameList,
int nodeType)
Build an adapter status response
|
int |
buildAddNameRequest(NetBIOSName name,
int addrIdx,
int tranId)
Build an add name request packet for the specified NetBIOS name
|
int |
buildDeleteNameRequest(NetBIOSName name,
int addrIdx,
int tranId)
Build a delete name request packet for the specified NetBIOS name
|
int |
buildNameQueryRequest(NetBIOSName name,
int tranId,
boolean wins)
Build a name query request packet for the specified NetBIOS name
|
int |
buildNameQueryResponse(NetBIOSName name)
Build a name query response packet for the specified NetBIOS name
|
int |
buildRefreshNameRequest(NetBIOSName name,
int addrIdx,
int tranId)
Build a refresh name request packet for the specified NetBIOS name
|
int |
buildSessionSetupRequest(NetBIOSName fromName,
NetBIOSName toName)
Build a session setup request packet
|
void |
DumpPacket(boolean sessPkt)
Dump the packet structure to the console.
|
NetBIOSNameList |
getAdapterStatusNameList()
Get the answer name list from an adapter status reply
|
int |
getAdditionalCount()
Get the additional byte count.
|
int |
getAnswerCount()
Get the answer count.
|
String |
getAnswerName()
Get the answer name details
|
NetBIOSNameList |
getAnswerNameList()
Get the answer name list
|
byte[] |
getBuffer()
Return the NetBIOS buffer.
|
int |
getFlags()
Get the flags from the received NetBIOS packet.
|
int |
getHeaderFlags()
Return the NetBIOS header flags value.
|
int |
getHeaderLength()
Return the NetBIOS header data length value.
|
int |
getHeaderType()
Return the NetBIOS header message type.
|
int |
getLength()
Return the received packet length.
|
int |
getNameServiceCount()
Return the name service count.
|
int |
getOpcode()
Return the NetBIOS opcode.
|
int |
getPacketType()
Return the NetBIOS packet type.
|
int |
getQuestionCount()
Return the question count.
|
String |
getQuestionName()
Get the question name.
|
int |
getQuestionNameLength()
Get the question name length.
|
int |
getResultCode()
Return the result code for the received packet.
|
int |
getTransactionId()
Return the NetBIOS transaction id.
|
static String |
getTypeAsString(int typ)
Return a packet type as a string
|
boolean |
isResponse()
Determine if the received packet is a repsonse packet.
|
void |
setAdditionalCount(int cnt)
Set the additional byte count.
|
void |
setAnswerCount(int cnt)
Set the answer byte count.
|
int |
setAnswerName(String name,
char ntyp,
int qtyp,
int qcls)
Set the answer name.
|
void |
setFlags(int flg)
Set the flags.
|
void |
setHeaderFlags(int flg)
Set the NetBIOS packet header flags value.
|
void |
setHeaderLength(int len)
Set the NetBIOS packet data length in the packet header.
|
void |
setHeaderType(int typ)
Set the NetBIOS packet type in the packet header.
|
int |
setIPAddress(int off,
byte[] ipaddr)
Set the IP address.
|
void |
setLength(int len)
Set the packet data length.
|
int |
setNameRegistrationFlags(int off,
int flg)
Set the name registration flags.
|
void |
setNameServiceCount(int cnt)
Set the name service count.
|
void |
setOpcode(int op)
Set the NetBIOS opcode.
|
void |
setQuestionCount(int cnt)
Set the question count.
|
int |
setQuestionName(NetBIOSName name,
int qtyp,
int qcls)
Set the question name.
|
int |
setQuestionName(String name,
char ntyp,
int qtyp,
int qcls)
Set the question name.
|
int |
setResourceData(int off,
int flg,
byte[] data,
int len)
Pack the resource data into the packet.
|
int |
setResourceDataLength(int off,
int len)
Set the resource data length in the NetBIOS packet.
|
int |
setResourceRecord(int pktoff,
int rroff,
int qtyp,
int qcls)
Set the resource record.
|
void |
setTransactionId(int id)
Set the transaction id.
|
int |
setTTL(int off,
int ttl)
Set the time to live for the packet.
|
public static final int MIN_RXLEN
public static final int NAME_QUERY
public static final int NAME_REGISTER
public static final int NAME_RELEASE
public static final int WACK
public static final int REFRESH
public static final int NAME_REGISTER_MULTI
public static final int RESP_QUERY
public static final int RESP_REGISTER
public static final int RESP_RELEASE
public static final int MASK_OPCODE
public static final int MASK_NMFLAGS
public static final int MASK_RCODE
public static final int MASK_NOOPCODE
public static final int MASK_NOFLAGS
public static final int MASK_NORCODE
public static final int MASK_RESPONSE
public static final int FLG_BROADCAST
public static final int FLG_RECURSION
public static final int FLG_RECURSDES
public static final int FLG_TRUNCATION
public static final int FLG_AUTHANSWER
public static final int NAME_TYPE_NB
public static final int NAME_TYPE_NBSTAT
public static final int NAME_LEN
public static final int NAME_CLASS_IN
public static final int DEFAULT_BUFSIZE
public static final int FMT_ERR
public static final int SRV_ERR
public static final int IMP_ERR
public static final int RFS_ERR
public static final int ACT_ERR
public static final int CFT_ERR
public static final int NAME_PERM
public static final int NAME_ACTIVE
public static final int NAME_CONFLICT
public static final int NAME_DEREG
public static final int NAME_GROUP
public static final int NAME_TYPE_BNODE
public static final int NAME_TYPE_PNODE
public static final int NAME_TYPE_MNODE
public static final int NAME_TYPE_RESVD
public NetBIOSPacket()
public NetBIOSPacket(byte[] buf)
buf
- byte[]public NetBIOSPacket(int siz)
siz
- intpublic void DumpPacket(boolean sessPkt)
sessPkt
- True if this is a NetBIOS session packet, else false.public final int getAdditionalCount()
public final String getAnswerName()
public final int getAnswerCount()
public final NetBIOSNameList getAnswerNameList()
public final NetBIOSNameList getAdapterStatusNameList()
public final byte[] getBuffer()
public final int getFlags()
public final int getHeaderFlags()
public final int getHeaderLength()
public final int getHeaderType()
public final int getLength()
public final int getNameServiceCount()
public final int getOpcode()
public final int getPacketType()
public final int getQuestionCount()
public final String getQuestionName()
public final int getQuestionNameLength()
public final int getResultCode()
public final int getTransactionId()
public final boolean isResponse()
public final void setAdditionalCount(int cnt)
cnt
- intpublic final void setAnswerCount(int cnt)
cnt
- intpublic final int setAnswerName(String name, char ntyp, int qtyp, int qcls)
name
- java.lang.Stringqtyp
- intqcls
- intpublic final void setFlags(int flg)
flg
- intpublic final void setHeaderFlags(int flg)
flg
- intpublic final void setHeaderLength(int len)
len
- intpublic final void setHeaderType(int typ)
typ
- intpublic final int setIPAddress(int off, byte[] ipaddr)
off
- intipaddr
- byte[]public final void setLength(int len)
len
- intpublic final int setNameRegistrationFlags(int off, int flg)
off
- intflg
- intpublic final void setNameServiceCount(int cnt)
cnt
- intpublic final void setOpcode(int op)
op
- intpublic final void setQuestionCount(int cnt)
cnt
- intpublic final int setQuestionName(NetBIOSName name, int qtyp, int qcls)
name
- NetBIOSNameqtyp
- intqcls
- intpublic final int setQuestionName(String name, char ntyp, int qtyp, int qcls)
name
- java.lang.Stringqtyp
- intqcls
- intpublic final int setResourceData(int off, int flg, byte[] data, int len)
off
- intflg
- intdata
- byte[]len
- intpublic final int setResourceDataLength(int off, int len)
off
- intlen
- intpublic final int setResourceRecord(int pktoff, int rroff, int qtyp, int qcls)
pktoff
- Packet offset to pack the resource record.rroff
- Offset to name.qtyp
- intqcls
- intpublic final void setTransactionId(int id)
id
- intpublic final int setTTL(int off, int ttl)
off
- intttl
- intpublic static final String getTypeAsString(int typ)
typ
- intpublic final int buildNameQueryResponse(NetBIOSName name)
name
- NetBIOSNamepublic final int buildAddNameRequest(NetBIOSName name, int addrIdx, int tranId)
name
- NetBIOSNameaddrIdx
- inttranId
- intpublic final int buildRefreshNameRequest(NetBIOSName name, int addrIdx, int tranId)
name
- NetBIOSNameaddrIdx
- inttranId
- intpublic final int buildDeleteNameRequest(NetBIOSName name, int addrIdx, int tranId)
name
- NetBIOSNameaddrIdx
- inttranId
- intpublic final int buildNameQueryRequest(NetBIOSName name, int tranId, boolean wins)
name
- NetBIOSNametranId
- intwins
- booleanpublic final int buildSessionSetupRequest(NetBIOSName fromName, NetBIOSName toName)
fromName
- NetBIOSNametoName
- NetBIOSNamepublic final int buildAdapterStatusResponse(NetBIOSNameList nameList, int nodeType)
nameList
- NetBIOSNameListnodeType
- intCopyright © 2005–2018 Alfresco Software. All rights reserved.