]> git.proxmox.com Git - mirror_ovs.git/blame - lib/stream-ssl.h
datapath: Detect and suppress flows that are implicated in loops.
[mirror_ovs.git] / lib / stream-ssl.h
CommitLineData
9467fe62
BP
1/*
2 * Copyright (c) 2008, 2009 Nicira Networks.
3 *
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:
7 *
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.
15 */
16#ifndef STREAM_SSL_H
17#define STREAM_SSL_H 1
18
19#include <stdbool.h>
20
21#ifdef HAVE_OPENSSL
22bool stream_ssl_is_configured(void);
23void stream_ssl_set_private_key_file(const char *file_name);
24void stream_ssl_set_certificate_file(const char *file_name);
25void stream_ssl_set_ca_cert_file(const char *file_name, bool bootstrap);
26void stream_ssl_set_peer_ca_cert_file(const char *file_name);
27
1b656aa8
JP
28/* Define the long options for SSL support.
29 *
30 * Note that the definition includes a final comma, and therefore a comma
31 * must not be supplied when using the definition. This is done so that
32 * compilation succeeds whether or not HAVE_OPENSSL is defined. */
a4af0040 33#define STREAM_SSL_LONG_OPTIONS \
9467fe62
BP
34 {"private-key", required_argument, 0, 'p'}, \
35 {"certificate", required_argument, 0, 'c'}, \
36 {"ca-cert", required_argument, 0, 'C'},
37
38#define STREAM_SSL_OPTION_HANDLERS \
39 case 'p': \
40 stream_ssl_set_private_key_file(optarg); \
41 break; \
42 \
43 case 'c': \
44 stream_ssl_set_certificate_file(optarg); \
45 break; \
46 \
47 case 'C': \
48 stream_ssl_set_ca_cert_file(optarg, false); \
49 break;
50#else /* !HAVE_OPENSSL */
51static inline bool stream_ssl_is_configured(void)
52{
53 return false;
54}
55#define STREAM_SSL_LONG_OPTIONS
56#define STREAM_SSL_OPTION_HANDLERS
57#endif /* !HAVE_OPENSSL */
58
59#endif /* stream-ssl.h */