Add missing files

This commit is contained in:
Flare Microsystems
2024-11-11 08:47:15 -08:00
parent b328918684
commit a2a5322835
6 changed files with 314 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
package com.flaremicro.crossjeeves.net;
public class ErrorCodes {
public static final int OK = 0;
public static final int READ_FAILED = 1;
public static final int WRITE_FAILED = 2;
public static final int THREAD_INTERRUPTED = 3;
public static final int SCRIPT_ERROR = 4;
public static final int FILE_DOWNLOAD_FAILURE = 5;
public static final int FILE_UPLOAD_FAILURE = 6;
public static final int INVALID_PACKET_RECIEVED = 7;
}

View File

@@ -0,0 +1,51 @@
package com.flaremicro.crossjeeves.net.packet;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import com.flaremicro.crossjeeves.net.NetworkHandler;
public class Packet6Disconnect extends Packet{
private int code;
private String reason;
public Packet6Disconnect(){
}
public Packet6Disconnect(int code, String reason){
this.code = code;
this.reason = reason;
}
public void recievePacket(DataInputStream in) throws IOException {
code = in.readInt();
reason = in.readUTF();
}
public void sendPacket(DataOutputStream out) throws IOException {
super.sendPacket(out);
out.writeInt(code);
out.writeUTF(reason);
}
public void processPacket(NetworkHandler networkHandler){
networkHandler.handlePacket(this);
}
public int getCode()
{
return code;
}
public String getReason(){
return this.reason;
}
@Override
public Packet cloneTypeOnly() {
return new Packet6Disconnect();
}
}

View File

@@ -0,0 +1,55 @@
package com.flaremicro.crossjeeves.net.packet;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import com.flaremicro.crossjeeves.net.NetworkHandler;
public class Packet7LogEntry extends Packet{
public static final byte STD_OUT = 0;
public static final byte STD_ERR = 1;
private byte std;
private String logEntry;
public Packet7LogEntry(){
}
public Packet7LogEntry(byte std, String logEntry){
this.std = std;
this.logEntry = logEntry;
}
public void recievePacket(DataInputStream in) throws IOException {
std = in.readByte();
logEntry = in.readUTF();
}
public void sendPacket(DataOutputStream out) throws IOException {
super.sendPacket(out);
out.writeByte(std);
out.writeUTF(logEntry);
}
public void processPacket(NetworkHandler networkHandler){
networkHandler.handlePacket(this);
}
public byte getStdOutput()
{
return std;
}
public String getLogEntry(){
return this.logEntry;
}
@Override
public Packet cloneTypeOnly() {
return new Packet7LogEntry();
}
}