1 /** @file
2  *
3  *  A brief file description
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 "I_EventSystem.h"
27 #include "I_NetVConnection.h"
28 #include "QUICFrameHandler.h"
29 
30 class QUICApplication;
31 class QUICStreamManager;
32 class UDPPacket;
33 
34 class QUICConnectionInfoProvider
35 {
36 public:
~QUICConnectionInfoProvider()37   virtual ~QUICConnectionInfoProvider() {}
38   virtual QUICConnectionId peer_connection_id() const     = 0;
39   virtual QUICConnectionId original_connection_id() const = 0;
40   virtual QUICConnectionId first_connection_id() const    = 0;
41   virtual QUICConnectionId connection_id() const          = 0;
42   virtual std::string_view cids() const                   = 0;
43   virtual const QUICFiveTuple five_tuple() const          = 0;
44 
45   virtual uint32_t pmtu() const                                = 0;
46   virtual NetVConnectionContext_t direction() const            = 0;
47   virtual int select_next_protocol(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in,
48                                    unsigned inlen) const       = 0;
49   virtual bool is_closed() const                               = 0;
50   virtual std::string_view negotiated_application_name() const = 0;
51 };
52 
53 class QUICConnection : public QUICFrameHandler, public QUICConnectionInfoProvider
54 {
55 public:
56   virtual QUICStreamManager *stream_manager()             = 0;
57   virtual void close(QUICConnectionErrorUPtr error)       = 0;
58   virtual void handle_received_packet(UDPPacket *packeet) = 0;
59   virtual void ping()                                     = 0;
60 };
61