add logicface: ITransport

This commit is contained in:
free will
2021-04-13 19:53:47 +08:00
parent c2f40ebd0c
commit 1d6faafdba
3 changed files with 84 additions and 4 deletions
+2 -2
View File
@@ -14,8 +14,8 @@ public interface InitialAble {
// boolean initial = false;
// 将组件标记为已初始化
public void doInitial();
void doInitial();
// 判断当前组件是否已经初始化
public boolean isInitial();
boolean isInitial();
}
+2 -2
View File
@@ -19,13 +19,13 @@ public interface IEncodingAble {
* @param encoder
* @return
*/
public int wireEncode(Encoder encoder) throws ComponentException, PacketException, MgmtException;
int wireEncode(Encoder encoder) throws ComponentException, PacketException, MgmtException;
/**
* 线速解码,将一个TLV解码成一个网络包
* @param block
* @return
*/
public boolean wireDecode(Block block) throws ComponentException, PacketException, MgmtException;
boolean wireDecode(Block block) throws ComponentException, PacketException, MgmtException;
}
+80
View File
@@ -0,0 +1,80 @@
package logicface;
import packet.LpPacket;
/*
* @Author: Wang Feng
* @Description: Tranport 接口, 便于LogicFace声明成员。logicFace模块中的每一种tranport都必须实现ITransport声明的方法
* @Version: 1.0.0
* @Date: 19:44 2021/4/13
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
*/
public interface ITransport {
/**
* 关闭
*/
void close();
/**
* 发送一个lpPacket
* @param lpPacket
* @return
*/
boolean send(LpPacket lpPacket);
/**
* 从网络中接收到一段数据
* @return
*/
LpPacket receive();
/** 获得Transport的对端地址
* // 格式
* // TCP tcp://192.238.3.3:7890
* // UDP udp://192.238.3.3:7890
* // ether ether://fc:aa:14:cf:a6:97
* // unix unix:///tmp/mirsock
* @return
*/
String getRemoteUri();
/**
* 获得Transport的本机地址
* // 格式
* // TCP tcp://192.238.3.3:7890
* // UDP udp://192.238.3.3:7890
* // ether ether://fc:aa:14:cf:a6:97
* // unix unix:///tmp/mirsock
* @return 本机地址
*/
String getLocalUri();
/**
* 获得Transport的对端地址
* // 格式
* // TCP 192.238.3.3:7890
* // UDP 192.238.3.3:7890
* // ether fc:aa:14:cf:a6:97
* // unix /tmp/mirsock
* @return 对端地址
*/
String getRemoteAddr();
/**
* 获得Transport的本机地址
* // 格式
* // TCP 192.238.3.3:7890
* // UDP 192.238.3.3:7890
* // ether fc:aa:14:cf:a6:97
* // unix /tmp/mirsock
* @return 本机地址
*/
String getLocalAddr();
/**
* 设置读操作的超时时间
* @param duration 超时时间 , 以 毫秒 为单位, 小于等于0,表示永不超时
* @return
*/
boolean setReadTimeout(long duration);
}