|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectverinec.adaptation.snmp.tftpserver.TFTPPacket
public class TFTPPacket
Class responsible for encapsulating TFTP packets. It is actually a straight forward implementation of the RFC 1350.
Most of the source was taken from
http://www.it.rit.edu/~netsyslb/vksf522/class_examples/Day09_TFTPServer/TFTPPacket.pdf
I removed the gui part.
| Field Summary | |
|---|---|
static int |
ACCESVIOLATION
Access violation error code |
static int |
ACK
ACK opcode |
private int |
blkNo
|
private byte[] |
data
|
static int |
DATA
Data opcode |
static int |
DISKFULL
Disk full error code |
private String |
errMsg
|
private int |
errNo
|
static int |
ERROR
Error opcode |
static int |
FILEEXISTS
File exists error code |
static int |
FILENOTFOUND
File not found error code |
private String |
fname
|
static int |
ILLEGALOPERATION
Illegal operation error code |
private Logger |
logger
|
private String |
mode
|
static int |
NOSUCHUSER
No such user error code |
private int |
opcode
|
static int |
RRQ
Read Request opcode |
static int |
UNKNOWN
Unknown opcode |
static int |
UNKNOWNCODE
Unknowncode error code |
static int |
UNKNOWNTID
Unknown TID error code |
static int |
WRQ
Write Request opcode |
| Constructor Summary | |
|---|---|
TFTPPacket()
|
|
| Method Summary | |
|---|---|
byte[] |
build()
Builds a TFTP packet |
void |
clearPacket()
Method to put all the packet fields to their default value |
int |
getBlockNo()
Gets the block number of the packet |
byte[] |
getData()
Gets the data |
String |
getErrorMsg()
Gets the error message |
int |
getErrorNo()
Gets the error opcode number |
String |
getFName()
Gets the name of the file to write |
String |
getMode()
Gets the mode to use |
int |
getOpcode()
Gets the opcode |
void |
parse(byte[] rawPacket,
int offset,
int length)
Parses a raw packet to get different informations |
String |
readNTString(DataInputStream dis)
Reads a null terminated string for a data input stream |
void |
setBlockNo(int blkNo)
Sets the blocknumber of the packet |
void |
setData(byte[] data)
Sets the data |
void |
setErrorMsg(String errMsg)
Sets the error message |
void |
setErrorNo(int errNo)
Sets the error number, i.e one of the error codes |
void |
setFName(String fname)
Sets the name of the file to write |
void |
setMode(String mode)
Sets the mode |
void |
setOpcode(int opcode)
Sets the data opcode to the given opcode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Logger logger
public static final int RRQ
public static final int WRQ
public static final int DATA
public static final int ACK
public static final int ERROR
public static final int UNKNOWN
public static final int UNKNOWNCODE
public static final int FILENOTFOUND
public static final int ACCESVIOLATION
public static final int DISKFULL
public static final int ILLEGALOPERATION
public static final int UNKNOWNTID
public static final int FILEEXISTS
public static final int NOSUCHUSER
private int opcode
private String fname
private String mode
private int blkNo
private byte[] data
private int errNo
private String errMsg
| Constructor Detail |
|---|
public TFTPPacket()
| Method Detail |
|---|
public void setOpcode(int opcode)
opcode - Opcode number that specifies the data identitypublic void setFName(String fname)
fname - Name of the file to writepublic void setMode(String mode)
mode - Mode to usepublic void setBlockNo(int blkNo)
blkNo - Block number of the packetpublic void setData(byte[] data)
data - Datapublic void setErrorNo(int errNo)
errNo - public void setErrorMsg(String errMsg)
errMsg - Error messagepublic int getOpcode()
public String getFName()
public String getMode()
public int getBlockNo()
public byte[] getData()
public int getErrorNo()
public String getErrorMsg()
public void parse(byte[] rawPacket,
int offset,
int length)
rawPacket - Raw dataoffset - Offset from where begining to read in rawPacketlength - Number of bytes to read in rawPacketpublic byte[] build()
public void clearPacket()
public String readNTString(DataInputStream dis)
throws IOException
dis - The stream to read from.
IOException - If reading the string fails.
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||