本文整理汇总了Java中es.tid.ospf.ospfv2.OSPFPacketTypes类的典型用法代码示例。如果您正苦于以下问题:Java OSPFPacketTypes类的具体用法?Java OSPFPacketTypes怎么用?Java OSPFPacketTypes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OSPFPacketTypes类属于es.tid.ospf.ospfv2包,在下文中一共展示了OSPFPacketTypes类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import es.tid.ospf.ospfv2.OSPFPacketTypes; //导入依赖的package包/类
public void run(){
log.info("run ruun");
int tipo = 1;
RawSocket socket = new RawSocket();
try{
if (socket.isOpen())
{
log.info("el socket YA esta abierto");
}
else
{
socket.open(PF_INET, 89);
}
if (!(socket.isOpen())){
log.info("Error el socket no se ha abierto");
}
socket.setUseSelectTimeout(true);
socket.setSendTimeout(TIMEOUT);
socket.setReceiveTimeout(TIMEOUT);
if (this.multicast){
String mCast="224.0.0.5";
//String bindAddr="0.0.0.0";
socket.setIPHeaderInclude(false);
socket.joinGroup(InetAddress.getByName(mCast), nodeLocalAddress);
log.info("OSPF Multicast RAW Socket opened");
}
else{
socket.bind(nodeLocalAddress);
log.info("OSPF Unicast RAW Socket opened");
}
}catch(IOException e){
log.error("Exception produced::"+e.toString());
}
while(true) {
try {
OSPFv2Packet ospfv2Packet =readOSPFv2Packet(socket);
if (ospfv2Packet != null){
if (ospfv2Packet.getType() == OSPFPacketTypes.OSPFv2_LINK_STATE_UPDATE){
ospfv2PacketQueue.add((OSPFv2LinkStateUpdatePacket)ospfv2Packet);
/*
* Redis database if requested
*/
if(redisOspfv2PacketQueue != null){
redisOspfv2PacketQueue.add((OSPFv2LinkStateUpdatePacket)ospfv2Packet);
}
}
}
} catch (Exception e1) {
e1.printStackTrace();
log.warn("OSPF Socket ends::"+e1.toString());
return;
}
}
}