2 Copyright (C) 2004-2008 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #ifndef __JackWinNamedPipe__
22 #define __JackWinNamedPipe__
29 class JackWinNamedPipe
39 JackWinNamedPipe(): fNamedPipe(INVALID_HANDLE_VALUE
)
41 JackWinNamedPipe(HANDLE pipe
): fNamedPipe(pipe
)
43 virtual ~JackWinNamedPipe()
46 virtual int Read(void* data
, int len
);
47 virtual int Write(void* data
, int len
);
51 \brief Client named pipe.
54 class JackWinNamedPipeClient
: public JackWinNamedPipe
59 JackWinNamedPipeClient(): JackWinNamedPipe()
61 JackWinNamedPipeClient(HANDLE pipe
): JackWinNamedPipe(pipe
)
64 virtual ~JackWinNamedPipeClient()
67 virtual int Connect(const char* dir
, int which
);
68 virtual int Connect(const char* dir
, const char* name
, int which
);
70 virtual void SetReadTimeOut(long sec
);
71 virtual void SetWriteTimeOut(long sec
);
74 class JackWinAsyncNamedPipeClient
: public JackWinNamedPipeClient
76 enum kIOState
{kIdle
= 0, kConnecting
, kReading
, kWriting
};
86 JackWinAsyncNamedPipeClient();
87 JackWinAsyncNamedPipeClient(HANDLE pipe
, bool pending
);
88 virtual ~JackWinAsyncNamedPipeClient();
90 virtual int Read(void* data
, int len
);
91 virtual int Write(void* data
, int len
);
95 return (HANDLE
)fOverlap
.hEvent
;
112 \brief Server named pipe.
115 class JackWinNamedPipeServer
: public JackWinNamedPipe
120 JackWinNamedPipeServer(): JackWinNamedPipe()
122 virtual ~JackWinNamedPipeServer()
125 virtual int Bind(const char* dir
, int which
);
126 virtual int Bind(const char* dir
, const char* name
, int which
);
127 virtual bool Accept();
128 virtual JackWinNamedPipeClient
* AcceptClient();
133 \brief Server async named pipe.
136 class JackWinAsyncNamedPipeServer
: public JackWinNamedPipeServer
141 JackWinAsyncNamedPipeServer(): JackWinNamedPipeServer()
143 virtual ~JackWinAsyncNamedPipeServer()
146 int Bind(const char* dir
, int which
);
147 int Bind(const char* dir
, const char* name
, int which
);
149 JackWinNamedPipeClient
* AcceptClient();
153 } // end of namespace