-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnpipe.hpp
44 lines (39 loc) · 1.13 KB
/
npipe.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// npipe.hpp -- define UNIX implementation of a minimal
// windows NT named pipe service
// 20070308 bcb Added changes for BSD and DARWIN
// 20100619 bcb Added no-copy to the NamedPipe class.
// 20100717 mvh Merged
#ifndef NPIPE_HPP
#define NPIPE_HPP
#include <sys/types.h>
#include "dicom.hpp"
class NamedPipe
{
public:
NamedPipe(char *theName);
~NamedPipe();
BOOL Create();
void Destroy();
size_t Write(unsigned char *theBuffer, size_t theLength);
size_t Read(unsigned char *theBuffer, size_t theLength);
BOOL Wait(size_t theWaitTime);
BOOL Connect(); // establish connection
void Disconnect(); // terminate connection
private:
char *itsName;
BOOL itsCreatedHere;
int itsControlReadFd; // connections received here
int itsControlWriteFd; // this FD bound to name in filesystem
#ifndef BSD
int itsConnectionFd; // this is the FD used for a connection
// which has been established
#else //BSD
FILE *itsConnectionFd;
#endif
#ifdef __GNUC__
private:// This will prevent it from being copied (it has a pointer)
NamedPipe(const NamedPipe&);
const NamedPipe & operator = (const NamedPipe&);
#endif
};
#endif