1 /** @file
2 
3   @section license License
4 
5   Licensed to the Apache Software Foundation (ASF) under one
6   or more contributor license agreements.  See the NOTICE file
7   distributed with this work for additional information
8   regarding copyright ownership.  The ASF licenses this file
9   to you under the Apache License, Version 2.0 (the
10   "License"); you may not use this file except in compliance
11   with the License.  You may obtain a copy of the License at
12 
13       http://www.apache.org/licenses/LICENSE-2.0
14 
15   Unless required by applicable law or agreed to in writing, software
16   distributed under the License is distributed on an "AS IS" BASIS,
17   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   See the License for the specific language governing permissions and
19   limitations under the License.
20  */
21 
22 #pragma once
23 
24 #include "QUICTypes.h"
25 
26 class QUICConnection;
27 
28 class QUICResetTokenTable
29 {
30 public:
31   void insert(const QUICStatelessResetToken token, QUICConnection *connection);
32   QUICConnection *lookup(const QUICStatelessResetToken token);
33   void erase(const QUICStatelessResetToken token);
34 
35 private:
36   class TokenHasher
37   {
38   public:
39     uint64_t
operator()40     operator()(const QUICStatelessResetToken &key) const
41     {
42       return static_cast<uint64_t>(key);
43     }
44   };
45   std::unordered_map<QUICStatelessResetToken, QUICConnection *, TokenHasher> _map;
46 };
47