home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
prgramer
/
cenvi
/
namepipe.lib
< prev
next >
Wrap
Text File
|
1994-03-08
|
2KB
|
77 lines
// NamePipe.lib - Some interfaces to named pipes
// ver.1
#define NP_INDEFINITE_WAIT -1
#define NP_DEFAULT_WAIT 0
// DosPeekNmPipe() pipe states
#define NP_STATE_DISCONNECTED 0x0001
#define NP_STATE_LISTENING 0x0002
#define NP_STATE_CONNECTED 0x0003
#define NP_STATE_CLOSING 0x0004
// DosCreateNPipe open modes
#define NP_ACCESS_INBOUND 0x0000
#define NP_ACCESS_OUTBOUND 0x0001
#define NP_ACCESS_DUPLEX 0x0002
#define NP_INHERIT 0x0000
#define NP_NOINHERIT 0x0080
#define NP_WRITEBEHIND 0x0000
#define NP_NOWRITEBEHIND 0x4000
// DosCreateNPipe and DosQueryNPHState state
#define NP_READMODE_BYTE 0x0000
#define NP_READMODE_MESSAGE 0x0100
#define NP_TYPE_BYTE 0x0000
#define NP_TYPE_MESSAGE 0x0400
#define NP_END_CLIENT 0x0000
#define NP_END_SERVER 0x4000
#define NP_WAIT 0x0000
#define NP_NOWAIT 0x8000
#define NP_UNLIMITED_INSTANCES 0x00FF
#define ERROR_PIPE_NOT_CONNECTED 233
DosCreateNPipe(pszName,pHpipe,openmode,pipemode,cbInbuf,cbOutbuf,msec)
{
#define ORD_DOS32CREATENPIPE 243
_rc = DynamicLink("doscalls",ORD_DOS32CREATENPIPE,BIT32,CDECL,
pszName,_pHpipe,openmode,pipemode,cbInbuf,cbOutbuf,msec);
pHpipe = _pHpipe;
return(_rc);
}
DosConnectNPipe(hpipe)
{
#define ORD_DOS32CONNECTNPIPE 241
return DynamicLink("doscalls",ORD_DOS32CONNECTNPIPE,BIT32,CDECL,hpipe);
}
DosDisConnectNPipe(hpipe)
{
#define ORD_DOS32DISCONNECTNPIPE 242
return DynamicLink("doscalls",ORD_DOS32DISCONNECTNPIPE,BIT32,CDECL,hpipe);
}
DosSetNPHState(hpipe,newState)
{
#define ORD_DOS32SETNPHSTATE 250
return DynamicLink("doscalls",ORD_DOS32SETNPHSTATE,BIT32,CDECL,hpipe,newState);
}
DosTransactNPipe(hpipe,pOutbuf,cbOut,pInbuf,cbIn,pcbRead)
{
#define ORD_DOS32TRANSACTNPIPE 252
// Make sure that input buffer area is big enough
if ( !defined(pInbuf) || BLObSize(pInbuf) < cbIn )
BLObSize(pInBuf,cbIn);
lrc = DynamicLink("doscalls",ORD_DOS32TRANSACTNPIPE,BIT32,CDECL,
hpipe,pOutbuf,cbOut,pInbuf,cbIn,_pcbRead);
pcbRead = defined(_pcbRead) ? _pcbRead : 0 ;
return( lrc );
}