public void RestoreFromFile() { var arpTable = new ArpTable(); arpTable.RestoreFromFile(); foreach (var item in arpTable.Entries) { output.WriteLine(item.ToString()); } }
// IProtocol interfaces // ------------------------ public bool Initialize(ProtocolParams parameters) { Debug.Assert(parameters == null || parameters["name"] == "ARP"); int size = ProtocolParams.LookupInt32(parameters, "cacheSize", 128); int age = ProtocolParams.LookupInt32(parameters, "max-age", ArpTable.MaxAge); arpTable = new ArpTable(size, age, this); pendingRequests = new ArrayList(); Core core = Core.Instance(); core.RegisterProtocol(this); if (!core.packetTypes.RegisterTypeHandler(PacketTypes.ARP, this)) { core.DeregisterProtocol(this); return(false); } return(true); }
public bool DestroyModule() { arpTable = null; return(true); }