Beispiel #1
0
        public Guid CreateNetInterfaceFilter(
            DisplayData displayData,
            Action action,
            Layer layer,
            uint index,
            uint weight,
            bool persistent = false,
            Guid id         = new Guid())
        {
            Guid filterId = IpFilterNative.CreateNetInterfaceFilter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                action,
                weight,
                index,
                persistent,
                id);

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #2
0
        public Guid CreateRemoteIPv4Filter(
            DisplayData displayData,
            Action action,
            Layer layer,
            uint weight,
            string address,
            bool persistent = false,
            Guid id         = new Guid())
        {
            Guid filterId = IpFilterNative.CreateRemoteIPv4Filter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                action,
                weight,
                Guid.Empty,
                Guid.Empty,
                address,
                persistent,
                id);

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #3
0
        public Guid CreateRemoteTcpPortFilter(
            DisplayData displayData,
            Action action,
            Layer layer,
            uint weight,
            uint port,
            bool persistent = false,
            Guid id         = new Guid())
        {
            Guid filterId = IpFilterNative.CreateRemoteTcpPortFilter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                action,
                weight,
                port,
                persistent,
                id);

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #4
0
        public Guid CreateAppCalloutFilter(DisplayData displayData,
                                           Layer layer,
                                           uint weight,
                                           Callout callout,
                                           ProviderContext providerContext,
                                           string appPath,
                                           bool persistent = false,
                                           Guid id         = new Guid())
        {
            Guid filterId = IpFilterNative.CreateAppFilter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                Action.Callout,
                weight,
                callout.Id,
                providerContext.Id,
                appPath,
                persistent,
                id);

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #5
0
        public void DestroySublayer(Sublayer sublayer)
        {
            sublayer.DestroyAllFilters();

            IpFilterNative.DestroySublayer(
                Session.Handle,
                sublayer.Id);
        }
Beispiel #6
0
        public ProviderContext CreateProviderContext(DisplayData displayData, byte[] data)
        {
            var id = IpFilterNative.CreateProviderContext(
                Session.Handle,
                ProviderId,
                displayData,
                data);

            return(new ProviderContext(id));
        }
Beispiel #7
0
        public Sublayer CreateSublayer(DisplayData displayData, uint weight)
        {
            var id = IpFilterNative.CreateSublayer(
                Session.Handle,
                ProviderId,
                displayData,
                weight);

            return(new Sublayer(this, id));
        }
Beispiel #8
0
        public Callout CreateCallout(DisplayData displayData, Guid key, Layer layer)
        {
            var id = IpFilterNative.CreateCallout(
                Session.Handle,
                key,
                ProviderId,
                displayData,
                layer);

            return(new Callout(id));
        }
Beispiel #9
0
        public ProviderContext CreateProviderContext(DisplayData displayData, byte[] data, bool persistent = false, Guid id = new Guid())
        {
            var providerContextId = IpFilterNative.CreateProviderContext(
                Session.Handle,
                ProviderId,
                displayData,
                data,
                persistent,
                id);

            return(new ProviderContext(providerContextId));
        }
Beispiel #10
0
        public Sublayer CreateSublayer(DisplayData displayData, uint weight, bool persistent = false, Guid id = new Guid())
        {
            var sublayerId = IpFilterNative.CreateSublayer(
                Session.Handle,
                ProviderId,
                displayData,
                weight,
                persistent,
                id);

            return(new Sublayer(this, sublayerId));
        }
Beispiel #11
0
 public void DestroyFilter(Guid filterId)
 {
     try
     {
         IpFilterNative.DestroyFilter(
             Session.Handle,
             filterId);
     }
     catch (FilterNotFoundException)
     {
     }
 }
Beispiel #12
0
        public Callout CreateCallout(DisplayData displayData, Guid key, Layer layer, bool persistent = false)
        {
            var calloutId = IpFilterNative.CreateCallout(
                Session.Handle,
                key,
                ProviderId,
                displayData,
                layer,
                persistent);

            return(new Callout(calloutId));
        }
Beispiel #13
0
        public void DestroyCallout(Guid calloutId)
        {
            try
            {
                IpFilterNative.DestroyCallout(
                    Session.Handle,
                    calloutId);
            }
            catch (CalloutNotFoundException)
            {
            }

            _callouts.Remove(calloutId);
        }
Beispiel #14
0
        public Guid CreateLayerFilter(
            DisplayData displayData,
            Action action,
            Layer layer,
            uint weight)
        {
            var filterId = IpFilterNative.CreateLayerFilter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                action,
                weight, Guid.Empty, Guid.Empty);

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #15
0
        public Guid CreateLoopbackFilter(
            DisplayData displayData,
            Action action,
            Layer layer,
            uint weight,
            bool persistent = false)
        {
            Guid filterId = IpFilterNative.CreateLoopbackFilter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                action,
                weight,
                persistent);

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #16
0
        public Guid BlockOutsideDns(DisplayData displayData,
                                    Layer layer,
                                    uint weight,
                                    Callout callout,
                                    uint index)
        {
            var filterId = IpFilterNative.BlockOutsideDns(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                Action.Callout,
                weight,
                callout.Id,
                index);

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #17
0
        public Guid CreateNetInterfaceFilter(
            DisplayData displayData,
            Action action,
            Layer layer,
            uint weight,
            string interfaceId)
        {
            var filterId = IpFilterNative.CreateNetInterfaceFilter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                action,
                weight,
                interfaceId);

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #18
0
        public Guid CreateRemoteTcpPortFilter(
            DisplayData displayData,
            Action action,
            Layer layer,
            uint weight,
            uint port)
        {
            var filterId = IpFilterNative.CreateRemoteTcpPortFilter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                action,
                weight,
                port);

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #19
0
        public Guid CreateRemoteNetworkIPv4Filter(
            DisplayData displayData,
            Action action,
            Layer layer,
            uint weight,
            NetworkAddress addr)
        {
            var filterId = IpFilterNative.CreateRemoteNetworkIPv4Filter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                action,
                weight,
                addr);

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #20
0
        public Guid CreateRemoteIPv4Filter(
            DisplayData displayData,
            Action action,
            Layer layer,
            uint weight,
            string address)
        {
            var filterId = IpFilterNative.CreateRemoteIPv4Filter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                action,
                weight,
                address);

            AddFilter(filterId);

            return filterId;
        }
Beispiel #21
0
        public Guid CreateLayerCalloutFilter(
            DisplayData displayData,
            Layer layer,
            uint weight,
            Callout callout,
            ProviderContext providerContext)
        {
            var filterId = IpFilterNative.CreateLayerFilter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                Action.Callout,
                weight,
                callout.Id,
                providerContext.Id);

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #22
0
        public Guid BlockOutsideDns(DisplayData displayData,
                                    Layer layer,
                                    uint weight,
                                    Guid calloutGuid,
                                    uint index,
                                    bool persistent = false)
        {
            Guid filterId = IpFilterNative.BlockOutsideDns(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                Action.Callout,
                weight,
                calloutGuid,
                index,
                (uint)(persistent ? 1 : 0));

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #23
0
        public Guid CreateAppFilter(
            DisplayData displayData,
            Action action,
            Layer layer,
            uint weight,
            string appPath)
        {
            var filterId = IpFilterNative.CreateAppFilter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                action,
                weight,
                Guid.Empty, 
                Guid.Empty,
                appPath);

            AddFilter(filterId);

            return filterId;
        }
Beispiel #24
0
        public Guid CreateRemoteNetworkIPv4CalloutFilter(
            DisplayData displayData,
            Layer layer,
            uint weight,
            Callout callout,
            ProviderContext providerContext,
            NetworkAddress addr)
        {
            var filterId = IpFilterNative.CreateRemoteNetworkIPv4Filter(
                Session.Handle,
                ProviderId,
                Id,
                displayData,
                layer,
                Action.Callout,
                weight,
                callout.Id,
                providerContext.Id,
                addr);

            AddFilter(filterId);

            return(filterId);
        }
Beispiel #25
0
 public void CommitTransaction()
 {
     IpFilterNative.CommitTransaction(Handle);
 }
Beispiel #26
0
 public void AbortTransaction()
 {
     IpFilterNative.AbortTransaction(Handle);
 }
Beispiel #27
0
 public void StartTransaction()
 {
     IpFilterNative.StartTransaction(Handle);
 }
Beispiel #28
0
 public void Close()
 {
     IpFilterNative.DestroySession(Handle);
 }
Beispiel #29
0
 public static Session Permanent()
 {
     return(new Session(IpFilterNative.CreateSession(), SessionType.Permanent));
 }
Beispiel #30
0
 public static Session Dynamic()
 {
     return(new Session(IpFilterNative.CreateDynamicSession(), SessionType.Dynamic));
 }