]> git.proxmox.com Git - mirror_ovs.git/blame - lib/vconn-ssl.h
Merge citrix branch into master.
[mirror_ovs.git] / lib / vconn-ssl.h
CommitLineData
064af421
BP
1/*
2 * Copyright (c) 2008 Nicira Networks.
3 *
a14bc59f
BP
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
064af421 7 *
a14bc59f
BP
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
064af421
BP
15 */
16#ifndef VCONN_SSL_H
17#define VCONN_SSL_H 1
18
19#include <stdbool.h>
20
21#ifdef HAVE_OPENSSL
22bool vconn_ssl_is_configured(void);
23void vconn_ssl_set_private_key_file(const char *file_name);
24void vconn_ssl_set_certificate_file(const char *file_name);
25void vconn_ssl_set_ca_cert_file(const char *file_name, bool bootstrap);
26void vconn_ssl_set_peer_ca_cert_file(const char *file_name);
27
28#define VCONN_SSL_LONG_OPTIONS \
29 {"private-key", required_argument, 0, 'p'}, \
30 {"certificate", required_argument, 0, 'c'}, \
31 {"ca-cert", required_argument, 0, 'C'},
32
33#define VCONN_SSL_OPTION_HANDLERS \
34 case 'p': \
35 vconn_ssl_set_private_key_file(optarg); \
36 break; \
37 \
38 case 'c': \
39 vconn_ssl_set_certificate_file(optarg); \
40 break; \
41 \
42 case 'C': \
43 vconn_ssl_set_ca_cert_file(optarg, false); \
44 break;
45#else /* !HAVE_OPENSSL */
46static inline bool vconn_ssl_is_configured(void)
47{
48 return false;
49}
50#define VCONN_SSL_LONG_OPTIONS
51#define VCONN_SSL_OPTION_HANDLERS
52#endif /* !HAVE_OPENSSL */
53
54#endif /* vconn-ssl.h */