<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NetworkExtension",
  "identifier" : "/documentation/NetworkExtension/NEFilterPacketHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:@T@NEFilterPacketHandler"
  },
  "title" : "NEFilterPacketHandler"
}
-->

# NEFilterPacketHandler

A type for Swift closures or ObjectiveC blocks that make filtering decisions about network packets.

```
typealias NEFilterPacketHandler = (NEFilterPacketContext, nw_interface_t, NETrafficDirection, UnsafeRawPointer, Int) -> NEFilterPacketProvider.Verdict
```

## Parameters

`context`

The current filtering context.

`interface`

The ingress or egress interface of the packet.

`direction`

The direction the packet is flowing.

`packetBytes`

The packet’s bytes.

`packetLength`

The length of the packet’s bytes.

## Return Value

A verdict on whether the framework should allow, drop, or delay the packet. If the verdict is [`NEFilterPacketProvider.Verdict.delay`](/documentation/NetworkExtension/NEFilterPacketProvider/Verdict/delay), the framework assumes the handler already called [`delayCurrentPacket(_:)`](/documentation/NetworkExtension/NEFilterPacketProvider/delayCurrentPacket(_:)).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)