{"verbose", optional_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
-#ifdef HAVE_OPENSSL
- {"private-key", required_argument, 0, 'p'},
- {"certificate", required_argument, 0, 'c'},
- {"ca-cert", required_argument, 0, 'C'},
-#endif
+ VCONN_SSL_LONG_OPTIONS
{0, 0, 0, 0},
};
char *short_options = long_options_to_short_options(long_options);
vlog_set_verbosity(optarg);
break;
-#ifdef HAVE_OPENSSL
- case 'p':
- vconn_ssl_set_private_key_file(optarg);
- break;
-
- case 'c':
- vconn_ssl_set_certificate_file(optarg);
- break;
-
- case 'C':
- vconn_ssl_set_ca_cert_file(optarg);
- break;
-#endif
+ VCONN_SSL_OPTION_HANDLERS
case '?':
exit(EXIT_FAILURE);
void vconn_ssl_set_private_key_file(const char *file_name);
void vconn_ssl_set_certificate_file(const char *file_name);
void vconn_ssl_set_ca_cert_file(const char *file_name);
-#endif
+
+#define VCONN_SSL_LONG_OPTIONS \
+ {"private-key", required_argument, 0, 'p'}, \
+ {"certificate", required_argument, 0, 'c'}, \
+ {"ca-cert", required_argument, 0, 'C'},
+
+#define VCONN_SSL_OPTION_HANDLERS \
+ case 'p': \
+ vconn_ssl_set_private_key_file(optarg); \
+ break; \
+ \
+ case 'c': \
+ vconn_ssl_set_certificate_file(optarg); \
+ break; \
+ \
+ case 'C': \
+ vconn_ssl_set_ca_cert_file(optarg); \
+ break;
+#else /* !HAVE_OPENSSL */
+#define VCONN_SSL_LONG_OPTIONS
+#define VCONN_SSL_OPTION_HANDLERS
+#endif /* !HAVE_OPENSSL */
#endif /* vconn-ssl.h */
{"verbose", optional_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
-#ifdef HAVE_OPENSSL
- {"private-key", required_argument, 0, 'p'},
- {"certificate", required_argument, 0, 'c'},
- {"ca-cert", required_argument, 0, 'C'},
-#endif
+ VCONN_SSL_LONG_OPTIONS
{0, 0, 0, 0},
};
char *short_options = long_options_to_short_options(long_options);
vlog_set_verbosity(optarg);
break;
-#ifdef HAVE_OPENSSL
- case 'p':
- vconn_ssl_set_private_key_file(optarg);
- break;
-
- case 'c':
- vconn_ssl_set_certificate_file(optarg);
- break;
-
- case 'C':
- vconn_ssl_set_ca_cert_file(optarg);
- break;
-#endif
+ VCONN_SSL_OPTION_HANDLERS
case '?':
exit(EXIT_FAILURE);
{"verbose", optional_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
-#ifdef HAVE_OPENSSL
- {"private-key", required_argument, 0, 'p'},
- {"certificate", required_argument, 0, 'c'},
- {"ca-cert", required_argument, 0, 'C'},
-#endif
+ VCONN_SSL_LONG_OPTIONS
{0, 0, 0, 0},
};
char *short_options = long_options_to_short_options(long_options);
}
break;
-#ifdef HAVE_OPENSSL
- case 'p':
- vconn_ssl_set_private_key_file(optarg);
- break;
-
- case 'c':
- vconn_ssl_set_certificate_file(optarg);
- break;
-
- case 'C':
- vconn_ssl_set_ca_cert_file(optarg);
- break;
-#endif
+ VCONN_SSL_OPTION_HANDLERS
case '?':
exit(EXIT_FAILURE);
{"verbose", optional_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
-#ifdef HAVE_OPENSSL
- {"private-key", required_argument, 0, 'p'},
- {"certificate", required_argument, 0, 'c'},
- {"ca-cert", required_argument, 0, 'C'},
-#endif
+ VCONN_SSL_LONG_OPTIONS
{0, 0, 0, 0},
};
char *short_options = long_options_to_short_options(long_options);
vlog_set_verbosity(optarg);
break;
-#ifdef HAVE_OPENSSL
- case 'p':
- vconn_ssl_set_private_key_file(optarg);
- break;
-
- case 'c':
- vconn_ssl_set_certificate_file(optarg);
- break;
-
- case 'C':
- vconn_ssl_set_ca_cert_file(optarg);
- break;
-#endif
+ VCONN_SSL_OPTION_HANDLERS
case '?':
exit(EXIT_FAILURE);