From 5e4ad23b78ea1931fddc24305d76a3d368984db9 Mon Sep 17 00:00:00 2001 From: mccallum Date: Tue, 12 Mar 1996 19:42:10 +0000 Subject: [PATCH] ([Port +outPacketClass]): Method renamed from packetClass. ([Port -outPacketClass]): Likewise. ([InPort -setReceivedPacketInvocation:]): Method renamed from setPacketInvocation. ([OutPort -sendPacket:]): Method renamed from -sendPacket:withTimeout:. (OutPacket, InPacket): New classes, replacing Packet class. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1119 72102866-910b-0410-8b05-ffd578937521 --- Source/Port.m | 67 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/Source/Port.m b/Source/Port.m index fc59f9388..594dba48e 100644 --- a/Source/Port.m +++ b/Source/Port.m @@ -73,7 +73,13 @@ is_valid = NO; } -- (Class) packetClass ++ (Class) outPacketClass +{ + [self subclassResponsibility: _cmd]; + return nil; +} + +- (Class) outPacketClass { [self subclassResponsibility: _cmd]; return nil; @@ -128,7 +134,7 @@ return nil; } -- (void) setPacketInvocation: (id )invocation +- (void) setReceivedPacketInvocation: (id )invocation { _packet_invocation = invocation; } @@ -155,7 +161,7 @@ return nil; } -- (BOOL) sendPacket: packet withTimeout: (int)milliseconds +- (BOOL) sendPacket: packet { [self subclassResponsibility:_cmd]; return NO; @@ -164,23 +170,56 @@ @end -@implementation Packet +@implementation InPacket -/* xxx There should be a designated initializer for the Packet class. - Currently some subclasses and users, bypass this by calling - MemoryStream initializers. */ - -- initForSendingWithCapacity: (unsigned)c - replyPort: p +/* The designated initializer. */ +- initForReceivingWithCapacity: (unsigned)c + receivingInPort: ip + replyOutPort: op { - [super initWithCapacity: c]; - reply_port = p; + [super initWithCapacity: c + prefix: 0]; + assert ([op isValid]); + assert (!ip || [ip isValid]); + _reply_out_port = op; + _receiving_in_port = ip; return self; } -- replyPort +- replyOutPort { - return reply_port; + return _reply_out_port; +} + +- receivingInPort +{ + return _receiving_in_port; +} + +@end + + +@implementation OutPacket + +/* The designated initializer. */ +- initForSendingWithCapacity: (unsigned)c + replyInPort: ip +{ + [super initWithCapacity: c + prefix: [[self class] prefixSize]]; + assert ([ip isValid]); + _reply_in_port = ip; + return self; +} + ++ (unsigned) prefixSize +{ + return 0; +} + +- replyInPort +{ + return _reply_in_port; } @end