change log updated
[public/netxms.git] / include / netxms_isc.h
CommitLineData
8ff2df88
VK
1/*
2** NetXMS - Network Management System
3** Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Victor Kirhenshtein
4**
5** This program is free software; you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation; either version 2 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program; if not, write to the Free Software
17** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18**
19** File: netxms_isc.h
20**
21**/
22
23#ifndef _netxms_isc_h_
4c4db622
AK
24#define _netxms_isc_h_
25
b16935d5
VK
26/**
27 * Default ISC port number
28 */
4c4db622
AK
29#define NETXMS_ISC_PORT 4702
30
b16935d5
VK
31/**
32 * Well-known ISC services
33 */
967893bb
VK
34#define ISC_SERVICE_EVENT_FORWARDER ((UINT32)1)
35#define ISC_SERVICE_OBJECT_SYNC ((UINT32)2)
36#define ISC_SERVICE_LICENSE_SERVER ((UINT32)3)
4c4db622 37
967893bb 38#define ISC_SERVICE_CUSTOM_1 ((UINT32)100000)
4c4db622 39
b16935d5
VK
40/**
41 * ISC error codes
42 */
967893bb
VK
43#define ISC_ERR_SUCCESS ((UINT32)0)
44#define ISC_ERR_UNKNOWN_SERVICE ((UINT32)1)
45#define ISC_ERR_REQUEST_OUT_OF_STATE ((UINT32)2)
46#define ISC_ERR_SERVICE_DISABLED ((UINT32)3)
47#define ISC_ERR_ENCRYPTION_REQUIRED ((UINT32)4)
48#define ISC_ERR_CONNECTION_BROKEN ((UINT32)5)
49#define ISC_ERR_ALREADY_CONNECTED ((UINT32)6)
50#define ISC_ERR_SOCKET_ERROR ((UINT32)7)
51#define ISC_ERR_CONNECT_FAILED ((UINT32)8)
52#define ISC_ERR_INVALID_NXCP_VERSION ((UINT32)9)
53#define ISC_ERR_REQUEST_TIMEOUT ((UINT32)10)
54#define ISC_ERR_NOT_IMPLEMENTED ((UINT32)11)
55#define ISC_ERR_NO_CIPHERS ((UINT32)12)
56#define ISC_ERR_INVALID_PUBLIC_KEY ((UINT32)13)
57#define ISC_ERR_INVALID_SESSION_KEY ((UINT32)14)
58#define ISC_ERR_INTERNAL_ERROR ((UINT32)15)
59#define ISC_ERR_SESSION_SETUP_FAILED ((UINT32)16)
60#define ISC_ERR_OBJECT_NOT_FOUND ((UINT32)17)
61#define ISC_ERR_POST_EVENT_FAILED ((UINT32)18)
4c4db622 62
b16935d5
VK
63/**
64 * ISC session
65 */
4c4db622
AK
66class ISCSession
67{
68private:
69 SOCKET m_socket;
967893bb 70 UINT32 m_peerAddress; // Peer address in host byte order
4c4db622
AK
71 void *m_userData;
72
73public:
74 ISCSession(SOCKET sock, struct sockaddr_in *addr)
75 {
76 m_socket = sock;
77 m_peerAddress = ntohl(addr->sin_addr.s_addr);
78 m_userData = NULL;
79 }
80
81 SOCKET GetSocket() { return m_socket; }
967893bb 82 UINT32 GetPeerAddress() { return m_peerAddress; }
4c4db622
AK
83
84 void SetUserData(void *data) { m_userData = data; }
85 void *GetUserData() { return m_userData; }
86};
87
b16935d5
VK
88/**
89 * ISC service definition
90 */
4c4db622
AK
91typedef struct
92{
967893bb 93 UINT32 id; // Service ID
4c4db622
AK
94 const TCHAR *name; // Name
95 const TCHAR *enableParameter; // Server parameter to be set to enable service
b368969c 96 BOOL (*setupSession)(ISCSession *, NXCPMessage *); // Session setup handler
4c4db622 97 void (*closeSession)(ISCSession *); // Session close handler
b368969c 98 BOOL (*processMsg)(ISCSession *, NXCPMessage *, NXCPMessage *);
4c4db622 99} ISC_SERVICE;
bfeebddf 100
8ff2df88
VK
101
102#endif