proxygen
TLSCredProcessor.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017-present Facebook, Inc.
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 #pragma once
17 
18 #include <string>
19 #include <set>
20 
21 #include <folly/Optional.h>
23 #include <wangle/util/FilePoller.h>
24 
25 namespace wangle {
26 
32  public:
34  explicit TLSCredProcessor(std::chrono::milliseconds pollInterval);
35 
37 
42  void setTicketPathToWatch(const std::string& ticketFile);
43 
49  void setCertPathsToWatch(std::set<std::string> certFiles);
50 
51  void addTicketCallback(
52  std::function<void(wangle::TLSTicketKeySeeds)> callback);
53  void addCertCallback(std::function<void()> callback);
54 
55  void stop();
56 
57  void setPollInterval(std::chrono::milliseconds pollInterval);
58 
79  const std::string& fileName);
80 
81  private:
82  void ticketFileUpdated(const std::string& ticketFile) noexcept;
84 
85  std::unique_ptr<FilePoller> poller_;
87  std::set<std::string> certFiles_;
88  std::vector<std::function<void(wangle::TLSTicketKeySeeds)>> ticketCallbacks_;
89  std::vector<std::function<void()>> certCallbacks_;
90 };
91 }
void setTicketPathToWatch(const std::string &ticketFile)
static folly::Optional< wangle::TLSTicketKeySeeds > processTLSTickets(const std::string &fileName)
std::set< std::string > certFiles_
requires E e noexcept(noexcept(s.error(std::move(e))))
std::unique_ptr< FilePoller > poller_
void setPollInterval(std::chrono::milliseconds pollInterval)
std::vector< std::function< void()> > certCallbacks_
void addCertCallback(std::function< void()> callback)
std::vector< std::function< void(wangle::TLSTicketKeySeeds)> > ticketCallbacks_
void setCertPathsToWatch(std::set< std::string > certFiles)
const char * string
Definition: Conv.cpp:212
void ticketFileUpdated(const std::string &ticketFile) noexcept
void addTicketCallback(std::function< void(wangle::TLSTicketKeySeeds)> callback)