2002-07-09 12:24:59 +00:00
|
|
|
#ifndef _PORTLINK_H_
|
|
|
|
#define _PORTLINK_H_
|
|
|
|
|
|
|
|
#include <Errors.h>
|
|
|
|
#include <OS.h>
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
#include <Rect.h>
|
2003-03-06 22:24:45 +00:00
|
|
|
#include <List.h>
|
2002-07-09 12:24:59 +00:00
|
|
|
|
|
|
|
class PortLinkData;
|
2003-06-23 13:18:39 +00:00
|
|
|
class PortMessage;
|
2002-07-09 12:24:59 +00:00
|
|
|
|
|
|
|
class PortLink
|
|
|
|
{
|
2003-07-04 21:04:37 +00:00
|
|
|
public:
|
2002-11-19 00:31:58 +00:00
|
|
|
class ReplyData
|
2002-09-30 22:34:20 +00:00
|
|
|
{
|
2002-11-19 00:31:58 +00:00
|
|
|
public:
|
|
|
|
ReplyData(void) { code=0; buffersize=0; buffer=NULL; }
|
2003-03-12 18:00:51 +00:00
|
|
|
~ReplyData(void) { if(buffer) delete buffer; }
|
2002-09-30 22:34:20 +00:00
|
|
|
int32 code;
|
|
|
|
ssize_t buffersize;
|
|
|
|
int8 *buffer;
|
2002-11-19 00:31:58 +00:00
|
|
|
};
|
2002-07-09 12:24:59 +00:00
|
|
|
PortLink(port_id port);
|
2002-09-30 22:34:20 +00:00
|
|
|
PortLink(const PortLink &link);
|
2002-07-09 12:24:59 +00:00
|
|
|
~PortLink(void);
|
|
|
|
void SetOpCode(int32 code);
|
|
|
|
void SetPort(port_id port);
|
|
|
|
port_id GetPort(void);
|
2002-09-30 22:34:20 +00:00
|
|
|
status_t Flush(bigtime_t timeout=B_INFINITE_TIMEOUT);
|
2002-07-09 12:24:59 +00:00
|
|
|
int8* FlushWithReply(int32 *code, status_t *status, ssize_t *buffersize,
|
|
|
|
bigtime_t timeout=B_INFINITE_TIMEOUT);
|
2002-09-30 22:34:20 +00:00
|
|
|
status_t FlushWithReply(PortLink::ReplyData *data,bigtime_t timeout=B_INFINITE_TIMEOUT);
|
2003-06-23 13:18:39 +00:00
|
|
|
status_t FlushWithReply(PortMessage *msg,bigtime_t timeout=B_INFINITE_TIMEOUT);
|
|
|
|
|
2003-03-21 13:09:22 +00:00
|
|
|
status_t Attach(const void *data, size_t size);
|
2003-07-11 01:49:58 +00:00
|
|
|
template <class Type> status_t Attach(Type data);
|
2002-07-09 12:24:59 +00:00
|
|
|
void MakeEmpty(void);
|
|
|
|
protected:
|
|
|
|
void FlattenData(int8 **buffer,int32 *size);
|
|
|
|
port_id target, replyport;
|
2002-09-30 22:34:20 +00:00
|
|
|
int32 opcode;
|
|
|
|
uint32 bufferlength,capacity;
|
|
|
|
bool port_ok;
|
2003-03-06 22:24:45 +00:00
|
|
|
BList *attachlist;
|
2002-07-09 12:24:59 +00:00
|
|
|
};
|
|
|
|
|
2003-04-14 01:56:41 +00:00
|
|
|
#endif
|