Unable to understand Flow of Network extension for iOS

For a past few days, I have been exploring control Filter and data filter. I am unable to understand how control moves from various functions of data filter to control Filter. One thing that I am unable to figure out is that when I pass verdict as .allow in dataFilter's handleNewFlow and mark .shouldReport as true, I get inBytes and outbytes in the flow report of handle() in controlFilter. But when I pass verdict as needRules and wait till the handle is called in controlFilter when the report.event == .flowClosed, I don't get inBytes and outBytes. I am unable to understand this complete flow of network extension from the apple documentation. Can someone provide me with some flow chart or some pictorial representation or detailed explanation of network extension for iOS? Also is there some way to imitate the ..statisticsReportFrequency for iOS as it is not available for iOS?

Also I need help in logging inbytes and outbytes at end of flow in iOS. I know that we get bytes in handle report in control filter when report.event == .flowClosed. But I only get bytes when I allow the flow in data filter and mark should report as true. Apart from that I don't get byte data when I go with .needRules and should report as true even when the handle report is called with report.event == .flowClosed. /** * @property bytesInboundCount * @discussion The number of inbound bytes received from the flow. This property is only non-zero when the report event is NEFilterReportEventFlowClosed or NEFilterReportEventFlowStatistics. Is there some issue in iOS or am I missing something?

Vesemir, Are you working with shpande on the same product? Or are you working on a separate product in roughly the same space?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Sorry about the delay responding. It’s been a busy week.

Let’s start with this:

Also is there some way to imitate the .statisticsReportFrequency for iOS as it is not available for iOS?

No. It’s not just this property is missing, it’s that the entire filter statistics mechanism is not present on iOS.


Regarding your main issue, lemme recap my understanding:

  1. Your data filter receives a flow via handleNewFlow(_:).
  2. It returns .needRules().
  3. The control filter receives the flow via handleNewFlow(_:completionHandler:).

And this is where I get lost. The next event in your description is this:

wait till the handle is called in control filter when the report.event == .flowClosed

which seems to be missing a step. What did the control filter’s ``handleNewFlow(_:completionHandler:)` method return?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Unable to understand Flow of Network extension for iOS
 
 
Q