mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-10-04 19:42:01 +08:00
writing logicface...
This commit is contained in:
1 parent
1d6faafdba
commit
d4b6a05b60
5 files changed
+296
-3
No files matched your search
@@ -0,0 +1,78 @@
|
||||
package logicface;
|
||||
|
||||
import component.Identifier;
|
||||
import packet.MINPacket;
|
||||
|
||||
/*
|
||||
* @Author: Wang Feng
|
||||
* @Description: 逻辑接口类
|
||||
* @Version: 1.0.0
|
||||
* @Date: 20:27 2021/4/13
|
||||
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
|
||||
*/
|
||||
public class LogicFace {
|
||||
// LogicFaceType区:LogicFace的类型
|
||||
public static final int LogicFaceTypeTCP = 0;
|
||||
public static final int LogicFaceTypeUDP = 1;
|
||||
public static final int LogicFaceTypeEther = 2;
|
||||
public static final int LogicFaceTypeUnix = 3;
|
||||
public static final int LogicFaceTypeInner = 4;
|
||||
|
||||
// 成员变量区
|
||||
public int logicFaceType;
|
||||
public ITransport transport; // 与logicFace绑定的transport
|
||||
public LinkService linkService; // 与logicFace绑定的linkService
|
||||
public LogicFaceCounters logicFaceCounters=new LogicFaceCounters(); // logicFace 流量统计对象
|
||||
public long expireTime; // 超时时间 ms
|
||||
public boolean state; // true 为 up , false 为down
|
||||
|
||||
/**
|
||||
* 通过TCP连接MIR
|
||||
* @param ip MIR的IP地址,如"1.1.12.2"
|
||||
* @param port MIR的TCP端口号,如 13899
|
||||
* @return
|
||||
*/
|
||||
public boolean initWithTcp(String ip,String port){
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过UDP连接MIR
|
||||
* @param ip MIR的IP地址,如"1.1.12.2"
|
||||
* @param port MIR的TCP端口号,如 13899
|
||||
* @return
|
||||
*/
|
||||
public boolean initWithUdp(String ip,String port){
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过unixSocket连接MIR
|
||||
* @param path MIR的unix socket地址,默认是 "/tmp/mir-sock"
|
||||
* @return
|
||||
*/
|
||||
public boolean initWithUnixSocket(String path){
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在MIR中注册一个标识,路由指向本客户端
|
||||
* // (1) 构造一个命令兴趣包, 通过l.SendInterest(interest) 把兴趣包发出去;
|
||||
* // (2) 等待一个数据包, 如果等待超时,则报错,如果接收到的包不是数据包则报错;
|
||||
* // (3) 解析收到的数据包,根据数据包中的应答信息判断标识是否注册成功
|
||||
* @param identifier 要添加的路由标识
|
||||
* @param timeout 超时时间,以 毫秒 为单位
|
||||
* @return
|
||||
*/
|
||||
public boolean registerIdentifier(Identifier identifier,long timeout){
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从 LogicFace 中接收一个网络包
|
||||
* @return 多标识网络包
|
||||
*/
|
||||
// public MINPacket ReceivePacket(){
|
||||
// return this.linkService
|
||||
// }
|
||||
}
|
||||
Reference in new issue
Block a user