2 Copyright (C) 2004-2006 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 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 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __JackWinNamedPipe__
21 #define __JackWinNamedPipe__
23 #include "JackChannelTransaction.h"
31 class JackWinNamedPipe
: public JackChannelTransaction
41 JackWinNamedPipe(): fNamedPipe(INVALID_HANDLE_VALUE
)
43 JackWinNamedPipe(HANDLE pipe
): fNamedPipe(pipe
)
45 virtual ~JackWinNamedPipe()
48 virtual int Read(void* data
, int len
);
49 virtual int Write(void* data
, int len
);
53 \brief Client named pipe.
56 class JackWinNamedPipeClient
: public JackWinNamedPipe
61 JackWinNamedPipeClient(): JackWinNamedPipe()
63 JackWinNamedPipeClient(HANDLE pipe
): JackWinNamedPipe(pipe
)
66 virtual ~JackWinNamedPipeClient()
69 virtual int Connect(const char* dir
, int which
);
70 virtual int Connect(const char* dir
, const char* name
, int which
);
72 virtual void SetReadTimeOut(long sec
);
73 virtual void SetWriteTimeOut(long sec
);
76 class JackWinAsyncNamedPipeClient
: public JackWinNamedPipeClient
78 enum kIOState
{kIdle
= 0, kConnecting
, kReading
, kWriting
};
88 JackWinAsyncNamedPipeClient();
89 JackWinAsyncNamedPipeClient(HANDLE pipe
, bool pending
);
90 virtual ~JackWinAsyncNamedPipeClient();
92 virtual int Read(void* data
, int len
);
93 virtual int Write(void* data
, int len
);
97 return fOverlap
.hEvent
;
100 kIOState
GetIOState()
114 \brief Server named pipe.
117 class JackWinNamedPipeServer
: public JackWinNamedPipe
122 JackWinNamedPipeServer(): JackWinNamedPipe()
124 virtual ~JackWinNamedPipeServer()
127 virtual int Bind(const char* dir
, int which
);
128 virtual int Bind(const char* dir
, const char* name
, int which
);
129 virtual bool Accept();
130 virtual JackWinNamedPipeClient
* AcceptClient();
135 \brief Server async named pipe.
138 class JackWinAsyncNamedPipeServer
: public JackWinNamedPipeServer
143 JackWinAsyncNamedPipeServer(): JackWinNamedPipeServer()
145 virtual ~JackWinAsyncNamedPipeServer()
148 int Bind(const char* dir
, int which
);
149 int Bind(const char* dir
, const char* name
, int which
);
151 JackWinNamedPipeClient
* AcceptClient();
155 } // end of namespace