1 /************************************************************************
2  *
3  * COMMON.H - NSCA Common Include File
4  * Copyright (c) 1999-2003 Ethan Galstad (nagios@nagios.org)
5  * Last Modified: 01-07-2003
6  *
7  * License:
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  ************************************************************************/
23 
24 #include "config.h"
25 
26 
27 #define PROGRAM_VERSION "2.7.2"
28 #define MODIFICATION_DATE "07-03-2007"
29 
30 
31 #define OK		0
32 #define ERROR		-1
33 
34 #define TRUE		1
35 #define FALSE		0
36 
37 #define STATE_UNKNOWN  	3	/* service state return codes */
38 #define	STATE_CRITICAL 	2
39 #define STATE_WARNING 	1
40 #define STATE_OK       	0
41 
42 
43 #define DEFAULT_SOCKET_TIMEOUT	10	/* timeout after 10 seconds */
44 
45 #define MAX_INPUT_BUFFER	2048	/* max size of most buffers we use */
46 
47 #define MAX_HOST_ADDRESS_LENGTH	256	/* max size of a host address */
48 
49 #define MAX_HOSTNAME_LENGTH	64
50 #define MAX_DESCRIPTION_LENGTH	128
51 #define MAX_PLUGINOUTPUT_LENGTH	512
52 
53 #define MAX_PASSWORD_LENGTH     512
54 
55 
56 /********************* ENCRYPTION TYPES ****************/
57 
58 #define ENCRYPT_NONE            0       /* no encryption */
59 #define ENCRYPT_XOR             1       /* not really encrypted, just obfuscated */
60 
61 #ifdef HAVE_LIBMCRYPT
62 #define ENCRYPT_DES             2       /* DES */
63 #define ENCRYPT_3DES            3       /* 3DES or Triple DES */
64 #define ENCRYPT_CAST128         4       /* CAST-128 */
65 #define ENCRYPT_CAST256         5       /* CAST-256 */
66 #define ENCRYPT_XTEA            6       /* xTEA */
67 #define ENCRYPT_3WAY            7       /* 3-WAY */
68 #define ENCRYPT_BLOWFISH        8       /* SKIPJACK */
69 #define ENCRYPT_TWOFISH         9       /* TWOFISH */
70 #define ENCRYPT_LOKI97          10      /* LOKI97 */
71 #define ENCRYPT_RC2             11      /* RC2 */
72 #define ENCRYPT_ARCFOUR         12      /* RC4 */
73 #define ENCRYPT_RC6             13      /* RC6 */            /* UNUSED */
74 #define ENCRYPT_RIJNDAEL128     14      /* RIJNDAEL-128 */
75 #define ENCRYPT_RIJNDAEL192     15      /* RIJNDAEL-192 */
76 #define ENCRYPT_RIJNDAEL256     16      /* RIJNDAEL-256 */
77 #define ENCRYPT_MARS            17      /* MARS */           /* UNUSED */
78 #define ENCRYPT_PANAMA          18      /* PANAMA */         /* UNUSED */
79 #define ENCRYPT_WAKE            19      /* WAKE */
80 #define ENCRYPT_SERPENT         20      /* SERPENT */
81 #define ENCRYPT_IDEA            21      /* IDEA */           /* UNUSED */
82 #define ENCRYPT_ENIGMA          22      /* ENIGMA (Unix crypt) */
83 #define ENCRYPT_GOST            23      /* GOST */
84 #define ENCRYPT_SAFER64         24      /* SAFER-sk64 */
85 #define ENCRYPT_SAFER128        25      /* SAFER-sk128 */
86 #define ENCRYPT_SAFERPLUS       26      /* SAFER+ */
87 #endif
88 
89 
90 
91 /******************** MISC DEFINITIONS *****************/
92 
93 #define TRANSMITTED_IV_SIZE     128     /* size of IV to transmit - must be as big as largest IV needed for any crypto algorithm */
94 
95 
96 /*************** PACKET STRUCTURE DEFINITIONS **********/
97 
98 #define NSCA_PACKET_VERSION_3   3		/* packet version identifier */
99 #define NSCA_PACKET_VERSION_2	2		/* older packet version identifiers */
100 #define NSCA_PACKET_VERSION_1	1
101 
102 /* data packet containing service check results */
103 typedef struct data_packet_struct{
104 	int16_t   packet_version;
105 	u_int32_t crc32_value;
106 	u_int32_t timestamp;
107 	int16_t   return_code;
108 	char      host_name[MAX_HOSTNAME_LENGTH];
109 	char      svc_description[MAX_DESCRIPTION_LENGTH];
110 	char      plugin_output[MAX_PLUGINOUTPUT_LENGTH];
111         }data_packet;
112 
113 /* initialization packet containing IV and timestamp */
114 typedef struct init_packet_struct{
115 	char      iv[TRANSMITTED_IV_SIZE];
116 	u_int32_t timestamp;
117         }init_packet;
118 
119 
120 
121 
122