#ifndef LIP_SAMPLE_TCP_CNTR_CFG_DEFS_H
#define LIP_SAMPLE_TCP_CNTR_CFG_DEFS_H

#include "lip_config.h"
#include "lip/transport/tcp/lip_tcp_cfg_defs.h"


#ifdef LIP_CFG_EXAMPLE_TCP_ENABLE
    #define LIP_EXAMPLE_TCP_ENABLE              LIP_CFG_EXAMPLE_TCP_ENABLE
#else
    #define LIP_EXAMPLE_TCP_ENABLE              0
#endif


#if LIP_EXAMPLE_TCP_ENABLE
    #if !LIP_TCP_ENABLE
        #error TCP module must be enabled through LIP_CFG_TCP_ENABLE for use tcp counter example
    #endif
    #if !LIP_TCP_DD_MODE_ENABLE
        #error TCP dd mode must be enabled through LIP_CFG_TCP_DD_MODE_ENABLE for use tcp counter example
    #endif

    #ifdef LIP_CFG_EXAMPLE_TCP_SEND_PART_SIZE
        #define TCP_SEND_PART_SIZE LIP_CFG_EXAMPLE_TCP_SEND_PART_SIZE
    #else
        #define TCP_SEND_PART_SIZE (8*1024)
    #endif
    #ifdef LIP_CFG_EXAMPLE_TCP_SEND_PART_CNT
        #define TCP_SEND_PART_CNT  LIP_CFG_EXAMPLE_TCP_SEND_PART_CNT
    #else
        #define TCP_SEND_PART_CNT  2
    #endif
    #if (TCP_SEND_PART_SIZE > LIP_TCP_DD_LEN_MAX) || ((TCP_SEND_PART_SIZE % 4) != 0)
        #error invalid LIP_CFG_EXAMPLE_TCP_SEND_PART_SIZE size
    #endif

    #if defined LIP_CFG_EXAMPLE_TCP_SEND_DATA_COPY_FUNC && LIP_TCP_ENABLE_CUSTOM_DATA_COPY_FUNC
        #define TCP_SEND_DATA_COPY_FUNC LIP_CFG_EXAMPLE_TCP_SEND_DATA_COPY_FUNC
        #if defined LIP_CFG_EXAMPLE_TCP_SEND_DATA_COPY_FUNC_CTX
            #define TCP_SEND_DATA_COPY_FUNC_CTX LIP_CFG_EXAMPLE_TCP_SEND_DATA_COPY_FUNC_CTX
        #else
            #define TCP_SEND_DATA_COPY_FUNC_CTX NULL
        #endif
    #endif

    #if defined LIP_CFG_EXAMPLE_TCP_RECV_DATA_COPY_FUNC && LIP_TCP_ENABLE_CUSTOM_DATA_COPY_FUNC
        #define TCP_RECV_DATA_COPY_FUNC LIP_CFG_EXAMPLE_TCP_RECV_DATA_COPY_FUNC
        #if defined LIP_CFG_EXAMPLE_TCP_RECV_DATA_COPY_FUNC_CTX
            #define TCP_RECV_DATA_COPY_FUNC_CTX LIP_CFG_EXAMPLE_TCP_RECV_DATA_COPY_FUNC_CTX
        #else
            #define TCP_RECV_DATA_COPY_FUNC_CTX NULL
        #endif
    #endif


    #ifdef LIP_CFG_EXAMPLE_TCP_RECV_PART_SIZE
        #define TCP_RECV_PART_SIZE LIP_CFG_EXAMPLE_TCP_RECV_PART_SIZE
    #else
        #define TCP_RECV_PART_SIZE 1024
    #endif
    #ifdef LIP_CFG_EXAMPLE_TCP_RECV_PART_CNT
        #define TCP_RECV_PART_CNT  LIP_CFG_EXAMPLE_TCP_RECV_PART_CNT
    #else
        #define TCP_RECV_PART_CNT  LIP_TCP_SOCK_RX_DD_CNT
    #endif
    #if (TCP_RECV_PART_SIZE > LIP_TCP_DD_LEN_MAX) || ((TCP_RECV_PART_SIZE % 4) != 0)
        #error invalid LIP_CFG_EXAMPLE_TCP_RECV_PART_SIZE size
    #endif

    #ifdef LIP_CFG_EXAMPLE_TCP_SEND_BUF_MEM
        #define TCP_SEND_BUF_MEM(v)   LIP_CFG_EXAMPLE_TCP_SEND_BUF_MEM(v)
    #else
        #define TCP_SEND_BUF_MEM(v)   LIP_DEFAULT_STATIC_BUF_MEM(v)
    #endif

    #ifdef LIP_CFG_EXAMPLE_TCP_RECV_BUF_MEM
        #define TCP_RECV_BUF_MEM(v)   LIP_CFG_EXAMPLE_TCP_RECV_BUF_MEM(v)
    #else
        #define TCP_RECV_BUF_MEM(v)   LIP_DEFAULT_STATIC_BUF_MEM(v)
    #endif
#endif

#endif // LIP_SAMPLE_TCP_CNTR_CFG_DEFS_H
