new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / win32 / ui / os_win32ui.h
1 /* Copyright (C) 2009 Trend Micro Inc.
2  * All rights reserved.
3  *
4  * This program is a free software; you can redistribute it
5  * and/or modify it under the terms of the GNU General Public
6  * License (version 2) as published by the FSF - Free Software
7  * Foundation.
8  */
9
10 #ifndef WIN_32UI_H
11 #define WIN_32UI_H
12
13 #include <stdio.h>
14 #include <unistd.h>
15 #include <windows.h>
16 #include <winresrc.h>
17 #include <commctrl.h>
18
19 /* Default values */
20 #define CONFIG          "ossec.conf"
21 #define LASTCONFIG      "last-ossec.conf"
22 #define VERSION_FILE    "VERSION.txt"
23 #define OSSECLOGS       "ossec.log"
24 #define HELPTXT         "help.txt"
25 #define SENDER_FILE     "rids\\sender_counter"
26 #define DEFDIR          "C:\\Program Files\\ossec-agent"
27
28 /* Status messages */
29 #define ST_RUNNING          "Running"
30 #define ST_RUNNING_RESTART  "Running (pending restart)"
31 #define ST_STOPPED          "Stopped"
32 #define ST_UNKNOWN          "Unknown"
33 #define ST_NOTSET           "0"
34 #define ST_MISSING_IMPORT   "Require import of authentication key.\r\n" \
35                             "            - Not Running"
36 #define ST_MISSING_SERVER   "Require OSSEC Server IP address.\r\n" \
37                             "            - Not Running"
38 #define ST_MISSING_ALL      "Require import of authentication key.\r\n" \
39                             "            Missing OSSEC Server IP address.\r\n" \
40                             "            - Not Running"
41
42 /* Pre-def fields */
43 #define FL_NOKEY        "<insert_auth_key_here>"
44 #define FL_NOSERVER     "<insert_server_ip_here>"
45 #define SERVER_IP_USED      1
46 #define SERVER_HOST_USED    2
47
48 /* Prototypes */
49 char *decode_base64(const char *src);
50 char *encode_base64(int size, char *src);
51
52 /* Global ossec config structure */
53 typedef struct _ossec_config {
54     unsigned short int server_type;
55     unsigned short int admin_access;
56     unsigned long int msg_sent;
57     char *dir;
58     char *config;
59     char *key;
60     char *server;
61
62     char *agentid;
63     char *agentname;
64     char *agentip;
65
66     char *version;
67     char *install_date;
68     char *status;
69 } ossec_config;
70
71
72 /** Global variables **/
73
74 /* Agent status */
75 char ui_server_info[2048 + 1];
76
77 /* Configuration */
78 ossec_config config_inst;
79
80 /* Status bar */
81 HWND hStatus;
82
83 /* Ossec icon */
84 #define IDI_OSSECICON  201
85 #define UI_MANIFEST_ID 202
86
87 /* User input */
88 #define UI_SERVER_TEXT      1501
89 #define UI_SERVER_AUTH      1502
90 #define UI_SERVER_MSG       1503
91 #define UI_SERVER_TOP       1504
92 #define UI_SERVER_INFO      1505
93 #define UI_ID_CLOSE         1510
94
95 /* Menu values */
96 #define UI_MENU_MANAGE_STOP     1601
97 #define UI_MENU_MANAGE_START    1602
98 #define UI_MENU_MANAGE_STATUS   1603
99 #define UI_MENU_MANAGE_RESTART  1604
100 #define UI_MENU_MANAGE_EXIT     1605
101 #define UI_MENU_VIEW_LOGS       1606
102 #define UI_MENU_VIEW_CONFIG     1607
103 #define UI_MENU_HELP_HELP       1608
104 #define UI_MENU_HELP_ABOUT      1609
105 #define UI_MENU_NONE            1610
106
107 #define IDD_MAIN                1700
108 #define IDC_MAIN_STATUS         1701
109 #define IDC_ADD                 1702
110 #define IDC_CANCEL              1703
111 #define IDD_ABOUT               1704
112 #define IDC_STATIC -1
113
114 /** Prototypes **/
115
116 /* Generate server info */
117 int gen_server_info(HWND hwnd);
118
119 char *cat_file(char *file, FILE *fp2);
120
121 int is_file(char *file);
122
123 /* Reads ossec config */
124 int config_read(HWND hwnd);
125
126 /* Initializes the config */
127 void init_config();
128
129 /* Run command using cmd.exe */
130 int run_cmd(char *cmd, HWND hwnd);
131
132 /* Set OSSEC Server IP */
133 int set_ossec_server(char *ip, HWND hwnd);
134
135 /* Set OSSEC Auth Key */
136 int set_ossec_key(char *key, HWND hwnd);
137
138 /* Get OSSEC Server IP */
139 int get_ossec_server();
140
141
142 #endif