blob: a5ff830eefbf1774cce1fc1cef7f1db1c694b9e3 [file] [log] [blame] [edit]
/*
*
* Copyright (c) 2025 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* This file defines default compile-time configuration constants
* for the CHIP PAFTP layer.
*
*/
#pragma once
#include <system/SystemConfig.h>
/**
* @def WIFIPAF_LAYER_NUM_PAF_ENDPOINTS
*
* @brief
* This defines the number of WiFiPAFEndPoint objects allocated for use by the
* WiFiPAFLayer subsystem. Value should be defined as the minimum of (max number
* of simultaneous PAF connections the system supports, max number of
* simultaneous PAF connections the application will establish).
*/
#ifndef WIFIPAF_LAYER_NUM_PAF_ENDPOINTS
#define WIFIPAF_LAYER_NUM_PAF_ENDPOINTS 2
#endif // WIFIPAF_LAYER_NUM_PAF_ENDPOINTS
#if (WIFIPAF_LAYER_NUM_PAF_ENDPOINTS < 1)
#error "WIFIPAF_LAYER_NUM_PAF_ENDPOINTS must be greater than 0. configure options may be used to disable chip over PAF."
#endif
/**
* @def WIFIPAF_CONNECTION_OBJECT
*
* @brief
* This defines the type of WIFIPAF_CONNECTION_OBJECT parameters passed between
* PAF platform code and the WiFiPAFLayer subsystem.
*
* Most platforms should be able to retain this type's default definition as
* (void *), and pass [pointers to] connection handles generated by their
* platform interface where WIFIPAF_CONNECTION_OBJECT arguments are required by
* WiFiPAFLayer input functions.
*
*/
#ifndef WIFIPAF_CONNECTION_OBJECT
#define WIFIPAF_CONNECTION_OBJECT void *
#endif // WIFIPAF_CONNECTION_OBJECT
/**
* @def WIFIPAF_CONNECTION_UNINITIALIZED
*
* @brief
* This defines the value of an uninitialized WIFIPAF_CONNECTION_OBJECT.
*
*/
#ifndef WIFIPAF_CONNECTION_UNINITIALIZED
#define WIFIPAF_CONNECTION_UNINITIALIZED nullptr
#endif // WIFIPAF_CONNECTION_UNINITIALIZED
/**
* @def PAF_MAX_RECEIVE_WINDOW_SIZE
*
* @brief
* This is the maximum allowed size of a PAF end point's receive window, defined as the number of fragments the
* end point may reliably receive without PAF-layer acknowledgement. This value should be no larger than the floor
* of ONE-HALF the total number of slots or buffers reserved. The PAFTP layer reserves all of these buffers for its
* own use - one half for incoming writes or indications, and the other half for incoming confirmations.
*
* This value must be greater than 1, or race condition avoidance logic will prevent send the on remote device. This
* logic prevents any send with no piggybacked ack when the receiver's window has only 1 slot open. Without this
* logic, simultaneous data transmissions could fill both receiver's windows, leaving no room for the acks required
* to re-open them. Both senders would wedge, and the PAFTP connection would stall.
*
* This value must also exceed (WIFIPAF_CONFIG_IMMEDIATE_ACK_WINDOW_THRESHOLD + 1), or ***immediate*** stand-alone
* acks will forever be sent without delay in response to one another as each peer's window size dips below
* WIFIPAF_CONFIG_IMMEDIATE_ACK_WINDOW_THRESHOLD with receipt of any single message fragment.
*
* Default value of 3 is absolute minimum for stable performance, and an attempt to ensure safe window sizes on new
* platforms.
*
*/
#ifndef PAF_MAX_RECEIVE_WINDOW_SIZE
#define PAF_MAX_RECEIVE_WINDOW_SIZE 6
#endif
#if (PAF_MAX_RECEIVE_WINDOW_SIZE < 3)
#error "PAF_MAX_RECEIVE_WINDOW_SIZE must be greater than 2 for PAF transport protocol stability."
#endif
/**
* @def PAFTP_CONN_RSP_TIMEOUT_MS
*
* @brief
* Maximum amount of time, in milliseconds, after sending or receiving a PAFTP Session Handshake
* request to wait for connection establishment.
*/
#ifndef PAFTP_CONN_RSP_TIMEOUT_MS
#define PAFTP_CONN_RSP_TIMEOUT_MS 5000
#endif // PAFTP_CONN_RSP_TIMEOUT_MS
/**
* @def PAFTP_ACK_TIMEOUT_MS
*
* @brief
* Maximum amount of time, in milliseconds, after sending a PAFTP packet to wait for
* an acknowledgement. When the ack is not received within this period the PAFTP session is closed.
*/
#ifndef PAFTP_ACK_TIMEOUT_MS
#define PAFTP_ACK_TIMEOUT_MS 15000
#endif // PAFTP_ACK_TIMEOUT_MS
/**
* @def PAFTP_CONN_IDLE_TIMEOUT_MS
*
* @brief
* Maximum amount of time, in milliseconds, no unique data has been sent over PAFTP session
* before the Commissioner must close the PAFTP session
*/
#ifndef PAFTP_CONN_IDLE_TIMEOUT_MS
#define PAFTP_CONN_IDLE_TIMEOUT_MS 30000
#endif // PAFTP_CONN_IDLE_TIMEOUT_MS
/*
* Ref: [4.748] Supported Maximum Service Specific Info Length
*/
#define CHIP_PAF_DEFAULT_MTU 350
#include <lib/core/CHIPConfig.h>