Skip to content

Commit 436e809

Browse files
committed
bind Tor.framework v404.6.2
1 parent 03ac2ad commit 436e809

File tree

6 files changed

+51
-113
lines changed

6 files changed

+51
-113
lines changed

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@
5050
# *.7z binary
5151
# *.ttf binary
5252
# *.pyc binary
53-
TorFramework/Tor.framework/Tor filter=lfs diff=lfs merge=lfs -text
53+
Xamarin.iOS.Tor/Tor.framework/Tor filter=lfs diff=lfs merge=lfs -text

Xamarin.iOS.Tor/ApiDefinition.cs

+24-53
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,9 @@
1-
using System;
2-
using ObjCRuntime;
1+
using System;
32
using Foundation;
3+
using ObjCRuntime;
44

55
namespace Xamarin.iOS.Tor
66
{
7-
// Binding Analysis:
8-
// Automated binding is complete, but there are a few APIs which have been flagged with[Verify] attributes.While the entire binding
9-
// should be audited for best API design practices, look more closely at APIs with the following Verify attribute hints:
10-
11-
// ConstantsInterfaceAssociation (1 instance):
12-
13-
// There's no foolproof way to determine with which Objective-C interface an extern variable declaration may be associated. Instances
14-
// of these are bound as [Field] properties in a partial interface into a nearby concrete interface to produce a more intuitive API,
15-
// possibly eliminating the 'Constants' interface altogether.
16-
17-
// PlatformInvoke(4 instances) :
18-
19-
// In general P/Invoke bindings are not as correct or complete as Objective-C bindings(at least currently). You may need to fix up the
20-
// library name(it defaults to '__Internal') and return/parameter types manually to conform to C calling conventionsfor the target
21-
// platform.You may find you don't even want to expose the C API in your binding, but if you do, you'll probably also want to relocate
22-
23-
// the definition to a more appropriate class and expose a stronger type-safe wrapper.For P/Invoke guidance, see http://www.mono-
24-
25-
// project.com/docs/advanced/pinvoke/.
26-
27-
28-
//Once you have verified a Verify attribute, you should remove it from the binding source code.The presence of Verify attributes
29-
//intentionally cause build failures.
30-
31-
//For more information about the Verify attribute hints above, consult the Objective Sharpie documentation by running 'sharpie docs' or
32-
//visiting the following URL:
337

348
// @interface TORNode : NSObject <NSSecureCoding>
359
[BaseType(typeof(NSObject))]
@@ -369,12 +343,10 @@ interface TORCircuit : INSSecureCoding
369343
IntPtr Constructor(string circuitString);
370344
}
371345

372-
// This is our trampoline boy
373346
// typedef BOOL (^TORObserverBlock)(NSArray<NSNumber *> * _Nonnull, NSArray<NSData *> * _Nonnull, BOOL * _Nonnull);
374347
unsafe delegate bool TORObserverBlock(NSNumber[] arg0, NSData[] arg1, bool* arg2);
375348

376349
[Static]
377-
//[Verify(ConstantsInterfaceAssociation)]
378350
partial interface Constants
379351
{
380352
// extern const NSErrorDomain _Nonnull TORControllerErrorDomain __attribute__((visibility("default")));
@@ -449,40 +421,40 @@ interface TORController
449421
void GetSessionConfiguration(Action<NSUrlSessionConfiguration> completion);
450422

451423
// TODO Fix: /Users/dan/Desktop/root/chaincase/app/TorFramework/BTOUCH: Error BI1001: bgen: Do not know how to make a trampoline for System.Boolean* (BI1001) (TorFramework)
424+
// -(void)sendCommand:(NSString * _Nonnull)command arguments:(NSArray<NSString *> * _Nullable)arguments data:(NSData * _Nullable)data observer:(TORObserverBlock _Nonnull)observer;
452425
//[Export("sendCommand:arguments:data:observer:")]
453426
//void SendCommand(string command, [NullAllowed] string[] arguments, [NullAllowed] NSData data, TORObserverBlock observer);
454427

455428
// -(void)getCircuits:(void (^ _Nonnull)(NSArray<TORCircuit *> * _Nonnull))completion;
456429
[Export("getCircuits:")]
457430
[Async]
458-
void GetCircuits(Action<NSArray<TORCircuit>> completion);
431+
void GetCircuits(Action<NSArray<TORCircuit>> completion);
459432

460-
// -(void)resetConnection:(void (^ _Nullable)(BOOL))completion;
461-
[Export("resetConnection:")]
462-
void ResetConnection([NullAllowed] Action<bool> completion);
433+
// -(void)resetConnection:(void (^ _Nullable)(BOOL))completion;
434+
[Export("resetConnection:")]
435+
void ResetConnection([NullAllowed] Action<bool> completion);
463436

464-
// -(void)closeCircuitsByIds:(NSArray<NSString *> * _Nonnull)circuitIds completion:(void (^ _Nullable)(BOOL))completion;
465-
[Export("closeCircuitsByIds:completion:")]
466-
void CloseCircuitsByIds(string[] circuitIds, [NullAllowed] Action<bool> completion);
437+
// -(void)closeCircuitsByIds:(NSArray<NSString *> * _Nonnull)circuitIds completion:(void (^ _Nullable)(BOOL))completion;
438+
[Export("closeCircuitsByIds:completion:")]
439+
void CloseCircuitsByIds(string[] circuitIds, [NullAllowed] Action<bool> completion);
467440

468-
// -(void)closeCircuits:(NSArray<TORCircuit *> * _Nonnull)circuits completion:(void (^ _Nullable)(BOOL))completion;
469-
[Export("closeCircuits:completion:")]
470-
void CloseCircuits(TORCircuit[] circuits, [NullAllowed] Action<bool> completion);
441+
// -(void)closeCircuits:(NSArray<TORCircuit *> * _Nonnull)circuits completion:(void (^ _Nullable)(BOOL))completion;
442+
[Export("closeCircuits:completion:")]
443+
void CloseCircuits(TORCircuit[] circuits, [NullAllowed] Action<bool> completion);
471444

445+
// -(id _Nonnull)addObserverForCircuitEstablished:(void (^ _Nonnull)(BOOL))block;
446+
[Export("addObserverForCircuitEstablished:")]
447+
NSObject AddObserverForCircuitEstablished(Action<bool> block);
472448

473-
// -(id _Nonnull)addObserverForCircuitEstablished:(void (^ _Nonnull)(BOOL))block;
474-
[Export("addObserverForCircuitEstablished:")]
475-
NSObject AddObserverForCircuitEstablished(Action<bool> block);
449+
// -(id _Nonnull)addObserverForStatusEvents:(BOOL (^ _Nonnull)(NSString * _Nonnull, NSString * _Nonnull, NSString * _Nonnull, NSDictionary<NSString *,NSString *> * _Nullable))block;
450+
[Export("addObserverForStatusEvents:")]
451+
NSObject AddObserverForStatusEvents(Func<NSString, NSString, NSString, NSDictionary<NSString, NSString>, bool> block);
476452

477-
// -(id _Nonnull)addObserverForStatusEvents:(BOOL (^ _Nonnull)(NSString * _Nonnull, NSString * _Nonnull, NSString * _Nonnull, NSDictionary<NSString *,NSString *> * _Nullable))block;
478-
[Export("addObserverForStatusEvents:")]
479-
NSObject AddObserverForStatusEvents(Func<NSString, NSString, NSString, NSDictionary<NSString, NSString>, bool> block);
453+
// -(void)removeObserver:(id _Nullable)observer;
454+
[Export("removeObserver:")]
455+
void RemoveObserver([NullAllowed] NSObject observer);
456+
}
480457

481-
// -(void)removeObserver:(id _Nullable)observer;
482-
[Export("removeObserver:")]
483-
void RemoveObserver([NullAllowed] NSObject observer);
484-
}
485-
486458
// @interface TORConfiguration : NSObject
487459
[BaseType(typeof(NSObject))]
488460
interface TORConfiguration
@@ -530,5 +502,4 @@ interface TORThread
530502
[DesignatedInitializer]
531503
IntPtr Constructor([NullAllowed] string[] arguments);
532504
}
533-
}
534-
505+
}

Xamarin.iOS.Tor/Structs.cs

+19-52
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,22 @@
1-
using System.Runtime.InteropServices;
1+
using System.Runtime.InteropServices;
22

3-
namespace Xamarin.iOS.Tor
3+
static class CFunctions
44
{
5-
6-
// Binding Analysis:
7-
// Automated binding is complete, but there are a few APIs which have been flagged with[Verify] attributes.While the entire binding
8-
// should be audited for best API design practices, look more closely at APIs with the following Verify attribute hints:
9-
10-
// ConstantsInterfaceAssociation (1 instance):
11-
12-
// There's no foolproof way to determine with which Objective-C interface an extern variable declaration may be associated. Instances
13-
// of these are bound as [Field] properties in a partial interface into a nearby concrete interface to produce a more intuitive API,
14-
// possibly eliminating the 'Constants' interface altogether.
15-
16-
// PlatformInvoke(4 instances) :
17-
18-
// In general P/Invoke bindings are not as correct or complete as Objective-C bindings(at least currently). You may need to fix up the
19-
// library name(it defaults to '__Internal') and return/parameter types manually to conform to C calling conventionsfor the target
20-
// platform.You may find you don't even want to expose the C API in your binding, but if you do, you'll probably also want to relocate
21-
22-
// the definition to a more appropriate class and expose a stronger type-safe wrapper.For P/Invoke guidance, see http://www.mono-project.com/docs/advanced/pinvoke/.
23-
24-
25-
//Once you have verified a Verify attribute, you should remove it from the binding source code.The presence of Verify attributes
26-
//intentionally cause build failures.
27-
28-
//For more information about the Verify attribute hints above, consult the Objective Sharpie documentation by running 'sharpie docs' or
29-
//visiting the following URL: http://xmn.io/sharpie-docs
30-
31-
static class CFunctions
32-
{
33-
34-
// extern void TORInstallEventLogging ();
35-
[DllImport("__Internal")]
36-
//[Verify(PlatformInvoke)]
37-
static extern void TORInstallEventLogging();
38-
39-
40-
//// extern void TORInstallEventLoggingCallback (tor_log_cb _Nonnull cb);
41-
//[DllImport("__Internal")]
42-
////[Verify(PlatformInvoke)]
43-
//static extern unsafe void TORInstallEventLoggingCallback(tor_log_cb* cb);
44-
45-
// extern void TORInstallTorLogging ();
46-
[DllImport("__Internal")]
47-
//[Verify(PlatformInvoke)]
48-
static extern void TORInstallTorLogging();
49-
50-
//// extern void TORInstallTorLoggingCallback (tor_log_cb _Nonnull cb);
51-
//[DllImport("__Internal")]
52-
////[Verify(PlatformInvoke)]
53-
//static extern unsafe void TORInstallTorLoggingCallback(tor_log_cb* cb);
54-
}
5+
// extern void TORInstallEventLogging ();
6+
[DllImport ("__Internal")]
7+
static extern void TORInstallEventLogging ();
8+
9+
// extern void TORInstallEventLoggingCallback (tor_log_cb _Nonnull cb);
10+
//[DllImport ("__Internal")]
11+
//[Verify (PlatformInvoke)]
12+
//static extern unsafe void TORInstallEventLoggingCallback (tor_log_cb* cb);
13+
14+
// extern void TORInstallTorLogging ();
15+
[DllImport ("__Internal")]
16+
static extern void TORInstallTorLogging ();
17+
18+
// extern void TORInstallTorLoggingCallback (tor_log_cb _Nonnull cb);
19+
//[DllImport ("__Internal")]
20+
//[Verify (PlatformInvoke)]
21+
//static extern unsafe void TORInstallTorLoggingCallback (tor_log_cb* cb);
5522
}
1 Byte
Binary file not shown.

Xamarin.iOS.Tor/Tor.framework/Tor

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:1d0226abdecfc2734191a473029d58051c7ebc829d7b6293f699958c8d36145f
3-
size 63591168
2+
oid sha256:8e018e8347c7f834042634ed21124e0623176683efae746f79ae74c26c220bc3
3+
size 63573024

Xamarin.iOS.Tor/Xamarin.iOS.Tor.csproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@
5555
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
5656
</Content>
5757
</ItemGroup>
58+
<ItemGroup>
59+
<PackageReference Include="Microsoft.AspNetCore.Components">
60+
<Version>3.1.8</Version>
61+
</PackageReference>
62+
</ItemGroup>
5863
<ItemGroup>
5964
<NativeReference Include="Tor.framework">
6065
<Kind>Framework</Kind>
6166
<SmartLink>False</SmartLink>
6267
</NativeReference>
6368
</ItemGroup>
64-
<ItemGroup>
65-
<PackageReference Include="Microsoft.AspNetCore.Components">
66-
<Version>3.1.8</Version>
67-
</PackageReference>
68-
</ItemGroup>
6969
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets" />
7070
</Project>

0 commit comments

Comments
 (0)