added SIG_IGN handler for signals on Solaris
[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_
bfeebddf
VK
24#define _netxms_isc_h_\r
25\r
26\r
27//\r
28// Default port number\r
29//\r
30\r
31#define NETXMS_ISC_PORT 4702\r
32\r
33\r
34//\r
35// Well-known ISC services\r
36//\r
37\r
38#define ISC_SERVICE_EVENT_FORWARDER ((DWORD)1)\r
39#define ISC_SERVICE_OBJECT_SYNC ((DWORD)2)\r
40#define ISC_SERVICE_LICENSE_SERVER ((DWORD)3)\r
41\r
42#define ISC_SERVICE_CUSTOM_1 ((DWORD)100000)\r
43\r
44\r
45//\r
46// ISC error codes\r
47//\r
48\r
49\r
50#define ISC_ERR_SUCCESS ((DWORD)0)\r
51#define ISC_ERR_UNKNOWN_SERVICE ((DWORD)1)\r
52#define ISC_ERR_REQUEST_OUT_OF_STATE ((DWORD)2)\r
53#define ISC_ERR_SERVICE_DISABLED ((DWORD)3)\r
54#define ISC_ERR_ENCRYPTION_REQUIRED ((DWORD)4)\r
55#define ISC_ERR_CONNECTION_BROKEN ((DWORD)5)\r
56#define ISC_ERR_ALREADY_CONNECTED ((DWORD)6)\r
57#define ISC_ERR_SOCKET_ERROR ((DWORD)7)\r
58#define ISC_ERR_CONNECT_FAILED ((DWORD)8)\r
59#define ISC_ERR_INVALID_NXCP_VERSION ((DWORD)9)\r
60#define ISC_ERR_REQUEST_TIMEOUT ((DWORD)10)\r
61#define ISC_ERR_NOT_IMPLEMENTED ((DWORD)11)\r
62#define ISC_ERR_NO_CIPHERS ((DWORD)12)\r
63#define ISC_ERR_INVALID_PUBLIC_KEY ((DWORD)13)\r
64#define ISC_ERR_INVALID_SESSION_KEY ((DWORD)14)\r
65#define ISC_ERR_INTERNAL_ERROR ((DWORD)15)\r
66#define ISC_ERR_SESSION_SETUP_FAILED ((DWORD)16)\r
86cffad8
VK
67#define ISC_ERR_OBJECT_NOT_FOUND ((DWORD)17)\r
68#define ISC_ERR_POST_EVENT_FAILED ((DWORD)18)\r
69\r
70\r
71//\r
72// ISC session\r
73//\r
74\r
75class ISCSession\r
76{\r
77private:\r
78 SOCKET m_socket;\r
79 DWORD m_peerAddress; // Peer address in host byte order\r
80 void *m_userData;\r
81\r
82public:\r
83 ISCSession(SOCKET sock, struct sockaddr_in *addr)\r
84 {\r
85 m_socket = sock;\r
86 m_peerAddress = ntohl(addr->sin_addr.s_addr);\r
87 m_userData = NULL;\r
88 }\r
89\r
90 SOCKET GetSocket() { return m_socket; }\r
91 DWORD GetPeerAddress() { return m_peerAddress; }\r
92\r
93 void SetUserData(void *data) { m_userData = data; }\r
94 void *GetUserData() { return m_userData; }\r
95};\r
bfeebddf
VK
96\r
97\r
98//\r
99// ISC service definition\r
100//\r
101\r
102typedef struct\r
103{\r
104 DWORD id; // Service ID\r
105 const TCHAR *name; // Name\r
106 const TCHAR *enableParameter; // Server parameter to be set to enable service\r
86cffad8
VK
107 BOOL (*setupSession)(ISCSession *, CSCPMessage *); // Session setup handler\r
108 void (*closeSession)(ISCSession *); // Session close handler\r
109 BOOL (*processMsg)(ISCSession *, CSCPMessage *, CSCPMessage *);\r
bfeebddf
VK
110} ISC_SERVICE;\r
111
8ff2df88
VK
112
113#endif