#ifdef DEBUG
/* Setup our SIGINT signal handler which allows a "normal" termination of
* the server in DEBUG mode. */
#ifdef DEBUG
/* Setup our SIGINT signal handler which allows a "normal" termination of
* the server in DEBUG mode. */
int socket_option = 1;
setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR,
&socket_option, sizeof(socket_option));
int socket_option = 1;
setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR,
&socket_option, sizeof(socket_option));
server_in.sin6_port = htons((uint16_t)port); /* port to bind to */
#endif
if (bind(server_socket, (struct sockaddr *)&server_in,
server_in.sin6_port = htons((uint16_t)port); /* port to bind to */
#endif
if (bind(server_socket, (struct sockaddr *)&server_in,
printf("tlsproxy %s\n", VERSION);
printf("Listening for connections on port %d.\n", port);
printf("tlsproxy %s\n", VERSION);
printf("Listening for connections on port %d.\n", port);
while (!done) {
/* Accept new connection. */
client_socket = accept(server_socket, NULL, NULL);
while (!done) {
/* Accept new connection. */
client_socket = accept(server_socket, NULL, NULL);
/* Initialize GnuTLS. */
result = gnutls_global_init();
GNUTLS_ERROR_EXIT(result, "gnutls_global_init()");
/* Initialize GnuTLS. */
result = gnutls_global_init();
GNUTLS_ERROR_EXIT(result, "gnutls_global_init()");
/* Setup GnuTLS cipher suites. */
result = gnutls_priority_init(&global_tls_priority_cache, "NORMAL", NULL);
GNUTLS_ERROR_EXIT(result, "gnutls_priority_init()");
/* Setup GnuTLS cipher suites. */
result = gnutls_priority_init(&global_tls_priority_cache, "NORMAL", NULL);
GNUTLS_ERROR_EXIT(result, "gnutls_priority_init()");