Debian Codegraph @

src/ui_win_cli.c

raw
1 /*
2 * stunnel TLS offloading and load-balancing proxy
3 * Copyright (C) 1998-2026 Michal Trojnara <[email protected]>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * 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.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, see <http://www.gnu.org/licenses>.
17 *
18 * Linking stunnel statically or dynamically with other modules is making
19 * a combined work based on stunnel. Thus, the terms and conditions of
20 * the GNU General Public License cover the whole combination.
21 *
22 * In addition, as a special exception, the copyright holder of stunnel
23 * gives you permission to combine stunnel with free software programs or
24 * libraries that are released under the GNU LGPL and with code included
25 * in the standard release of OpenSSL under the OpenSSL License (or
26 * modified versions of such code, with unchanged license). You may copy
27 * and distribute such a system following the terms of the GNU GPL for
28 * stunnel and the licenses of the other code concerned.
29 *
30 * Note that people who make modified versions of stunnel are not obligated
31 * to grant this special exception for their modified versions; it is their
32 * choice whether to do so. The GNU General Public License gives permission
33 * to release a modified version without this exception; this exception
34 * also makes it possible to release a modified version which carries
35 * forward this exception.
36 */
37
38 #include "prototypes.h"
39
40 int main(int argc, char *argv[]) {
41 if(stunnel_init())
42 return 1;
43 main_init();
44 if(!main_configure(argc>1 ? argv[1] : NULL, argc>2 ? argv[2] : NULL))
45 daemon_loop();
46 main_cleanup();
47 return 0;
48 }
49
50 /**************************************** options callbacks */
51
52 void ui_config_reloaded(void) {
53 /* no action */
54 }
55
56 ICON_IMAGE load_icon_default(ICON_TYPE type) {
57 (void)type; /* squash the unused parameter warning */
58 return NULL;
59 }
60
61 ICON_IMAGE load_icon_file(const char *name) {
62 (void)name; /* squash the unused parameter warning */
63 return NULL;
64 }
65
66 /**************************************** client callbacks */
67
68 void ui_new_chain(const unsigned section_number) {
69 (void)section_number; /* squash the unused parameter warning */
70 }
71
72 void ui_clients(const long num) {
73 (void)num; /* squash the unused parameter warning */
74 }
75
76 /**************************************** s_log callbacks */
77
78 void message_box(LPCTSTR text, const UINT type) {
79 MessageBox(NULL, text, TEXT("stunnel"), type);
80 }
81
82 void ui_new_log(const char *line) {
83 LPTSTR tstr;
84
85 tstr=str2tstr(line);
86 #ifdef _WIN32_WCE
87 /* log to Windows CE debug output stream */
88 RETAILMSG(TRUE, (TEXT("%s\r\n"), tstr));
89 #else
90 /* use UTF-16 or native codepage rather than UTF-8 */
91 _putts(tstr);
92 fflush(stdout);
93 #endif
94 str_free(tstr);
95 }
96
97 /**************************************** ctx callbacks */
98
99 int ui_passwd_cb(char *buf, int size, int rwflag, void *userdata) {
100 return PEM_def_callback(buf, size, rwflag, userdata);
101 }
102
103 #if !defined(OPENSSL_NO_ENGINE) || OPENSSL_VERSION_NUMBER>=0x10101000L
104
105 int (*ui_get_opener(void)) (UI *) {
106 return UI_method_get_opener(UI_OpenSSL());
107 }
108
109 int (*ui_get_writer(void)) (UI *, UI_STRING *) {
110 return UI_method_get_writer(UI_OpenSSL());
111 }
112
113 int (*ui_get_reader(void)) (UI *, UI_STRING *) {
114 return UI_method_get_reader(UI_OpenSSL());
115 }
116
117 int (*ui_get_closer(void)) (UI *) {
118 return UI_method_get_closer(UI_OpenSSL());
119 }
120
121 #endif /* !defined(OPENSSL_NO_ENGINE) || OPENSSL_VERSION_NUMBER>=0x10101000L */
122
123 /* end of ui_win_cli.c */