mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Move NSStream addition declarations to separate file.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29853 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1a4662001d
commit
f59ba481f0
9 changed files with 228 additions and 83 deletions
|
@ -50,6 +50,7 @@
|
|||
#import <GNUstepBase/NSNumber+GNUstepBase.h>
|
||||
#import <GNUstepBase/NSObject+GNUstepBase.h>
|
||||
#import <GNUstepBase/NSProcessInfo+GNUstepBase.h>
|
||||
#import <GNUstepBase/NSStream+GNUstepBase.h>
|
||||
#import <GNUstepBase/NSString+GNUstepBase.h>
|
||||
#import <GNUstepBase/NSTask+GNUstepBase.h>
|
||||
#import <GNUstepBase/NSThread+GNUstepBase.h>
|
||||
|
|
121
Headers/Additions/GNUstepBase/NSStream+GNUstepBase.h
Normal file
121
Headers/Additions/GNUstepBase/NSStream+GNUstepBase.h
Normal file
|
@ -0,0 +1,121 @@
|
|||
/** Declaration of extension methods for base additions
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
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 INCLUDED_NSStream_GNUstepBase_h
|
||||
#define INCLUDED_NSStream_GNUstepBase_h
|
||||
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
#import <Foundation/NSStream.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
|
||||
|
||||
/**
|
||||
* The additionalinterface defined for GNUstep.<br />
|
||||
* Currently NOT implemented when using the Apple Foundation!<br />
|
||||
* Please contribute an Apple implementation.
|
||||
*/
|
||||
@interface NSStream (GNUstepBase)
|
||||
|
||||
/**
|
||||
* Creates and returns by reference an NSInputStream object and
|
||||
* NSOutputStream object for a local socket or named pipe connection
|
||||
* with the specified path. To use them you need to open them and wait
|
||||
* on the NSStreamEventOpenCompleted event on one of them.
|
||||
*/
|
||||
+ (void) getLocalStreamsToPath: (NSString *)path
|
||||
inputStream: (NSInputStream **)inputStream
|
||||
outputStream: (NSOutputStream **)outputStream;
|
||||
/**
|
||||
* Creates and returns by reference an NSInputStream object and NSOutputStream
|
||||
* object for a anonymous local socket or pipe. Although you still need to
|
||||
* open them, the open will be instantaneous, and no NSStreamEventOpenCompleted
|
||||
* event will be delivered.
|
||||
*/
|
||||
+ (void) pipeWithInputStream: (NSInputStream **)inputStream
|
||||
outputStream: (NSOutputStream **)outputStream;
|
||||
@end
|
||||
|
||||
/**
|
||||
* GSServerStream is a subclass of NSStream that encapsulate a "server"
|
||||
* stream; * that is a stream that binds to a socket and accepts incoming
|
||||
* connections.<br />
|
||||
* Currently NOT implemented when using the Apple Foundation!<br />
|
||||
* Please contribute an Apple implementation.
|
||||
*/
|
||||
@interface GSServerStream : NSStream
|
||||
|
||||
/**
|
||||
* Createe a ip (ipv6) server stream
|
||||
*/
|
||||
+ (id) serverStreamToAddr: (NSString*)addr port: (NSInteger)port;
|
||||
|
||||
/**
|
||||
* Create a local (unix domain or named pipe) server stream
|
||||
*/
|
||||
+ (id) serverStreamToAddr: (NSString*)addr;
|
||||
|
||||
/**
|
||||
* This is the method that accepts a connection and generates two streams
|
||||
* as the server side inputStream and OutputStream.
|
||||
* Although you still need to open them, the open will be
|
||||
* instantanious, and no NSStreamEventOpenCompleted event will be delivered.
|
||||
*/
|
||||
- (void) acceptWithInputStream: (NSInputStream **)inputStream
|
||||
outputStream: (NSOutputStream **)outputStream;
|
||||
|
||||
/**
|
||||
* the designated initializer for a ip (ipv6) server stream
|
||||
*/
|
||||
- (id) initToAddr: (NSString*)addr port: (NSInteger)port;
|
||||
|
||||
/**
|
||||
* the designated initializer for a local (unix domain or named pipe)
|
||||
* server stream
|
||||
*/
|
||||
- (id) initToAddr: (NSString*)addr;
|
||||
|
||||
@end
|
||||
|
||||
/** May be used to read the local IP address of a tcp/ip network stream. */
|
||||
GS_EXPORT NSString * const GSStreamLocalAddressKey;
|
||||
/** May be used to read the local port of a tcp/ip network stream. */
|
||||
GS_EXPORT NSString * const GSStreamLocalPortKey;
|
||||
/** May be used to read the remote IP address of a tcp/ip network stream. */
|
||||
GS_EXPORT NSString * const GSStreamRemoteAddressKey;
|
||||
/** May be used to read the remote port of a tcp/ip network stream. */
|
||||
GS_EXPORT NSString * const GSStreamRemotePortKey;
|
||||
|
||||
#endif /* OS_API_VERSION */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* INCLUDED_NSStream_GNUstepBase_h */
|
||||
|
|
@ -249,67 +249,6 @@ typedef NSUInteger NSStreamEvent;
|
|||
|
||||
@end
|
||||
|
||||
/**
|
||||
* the additional interface defined for gnustep
|
||||
*/
|
||||
@interface NSStream (GNUstepExtensions)
|
||||
|
||||
/**
|
||||
* Creates and returns by reference an NSInputStream object and
|
||||
* NSOutputStream object for a local socket or named pipe connection
|
||||
* with the specified path. To use them you need to open them and wait
|
||||
* on the NSStreamEventOpenCompleted event on one of them.
|
||||
*/
|
||||
+ (void) getLocalStreamsToPath: (NSString *)path
|
||||
inputStream: (NSInputStream **)inputStream
|
||||
outputStream: (NSOutputStream **)outputStream;
|
||||
/**
|
||||
* Creates and returns by reference an NSInputStream object and NSOutputStream
|
||||
* object for a anonymous local socket or pipe. Although you still need to
|
||||
* open them, the open will be instantaneous, and no NSStreamEventOpenCompleted
|
||||
* event will be delivered.
|
||||
*/
|
||||
+ (void) pipeWithInputStream: (NSInputStream **)inputStream
|
||||
outputStream: (NSOutputStream **)outputStream;
|
||||
@end
|
||||
|
||||
/**
|
||||
* GSServerStream is a subclass of NSStream that encapsulate a "server" stream;
|
||||
* that is a stream that binds to a socket and accepts incoming connections
|
||||
*/
|
||||
@interface GSServerStream : NSStream
|
||||
|
||||
/**
|
||||
* Createe a ip (ipv6) server stream
|
||||
*/
|
||||
+ (id) serverStreamToAddr: (NSString*)addr port: (NSInteger)port;
|
||||
|
||||
/**
|
||||
* Create a local (unix domain or named pipe) server stream
|
||||
*/
|
||||
+ (id) serverStreamToAddr: (NSString*)addr;
|
||||
|
||||
/**
|
||||
* This is the method that accepts a connection and generates two streams
|
||||
* as the server side inputStream and OutputStream.
|
||||
* Although you still need to open them, the open will be
|
||||
* instantanious, and no NSStreamEventOpenCompleted event will be delivered.
|
||||
*/
|
||||
- (void) acceptWithInputStream: (NSInputStream **)inputStream
|
||||
outputStream: (NSOutputStream **)outputStream;
|
||||
|
||||
/**
|
||||
* the designated initializer for a ip (ipv6) server stream
|
||||
*/
|
||||
- (id) initToAddr: (NSString*)addr port: (NSInteger)port;
|
||||
|
||||
/**
|
||||
* the designated initializer for a local (unix domain or named pipe)
|
||||
* server stream
|
||||
*/
|
||||
- (id) initToAddr: (NSString*)addr;
|
||||
|
||||
@end
|
||||
|
||||
GS_EXPORT NSString * const NSStreamDataWrittenToMemoryStreamKey;
|
||||
GS_EXPORT NSString * const NSStreamFileCurrentOffsetKey;
|
||||
|
@ -331,15 +270,6 @@ GS_EXPORT NSString * const NSStreamSOCKSProxyVersion4;
|
|||
GS_EXPORT NSString * const NSStreamSOCKSProxyVersion5;
|
||||
GS_EXPORT NSString * const NSStreamSOCKSProxyVersionKey;
|
||||
|
||||
/** May be used to read the local IP address of a tcp/ip network stream. */
|
||||
GS_EXPORT NSString * const GSStreamLocalAddressKey;
|
||||
/** May be used to read the local port of a tcp/ip network stream. */
|
||||
GS_EXPORT NSString * const GSStreamLocalPortKey;
|
||||
/** May be used to read the remote IP address of a tcp/ip network stream. */
|
||||
GS_EXPORT NSString * const GSStreamRemoteAddressKey;
|
||||
/** May be used to read the remote port of a tcp/ip network stream. */
|
||||
GS_EXPORT NSString * const GSStreamRemotePortKey;
|
||||
|
||||
/**
|
||||
* Informal protocol for delegates of instance of the [NSStream] class.
|
||||
*/
|
||||
|
@ -351,6 +281,10 @@ GS_EXPORT NSString * const GSStreamRemotePortKey;
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !NO_GNUSTEP && !defined(GNUSTEP_BASE_INTERNAL)
|
||||
#import <GNUstepBase/NSStream+GNUstepBase.h>
|
||||
#endif
|
||||
|
||||
#endif /* 100200 */
|
||||
|
||||
#endif /* __NSStream_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
|
|
@ -54,6 +54,7 @@ Additions_OBJC_FILES =\
|
|||
NSNumber+GNUstepBase.m \
|
||||
NSObject+GNUstepBase.m \
|
||||
NSProcessInfo+GNUstepBase.m \
|
||||
NSStream+GNUstepBase.m \
|
||||
NSString+GNUstepBase.m \
|
||||
NSTask+GNUstepBase.m \
|
||||
NSThread+GNUstepBase.m \
|
||||
|
|
95
Source/Additions/NSStream+GNUstepBase.m
Normal file
95
Source/Additions/NSStream+GNUstepBase.m
Normal file
|
@ -0,0 +1,95 @@
|
|||
/* Implementation of extension methods to base additions
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
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"
|
||||
#import "GNUstepBase/NSStream+GNUstepBase.h"
|
||||
|
||||
/* Code used in GNUstepBase
|
||||
*/
|
||||
NSString * const GSStreamLocalAddressKey
|
||||
= @"GSStreamLocalAddressKey";
|
||||
NSString * const GSStreamLocalPortKey
|
||||
= @"GSStreamLocalPortKey";
|
||||
NSString * const GSStreamRemoteAddressKey
|
||||
= @"GSStreamRemoteAddressKey";
|
||||
NSString * const GSStreamRemotePortKey
|
||||
= @"GSStreamRemotePortKey";
|
||||
|
||||
|
||||
/* The remaining code is specific to the Apple Foundation
|
||||
*/
|
||||
#if !defined(GNUSTEP)
|
||||
@implementation NSStream (GNUstepBase)
|
||||
|
||||
+ (void) getLocalStreamsToPath: (NSString *)path
|
||||
inputStream: (NSInputStream **)inputStream
|
||||
outputStream: (NSOutputStream **)outputStream
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
+ (void) pipeWithInputStream: (NSInputStream **)inputStream
|
||||
outputStream: (NSOutputStream **)outputStream
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
@end
|
||||
|
||||
@implememntation GSServerStream
|
||||
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
+ (id) serverStreamToAddr: (NSString*)addr port: (NSInteger)port
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
+ (id) serverStreamToAddr: (NSString*)addr
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) acceptWithInputStream: (NSInputStream **)inputStream
|
||||
outputStream: (NSOutputStream **)outputStream
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (id) initToAddr: (NSString*)addr port: (NSInteger)port
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (id) initToAddr: (NSString*)addr
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
@end
|
||||
#endif
|
||||
|
|
@ -131,6 +131,7 @@ NSMutableString+GNUstepBase.h \
|
|||
NSNumber+GNUstepBase.h \
|
||||
NSObject+GNUstepBase.h \
|
||||
NSProcessInfo+GNUstepBase.h \
|
||||
NSStream+GNUstepBase.h \
|
||||
NSString+GNUstepBase.h \
|
||||
NSTask+GNUstepBase.h \
|
||||
NSThread+GNUstepBase.h \
|
||||
|
|
|
@ -98,7 +98,7 @@ SOCKIVARS
|
|||
- (void) _setSock: (SOCKET)sock;
|
||||
|
||||
/*
|
||||
* Set the socket addres from string information.
|
||||
* Set the socket address from string information.
|
||||
*/
|
||||
- (BOOL) _setSocketAddress: (NSString*)address
|
||||
port: (NSInteger)port
|
||||
|
|
|
@ -56,9 +56,10 @@
|
|||
`-- GSLocalServerStream (gnu/linux)
|
||||
*/
|
||||
|
||||
#include <Foundation/NSStream.h>
|
||||
#include <Foundation/NSRunLoop.h>
|
||||
#include <Foundation/NSMapTable.h>
|
||||
#import "Foundation/NSStream.h"
|
||||
#import "Foundation/NSRunLoop.h"
|
||||
#import "Foundation/NSMapTable.h"
|
||||
#import "GNUstepBase/NSStream+GNUstepBase.h"
|
||||
|
||||
/**
|
||||
* Convenience methods used to add streams to the run loop.
|
||||
|
|
|
@ -77,15 +77,6 @@ NSString * const NSStreamSOCKSProxyVersion5
|
|||
NSString * const NSStreamSOCKSProxyVersionKey
|
||||
= @"NSStreamSOCKSProxyVersionKey";
|
||||
|
||||
NSString * const GSStreamLocalAddressKey
|
||||
= @"GSStreamLocalAddressKey";
|
||||
NSString * const GSStreamLocalPortKey
|
||||
= @"GSStreamLocalPortKey";
|
||||
NSString * const GSStreamRemoteAddressKey
|
||||
= @"GSStreamRemoteAddressKey";
|
||||
NSString * const GSStreamRemotePortKey
|
||||
= @"GSStreamRemotePortKey";
|
||||
|
||||
|
||||
/*
|
||||
* Determine the type of event to use when adding a stream to the run loop.
|
||||
|
|
Loading…
Reference in a new issue