📄 cmppconnectmessage.java
字号:
// FrontEnd Plus for JAD
// DeCompiled : CMPPConnectMessage.class
package cmpp12;
import java.io.*;
// Referenced classes of package cmpp12:
// CMPPMessage, CMPPConnectRepMessage, CmppConstants
public class CMPPConnectMessage extends CMPPMessage
{
private String sourceAddr;
private int authenticatorICP_LEN;
private byte authenticatorICP[];
private byte version;
private int timeStamp;
public byte authenticatorISMG[];
private int sourceAddr_LEN;
public CMPPConnectMessage()
{
sourceAddr = null;
authenticatorICP_LEN = 16;
authenticatorICP = new byte[authenticatorICP_LEN];
version = 0;
timeStamp = 0;
authenticatorISMG = new byte[authenticatorICP_LEN];
sourceAddr_LEN = 6;
commandID = 1;
setSequenceID(CmppConstants.getSequenceNo());
totalLength = 39;
}
public boolean setBodyByByteArray(byte body[])
{
if(body == null || 27 != body.length)
{
errorCode = 1;
return false;
}
try
{
DataInputStream dataStream = new DataInputStream(new ByteArrayInputStream(body));
byte buff[] = new byte[sourceAddr_LEN];
dataStream.readFully(buff, 0, sourceAddr_LEN);
sourceAddr = (new String(buff, "ISO-8859-1")).trim();
dataStream.readFully(authenticatorICP, 0, authenticatorICP_LEN);
version = dataStream.readByte();
timeStamp = dataStream.readInt();
errorCode = 0;
boolean flag = true;
return flag;
}
catch(IOException ioe)
{
errorCode = 100;
}
boolean flag1 = false;
return flag1;
}
public boolean setHeadByByteArray(byte ba[], int startPos, int length)
{
byte buffer[] = new byte[length];
for(int i = 0; i < length; i++)
buffer[i] = ba[startPos + i];
return setHeadByByteArray(buffer);
}
public boolean validate()
{
return false;
}
public byte[] getBodyByteArray()
{
byte msgBody[] = new byte[27];
if(sourceAddr == null || authenticatorICP == null)
{
errorCode = 100;
return null;
}
try
{
ByteArrayOutputStream ba = new ByteArrayOutputStream(27);
DataOutputStream dataStream = new DataOutputStream(ba);
dataStream.write(CMPPMessage.trimStringZ(sourceAddr, sourceAddr_LEN).getBytes("ISO-8859-1"));
dataStream.write(authenticatorICP);
dataStream.writeByte(version);
dataStream.writeInt(timeStamp);
dataStream.flush();
msgBody = ba.toByteArray();
errorCode = 0;
byte abyte1[] = msgBody;
return abyte1;
}
catch(IOException ioe)
{
errorCode = 100;
}
byte abyte0[] = null;
return abyte0;
}
public boolean setSourceAddr(String sourceAddr)
{
this.sourceAddr = sourceAddr.trim();
return true;
}
public boolean setAuthenticatorICP(byte authenticatorICP[])
{
if(authenticatorICP.length != authenticatorICP_LEN)
{
return false;
} else
{
this.authenticatorICP = authenticatorICP;
return true;
}
}
public boolean setVersion(byte version)
{
this.version = version;
return true;
}
public boolean setTimeStamp(int timeStamp)
{
this.timeStamp = timeStamp;
return true;
}
public String getSourceAddr()
{
return sourceAddr;
}
public byte[] getAuthenticatorICP()
{
return authenticatorICP;
}
public byte getVersion()
{
return version;
}
public int getTimeStamp()
{
return timeStamp;
}
public boolean saveDataToDB()
{
return false;
}
public boolean loadDataFromDB()
{
return false;
}
public CMPPMessage getResponse()
{
CMPPConnectRepMessage connectRep = new CMPPConnectRepMessage(errorCode, authenticatorISMG, version);
connectRep.setTotalLength(30);
connectRep.setCommandID(0x80000001);
connectRep.setSequenceID(sequenceID);
return connectRep;
}
public boolean isConnect()
{
return true;
}
public static void main(String args[])
{
int len = 8;
byte testReserve[] = new byte[len];
for(int m = 0; m < len; m++)
testReserve[m] = 0;
String test = new String(testReserve);
System.out.println(test);
String reserveStr = null;
reserveStr = CMPPMessage.dealWithReserve(testReserve, len);
System.out.println(String.valueOf(String.valueOf((new StringBuffer(".")).append(reserveStr).append("."))));
}
public void tester()
{
System.out.println("ok!");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -