proxygen
SSLSessionCacheData.cpp
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 //
18 
19 using namespace std::chrono;
20 
21 namespace folly {
22 
23 template<>
26  ret["session_data"] = folly::dynamic(data.sessionData.toStdString());
27  system_clock::duration::rep rep = data.addedTime.time_since_epoch().count();
28  ret["added_time"] = folly::dynamic(static_cast<uint64_t>(rep));
29  ret["service_identity"] = folly::dynamic(data.serviceIdentity.toStdString());
30  return ret;
31 }
32 
33 template<>
36  data.sessionData = d["session_data"].asString();
37  data.addedTime =
38  system_clock::time_point(system_clock::duration(d["added_time"].asInt()));
39  data.serviceIdentity = d.getDefault("service_identity", "").asString();
40  return data;
41 }
42 
43 } // folly
static ObjectMaker object()
Definition: dynamic-inl.h:240
IfIsNonStringDynamicConvertible< K, dynamic > getDefault(K &&k, const dynamic &v=dynamic::object) const &
Definition: dynamic-inl.h:685
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
folly::dynamic toDynamic(const wangle::SSLSessionCacheData &data)
std::string asString() const
Definition: dynamic-inl.h:518
std::basic_string< E, T, A > toStdString() const
Definition: FBString.h:1227
std::chrono::time_point< std::chrono::system_clock > addedTime
wangle::SSLSessionCacheData convertTo(const dynamic &d)
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43