1 /** @file
2 
3   Main function to start the HTTP Proxy Server
4 
5   @section license License
6 
7   Licensed to the Apache Software Foundation (ASF) under one
8   or more contributor license agreements.  See the NOTICE file
9   distributed with this work for additional information
10   regarding copyright ownership.  The ASF licenses this file
11   to you under the Apache License, Version 2.0 (the
12   "License"); you may not use this file except in compliance
13   with the License.  You may obtain a copy of the License at
14 
15       http://www.apache.org/licenses/LICENSE-2.0
16 
17   Unless required by applicable law or agreed to in writing, software
18   distributed under the License is distributed on an "AS IS" BASIS,
19   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   See the License for the specific language governing permissions and
21   limitations under the License.
22  */
23 
24 #pragma once
25 
26 #include <atomic>
27 #include <mutex>
28 #include <condition_variable>
29 
30 struct HttpProxyPort;
31 
32 /// Perform any pre-thread start initialization.
33 void prep_HttpProxyServer();
34 
35 /** Initialize all HTTP proxy port data structures needed to accept connections.
36  */
37 void init_accept_HttpProxyServer(int n_accept_threads = 0);
38 
39 /** Checks whether we can call start_HttpProxyServer().
40  */
41 void init_HttpProxyServer();
42 
43 /** Start the proxy server.
44     The port data should have been created by @c prep_HttpProxyServer().
45 */
46 void start_HttpProxyServer();
47 
48 void stop_HttpProxyServer();
49 
50 NetProcessor::AcceptOptions make_net_accept_options(const HttpProxyPort *port, unsigned nthreads);
51 
52 extern std::mutex proxyServerMutex;
53 extern std::condition_variable proxyServerCheck;
54 extern bool et_net_threads_ready;
55 
56 extern std::mutex etUdpMutex;
57 extern std::condition_variable etUdpCheck;
58 extern bool et_udp_threads_ready;
59