I've attempted to write a binding project for this project: https://github.com/tolo/HHServices
The Project uses the lower level C class : dns_sd.h. I dont know how to import this into my binding project.
All the classes that I need to bind are fine, with the exception of this one:
#import <Foundation/Foundation.h>
#include <dns_sd.h> // Note this!
@interface HHServiceSupport : NSObject {
@private
CFRunLoopRef runLoop;
@protected
DNSServiceRef sdRef;
}
@property (nonatomic, readonly) DNSServiceRef sdRef;
@property (nonatomic, assign) DNSServiceErrorType lastError;
@property (nonatomic, readonly) BOOL hasFailed;
- (void) doDestroy;
- (void) dnsServiceError:(DNSServiceErrorType)error;
- (void) openConnection;
- (void) closeConnection;
@end
My binding for this looks like:
[BaseType (typeof(NSObject))]
interface HHServiceSupport
{
// @private
// CFRunLoopRef runLoop;
// @protected
// DNSServiceRef sdRef;
//Do I bind the above??!
//@property (nonatomic, readonly) DNSServiceRef sdRef;
[Export("sdRef")]
DNSServiceRef SDRef { get; set; }
//@property (nonatomic, assign) DNSServiceErrorType lastError;
[Export("lastError")]
DNSServiceErrorType LastError { get; set; }
//@property (nonatomic, readonly) BOOL hasFailed;
[Export("hasFailed")]
bool HasFailed { get; set; }
//- (void) doDestroy;
[Export("doDestroy")]
void DoDestroy();
//- (void) dnsServiceError:(DNSServiceErrorType)error;
[Export("dnsServiceError:")]
void DnsServiceError(DNSServiceErrorType error);
//- (void) openConnection;
[Export("openConnection")]
void OpenConnection();
//- (void) closeConnection;
[Export("closeConnection")]
void CloseConnection();
}
Because I dont know how to reference the c library dns_sd.h, I dont have any reference to classes such as DNSServiceRef, DNSServiceErrorType and so on and so the library wont build (saying these are unknown).
I've looked through all the documentation online regarding this, but dont find anything that refers to how to reference native c libraries.
The closest similar question I can find regarding this is: Referring to DNSSDObjects in dns_sd.h and DNSServiceResolve in MonoTouch which is unanswered.
Any assistance would be greatly appreciated.
ps: My ultimate goal is to enable peer to peer Bonjour so I can make a TCP socket connection between devices, instead of using GameKit, because that's just a disaster.