Post

Replies

Boosts

Views

Activity

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
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
Type conversion issue from 'UnsafeMutableRawPointer' to UnsafeMutablePointer<Int32>
Hi, I am new to Swift language. In my C++ application, I able to convert 'void *' to 'int * 'as below. Here, 'request' type is 'void *' type. int *ret = request; I am trying to do same thing in Swift also. Here 'request' type is 'UnsafeMutableRawPointer' But I am facing with error "Cannot convert value of type 'UnsafeMutableRawPointer' to specified type 'UnsafeMutablePointer&lt;Int32&gt;'" let ret: UnsafeMutablePointer&lt;Int32&gt; = request Any one please help to convert from UnsafeMutableRawPointer type to UnsafeMutablePointer&lt;Int32&gt;.
6
0
3.7k
Aug ’20
Is there any way to activate/deactivate network extension in unmanaged environment without user consent.
Hi, I want to activate/deactivate network extension on Mac without any user consent (I want allow network extension activation/deactivation on Mac by default) and Mac is under un-managed environment (Not managed by MDM tools). Is there any way to activate/deactivate network extension in unmanaged environment without use. consent. Thanks.
1
0
494
Nov ’20
How to run commands in swift language application
HI, I want to know whether my extension is in active state or not as part of my swift application. It would get this on terminal usingsystemextensionsctl list | grep FilterExtension | grep activated command. It can be possible with system() on C++ as system("systemextensionsctl list | grep FilterExtension | grep activated") But how can I achieve this in swift language? Help me. Thanks.
0
0
501
Feb ’21
How to import bridge header file to swift project through CMake for Ninja?
HI, I have a swift project and I am calling few objective C APIs as part of my swift project. I am using bridge header for this. I am creating swift project using CMake files. I able to create the swift project and compiling successfully for Xcode But I unable to compile successfully for Ninja. I am using XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER to import bridge header file to the swift project in my CMake file like set_target_properties(ADE PROPERTIES  FRAMEWORK TRUE  XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER ADE-Bridging-Header.h). But I failed to import successfully for Ninja. Is there any way to import Bridge header file through CMake for both Xcode and Ninja?
1
0
2.0k
Dec ’21
How to create swift project for multi architecture for Ninja using CMake
HI, I have a swift project and I want to compile it for both "x86_64" and "arm64" architectures on my Mac for both Xcode & Ninja. My swift project was successfully compiled for both "x86_64" and "arm64" with Xcode. But I am facing with multiple values for CMAKE_OSX_ARCHITECTURES not supported with Swift error in CMake while creating the swift project for Ninja. Pls help to fix this fir Ninja.
0
0
489
Dec ’21
How to suppress Allow/DontAllow popup when we call filterManager.saveToPreferences?
Hi, I have Content Filter Simple Firewall example from Apple site and modified as per my requirement and I able to compile & run with my developer id account. As part of NE activation request, throwing the Allow/Don't Allow popup after allowing the NE from security preferences. When I went through the code I got to know that this popup is getting from filterManager.saveToPreferences as part of activation request. Attached the screen shot for reference. How to suppress this allow/disallow popup? Please help me.
17
0
2.6k
Apr ’22
how to get original path of alias file at createItem() of fileproviderextension?
Hi, I am using file provide extension to sync the app with remote storage. createItem() fileprovideer extension is calling when I copy a file and I able to sync properly with normal file and symlink files. itemTemplate.symlinkTargetPath helps me to sync symlink file. But, I am facing the with alias file to sync. I tried to get original file name of alias file but I haven't found any option. How to get the original file name of alias file at createItem() of fileprovider extension. Is there any way to sync alias file? My createItem() sample code at extension which sends the call to server through grpc. public func createItem( basedOn itemTemplate: NSFileProviderItem, fields: NSFileProviderItemFields, contents contentsUrl: URL?, options: NSFileProviderCreateItemOptions = [], request: NSFileProviderRequest, progress: Progress ) async throws -&gt; (NSFileProviderItem, NSFileProviderItemFields) { var (templateAttributes, _) = self.load(fields: fields, from: itemTemplate) templateAttributes.ownerAccountID = getuid(); templateAttributes.groupOwnerAccountID = getgid(); let identifier: NSFileProviderItemIdentifier let attributes: FileProviderItemAttributes if itemTemplate.contentType?.conforms(to: .directory) == true { // Handle folder creation ..... ..... } else if itemTemplate.contentType?.conforms(to: .symbolicLink) == true { // Handle symlinks guard let targetPath = itemTemplate.symlinkTargetPath else { fatalError("couldn't get symlinkTargetPath on \(itemTemplate)") } .... .... } else if itemTemplate.contentType?.conforms(to: .aliasFile) == true { // TODO I am not yet handled this case. I need to get original path of alias file. } else { // Handle file creation .... .... } let item = try FileSystemItem.any(filename: itemTemplate.filename, identifier: identifier, parentIdentifier: itemTemplate.parentItemIdentifier, attributes: attributes) return (item, []) }
1
0
734
Apr ’23
How to run two different vendor content filter extensions without having connection issues
My customer installed two different apps on his Mac machine. These two apps are using ContentFilter extensions. One of the app is mine and another app is different vendor. If my customer enabled both ContentFilter extensions then he fails to connect immediately to its required destination to allow it to run. If one of the ContentFilter extension is disabled then there is no issue. Is it not possible to run two different ContentFilter extensions on same Mac machine? Is there any way to fix these type of issues? Thank You Nagendra R
2
0
903
Apr ’23