Hi, I am new to Swift language. I am trying to convert below C++ function to Swift function as below.
C++ function:
int test(test_type type, request_info_t *request, size_t request_len)
{
size_t size = request_len;
int mib[] = {0,0,0,0,0};
int ret = sysctl(mib, 5, request, &size, NULL, 0)
return ret;
}
Swift function:
func test( type: test_type, request: request_info_t, request_len: size_t) -> Int64
{
let size: Int = request_len
let mib: [Int]= [0, 0, 0, 0, 0]
let val: Int32 = sysctl(mib, 5, request, size, nil, 0)
return val
}
But I am facing below issues with arguments at sysctl(). Could any one please to convert this. Error due to first argument mib: Cannot convert value of type '[Int]' to expected argument type 'UnsafeMutablePointer<Int32>?'
Error due to third argument request: Cannot convert value of type 'Int' to expected argument type 'UnsafeMutablePointer<Int>?'
Error due to fourth argument size: Cannot convert value of type 'requestinfot' to expected argument type 'UnsafeMutableRawPointer?'
Post
Replies
Boosts
Views
Activity
Hi,
I have tried to compile and run SimpleFirewall - https://developer.apple.com/documentation/networkextension/filtering_network_traffic example on MacBook Pro. Where can I get 'os_log' output logs in this example? I have verified in system.log but no use.
Hi,
I am new to network extensions.
Is there any sample program for network extension content filters in Objective-c? I have found in swift but not find in Objective-C.
I want to register network extensions and I want listen all TCP & UDP network operations using network extension content filters in Objective-C.
Hi,
I am new to network applications.
Should place network extension application in /Applications to run it? or Is network extension application run from any where on the machine?
Hi,
I am new to network extension programming. I have one 'cpp' application which will run under /usr/local/sample directory. I want to listen all UDP & TCP network operation using network extension Content Filter in my c++ application, and I want execute my own rules on received event.
Is it possible to register network extensions from my 'cpp' application and Is it possible to catch the events on TCP & UDP using network extension from my c++ application? How it would be possible? Please provide any sample program.