public static byte GetByteFromFlags(OspfOptions options) { byte result = 0; foreach (var item in Enum.GetValues(typeof(OspfOptions))) { var value = (byte)item; if (((byte)options & value) == value) { result |= value; } } return result; }
public OspfOptions GetOptions(Boolean supportOBit = false, Boolean removeLLSDataBlock = false) { var options = new OspfOptions(); if (!removeLLSDataBlock) { options |= OspfOptions.ContainsLLSDataBlock; } if (supportOBit) { options |= OspfOptions.O; } if (ExternalRoutingCapability) { options |= OspfOptions.ExternalRoutingCapable; } return options; }
public static Neighbor Create(OspfModule module, RoutingController controller, Interface ospfInterface, IPAddress source, IPAddress rid, OspfOptions options, byte priority, IPAddress dr, IPAddress bdr) { var n = new Neighbor { _controller = controller, Module = module, Interface = ospfInterface, RouterID = rid, DiscoveredOptions = options, //TODO: is THIS the source?? Address = source, Priority = priority, OspfNeighborState = OspfNeighborState.Down, DR = dr, BDR = bdr, LastSeen = DateTime.Now }; n.Init(); return n; }