1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2  *
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef QuicSocketControl_h
8 #define QuicSocketControl_h
9 
10 #include "CommonSocketControl.h"
11 #include "nsIWeakReferenceUtils.h"
12 
13 namespace mozilla {
14 namespace net {
15 
16 class Http3Session;
17 
18 // IID for the QuicSocketControl interface
19 #define NS_QUICSOCKETCONTROL_IID                     \
20   {                                                  \
21     0xdbc67fd0, 0x1ac6, 0x457b, {                    \
22       0x91, 0x4e, 0x4c, 0x86, 0x60, 0xff, 0x00, 0x69 \
23     }                                                \
24   }
25 
26 class QuicSocketControl final : public CommonSocketControl {
27  public:
28   NS_DECLARE_STATIC_IID_ACCESSOR(NS_QUICSOCKETCONTROL_IID)
29 
30   NS_DECL_ISUPPORTS_INHERITED
31 
32   NS_IMETHOD GetSSLVersionOffered(int16_t* aSSLVersionOffered) override;
33 
34   explicit QuicSocketControl(uint32_t providerFlags);
35 
36   void SetNegotiatedNPN(const nsACString& aValue);
37   void SetInfo(uint16_t aCipherSuite, uint16_t aProtocolVersion,
38                uint16_t aKeaGroup, uint16_t aSignatureScheme);
39 
40   void SetAuthenticationCallback(Http3Session* aHttp3Session);
41   void CallAuthenticated();
42 
43   void HandshakeCompleted();
44   void SetCertVerificationResult(PRErrorCode errorCode) override;
45 
46  private:
47   ~QuicSocketControl() = default;
48 
49   // For Authentication done callback.
50   nsWeakPtr mHttp3Session;
51 };
52 
53 NS_DEFINE_STATIC_IID_ACCESSOR(QuicSocketControl, NS_QUICSOCKETCONTROL_IID)
54 
55 }  // namespace net
56 }  // namespace mozilla
57 
58 #endif  // QuicSocketControl_h
59