Post

Replies

Boosts

Views

Activity

Facing type conversion issues in swift language
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?'
2
0
1.4k
Aug ’20
How to include network extension program in my cpp application?
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.
1
0
427
Aug ’20