4 #include <nms_common.h>
9 #define MAX_PIPE_NAME_LEN 128
14 class LIBNETXMS_EXPORTABLE NamedPipe
16 friend class NamedPipeListener
;
19 TCHAR m_name
[MAX_PIPE_NAME_LEN
];
23 NamedPipe(const TCHAR
*name
, HPIPE handle
);
28 const TCHAR
*name() const { return m_name
; }
29 HPIPE
handle() { return m_handle
; }
31 bool write(const void *data
, size_t size
);
33 static NamedPipe
*connect(const TCHAR
*name
, UINT32 timeout
= 1000);
37 * Client request handler
39 typedef void (*NamedPipeRequestHandler
)(NamedPipe
*pipe
, void *userArg
);
42 * Named pipe listener (server)
44 class LIBNETXMS_EXPORTABLE NamedPipeListener
47 TCHAR m_name
[MAX_PIPE_NAME_LEN
];
49 NamedPipeRequestHandler m_reqHandler
;
51 THREAD m_serverThread
;
55 static THREAD_RESULT THREAD_CALL
serverThreadStarter(void *arg
);
57 NamedPipeListener(const TCHAR
*name
, HPIPE handle
, NamedPipeRequestHandler reqHandler
, void *userArg
);
62 const TCHAR
*name() const { return m_name
; }
67 static NamedPipeListener
*create(const TCHAR
*name
, NamedPipeRequestHandler reqHandler
, void *userArg
);
70 #endif /* _nxproc_h_ */