2017-05-04 13:14:04 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef TCPFastOpenLayer_h__
|
|
|
|
#define TCPFastOpenLayer_h__
|
|
|
|
|
|
|
|
#include "prerror.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2017-05-04 13:14:13 +03:00
|
|
|
/**
|
|
|
|
* This layer must be placed just above PR-tcp socket, i.e. it must be under
|
|
|
|
* nss layer.
|
|
|
|
* At the beginning of TCPFastOpenLayer.cpp there is explanation what this
|
|
|
|
* layer do.
|
|
|
|
**/
|
2017-05-04 13:14:54 +03:00
|
|
|
|
2017-08-20 10:45:26 +03:00
|
|
|
typedef enum {
|
|
|
|
TFO_NOT_TRIED,
|
|
|
|
TFO_TRIED,
|
|
|
|
TFO_DATA_SENT,
|
|
|
|
TFO_FAILED_CONNECTION_REFUSED,
|
|
|
|
TFO_FAILED_NET_TIMEOUT,
|
|
|
|
TFO_FAILED_UNKNOW_ERROR,
|
|
|
|
TFO_FAILED_BACKUP_CONNECTION,
|
|
|
|
TFO_FAILED_CONNECTION_REFUSED_NO_TFO_FAILED_TOO,
|
|
|
|
TFO_FAILED_NET_TIMEOUT__NO_TFO_FAILED_TOO,
|
|
|
|
TFO_FAILED_UNKNOW_ERROR_NO_TFO_FAILED_TOO,
|
|
|
|
TFO_FAILED_BACKUP_CONNECTION_NO_TFO_FAILED_TOO,
|
2017-08-30 11:05:00 +03:00
|
|
|
TFO_FAILED,
|
|
|
|
TFO_HTTP // TFO is disabled for non-secure connections.
|
2017-08-20 10:45:26 +03:00
|
|
|
} TFOResult;
|
2017-05-04 13:14:54 +03:00
|
|
|
|
2017-05-04 13:14:04 +03:00
|
|
|
nsresult AttachTCPFastOpenIOLayer(PRFileDesc *fd);
|
|
|
|
|
|
|
|
// Get the result of TCP Fast Open.
|
2017-05-04 13:14:54 +03:00
|
|
|
void TCPFastOpenFinish(PRFileDesc *fd, PRErrorCode &err,
|
|
|
|
bool &fastOpenNotSupported, uint8_t &tfoStatus);
|
2017-05-04 13:14:04 +03:00
|
|
|
|
2017-05-04 13:14:13 +03:00
|
|
|
int32_t TCPFastOpenGetBufferSizeLeft(PRFileDesc *fd);
|
2017-05-04 13:15:16 +03:00
|
|
|
|
|
|
|
bool TCPFastOpenGetCurrentBufferSize(PRFileDesc *fd);
|
|
|
|
bool TCPFastOpenFlushBuffer(PRFileDesc *fd);
|
2017-05-04 13:14:04 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // TCPFastOpenLayer_h__
|