1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef TCPFASTOPEN_H__
7 #define TCPFASTOPEN_H__
10 * This is an abstract class for TCP Fast Open - TFO (RFC7413).
11 * It is not always safe to use Fast Open. It can be use for requests that
13 * Middle boxes can block or reset connections that use TFO, therefore a
14 * backup connection will be prepared with a delay.
15 * In case of blocking such a connection tcp socket will terminate only after
16 * a timeout, therefore a backup connection is needed. If connection is refuse
17 * the same socketTransport will retry.
19 * This is implemented by nsHalfopenSocket.
27 // Check if we have a transaction that is safe to be used with TFO.
28 // Connections over TLS are always safe and some http requests (e.g. GET).
29 virtual bool FastOpenEnabled() = 0;
30 // To use TFO we need to have a transaction prepared, e.g. also have
31 // nsHttpConnection ready. This functions is call by nsSocketTransport to
32 // setup a connection.
33 virtual nsresult
StartFastOpen() = 0;
34 // Inform nsHalfopenSocket whether a connection using TFO succeeded or not.
35 // This will cancel the backup connection and in case of a failure rewind
37 virtual void SetFastOpenConnected(nsresult error
, bool aWillRetry
) = 0;
38 virtual void FastOpenNotSupported() = 0;
39 virtual void SetFastOpenStatus(uint8_t tfoStatus
) = 0;
43 } // namespace mozilla
45 #endif // TCPFASTOPEN_H__