Reporting: oracle schema fixed
[public/netxms.git] / include / nxcpapi.h
CommitLineData
9fa031cd 1/*
0d9c1b96 2** NetXMS - Network Management System
9f2ad16c 3** NXCP API
68f384ea 4** Copyright (C) 2003-2010 Victor Kirhenshtein
0d9c1b96
VK
5**
6** This program is free software; you can redistribute it and/or modify
65d2c384
VK
7** it under the terms of the GNU Lesser General Public License as published by
8** the Free Software Foundation; either version 3 of the License, or
0d9c1b96
VK
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
68f384ea 16** You should have received a copy of the GNU Lesser General Public License
0d9c1b96
VK
17** along with this program; if not, write to the Free Software
18** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19**
9f2ad16c 20** File: nxcpapi.h
0d9c1b96
VK
21**
22**/
23
9f2ad16c
VK
24#ifndef _nxcpapi_h_
25#define _nxcpapi_h_
0d9c1b96 26
9f2ad16c 27#include <nms_util.h>
bf6fb6c3 28#include <nms_threads.h>
de4af576 29#include <uuid.h>
8c290af0 30
bb8136f7
VK
31#ifdef _WIN32
32#include <wincrypt.h>
33#endif
34
4af351c7 35/**
b368969c 36 * Temporary buffer structure for RecvNXCPMessage() function
4af351c7 37 */
0d9c1b96
VK
38typedef struct
39{
b368969c
VK
40 UINT32 bufferSize;
41 UINT32 bufferPos;
43a6f3ca 42 char buffer[NXCP_TEMP_BUF_SIZE];
b368969c 43} NXCP_BUFFER;
0d9c1b96
VK
44
45
9f2ad16c
VK
46#ifdef __cplusplus
47
5c44534b
VK
48struct MessageField;
49
4af351c7
VK
50/**
51 * Parsed NXCP message
52 */
b368969c 53class LIBNETXMS_EXPORTABLE NXCPMessage
0d9c1b96
VK
54{
55private:
b368969c
VK
56 UINT16 m_code;
57 UINT16 m_flags;
5c44534b 58 UINT32 m_id;
6be0a20b
VK
59 MessageField *m_fields; // Message fields
60 int m_version; // Protocol version
61 BYTE *m_data; // binary data
62 size_t m_dataSize; // binary data size
0d9c1b96 63
712b2760 64 void *set(UINT32 fieldId, BYTE type, const void *value, bool isSigned = false, size_t size = 0);
ca0a165b
VK
65 void *get(UINT32 fieldId, BYTE requiredType, BYTE *fieldType = NULL) const;
66 NXCP_MESSAGE_FIELD *find(UINT32 fieldId) const;
0d9c1b96
VK
67
68public:
b368969c
VK
69 NXCPMessage(int version = NXCP_VERSION);
70 NXCPMessage(NXCPMessage *msg);
71 NXCPMessage(NXCP_MESSAGE *rawMag, int version = NXCP_VERSION);
72 ~NXCPMessage();
0d9c1b96 73
c4b35dc7 74 NXCP_MESSAGE *createMessage() const;
0d9c1b96 75
ca0a165b 76 UINT16 getCode() const { return m_code; }
b368969c 77 void setCode(UINT16 code) { m_code = code; }
0d9c1b96 78
ca0a165b 79 UINT32 getId() const { return m_id; }
b368969c 80 void setId(UINT32 id) { m_id = id; }
0d9c1b96 81
ca0a165b
VK
82 bool isEndOfFile() const { return (m_flags & MF_END_OF_FILE) ? true : false; }
83 bool isEndOfSequence() const { return (m_flags & MF_END_OF_SEQUENCE) ? true : false; }
84 bool isReverseOrder() const { return (m_flags & MF_REVERSE_ORDER) ? true : false; }
85 bool isBinary() const { return (m_flags & MF_BINARY) ? true : false; }
86 bool isControl() const { return (m_flags & MF_CONTROL) ? true : false; }
87 bool isCompressed() const { return (m_flags & MF_COMPRESSED) ? true : false; }
6be0a20b 88
ca0a165b
VK
89 const BYTE *getBinaryData() const { return m_data; }
90 size_t getBinaryDataSize() const { return m_dataSize; }
4af351c7 91
ca0a165b
VK
92 bool isFieldExist(UINT32 fieldId) const { return find(fieldId) != NULL; }
93 int getFieldType(UINT32 fieldId) const;
4101571e 94
712b2760
VK
95 void setField(UINT32 fieldId, INT16 value) { set(fieldId, NXCP_DT_INT16, &value, true); }
96 void setField(UINT32 fieldId, UINT16 value) { set(fieldId, NXCP_DT_INT16, &value, false); }
97 void setField(UINT32 fieldId, INT32 value) { set(fieldId, NXCP_DT_INT32, &value, true); }
98 void setField(UINT32 fieldId, UINT32 value) { set(fieldId, NXCP_DT_INT32, &value, false); }
99 void setField(UINT32 fieldId, INT64 value) { set(fieldId, NXCP_DT_INT64, &value, true); }
100 void setField(UINT32 fieldId, UINT64 value) { set(fieldId, NXCP_DT_INT64, &value, false); }
b368969c 101 void setField(UINT32 fieldId, double value) { set(fieldId, NXCP_DT_FLOAT, &value); }
19a2cd39 102 void setField(UINT32 fieldId, bool value) { INT16 v = value ? 1 : 0; set(fieldId, NXCP_DT_INT16, &v, true); }
b368969c 103 void setField(UINT32 fieldId, const TCHAR *value) { if (value != NULL) set(fieldId, NXCP_DT_STRING, value); }
712b2760 104 void setField(UINT32 fieldId, const TCHAR *value, size_t maxLen) { if (value != NULL) set(fieldId, NXCP_DT_STRING, value, false, maxLen); }
5f573844 105 void setField(UINT32 fieldId, const BYTE *value, size_t size) { set(fieldId, NXCP_DT_BINARY, value, false, size); }
de4af576
VK
106 void setField(UINT32 fieldId, const InetAddress& value) { set(fieldId, NXCP_DT_INETADDR, &value); }
107 void setField(UINT32 fieldId, const uuid& value) { set(fieldId, NXCP_DT_BINARY, value.getValue(), false, UUID_LENGTH); }
35f836fe 108#ifdef UNICODE
b368969c 109 void setFieldFromMBString(UINT32 fieldId, const char *value);
35f836fe 110#else
b368969c 111 void setFieldFromMBString(UINT32 fieldId, const char *value) { set(fieldId, NXCP_DT_STRING, value); }
35f836fe 112#endif
b368969c 113 void setFieldFromTime(UINT32 fieldId, time_t value) { UINT64 t = (UINT64)value; set(fieldId, NXCP_DT_INT64, &t); }
14149881 114 void setFieldFromInt32Array(UINT32 fieldId, size_t numElements, const UINT32 *elements);
b368969c 115 void setFieldFromInt32Array(UINT32 fieldId, IntegerArray<UINT32> *data);
8f238fd7 116 bool setFieldFromFile(UINT32 fieldId, const TCHAR *pszFileName);
967893bb 117
ca0a165b
VK
118 INT16 getFieldAsInt16(UINT32 fieldId) const;
119 UINT16 getFieldAsUInt16(UINT32 fieldId) const;
120 INT32 getFieldAsInt32(UINT32 fieldId) const;
121 UINT32 getFieldAsUInt32(UINT32 fieldId) const;
122 INT64 getFieldAsInt64(UINT32 fieldId) const;
123 UINT64 getFieldAsUInt64(UINT32 fieldId) const;
124 double getFieldAsDouble(UINT32 fieldId) const;
125 bool getFieldAsBoolean(UINT32 fieldId) const;
126 time_t getFieldAsTime(UINT32 fieldId) const;
127 UINT32 getFieldAsInt32Array(UINT32 fieldId, UINT32 numElements, UINT32 *buffer) const;
128 UINT32 getFieldAsInt32Array(UINT32 fieldId, IntegerArray<UINT32> *data) const;
129 const BYTE *getBinaryFieldPtr(UINT32 fieldId, size_t *size) const;
130 TCHAR *getFieldAsString(UINT32 fieldId, TCHAR *buffer = NULL, size_t bufferSize = 0) const;
131 char *getFieldAsMBString(UINT32 fieldId, char *buffer = NULL, size_t bufferSize = 0) const;
132 char *getFieldAsUtf8String(UINT32 fieldId, char *buffer = NULL, size_t bufferSize = 0) const;
133 UINT32 getFieldAsBinary(UINT32 fieldId, BYTE *buffer, size_t bufferSize) const;
134 InetAddress getFieldAsInetAddress(UINT32 fieldId) const;
135 uuid getFieldAsGUID(UINT32 fieldId) const;
4101571e 136
b368969c 137 void deleteAllFields();
e44ac467 138
5c44534b
VK
139 void disableEncryption() { m_flags |= MF_DONT_ENCRYPT; }
140 void setEndOfSequence() { m_flags |= MF_END_OF_SEQUENCE; }
141 void setReverseOrderFlag() { m_flags |= MF_REVERSE_ORDER; }
934f53da 142
ca0a165b 143 static String dump(const NXCP_MESSAGE *msg, int version);
0d9c1b96
VK
144};
145
4af351c7
VK
146/**
147 * Message waiting queue element structure
148 */
deaa4491
VK
149typedef struct
150{
b368969c 151 void *msg; // Pointer to message, either to NXCPMessage object or raw message
14149881 152 UINT64 sequence; // Sequence number
f128c07c
VK
153 UINT32 id; // Message ID
154 UINT32 ttl; // Message time-to-live in milliseconds
155 UINT16 code; // Message code
156 UINT16 isBinary; // 1 for binary (raw) messages
deaa4491
VK
157} WAIT_QUEUE_ELEMENT;
158
4af351c7 159/**
f128c07c
VK
160 * Max number of waiting threads in message queue
161 */
162#define MAX_MSGQUEUE_WAITERS 32
163
164/**
4af351c7
VK
165 * Message waiting queue class
166 */
9f2ad16c 167class LIBNETXMS_EXPORTABLE MsgWaitQueue
deaa4491 168{
deaa4491 169private:
ef8a3c32 170#if defined(_WIN32)
f128c07c
VK
171 CRITICAL_SECTION m_mutex;
172 HANDLE m_wakeupEvents[MAX_MSGQUEUE_WAITERS];
173 BYTE m_waiters[MAX_MSGQUEUE_WAITERS];
ef8a3c32
VK
174#elif defined(_USE_GNU_PTH)
175 pth_mutex_t m_mutex;
176 pth_cond_t m_wakeupCondition;
f128c07c
VK
177#else
178 pthread_mutex_t m_mutex;
179 pthread_cond_t m_wakeupCondition;
180#endif
f128c07c
VK
181 UINT32 m_holdTime;
182 int m_size;
183 int m_allocated;
184 WAIT_QUEUE_ELEMENT *m_elements;
14149881 185 UINT64 m_sequence;
deaa4491 186
f128c07c
VK
187 void *waitForMessageInternal(UINT16 isBinary, UINT16 code, UINT32 id, UINT32 timeout);
188
189 void lock()
190 {
191#ifdef _WIN32
192 EnterCriticalSection(&m_mutex);
ef8a3c32
VK
193#elif defined(_USE_GNU_PTH)
194 pth_mutex_acquire(&m_mutex, FALSE, NULL);
f128c07c
VK
195#else
196 pthread_mutex_lock(&m_mutex);
197#endif
198 }
199
200 void unlock()
201 {
202#ifdef _WIN32
203 LeaveCriticalSection(&m_mutex);
ef8a3c32
VK
204#elif defined(_USE_GNU_PTH)
205 pth_mutex_release(&m_mutex);
f128c07c
VK
206#else
207 pthread_mutex_unlock(&m_mutex);
208#endif
209 }
cc022855 210
d87ddcc2
VK
211 void housekeeperRun();
212
213 static MUTEX m_housekeeperLock;
214 static HashMap<UINT64, MsgWaitQueue> *m_activeQueues;
215 static CONDITION m_shutdownCondition;
216 static THREAD m_housekeeperThread;
217 static EnumerationCallbackResult houseKeeperCallback(const void *key, const void *object, void *arg);
218 static THREAD_RESULT THREAD_CALL housekeeperThread(void *);
219 static EnumerationCallbackResult diagInfoCallback(const void *key, const void *object, void *arg);
deaa4491
VK
220
221public:
222 MsgWaitQueue();
223 ~MsgWaitQueue();
224
b368969c
VK
225 void put(NXCPMessage *pMsg);
226 void put(NXCP_MESSAGE *pMsg);
227 NXCPMessage *waitForMessage(WORD wCode, UINT32 dwId, UINT32 dwTimeOut)
deaa4491 228 {
b368969c 229 return (NXCPMessage *)waitForMessageInternal(0, wCode, dwId, dwTimeOut);
deaa4491 230 }
b368969c 231 NXCP_MESSAGE *waitForRawMessage(WORD wCode, UINT32 dwId, UINT32 dwTimeOut)
deaa4491 232 {
b368969c 233 return (NXCP_MESSAGE *)waitForMessageInternal(1, wCode, dwId, dwTimeOut);
deaa4491 234 }
cc022855 235
c17f6cbc 236 void clear();
f128c07c 237 void setHoldTime(UINT32 holdTime) { m_holdTime = holdTime; }
d87ddcc2
VK
238
239 static void shutdown();
240 static String getDiagInfo();
deaa4491
VK
241};
242
b549a0f8
VK
243/**
244 * NXCP encryption context
245 */
98abc9f1
VK
246class LIBNETXMS_EXPORTABLE NXCPEncryptionContext : public RefCountObject
247{
248private:
249 int m_cipher;
250 BYTE *m_sessionKey;
251 int m_keyLength;
252 BYTE m_iv[EVP_MAX_IV_LENGTH];
e4e091f0 253#ifdef _WITH_ENCRYPTION
e6336a90
VK
254 EVP_CIPHER_CTX m_encryptor;
255 EVP_CIPHER_CTX m_decryptor;
db05c2af 256 MUTEX m_encryptorLock;
e4e091f0 257#endif
98abc9f1
VK
258
259 NXCPEncryptionContext();
e6336a90 260 bool initCipher(int cipher);
98abc9f1
VK
261
262public:
b368969c 263 static NXCPEncryptionContext *create(NXCPMessage *msg, RSA *privateKey);
967893bb 264 static NXCPEncryptionContext *create(UINT32 ciphers);
98abc9f1
VK
265
266 virtual ~NXCPEncryptionContext();
267
b368969c 268 NXCP_ENCRYPTED_MESSAGE *encryptMessage(NXCP_MESSAGE *msg);
6be0a20b 269 bool decryptMessage(NXCP_ENCRYPTED_MESSAGE *msg, BYTE *decryptionBuffer);
e6336a90 270
98abc9f1
VK
271 int getCipher() { return m_cipher; }
272 BYTE *getSessionKey() { return m_sessionKey; }
273 int getKeyLength() { return m_keyLength; }
274 BYTE *getIV() { return m_iv; }
275};
276
6be0a20b
VK
277/**
278 * Message receiver result codes
279 */
280enum MessageReceiverResult
281{
282 MSGRECV_SUCCESS = 0,
283 MSGRECV_CLOSED = 1,
284 MSGRECV_TIMEOUT = 2,
285 MSGRECV_COMM_FAILURE = 3,
1bb62997
VK
286 MSGRECV_DECRYPTION_FAILURE = 4,
287 MSGRECV_PROTOCOL_ERROR = 5
6be0a20b
VK
288};
289
290/**
291 * Message receiver - abstract base class
292 */
293class LIBNETXMS_EXPORTABLE AbstractMessageReceiver
294{
295private:
296 BYTE *m_buffer;
297 BYTE *m_decryptionBuffer;
298 NXCPEncryptionContext *m_encryptionContext;
299 size_t m_initialSize;
300 size_t m_size;
301 size_t m_maxSize;
302 size_t m_dataSize;
303 size_t m_bytesToSkip;
304
1bb62997 305 NXCPMessage *getMessageFromBuffer(bool *protocolError);
6be0a20b
VK
306
307protected:
308 virtual int readBytes(BYTE *buffer, size_t size, UINT32 timeout) = 0;
309
310public:
311 AbstractMessageReceiver(size_t initialSize, size_t maxSize);
312 virtual ~AbstractMessageReceiver();
313
314 void setEncryptionContext(NXCPEncryptionContext *ctx) { m_encryptionContext = ctx; }
315
b368969c
VK
316 NXCPMessage *readMessage(UINT32 timeout, MessageReceiverResult *result);
317 NXCP_MESSAGE *getRawMessageBuffer() { return (NXCP_MESSAGE *)m_buffer; }
318
319 static const TCHAR *resultToText(MessageReceiverResult result);
6be0a20b
VK
320};
321
322/**
323 * Message receiver - socket implementation
324 */
325class LIBNETXMS_EXPORTABLE SocketMessageReceiver : public AbstractMessageReceiver
326{
327private:
328 SOCKET m_socket;
329
330protected:
331 virtual int readBytes(BYTE *buffer, size_t size, UINT32 timeout);
332
333public:
334 SocketMessageReceiver(SOCKET socket, size_t initialSize, size_t maxSize);
335 virtual ~SocketMessageReceiver();
336};
337
338/**
339 * Message receiver - UNIX socket/named pipe implementation
340 */
341class LIBNETXMS_EXPORTABLE PipeMessageReceiver : public AbstractMessageReceiver
342{
343private:
344 HPIPE m_pipe;
345#ifdef _WIN32
346 HANDLE m_readEvent;
347#endif
348
349protected:
350 virtual int readBytes(BYTE *buffer, size_t size, UINT32 timeout);
351
352public:
353 PipeMessageReceiver(HPIPE pipe, size_t initialSize, size_t maxSize);
354 virtual ~PipeMessageReceiver();
355};
356
503da871
VK
357/**
358 * NXCP compression methods
359 */
360enum NXCPCompressionMethod
361{
362 NXCP_COMPRESSION_NONE = 0,
363 NXCP_COMPRESSION_LZ4 = 1
364};
365
366/**
367 * Abstract stream compressor
368 */
369class LIBNETXMS_EXPORTABLE StreamCompressor
370{
371public:
9757ca46
VK
372 virtual ~StreamCompressor();
373
503da871
VK
374 virtual size_t compress(const BYTE *in, size_t inSize, BYTE *out, size_t maxOutSize) = 0;
375 virtual size_t decompress(const BYTE *in, size_t inSize, const BYTE **out) = 0;
376 virtual size_t compressBufferSize(size_t dataSize) = 0;
377
378 static StreamCompressor *create(NXCPCompressionMethod method, bool compress, size_t maxBlockSize);
379};
380
381/**
382 * Dummy stream compressor
383 */
384class LIBNETXMS_EXPORTABLE DummyStreamCompressor : public StreamCompressor
385{
386public:
9757ca46
VK
387 virtual ~DummyStreamCompressor();
388
503da871
VK
389 virtual size_t compress(const BYTE *in, size_t inSize, BYTE *out, size_t maxOutSize);
390 virtual size_t decompress(const BYTE *in, size_t inSize, const BYTE **out);
391 virtual size_t compressBufferSize(size_t dataSize);
392};
393
394struct __LZ4_stream_t;
395struct __LZ4_streamDecode_t;
396
397/**
398 * LZ4 stream compressor
399 */
400class LIBNETXMS_EXPORTABLE LZ4StreamCompressor : public StreamCompressor
401{
402private:
403 union
404 {
405 __LZ4_stream_t *encoder;
406 __LZ4_streamDecode_t *decoder;
407 } m_stream;
408 char *m_buffer;
409 size_t m_maxBlockSize;
410 size_t m_bufferSize;
411 size_t m_bufferPos;
412 bool m_compress;
413
414public:
415 LZ4StreamCompressor(bool compress, size_t maxBlockSize);
416 virtual ~LZ4StreamCompressor();
417
418 virtual size_t compress(const BYTE *in, size_t inSize, BYTE *out, size_t maxOutSize);
419 virtual size_t decompress(const BYTE *in, size_t inSize, const BYTE **out);
420 virtual size_t compressBufferSize(size_t dataSize);
421};
422
208d7427
VK
423#if 0
424/**
425 * NXCP message consumer interface
426 */
427class LIBNETXMS_EXPORTABLE MessageConsumer
428{
429public:
430 virtual SOCKET getSocket() = 0;
431 virtual void processMessage(NXCPMessage *msg) = 0;
432};
433
434/**
435 * Socket receiver - manages receiving NXCP messages from multiple sockets
436 */
437class LIBNETXMS_EXPORTABLE SocketReceiver
438{
439private:
440 THREAD m_thread;
441 HashMap<SOCKET, MessageConsumer> *m_consumers;
442
443 static int m_maxSocketsPerThread;
444 static ObjectArray<SocketReceiver> *m_receivers;
445
446public:
447 static void start();
448 static void shutdown();
449
450 static void addConsumer(MessageConsumer *mc);
451 static void removeConsumer(MessageConsumer *mc);
452
453 static String getDiagInfo();
454};
455#endif
456
9f2ad16c
VK
457#else /* __cplusplus */
458
b368969c 459typedef void NXCPMessage;
98abc9f1 460typedef void NXCPEncryptionContext;
9f2ad16c
VK
461
462#endif
463
deaa4491
VK
464
465//
0d9c1b96
VK
466// Functions
467//
468
469#ifdef __cplusplus
0d9c1b96 470
b368969c
VK
471int LIBNETXMS_EXPORTABLE RecvNXCPMessage(SOCKET hSocket, NXCP_MESSAGE *pMsg,
472 NXCP_BUFFER *pBuffer, UINT32 dwMaxMsgSize,
98abc9f1 473 NXCPEncryptionContext **ppCtx,
967893bb 474 BYTE *pDecryptionBuffer, UINT32 dwTimeout);
b368969c
VK
475int LIBNETXMS_EXPORTABLE RecvNXCPMessageEx(SOCKET hSocket, NXCP_MESSAGE **msgBuffer,
476 NXCP_BUFFER *nxcpBuffer, UINT32 *bufferSize,
cc022855 477 NXCPEncryptionContext **ppCtx,
967893bb
VK
478 BYTE **decryptionBuffer, UINT32 dwTimeout,
479 UINT32 maxMsgSize);
b368969c 480NXCP_MESSAGE LIBNETXMS_EXPORTABLE *CreateRawNXCPMessage(WORD wCode, UINT32 dwId, WORD flags,
967893bb 481 UINT32 dwDataSize, void *pData,
b368969c
VK
482 NXCP_MESSAGE *pBuffer);
483TCHAR LIBNETXMS_EXPORTABLE *NXCPMessageCodeName(WORD wCode, TCHAR *buffer);
967893bb 484BOOL LIBNETXMS_EXPORTABLE SendFileOverNXCP(SOCKET hSocket, UINT32 dwId, const TCHAR *pszFile,
cc022855 485 NXCPEncryptionContext *pCtx, long offset,
7b8b337e 486 void (* progressCallback)(INT64, void *), void *cbArg,
503da871 487 MUTEX mutex, NXCPCompressionMethod compressionMethod = NXCP_COMPRESSION_NONE);
7b8b337e 488BOOL LIBNETXMS_EXPORTABLE NXCPGetPeerProtocolVersion(SOCKET hSocket, int *pnVersion, MUTEX mutex);
cc022855 489
2df047f4 490bool LIBNETXMS_EXPORTABLE InitCryptoLib(UINT32 dwEnabledCiphers);
e5390fb5
VK
491UINT32 LIBNETXMS_EXPORTABLE NXCPGetSupportedCiphers();
492String LIBNETXMS_EXPORTABLE NXCPGetSupportedCiphersAsText();
b368969c 493NXCP_ENCRYPTED_MESSAGE LIBNETXMS_EXPORTABLE *NXCPEncryptMessage(NXCPEncryptionContext *pCtx, NXCP_MESSAGE *pMsg);
bf6fb6c3 494bool LIBNETXMS_EXPORTABLE NXCPDecryptMessage(NXCPEncryptionContext *pCtx,
6be0a20b 495 NXCP_ENCRYPTED_MESSAGE *pMsg,
e44ac467 496 BYTE *pDecryptionBuffer);
b368969c 497UINT32 LIBNETXMS_EXPORTABLE SetupEncryptionContext(NXCPMessage *pMsg,
98abc9f1 498 NXCPEncryptionContext **ppCtx,
b368969c 499 NXCPMessage **ppResponse,
4bd3d6c5 500 RSA *pPrivateKey, int nNXCPVersion);
b368969c 501void LIBNETXMS_EXPORTABLE PrepareKeyRequestMsg(NXCPMessage *pMsg, RSA *pServerKey, bool useX509Format);
3aa0061c 502RSA LIBNETXMS_EXPORTABLE *LoadRSAKeys(const TCHAR *pszKeyFile);
15cf5acc 503
bb8136f7 504#ifdef _WIN32
967893bb 505BOOL LIBNETXMS_EXPORTABLE SignMessageWithCAPI(BYTE *pMsg, UINT32 dwMsgLen, const CERT_CONTEXT *pCert,
b368969c 506 BYTE *pBuffer, size_t bufferSize, UINT32 *pdwSigLen);
bb8136f7
VK
507#endif
508
0d9c1b96
VK
509#endif
510
9f2ad16c 511#endif /* _nxcpapi_h_ */