mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-03 05:20:50 +00:00
ref[net]: refactored the packet service
This commit is contained in:
1 parent
9fbdf0f263
commit
d77792cbfc
112 files changed
+152
-164
No files matched your search
@@ -13,8 +13,8 @@
|
||||
|
||||
package com.zfoo.net.core.http;
|
||||
|
||||
import com.zfoo.net.packet.DecodedPacketInfo;
|
||||
import com.zfoo.net.packet.http.HttpHelloRequest;
|
||||
import com.zfoo.net.packet.model.DecodedPacketInfo;
|
||||
import com.zfoo.net.router.attachment.HttpAttachment;
|
||||
import com.zfoo.protocol.exception.RunException;
|
||||
import com.zfoo.protocol.util.StringUtils;
|
||||
|
||||
@@ -74,7 +74,7 @@ org.springframework.context.event.internalEventListenerFactory
|
||||
com.zfoo.net.config.model.NetConfig
|
||||
com.zfoo.net.NetContext
|
||||
com.zfoo.net.config.ConfigManager
|
||||
com.zfoo.net.packet.service.PacketService
|
||||
com.zfoo.net.packet.PacketService
|
||||
com.zfoo.net.router.Router
|
||||
com.zfoo.net.consumer.Consumer
|
||||
com.zfoo.net.session.SessionManager
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Arrays;
|
||||
*/
|
||||
public class CM_Array implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1119;
|
||||
public static final short PROTOCOL_ID = 1119;
|
||||
|
||||
private int[] a;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Objects;
|
||||
*/
|
||||
public class CM_Float implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1112;
|
||||
public static final short PROTOCOL_ID = 1112;
|
||||
|
||||
private float a;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Objects;
|
||||
*/
|
||||
public class CM_Int implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1110;
|
||||
public static final short PROTOCOL_ID = 1110;
|
||||
|
||||
private boolean flag;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Objects;
|
||||
*/
|
||||
public class CM_List implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1118;
|
||||
public static final short PROTOCOL_ID = 1118;
|
||||
|
||||
private List<Integer> list;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Objects;
|
||||
*/
|
||||
public class CM_Map implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1120;
|
||||
public static final short PROTOCOL_ID = 1120;
|
||||
|
||||
private Map<Integer, Integer> map;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Objects;
|
||||
*/
|
||||
public class CM_Object implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1114;
|
||||
public static final short PROTOCOL_ID = 1114;
|
||||
|
||||
private int a;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class CM_Set implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1121;
|
||||
public static final short PROTOCOL_ID = 1121;
|
||||
|
||||
private Set<Integer> a;
|
||||
private Set<ObjectA> b;
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Objects;
|
||||
*/
|
||||
public class ObjectA implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1116;
|
||||
public static final short PROTOCOL_ID = 1116;
|
||||
|
||||
private int a;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Objects;
|
||||
*/
|
||||
public class ObjectB implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1117;
|
||||
public static final short PROTOCOL_ID = 1117;
|
||||
|
||||
private boolean flag;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class SM_Float implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1113;
|
||||
public static final short PROTOCOL_ID = 1113;
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Objects;
|
||||
*/
|
||||
public class SM_Int implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1111;
|
||||
public static final short PROTOCOL_ID = 1111;
|
||||
|
||||
private Boolean flag;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class SM_Object implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1115;
|
||||
public static final short PROTOCOL_ID = 1115;
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class CM_CSharpRequest implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1165;
|
||||
public static final short PROTOCOL_ID = 1165;
|
||||
|
||||
// 注释1
|
||||
public byte a;
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class CSharpObjectA implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1166;
|
||||
public static final short PROTOCOL_ID = 1166;
|
||||
|
||||
public int value;
|
||||
public CSharpObjectB objectB;
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class CSharpObjectB implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1167;
|
||||
public static final short PROTOCOL_ID = 1167;
|
||||
|
||||
public boolean flag;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class GatewayToProviderRequest implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 5000;
|
||||
public static final short PROTOCOL_ID = 5000;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class GatewayToProviderResponse implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 5001;
|
||||
public static final short PROTOCOL_ID = 5001;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class HttpHelloRequest implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1700;
|
||||
public static final short PROTOCOL_ID = 1700;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class HttpHelloResponse implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1701;
|
||||
public static final short PROTOCOL_ID = 1701;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class JProtobufHelloRequest implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1500;
|
||||
public static final short PROTOCOL_ID = 1500;
|
||||
|
||||
@Protobuf(order = 1)
|
||||
private String message;
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class JProtobufHelloResponse implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1501;
|
||||
public static final short PROTOCOL_ID = 1501;
|
||||
|
||||
@Protobuf(order = 1)
|
||||
private String message;
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class JsonHelloRequest implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1600;
|
||||
public static final short PROTOCOL_ID = 1600;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class JsonHelloResponse implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1601;
|
||||
public static final short PROTOCOL_ID = 1601;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class ProviderMessAnswer implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 4001;
|
||||
public static final short PROTOCOL_ID = 4001;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class ProviderMessAsk implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 4000;
|
||||
public static final short PROTOCOL_ID = 4000;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class AsyncMessAnswer implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1153;
|
||||
public static final short PROTOCOL_ID = 1153;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class AsyncMessAsk implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1152;
|
||||
public static final short PROTOCOL_ID = 1152;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class SyncMessAnswer implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1151;
|
||||
public static final short PROTOCOL_ID = 1151;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class SyncMessAsk implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1150;
|
||||
public static final short PROTOCOL_ID = 1150;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class TcpHelloRequest implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1300;
|
||||
public static final short PROTOCOL_ID = 1300;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class TcpHelloResponse implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1301;
|
||||
public static final short PROTOCOL_ID = 1301;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class UdpHelloRequest implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1200;
|
||||
public static final short PROTOCOL_ID = 1200;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class UdpHelloResponse implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1201;
|
||||
public static final short PROTOCOL_ID = 1201;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Objects;
|
||||
*/
|
||||
public class WebSocketObjectA implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 2071;
|
||||
public static final short PROTOCOL_ID = 2071;
|
||||
|
||||
private int a;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Objects;
|
||||
*/
|
||||
public class WebSocketObjectB implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 2072;
|
||||
public static final short PROTOCOL_ID = 2072;
|
||||
|
||||
private boolean flag;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class WebSocketPacketRequest implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 2070;
|
||||
public static final short PROTOCOL_ID = 2070;
|
||||
|
||||
private byte a;
|
||||
private Byte aa;
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class WebsocketHelloRequest implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1400;
|
||||
public static final short PROTOCOL_ID = 1400;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.zfoo.protocol.IPacket;
|
||||
*/
|
||||
public class WebsocketHelloResponse implements IPacket {
|
||||
|
||||
public static final transient short PROTOCOL_ID = 1401;
|
||||
public static final short PROTOCOL_ID = 1401;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -15,9 +15,6 @@ package com.zfoo.net.protocol;
|
||||
|
||||
import com.zfoo.net.NetContext;
|
||||
import com.zfoo.net.packet.*;
|
||||
import com.zfoo.net.packet.model.DecodedPacketInfo;
|
||||
import com.zfoo.net.packet.service.IPacketService;
|
||||
import com.zfoo.net.packet.service.PacketService;
|
||||
import com.zfoo.net.router.attachment.SignalAttachment;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
|
||||
<!-- native为内部消息,common是公共消息每个模块都能使用,js是web通信用的协议会生成js协议文件 -->
|
||||
<protocols author="jaysunxiao">
|
||||
<protocols author="godotg">
|
||||
|
||||
<module id="1" name="native" minId="0" maxId="100">
|
||||
<protocol location="com.zfoo.net.router.attachment.SignalAttachment"/>
|
||||
|
||||
Reference in new issue
Block a user