From fe22c1f998acf3adbd755ec25df4471a99f29289 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Wed, 13 Nov 2019 04:17:00 -0500 Subject: [PATCH] Add final files --- Headers/Foundation/Foundation.h | 2 + .../FoundationLegacySwiftCompatibility.h | 30 +++ Headers/Foundation/NSXPCConnection.h | 121 +++++++++- Source/GNUmakefile | 2 + Source/NSXPCConnection.m | 217 +++++++++++++++++- 5 files changed, 369 insertions(+), 3 deletions(-) create mode 100644 Headers/Foundation/FoundationLegacySwiftCompatibility.h diff --git a/Headers/Foundation/Foundation.h b/Headers/Foundation/Foundation.h index ed517c270..15f408720 100644 --- a/Headers/Foundation/Foundation.h +++ b/Headers/Foundation/Foundation.h @@ -31,6 +31,7 @@ #import #import +#import #import #import #import @@ -187,6 +188,7 @@ #import #import #import +#import #import #ifdef __has_include diff --git a/Headers/Foundation/FoundationLegacySwiftCompatibility.h b/Headers/Foundation/FoundationLegacySwiftCompatibility.h new file mode 100644 index 000000000..f48a53f0a --- /dev/null +++ b/Headers/Foundation/FoundationLegacySwiftCompatibility.h @@ -0,0 +1,30 @@ +/* Definition of header FoundationLegacySwiftCompatibility + Copyright (C) 2019 Free Software Foundation, Inc. + + By: Gregory Casamento + Date: Tue Nov 12 23:50:29 EST 2019 + + This file is part of the GNUstep 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 _FoundationLegacySwiftCompatibility_h_GNUSTEP_BASE_INCLUDE +#define _FoundationLegacySwiftCompatibility_h_GNUSTEP_BASE_INCLUDE + +#include + +#endif diff --git a/Headers/Foundation/NSXPCConnection.h b/Headers/Foundation/NSXPCConnection.h index f5f65c7df..f0a96e5ce 100644 --- a/Headers/Foundation/NSXPCConnection.h +++ b/Headers/Foundation/NSXPCConnection.h @@ -27,14 +27,131 @@ #include -#if OS_API_VERSION(MAC_OS_X_VERSION_Nov 12 2019, GS_API_LATEST) +#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST) #if defined(__cplusplus) extern "C" { #endif -@interface NSXPCConnection : NSObject +@class NSMutableDictionary, NSString, NSOperationQueue, NSSet, NSLock, NSError; +@class NSXPCConnection, NSXPCListener, NSXPCInterface, NSXPCListenerEndpoint; +@protocol NSXPCListenerDelegate; +DEFINE_BLOCK_TYPE(GSXPCProxyErrorHandler, void, NSError *); +DEFINE_BLOCK_TYPE(GSXPCInterruptionHandler, void, void); +DEFINE_BLOCK_TYPE(GSXPCInvalidationHandler, void, void); + + +@protocol NSXPCProxyCreating + +- (id) remoteObjectProxy; + +- (id) remoteObjectProxyWithErrorHandler: (GSXPCProxyErrorHandler)handler; + +- (id) synchronousRemoteObjectProxyWithErrorHandler: (GSXPCProxyErrorHandler)handler; + +@end + +enum +{ + NSXPCConnectionPrivileged = (1 << 12UL) +}; +typedef NSUInteger NSXPCConnectionOptions; + +@interface NSXPCConnection : NSObject + +- (instancetype)initWithServiceName:(NSString *)serviceName; + +- (NSString *) serviceName; +- (void) setServiceName: (NSString *)serviceName; + +- (instancetype)initWithMachServiceName:(NSString *)name options:(NSXPCConnectionOptions)options; + +- (instancetype)initWithListenerEndpoint:(NSXPCListenerEndpoint *)endpoint; + +- (NSXPCListenerEndpoint *) endpoint; +- (void) setEndpoint: (NSXPCListenerEndpoint *) endpoint; + +- (NSXPCInterface *) exportedInterface; +- (void) setExportInterface: (NSXPCInterface *)exportedInterface; + +- (NSXPCInterface *) remoteObjectInterface; +- (void) setRemoteObjectInterface: (NSXPCInterface *)remoteObjectInterface; + + +- (id) remoteObjectProxy; +- (void) setRemoteObjectProxy: (id)remoteObjectProxy; + +- (id) remoteObjectProxyWithErrorHandler:(void (^)(NSError *error))handler; + +- (id) synchronousRemoteObjectProxyWithErrorHandler:(void (^)(NSError *error))handler; + +- (GSXPCInterruptionHandler) interruptionHandler; +- (void) setInterruptionHandler: (GSXPCInterruptionHandler)handler; + +- (GSXPCInvalidationHandler) invalidationHandler; +- (void) setInvalidationHandler: (GSXPCInvalidationHandler)handler; + +- (void) resume; + +- (void) suspend; + +- (void) invalidate; + +- (NSUInteger) auditSessionIdentifier; +- (NSUInteger) processIdentifier; +- (NSUInteger) effectiveUserIdentifier; +- (NSUInteger) effectiveGroupIdentifier; + +@end + + +@interface NSXPCListener : NSObject + ++ (NSXPCListener *) serviceListener; + ++ (NSXPCListener *) anonymousListener; + +- (instancetype) initWithMachServiceName:(NSString *)name; + +- (id ) delegate; +- (void) setDelegate: (id ) delegate; + +- (NSXPCListenerEndpoint *) endpoint; +- (void) setEndpoint: (NSXPCListenerEndpoint *)endpoint; + +- (void) resume; + +- (void) suspend; + +- (void) invalidate; + +@end + +@protocol NSXPCListenerDelegate + +- (BOOL) listener: (NSXPCListener *)listener shouldAcceptNewConnection: (NSXPCConnection *)newConnection; + +@end + +@interface NSXPCInterface : NSObject + ++ (NSXPCInterface *) interfaceWithProtocol: (Protocol *)protocol; + +- (Protocol *) protocol; +- (void) setProtocol: (Protocol *)protocol; + +- (void) setClasses: (NSSet *)classes forSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply; + +- (NSSet *) classesForSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply; + +- (void) setInterface: (NSXPCInterface *)ifc forSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply; + +- (NSXPCInterface *) interfaceForSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply; + +@end + +@interface NSXPCListenerEndpoint : NSObject // NSSecureCoding @end #if defined(__cplusplus) diff --git a/Source/GNUmakefile b/Source/GNUmakefile index d62625a4b..623a1a579 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -355,6 +355,7 @@ NSXMLDTDNode.m \ NSXMLElement.m \ NSXMLNode.m \ NSXMLParser.m \ +NSXPCConnection.m \ NSZone.m \ externs.m \ objc-load.m @@ -566,6 +567,7 @@ NSXMLElement.h \ NSXMLNode.h \ NSXMLNodeOptions.h \ NSXMLParser.h \ +NSXPCConnection.h \ NSZone.h HEADERS_INSTALL = \ diff --git a/Source/NSXPCConnection.m b/Source/NSXPCConnection.m index 3d383deaa..b27831ccf 100644 --- a/Source/NSXPCConnection.m +++ b/Source/NSXPCConnection.m @@ -23,8 +23,223 @@ */ #include - + @implementation NSXPCConnection +- (instancetype)initWithServiceName:(NSString *)serviceName +{ + return nil; +} + +- (NSString *) serviceName +{ + return nil; +} + +- (void) setServiceName: (NSString *)serviceName +{ +} + +- (instancetype)initWithMachServiceName:(NSString *)name options:(NSXPCConnectionOptions)options +{ + return nil; +} + +- (instancetype)initWithListenerEndpoint:(NSXPCListenerEndpoint *)endpoint +{ + return nil; +} + + +- (NSXPCListenerEndpoint *) endpoint +{ + return nil; +} + +- (void) setEndpoint: (NSXPCListenerEndpoint *) endpoint +{ +} + +- (NSXPCInterface *) exportedInterface +{ + return nil; +} + +- (void) setExportInterface: (NSXPCInterface *)exportedInterface +{ +} + +- (NSXPCInterface *) remoteObjectInterface +{ + return nil; +} + +- (void) setRemoteObjectInterface: (NSXPCInterface *)remoteObjectInterface +{ +} + +- (id) remoteObjectProxy +{ + return nil; +} + +- (void) setRemoteObjectProxy: (id)remoteObjectProxy +{ +} + +- (id) remoteObjectProxyWithErrorHandler:(void (^)(NSError *error))handler +{ + return nil; +} + +- (id) synchronousRemoteObjectProxyWithErrorHandler:(void (^)(NSError *error))handler +{ + return nil; +} + +- (GSXPCInterruptionHandler) interruptionHandler +{ + return NULL; +} + +- (void) setInterruptionHandler: (GSXPCInterruptionHandler)handler +{ +} + +- (GSXPCInvalidationHandler) invalidationHandler +{ + return NULL; +} + +- (void) setInvalidationHandler: (GSXPCInvalidationHandler)handler +{ +} + +- (void) resume +{ +} + +- (void) suspend +{ +} + +- (void) invalidate +{ +} + +- (NSUInteger) auditSessionIdentifier +{ + return 0; +} +- (NSUInteger) processIdentifier +{ + return 0; +} +- (NSUInteger) effectiveUserIdentifier +{ + return 0; +} +- (NSUInteger) effectiveGroupIdentifier +{ + return 0; +} +@end + +@implementation NSXPCListener + ++ (NSXPCListener *) serviceListener +{ + return nil; +} + ++ (NSXPCListener *) anonymousListener +{ + return nil; +} + +- (instancetype) initWithMachServiceName:(NSString *)name +{ + return nil; +} + +- (id ) delegate +{ + return nil; +} + +- (void) setDelegate: (id ) delegate +{ +} + +- (NSXPCListenerEndpoint *) endpoint +{ + return nil; +} + +- (void) setEndpoint: (NSXPCListenerEndpoint *)endpoint +{ +} + +- (void) resume +{ +} + +- (void) suspend +{ +} + +- (void) invalidate +{ +} + +@end + +@implementation NSXPCInterface + ++ (NSXPCInterface *) interfaceWithProtocol: (Protocol *)protocol +{ + return nil; +} + +- (Protocol *) protocol +{ + return nil; +} + +- (void) setProtocol: (Protocol *)protocol +{ +} + +- (void) setClasses: (NSSet *)classes forSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply +{ +} + +- (NSSet *) classesForSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply +{ + return nil; +} + +- (void) setInterface: (NSXPCInterface *)ifc forSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply +{ +} + +- (NSXPCInterface *) interfaceForSelector: (SEL)sel argumentIndex: (NSUInteger)arg ofReply: (BOOL)ofReply +{ + return nil; +} + +@end + +@implementation NSXPCListenerEndpoint + +- (instancetype) initWithCoder: (NSCoder *)coder +{ + return nil; +} + +- (void) encodeWithCoder: (NSCoder *)coder +{ +} + @end