Пример #1
0
        public RoutingTableEntry EstablishRouterPort(UInt16 networkNumber)
        {
            // destinationDev = _bnm.deviceList.Find(delegate(Device d) { return d.adr.Equals(incomingCRPpacket.dadr); });
            RoutingTableEntry frp = routingTableEntries.Find(delegate(RoutingTableEntry drp) { return(drp.networkNumber == networkNumber); });

            if (frp == null)
            {
                // create a new routerport and add to the list
                frp = new RoutingTableEntry();
                frp.networkNumber = networkNumber;
                // todo we run the risk of partially populating this object.....
                routingTableEntries.Add(frp);
            }
            return(frp);
        }
Пример #2
0
        public void AddRoutingTableEntry(UInt16 networkNumber, Byte portID)
        {
            // do we already have such an entry, create it if not
            RoutingTableEntry frp = routingTableEntries.Find(delegate(RoutingTableEntry drp) { return(drp.networkNumber == networkNumber); });

            if (frp == null)
            {
                // create a new entry
                routingTableEntries.Add(new RoutingTableEntry(networkNumber, portID));
                frp = routingTableEntries[routingTableEntries.Count - 1];
            }

            // let's make sure that port IDs have been made
            if (frp.portID != 0 && frp.portID != portID)
            {
                // sound a warning message. Also, use something other than 0 to indicate uninitialized
            }
            frp.portID = portID;
        }
Пример #3
0
        public void AddRoutingTableEntry(UInt16 networkNumber)
        {
            if (networkNumber < 1 || networkNumber > 0xfffe)
            {
                // these are illegal network numbers
                throw new ProtocolException("m0527 - Illegal Network Number " + networkNumber.ToString());
            }

            // do we already have such an entry, create it if not
            // RoutingTableEntry frp = routingTableEntries.Find(delegate(RoutingTableEntry drp) { return drp.networkNumber == networkNumber; });
            RoutingTableEntry frp = FindRoutingTableEntry(networkNumber);

            if (frp == null)
            {
                // create a new entry
                routingTableEntries.Add(new RoutingTableEntry(networkNumber, (byte)0));  // todo, how to create uninitialized PortID?
                frp = routingTableEntries[routingTableEntries.Count - 1];
            }
            // Only I-Am-Router-to-network adds RoutingTableEntries this way, so we know that the entry is a farSide
            frp.farSide = true;
        }