Пример #1
0
        public static Guid CreateNetInterfaceFilter(
            IntPtr sessionHandle,
            Guid providerId,
            Guid sublayerId,
            DisplayData displayData,
            Layer layer,
            Action action,
            uint weight,
            uint index,
            bool persistent = false,
            Guid id         = new Guid())
        {
            AssertSuccess(() => PInvoke.CreateNetInterfaceFilter(
                              sessionHandle,
                              ref providerId,
                              ref sublayerId,
                              ref displayData,
                              (uint)layer,
                              (uint)action,
                              weight,
                              index,
                              (uint)(persistent ? 1 : 0),
                              ref id));

            return(id);
        }
Пример #2
0
        public static Guid CreateRemoteNetworkIPv4Filter(
            IntPtr sessionHandle,
            Guid providerId,
            Guid sublayerId,
            DisplayData displayData,
            Layer layer,
            Action action,
            uint weight,
            Guid calloutId,
            Guid providerContextId,
            NetworkAddress address,
            bool persistent = false,
            Guid id         = new Guid())
        {
            AssertSuccess(() => PInvoke.CreateRemoteNetworkIPv4Filter(
                              sessionHandle,
                              ref providerId,
                              ref sublayerId,
                              ref displayData,
                              (uint)layer,
                              (uint)action,
                              weight,
                              ref calloutId,
                              ref providerContextId,
                              ref address,
                              (uint)(persistent ? 1 : 0),
                              ref id));

            return(id);
        }
Пример #3
0
 public static extern uint CreateProviderContext(
     IntPtr sessionHandle,
     ref DisplayData displayData,
     [In] ref Guid providerKey,
     uint size,
     IntPtr data,
     [In, Out] ref Guid key);
Пример #4
0
        public static Guid BlockOutsideDns(
            IntPtr sessionHandle,
            Guid providerId,
            Guid sublayerId,
            DisplayData displayData,
            Layer layer,
            Action action,
            uint weight,
            Guid calloutId,
            uint index)
        {
            var id = Guid.Empty;

            AssertSuccess(() => PInvoke.BlockOutsideDns(
                              sessionHandle,
                              ref providerId,
                              ref sublayerId,
                              ref displayData,
                              (uint)layer,
                              (uint)action,
                              weight,
                              ref calloutId,
                              index,
                              ref id));

            return(id);
        }
Пример #5
0
 public static extern uint CreateSublayer(
     IntPtr sessionHandle,
     [In] ref Guid providerKey,
     ref DisplayData displayData,
     uint weight,
     uint persistent,
     [In, Out] ref Guid key);
Пример #6
0
        public static Guid CreateAppFilter(IntPtr sessionHandle,
                                           Guid providerId,
                                           Guid sublayerId,
                                           DisplayData displayData,
                                           Layer layer,
                                           Action action,
                                           uint weight,
                                           Guid calloutId,
                                           Guid providerContextId,
                                           string appPath)
        {
            var id = Guid.Empty;

            AssertSuccess(() => PInvoke.CreateAppFilter(
                              sessionHandle,
                              ref providerId,
                              ref sublayerId,
                              ref displayData,
                              (uint)layer,
                              (uint)action,
                              weight,
                              ref calloutId,
                              ref providerContextId,
                              appPath,
                              ref id));

            return(id);
        }
Пример #7
0
        public static Guid CreateRemoteUdpPortFilter(
            IntPtr sessionHandle,
            Guid providerId,
            Guid sublayerId,
            DisplayData displayData,
            Layer layer,
            Action action,
            uint weight,
            uint port)
        {
            var id = Guid.Empty;

            AssertSuccess(() => PInvoke.CreateRemoteUDPPortFilter(
                              sessionHandle,
                              ref providerId,
                              ref sublayerId,
                              ref displayData,
                              (uint)layer,
                              (uint)action,
                              weight,
                              port,
                              ref id));

            return(id);
        }
Пример #8
0
 public static extern uint CreateCallout(
     IntPtr sessionHandle,
     ref DisplayData displayData,
     [In] ref Guid providerKey,
     uint layer,
     uint persistent,
     [In, Out] ref Guid key);
Пример #9
0
        public static Guid CreateNetInterfaceFilter(
            IntPtr sessionHandle,
            Guid providerId,
            Guid sublayerId,
            DisplayData displayData,
            Layer layer,
            Action action,
            uint weight,
            string interfaceId)
        {
            var id = Guid.Empty;

            AssertSuccess(() => PInvoke.CreateNetInterfaceFilter(
                              sessionHandle,
                              ref providerId,
                              ref sublayerId,
                              ref displayData,
                              (uint)layer,
                              (uint)action,
                              weight,
                              interfaceId,
                              ref id));

            return(id);
        }
Пример #10
0
        public static Guid CreateRemoteNetworkIPv4Filter(
            IntPtr sessionHandle,
            Guid providerId,
            Guid sublayerId,
            DisplayData displayData,
            Layer layer,
            Action action,
            uint weight,
            NetworkAddress address)
        {
            var id = Guid.Empty;

            AssertSuccess(() => PInvoke.CreateRemoteNetworkIPv4Filter(
                              sessionHandle,
                              ref providerId,
                              ref sublayerId,
                              ref displayData,
                              (uint)layer,
                              (uint)action,
                              weight,
                              ref address,
                              ref id));

            return(id);
        }
Пример #11
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);
        }
Пример #12
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);
        }
Пример #13
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);
        }
Пример #14
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);
        }
Пример #15
0
        public static Guid CreateProviderContext(
            IntPtr sessionHandle,
            Guid providerId,
            DisplayData displayData,
            byte[] data)
        {
            var id      = Guid.Empty;
            var dataPtr = IntPtr.Zero;
            var size    = 0;

            if (data != null && (size = data.Length) != 0)
            {
                dataPtr = Marshal.AllocHGlobal(size);
                Marshal.Copy(data, 0, dataPtr, size);
            }

            try
            {
                AssertSuccess(() => PInvoke.CreateProviderContext(
                                  sessionHandle,
                                  ref displayData,
                                  ref providerId,
                                  (uint)size,
                                  dataPtr,
                                  ref id));
            }
            finally
            {
                Marshal.FreeHGlobal(dataPtr);
            }

            return(id);
        }
Пример #16
0
        public Callout CreateCallout(DisplayData displayData, Guid calloutId, Layer layer)
        {
            var callout = _ipFilter.CreateCallout(displayData, calloutId, layer);

            _callouts.Add(callout.Id);

            return(callout);
        }
Пример #17
0
 public static extern uint CreateLoopbackFilter(
     IntPtr sessionHandle,
     [In] ref Guid providerKey,
     [In] ref Guid sublayerKey,
     ref DisplayData displayData,
     uint layer,
     uint action,
     uint weight,
     [In, Out] ref Guid filterKey);
Пример #18
0
        public Sublayer CreateSublayer(DisplayData displayData, uint weight)
        {
            var id = IpFilterNative.CreateSublayer(
                Session.Handle,
                ProviderId,
                displayData,
                weight);

            return(new Sublayer(this, id));
        }
Пример #19
0
        public ProviderContext CreateProviderContext(DisplayData displayData, byte[] data)
        {
            var id = IpFilterNative.CreateProviderContext(
                Session.Handle,
                ProviderId,
                displayData,
                data);

            return(new ProviderContext(id));
        }
Пример #20
0
 public static extern uint CreateRemoteNetworkIPv4Filter(
     IntPtr sessionHandle,
     [In] ref Guid providerKey,
     [In] ref Guid sublayerKey,
     ref DisplayData displayData,
     uint layer,
     uint action,
     uint weight,
     ref NetworkAddress addr,
     [In, Out] ref Guid filterKey);
Пример #21
0
 public static extern uint CreateNetInterfaceFilter(
     IntPtr sessionHandle,
     [In] ref Guid providerKey,
     [In] ref Guid sublayerKey,
     ref DisplayData displayData,
     uint layer,
     uint action,
     uint weight,
     [MarshalAs(UnmanagedType.LPStr)] string interfaceId,
     [In, Out] ref Guid filterKey);
Пример #22
0
        public Callout CreateCallout(DisplayData displayData, Guid key, Layer layer)
        {
            var id = IpFilterNative.CreateCallout(
                Session.Handle,
                key,
                ProviderId,
                displayData,
                layer);

            return(new Callout(id));
        }
Пример #23
0
 public static extern uint CreateRemoteUDPPortFilter(
     IntPtr sessionHandle,
     [In] ref Guid providerKey,
     [In] ref Guid sublayerKey,
     ref DisplayData displayData,
     uint layer,
     uint action,
     uint weight,
     uint port,
     uint persistent,
     [In, Out] ref Guid filterKey);
Пример #24
0
 public static extern uint CreateNetInterfaceFilter(
     IntPtr sessionHandle,
     [In] ref Guid providerKey,
     [In] ref Guid sublayerKey,
     ref DisplayData displayData,
     uint layer,
     uint action,
     uint weight,
     uint index,
     uint persistent,
     [In, Out] ref Guid filterKey);
Пример #25
0
 public static extern uint BlockOutsideDns(
     IntPtr sessionHandle,
     [In] ref Guid providerKey,
     [In] ref Guid sublayerKey,
     ref DisplayData displayData,
     uint layer,
     uint action,
     uint weight,
     [In] ref Guid calloutKey,
     uint index,
     [In, Out] ref Guid filterKey);
Пример #26
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));
        }
Пример #27
0
 public static extern uint CreateLayerFilter(
     IntPtr sessionHandle,
     [In] ref Guid providerKey,
     [In] ref Guid sublayerKey,
     ref DisplayData displayData,
     uint layer,
     uint action,
     uint weight,
     [In] ref Guid calloutKey,
     [In] ref Guid providerContextKey,
     uint persistent,
     [In, Out] ref Guid filterKey);
Пример #28
0
 public static extern uint CreateAppFilter(
     IntPtr sessionHandle,
     [In] ref Guid providerKey,
     [In] ref Guid sublayerKey,
     ref DisplayData displayData,
     uint layer,
     uint action,
     uint weight,
     [In] ref Guid calloutKey,
     [In] ref Guid providerContextKey,
     [MarshalAs(UnmanagedType.LPWStr)] string appPath,
     [In, Out] ref Guid filterKey);
Пример #29
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));
        }
Пример #30
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));
        }