Esempio n. 1
0
        public void PopulateTxRing(Bytes header, Bytes data)
        {
            using (thisLock.Lock()) {
                // Process each sent packet and pass on the filtered versions.
                foreach (FilterEngineContract /*.Imp*/ filterEngineImpRef in filterEngineImpRefs)
                {
                    FilterEngineContract /*.Imp*/ filterEngineImp = filterEngineImpRef.Acquire();
                    filterEngineImp.SendSendingPacket(header, data);
                    switch receive {
                    case filterEngineImp.AcceptPacket(returnedHeader, returnedData):
                        header = returnedHeader;
                        data   = returnedData;
                        wrappedAdapter.PopulateTxRing(header, data);
                        break;

                    case filterEngineImp.RejectPacket(returnedHeader, returnedData):
                        header = returnedHeader;
                        data   = returnedData;
                        txDroppedPackets++;
                        break;

                    case filterEngineImp.ModifyPacket(returnedHeader, returnedData):
                        header = returnedHeader;
                        data   = returnedData;
                        wrappedAdapter.PopulateTxRing(header, data);
                        break;
                    }
                    filterEngineImpRef.Release(filterEngineImp);
                }
            }
        }
Esempio n. 2
0
        public bool ProcessIncomingPacket(Bytes data)
        {
            using (thisLock.Lock()) {
                foreach (FilterEngineContract /*.Imp*/ filterEngineImpRef in filterEngineImpRefs)
                {
                    FilterEngineContract /*.Imp*/ filterEngineImp = filterEngineImpRef.Acquire();
                    filterEngineImp.SendReceivedPacket(data);
                    switch receive {
                    case filterEngineImp.AcceptPacket(returnedHeader, returnedData):
                        data = returnedData;
                        //delete returnedHeader;
                        break;     /* Continue and see if another filter will reject it */

                    case filterEngineImp.RejectPacket(returnedHeader, returnedData):
                        data = returnedData;
                        //delete returnedHeader;
                        return(false);

                    case filterEngineImp.ModifyPacket(returnedHeader, returnedData):
                        data = returnedData;
                        //delete returnedHeader;
                        break;
                    }

                    filterEngineImpRef.Release(filterEngineImp);
                }
            }
            return(true);
        }