From 7b6beb9bdeaeb59868ebc3aff82e58a995878d74 Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Fri, 3 Oct 2003 22:20:28 +0000 Subject: [PATCH] BSession is no longer a parent class Removal of deprecated reply functions Global protocol change - reply port is at the end of data, not the beginning PortLink still uses the BSession messaging style git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4933 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/app/PortLink.h | 71 ++++++++++++++-------------------- 1 file changed, 30 insertions(+), 41 deletions(-) diff --git a/headers/private/app/PortLink.h b/headers/private/app/PortLink.h index 5bedb4c404..f9c6889fc3 100644 --- a/headers/private/app/PortLink.h +++ b/headers/private/app/PortLink.h @@ -1,58 +1,47 @@ #ifndef _PORTLINK_H #define _PORTLINK_H - #include #include -#include "Session.h" - class PortMessage; -class PortLink : public BSession{ +class PortLink +{ public: - class ReplyData - { - public: - ReplyData(void) { code=0; buffersize=0; buffer=NULL; } - ~ReplyData(void) { if(buffer) delete buffer; } - - int32 code; - ssize_t buffersize; - int8 *buffer; - }; - - PortLink( port_id port ); - PortLink( const PortLink &link ); - virtual ~PortLink() { } + PortLink(port_id port); + PortLink(const PortLink &link); + virtual ~PortLink(void) { } - void SetOpCode( int32 code ); - void SetPort( port_id port ); - port_id GetPort(); - status_t Flush( bigtime_t timeout = B_INFINITE_TIMEOUT ); - int8* FlushWithReply( int32 *code, status_t *status, ssize_t *buffersize, - bigtime_t timeout=B_INFINITE_TIMEOUT ); - status_t FlushWithReply( PortLink::ReplyData *data,bigtime_t timeout=B_INFINITE_TIMEOUT ); - status_t FlushWithReply( PortMessage *msg,bigtime_t timeout=B_INFINITE_TIMEOUT ); + void SetOpCode(int32 code); + + void SetPort(port_id port); + port_id GetPort(); + + status_t Flush(bigtime_t timeout = B_INFINITE_TIMEOUT); + status_t FlushWithReply(PortMessage *msg,bigtime_t timeout=B_INFINITE_TIMEOUT); - status_t Attach(const void *data, size_t size); - void MakeEmpty(); - template status_t Attach(Type data) - { - int32 size = sizeof(Type); + void MakeEmpty(); + status_t Attach(const void *data, size_t size); + template status_t Attach(Type data) + { + int32 size = sizeof(Type); - if (4096 - fSendPosition > size){ - memcpy(fSendBuffer + fSendPosition, &data, size); - fSendPosition += size; - return B_OK; - } - return B_NO_MEMORY; + if (4096 - fSendPosition > size){ + memcpy(fSendBuffer + fSendPosition, &data, size); + fSendPosition += size; + return B_OK; } - + return B_NO_MEMORY; + } + private: - bool port_ok; + bool port_ok; + port_id fSendPort; + port_id fReceivePort; + char *fSendBuffer; + int32 fSendPosition; + int32 fSendCode; }; -//extern _IMPEXP_BE _PortLink_ *main_session; - #endif