2002-06-30 09:19:30 +00:00
|
|
|
/* Interface for GSFileHandle for GNUStep
|
|
|
|
Copyright (C) 1997-2002 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
|
|
|
Date: 1997
|
|
|
|
|
|
|
|
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 Library 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 Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
2006-09-13 10:20:49 +00:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02111 USA.
|
2002-06-30 09:19:30 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GSFileHandle_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __GSFileHandle_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
|
|
|
|
#include <Foundation/NSFileHandle.h>
|
|
|
|
#include <Foundation/NSArray.h>
|
|
|
|
#include <Foundation/NSDictionary.h>
|
|
|
|
#include <Foundation/NSRunLoop.h>
|
|
|
|
|
2007-02-18 23:09:07 +00:00
|
|
|
#include <GNUstepBase/GSConfig.h>
|
2002-06-30 09:19:30 +00:00
|
|
|
|
|
|
|
#if USE_ZLIB
|
|
|
|
#include <zlib.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
@interface GSFileHandle : NSFileHandle <RunLoopEvents, GCFinalization>
|
|
|
|
{
|
|
|
|
int descriptor;
|
|
|
|
BOOL closeOnDealloc;
|
|
|
|
BOOL isStandardFile;
|
|
|
|
BOOL isNullDevice;
|
2002-06-30 09:43:21 +00:00
|
|
|
BOOL isSocket;
|
2002-06-30 09:19:30 +00:00
|
|
|
BOOL isNonBlocking;
|
|
|
|
BOOL wasNonBlocking;
|
|
|
|
BOOL acceptOK;
|
|
|
|
BOOL connectOK;
|
|
|
|
BOOL readOK;
|
|
|
|
BOOL writeOK;
|
|
|
|
NSMutableDictionary *readInfo;
|
|
|
|
int readMax;
|
|
|
|
NSMutableArray *writeInfo;
|
|
|
|
int writePos;
|
|
|
|
NSString *address;
|
|
|
|
NSString *service;
|
|
|
|
NSString *protocol;
|
|
|
|
#if USE_ZLIB
|
|
|
|
gzFile gzDescriptor;
|
|
|
|
#endif
|
2005-10-11 19:09:26 +00:00
|
|
|
#if defined(__MINGW32__)
|
2005-02-23 16:05:09 +00:00
|
|
|
WSAEVENT event;
|
|
|
|
#endif
|
2002-06-30 09:19:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initAsClientAtAddress: (NSString*)address
|
|
|
|
service: (NSString*)service
|
|
|
|
protocol: (NSString*)protocol;
|
|
|
|
- (id) initAsClientInBackgroundAtAddress: (NSString*)address
|
|
|
|
service: (NSString*)service
|
|
|
|
protocol: (NSString*)protocol
|
|
|
|
forModes: (NSArray*)modes;
|
|
|
|
- (id) initAsServerAtAddress: (NSString*)address
|
|
|
|
service: (NSString*)service
|
|
|
|
protocol: (NSString*)protocol;
|
|
|
|
- (id) initForReadingAtPath: (NSString*)path;
|
|
|
|
- (id) initForWritingAtPath: (NSString*)path;
|
|
|
|
- (id) initForUpdatingAtPath: (NSString*)path;
|
|
|
|
- (id) initWithStandardError;
|
|
|
|
- (id) initWithStandardInput;
|
|
|
|
- (id) initWithStandardOutput;
|
|
|
|
- (id) initWithNullDevice;
|
|
|
|
|
|
|
|
- (void) checkAccept;
|
|
|
|
- (void) checkConnect;
|
|
|
|
- (void) checkRead;
|
|
|
|
- (void) checkWrite;
|
|
|
|
|
|
|
|
- (void) ignoreReadDescriptor;
|
|
|
|
- (void) ignoreWriteDescriptor;
|
|
|
|
- (void) setNonBlocking: (BOOL)flag;
|
|
|
|
- (void) postReadNotification;
|
|
|
|
- (void) postWriteNotification;
|
2002-09-29 08:43:24 +00:00
|
|
|
- (int) read: (void*)buf length: (int)len;
|
2002-06-30 09:19:30 +00:00
|
|
|
- (void) receivedEvent: (void*)data
|
|
|
|
type: (RunLoopEventType)type
|
|
|
|
extra: (void*)extra
|
|
|
|
forMode: (NSString*)mode;
|
|
|
|
- (void) setAddr: (struct sockaddr_in *)sin;
|
|
|
|
- (BOOL) useCompression;
|
|
|
|
- (void) watchReadDescriptorForModes: (NSArray*)modes;
|
|
|
|
- (void) watchWriteDescriptor;
|
2002-09-29 08:43:24 +00:00
|
|
|
- (int) write: (const void*)buf length: (int)len;
|
2002-06-30 09:19:30 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#endif /* __GSFileHandle_h_GNUSTEP_BASE_INCLUDE */
|