attempt to get avahi code working without breaking abi.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30957 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-07-13 12:13:31 +00:00
parent 4db2b9cf28
commit 2d4d2d6dc4
5 changed files with 61 additions and 50 deletions

View file

@ -1,3 +1,11 @@
2010-07-13 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSNetServices.h:
* Source/GSAvahiClient.h:
* Source/GSNetServices.h:
* Source/GSAvahiNetService.m:
Attempt to get ahavi code working without breaking ABI.
2010-07-13 Niels Grewe <niels.grewe@halbordnung.de>
* Headers/Foundation/NSNetServices.h: Update to a version working with

View file

@ -3,24 +3,24 @@
Written by: Chris B. Vetter
Date: 2006
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
*/
#ifndef __NSNetServices_h_GNUSTEP_BASE_INCLUDE
#define __NSNetServices_h_GNUSTEP_BASE_INCLUDE
@ -127,7 +127,12 @@ GS_EXPORT NSString * const NSNetServicesErrorDomain;
@interface NSNetService : NSObject
{
#if GS_EXPOSE(NSNetService)
@private
id _delegate;
void *_netService;
void *_reserved;
#endif
}
+ (NSData *) dataFromTXTRecordDictionary: (NSDictionary *) txtDictionary;
@ -146,7 +151,7 @@ GS_EXPORT NSString * const NSNetServicesErrorDomain;
- (void) scheduleInRunLoop: (NSRunLoop *) aRunLoop
forMode: (NSString *) mode;
#if OS_API_VERSION(100500,GS_API_LATEST)
#if OS_API_VERSION(100500,GS_API_LATEST)
- (NSInteger)port;
- (void) publishWithOptions: (NSNetServiceOptions)options;
@ -209,7 +214,12 @@ GS_EXPORT NSString * const NSNetServicesErrorDomain;
@interface NSNetServiceBrowser : NSObject
{
#if GS_EXPOSE(NSNetServiceBrowser)
@private
id _delegate;
void *_netServiceBrowser;
void *_reserved;
#endif
}
- (id) init;

View file

@ -27,37 +27,39 @@
@interface GSAvahiClient: NSObject
{
id _delegate;
void *_unused;
void *_reserved;
GSAvahiRunLoopContext *ctx;
void *_client;
NSRecursiveLock *_lock;
}
+ (int)netServicesErrorForAvahiError: (int)errNo;
+ (int) netServicesErrorForAvahiError: (int)errNo;
- (void*)client;
- (void*) client;
- (id)initWithRunLoop: (NSRunLoop*)rl
forMode: (NSString*)mode;
- (id) initWithRunLoop: (NSRunLoop*)rl
forMode: (NSString*)mode;
- (void)setupClientWithFlags: (int)flags
andReportError: (int*)error;
- (void) setupClientWithFlags: (int)flags
andReportError: (int*)error;
- (void)setState: (int)theState
forClient: (void*)cl;
- (void) setState: (int)theState
forClient: (void*)cl;
- (void)scheduleInRunLoop: (NSRunLoop*)rl
forMode: (NSString*)mode;
- (void) scheduleInRunLoop: (NSRunLoop*)rl
forMode: (NSString*)mode;
- (void)removeFromRunLoop: (NSRunLoop*)rl
forMode: (NSString*)mode;
- (void) removeFromRunLoop: (NSRunLoop*)rl
forMode: (NSString*)mode;
- (void)handleError: (int)errNo;
- (void) handleError: (int)errNo;
- (void)setDelegate: (id)delegate;
- (void) setDelegate: (id)delegate;
- (id)delegate;
- (id) delegate;
- (NSDictionary*)errorDictWithErrorCode: (int) error;
- (NSDictionary*) errorDictWithErrorCode: (int) error;
@end

View file

@ -642,10 +642,11 @@ GSAvahiEntryGroupStateChanged(AvahiEntryGroup *group,
- (void) netService: (NSNetService*)service
didUpdateAddresses: (NSArray*)addresses
{
if ([_delegate respondsToSelector: @selector(netService:didUpdateAddresses:)])
if ([[self delegate] respondsToSelector:
@selector(netService:didUpdateAddresses:)])
{
[_delegate netService: service
didUpdateAddresses: addresses];
[[self delegate] netService: service
didUpdateAddresses: addresses];
}
}
@ -660,7 +661,7 @@ didUpdateRecordData: (id)data
}
theSelector = NSSelectorFromString([NSString stringWithFormat:
@"netService:didUpdate%@RecordData:", rrType]);
if ([_delegate respondsToSelector: theSelector])
if ([[self delegate] respondsToSelector: theSelector])
{
if (([rrType isEqualToString: @"TXT"])
&& [data isKindOfClass: [NSArray class]])
@ -671,16 +672,16 @@ didUpdateRecordData: (id)data
*/
data = [(NSArray*)data lastObject];
}
[_delegate performSelector: theSelector
withObject: service
withObject: data];
[[self delegate] performSelector: theSelector
withObject: service
withObject: data];
}
else if ([_delegate respondsToSelector:
else if ([[self delegate] respondsToSelector:
@selector(netService:didUpdateRecordData:forRecordType:)])
{
[_delegate netService: service
didUpdateRecordData: data
forRecordType: rrType];
[[self delegate] netService: service
didUpdateRecordData: data
forRecordType: rrType];
}
}
@ -691,11 +692,11 @@ didUpdateRecordData: (id)data
SEL theSelector = NSSelectorFromString([NSString stringWithFormat:
@"netService:didNotMonitor%@RecordData:", rrType]);
if ([_delegate respondsToSelector: theSelector])
if ([[self delegate] respondsToSelector: theSelector])
{
[_delegate performSelector: theSelector
withObject: service
withObject: errorDict];
[[self delegate] performSelector: theSelector
withObject: service
withObject: errorDict];
}
}

View file

@ -3,24 +3,24 @@
Written by: Niels Grewe <niels.grewe@halbordnung.de>
Date: March 2010
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
*/
#import "common.h"
#define EXPOSE_NSNetServices_IVARS 1
@ -33,10 +33,6 @@
* NSNetService using the mDNSResponder API.
*/
@interface GSMDNSNetService : NSNetService
{
void *_netService;
void *_reserved;
}
@end
@ -44,10 +40,6 @@
* NSNetServiceBrowser using the mDNSResponder API.
*/
@interface GSMDNSNetServiceBrowser : NSNetServiceBrowser
{
void *_netServiceBrowser;
void *_reserved;
}
@end
// Subclasses using Avahi:
@ -109,7 +101,6 @@ NSString* GSNetServiceDotTerminatedNSStringFromString(const char* string);
NSMapTable *_browsers;
NSMapTable *_browserTimeouts;
NSTimer *_timer;
id _reserved;
}
/**
@ -139,6 +130,5 @@ NSString* GSNetServiceDotTerminatedNSStringFromString(const char* string);
GSAvahiBrowserType _type;
BOOL _hasFirstEvent;
NSMutableDictionary *_services;
id _reserved;
}
@end