Compile Time Macros

Jump to: navigation, search
<< Preparing for Integration
Building the Library >>



The <trsystem.h> file is used to configure the compile time switches for the Treck protocol stack. It should be considered the master configuration file. In this file, you will find macros to define things such as optimization, endian, and defaults for run time parameters used by the protocol stack. You may find that you do not need to modify this file if your environment is already defined in the <trsystem.h> file. When you are integrating to your hardware platform and hooking the protocol stack up to your kernel, this will be the only header file that you need modify. If you decide to turn on macros that are defined in this file, you can do it at the top of the file.


Cryptography Macros

  • TM_USE_ASYNC_CRYPTO
    Allow the crypto engine to block while processing data.
  • TM_USE_SW_CRYPTOENGINE
    Enable software cryptographic implementations if you want to use software implementation of any hash algorithm (i.e. MD5, SHA1, RIPEMD, etc), or cryptography algorithm (i.e. DES, 3DES BLOWFISH, RC4, RC5, CAST128, TWOFISH, AES, DIFFIE-HELLMAN exchange, RSA, DSA, etc). If your hardware accelerator supports all algorithms, you may want to disable the software cryptographic engine to save code space.
  • TM_AALG_VAR_BLOCK_SIZE
    SHA-384 and SHA-512 use a larger block size that other hash algorithms, so TM_AALG_VAR_BLOCK_SIZE must be defined when using either hash algorithm. When this macro is defined, ttAhAlgorithm has an extra field for algorithm block size.

Cryptographic Algorithm Macros

  • TM_USE_MD2
  • TM_USE_MD5
  • TM_USE_SHA1
  • TM_USE_SHA256
  • TM_USE_SHA384
  • TM_USE_SHA512
  • TM_USE_SHAHMAC_96
  • TM_USE_AESXCBC
  • TM_USE_RIPEMD
  • TM_USE_DES
  • TM_USE_3DES
  • TM_USE_BLOWFISH
  • TM_USE_RC2
  • TM_USE_RC5
  • TM_USE_CAST128
  • TM_USE_AES
  • TM_USE_TWOFISH
  • TM_USE_ARCFOUR
Note Note: SHA-384 and SHA-512 require TM_AALG_VAR_BLOCK_SIZE.
Note Note: A patent license is required to use RC5.

Protocol Macros

  • TM_USE_IPV4
    Enable IPv4 in the protocol stack.
  • TM_USE_IPV6
    Enable IPv6 in the protocol stack.
  • TM_USE_DHCP
    Enable the Dynamic Host Configuration Protocol Client for IPv4.
  • TM_USE_DHCP_SERVER
    Enable the Dynamic Host Configuration Protocol Server for IPv4.
  • TM_USE_IGMP
    Enable the Internet Gateway Management Protocol.
  • TM_USE_IGMPV3
    Enable the Internet Gateway Management Protocol version 3.
  • TM_USE_PPP
    Enable the Point-to-Point Protocol (PPP).
  • TM_USE_EAPOL_CLIENT
    Enable client-side Extensible Authentication Protocol over LAN (EAPoL). This protocol is used in IEEE Std 802.1X for peer authentication (Supplicant end).
  • TM_USE_EAPOL_SERVER
    Enable server-side Extensible Authentication Protocol over LAN (EAPoL). This protocol is used in IEEE Std 802.1X for peer authentication (Authenticator end).
  • TM_USE_AUTO_IP
    Enable the use Auto IP Configuration or to add collision detection.
  • TM_DISABLE_TELNETD
    Disable the Telnet Server code to save code space.
  • TM_DISABLE_FTP
    Disable the File Transfer Protocol (FTP) Client code to save code space.
  • TM_DISABLE_FTPD
    Disable the File Transfer Protocol (FTP) Server code to save code space.
  • TM_DISABLE_TFTP
    Disable the Trivial File Transfer Protocol (TFTP) Client code to save code space.
  • TM_DISABLE_TFTPD
    Disable the Trivial File Transfer Protocol (TFTP) Server code to save code space.
  • TM_DISABLE_TCP
    Disable the Transmission Control Protocol (TCP) code to save code space.
  • TM_USE_SCTP
    Enable the Stream Control Transmission Protocol (SCTP). This protocol can be used as a replacement for TCP. It supports automatic path failover when one or both endpoints have multiple IP addresses (multi-homed). See SCTP Option Macros below or the separate SCTP page for details.
  • TM_USE_HTTPC
    Enable the Web (HTTP) client.
  • TM_USE_HTTPD
    Enable the Web (HTTP) server.
  • TM_USE_POP3
    Enable Post Office Protocol version 3 (POP3).
  • TM_USE_SMTP
    Enable the Simple Mail Transfer Protocol (SMTP).
  • TM_USE_SMTP_ASYNC_CB
    Enable asynchronous event notification for SMTP. Use this feature if you are using non-blocking mode and your SMTP session has many transactions (e.g. many recipients or messages) and you need better performance. This feature can improve responsiveness by telling you when tfSmtpUserExecute() needs to be called.
  • TM_DISABLE_SNTP
    Disable the Simple Network Time Protocol (SNTP) client code to save code space.
  • TM_MOBILE_IP4
    Enable the Mobile IPv4 protocol.
  • TM_MIP_USE_DHCP
    Enable DHCP with Mobile IPv4.
Note Note: This option will enable TM_USE_DHCP automatically.
  • TM_USE_IPSEC
    Enable IP Security (IPsec).
  • TM_USE_IKE
    Enable the Internet Key Exchange (IKE) protocol.
  • TM_USE_SEC_STAT
    Enable IPsec/IKE statistics. This requires that one or both TM_USE_IKE or TM_USE_IPSEC be defined. Additionally the macro TM_SEC_STAT_MAX_IKE_ADDRESSES may be defined. This macro specifies the number of IKE addresses to keep statistics on. This must be at most 32,767. If left undefined it will be set to 1.
  • TM_USE_SSL_CLIENT
    Enable Secure Socket Layer (SSL) client functionality.
  • TM_USE_SSL_SERVER
    Enable Secure Socket Layer (SSL) server functionality.
  • TM_USE_FTP_SSL
    Enable Secure Socket Layer (SSL) client over FTP.
  • TM_USE_FTPD_SSL
    Enable Secure Socket Layer (SSL) server over FTP.
  • TM_USE_SMTP_SSL
    Enable Secure Socket Layer (SSL) client over SMTP. (Prerequisites: TM_USE_SMTP and TM_USE_SSL_CLIENT)
  • TM_USE_UPNP_DEVICE
    Enable UPnP network device support.
Note Note: If you enable TM_USE_UPNP_DEVICE, you must also enable TM_USE_HTTPD and TM_USE_HTTPD_SSI, since Treck UPnP uses Treck web server SSI.
Note Note: If you enable TM_USE_SOAP, you must also enable TM_USE_HTTPD, since Treck SOAP uses Treck web server.
  • TM_USE_PKI
    Enable Public Key Infrastructure capabilities in Treck products. Treck IKE supports digital signature authentication method. This also includes RSA/DSA algorithm, PEM/DER certification, X509v3 and ASN1 format, multi CA and CRL. These capabilities are enabled by default when TM_USE_SSL_CLIENT or TM_USE_SSL_SERVER are enabled.

Protocol Option Macros

ARP Option Macros

  • TM_ARP_UPDATE_ON_RECV
    Enable updating of the ARP cache on receipt of each IP packet. This will prevent the stack from sending an ARP request every 10 minutes on an active ARP entry, i.e. an ARP entry for a destination IP address that the stack is actively sending to. Enabling this feature will affect speed and size, since every incoming packet will be checked for an ARP cache match on its destination IP address.
  • TM_USE_ARP_FLUSH
    Enable flushing of the ARP cache table for a given address family or set of address families via tfArpFlush().

DHCP Client Option Macros

  • TM_DISABLE_DHCP_COLLECT
    If you do not need to select from a collection of DHCP offers, you can uncomment the TM_DISABLE_DHCP_COLLECT macro in trsystem.h to remove the code for this feature.
  • TM_USE_DHCP_DOMAIN_SEARCH
    Uncomment this macro in trsystem.h to enable support for the Domain Search Option (RFC 3397). Note that this option does not change how the DNS resolver operates (see TM_USE_DNS_DOMAIN_SEARCH).
  • TM_USE_DHCP_FQDN
    Enable the Dynamic Host Configuration Protocol Fully Qualified Domain Name (DHCP FQDN) option.
  • TM_USE_DHCP_SEND_OVERLOAD
    To enable the option overload feature for large outbound DHCP messages (RFC 2132, section 9.3), uncomment the TM_USE_DHCP_SEND_OVERLOAD macro in trsystem.h. When enabled, outbound DHCP messages that have more than 312 bytes of options (DHCP message size > 548 bytes) will be subject to option overloading (options will be moved to the unused sname and file fields to shrink the overall message size). Note: the 548 byte threshold is a default value that you can override (see below).
  • TM_DHCP_SEND_OVERLOAD_THRESHOLD
    If the option overload feature is enabled (see TM_USE_DHCP_SEND_OVERLOAD above), Treck will try to limit the length of outbound DHCP messages to 548 bytes or less by moving options to the unused sname and file fields. You can change the message length overload threshold by setting macro TM_DHCP_SEND_OVERLOAD_THRESHOLD in trsystem.h to the allowable message length for your system. The minimum value you may define is 548.
  • TM_DHCP_CB_WITH_MHOME
    Uncomment this macro in trsystem.h to receive the multihome index in the DHCP address notification callback function. NOTE: This changes the address notification callback function prototype.
  • TM_DHCP_CB_RELEASE
    Uncomment this macro in trsystem.h to allow time for the DHCP Release message to be sent when unconfiguring a DHCP autoconfigured address. This does not guarantee receipt of the message by the DHCP server.

DHCP Server Option Macros

  • TM_USE_DHCP_SERVER
    Enable DHCP Server. Uncomment this macro in trsystem.h to add all Treck DHCP server code to your build.
    Default: undefined
  • TM_DHCPD_USE_FS
    Enable the DHCP Server file system interface. Uncomment this macro in trsystem.h, if you need the DHCP server file interface.
    Default: undefined

DHCPv6 Client Option Macros

  • TM_6_USE_DHCP
    This macro must be defined to include DHCPv6 client code when compiling the Treck stack.
  • TM_6_MAX_DHCP_IPS_PER_IA
    This macro controls the maximum number of DHCPv6 addresses the client will use from an IA. Currently, the client will only accept a single IA, so this number is analogous to the total number of DHCPv6 addresses the client will accept.
    Default: 4
  • TM_6_DHCP_USE_FQDN
    This macro must be defined to include support for the FQDN option in the DHCPv6 client code.
  • TM_6_DHCP_FQDN_MAX_ASCII_LEN
    This macro controls the maximum allowed length of the domain name returned by the DHCPv6 server when stored in ASCII format. This option does not modify the server's behavior; it changes the maximum length that the client is able to save. The maximum length the server could send is 256 bytes. Setting this value to less than 256 will save memory but will result in the client being unable to process FQDNs longer than the specified value.
    Default: 256
  • TM_6_DHCP_USE_AUTH
    This macro must be defined to include support for DHCPv6 authentication in the DHCPv6 client code.
  • TM_6_DHCP_USE_CONF_OPEN
    This macro must be defined to include support for the TM_6_DEV_USER_DHCP_CONF_OPEN flag when calling tfNgOpenInterface(). The TM_6_DEV_USER_DHCP_CONF_OPEN flag is set in conjunction with TM_6_DEV_USER_DHCP to instruct the DHCPv6 client to reboot with a Confirm and Reply message exchange rather than a standard Solicit and Advertise exchange.
    Default: undefined
  • TM_6_DHCP_USE_RAPID_COMMIT
    This macro must be defined to include support for the Rapid Commit option in the DHCPv6 client. To enable the Rapid Commit option on an interface, you must also call tfInterfaceSetOptions() to set option TM_6_DEV_OPTIONS_DHCP_RAPID_CMT. The Rapid Commit option is included in the message exchange between client and server to commit addresses and other configuration information in fewer messages.
    Default: undefined

Lightweight DHCPv6 Relay Agent Option Macros

  • TM_6_USE_DHCP_RELAY
    Enable Lightweight DHCPv6 Relay Agent (LDRA). Uncomment this macro in trsystem.h to add all LDRA server code to your build.
    Default: undefined
  • TM_DHCPD_USE_FS
    Enable the DHCP Server file system interface. Uncomment this macro in trsystem.h, if you need the LDRA file interface.
    Default: undefined

DHCPv6 Server Option Macros

  • TM_6_USE_DHCP_SERVER
    Enable DHCPv6 Server. Uncomment this macro in trsystem.h to add all Treck DHCPv6 server code to your build.
    Default: undefined
  • TM_DHCPD_USE_FS
    Enable the DHCP Server file system interface. Uncomment this macro in trsystem.h, if you need the DHCPv6 server file interface.
    Default: undefined

DNS Option Macros

  • TM_DNS_USE_SRV
    Enable Domain Name System SRV record support.
  • TM_DNS_MAX_SOCKETS_ALLOWED
    Define this macro to specify the number of simultaneous DNS requests allowed. Default: 1.
  • TM_DNS_TRANS_ID_BACKLOG_SIZE
    Specify the size of the backlog of random Transaction IDs. All newly generated Transaction IDs are required to be unique to this list and to all Transaction IDs currently in the DNS cache. The default value is 8. For security purposes this value should remain as small as is reasonably possible.
  • TM_DNS_USE_SRV
    To enable SRV functionality, TM_DNS_USE_SRV must be defined in trsystem.h.
  • TM_DNS_SRV_HOSTS_PER_ENTRY
    This macro can be defined in trsystem.h. The default value is 3.This macro controls the maximum number of hosts saved in the DNS cache for a single SRV query. By default, if an SRV query for ftp._tcp.treck.com returns ftp1.treck.com, ftp2.treck.com, ftp3.treck.com, and ftp4.treck.com, only the first three (based on priority and weight) are saved. The fourth is discarded.
  • TM_DNS_SRV_ADDRS_PER_HOST
    This macro can be defined in trsystem.h. The default value is 2. This macro controls the maximum number of addresses saved for each host associated with an SRV query. Each host may have multiple IP addresses. By default, only two addresses will be saved for each host – all others will be discarded.
  • TM_USE_DNS_DOMAIN_SEARCH
    Uncomment this macro in trsystem.h to include code that will attempt to resolve a partial hostname by iteratively applying a sequence of domain suffixes. This option requires that TM_USE_DHCP be defined in trsystem.h. It is recommended that you also define TM_USE_DHCP_DOMAIN_SEARCH to request the Domain Search Option during DHCP configuration. This macro is undefined by default. See main article for details.
  • TM_USE_DNS_UPDATE
    Uncomment this macro in trsystem.h to include the Dynamic DNS Update code.

HTTP Option Macros

  • TM_USE_HTTPD_CGI
    Enable CGI support of HTTPD (web server). See CGI Interface.
  • TM_USE_HTTPD_SSI
    Enable support for HTTPD Server-Side Includes. See SSI Interface.
  • TM_DISABLE_HTTPD_BASIC_AUTH
    Disable support for Basic Access Authentication in the Treck Web Server. See RFC 2617.
  • TM_DISABLE_HTTPD_DIGEST_AUTH
    Disable support for Digest Access Authentication in the Treck Web Server. See RFC 2617.
  • TM_DISABLE_HTTPC_BASIC_AUTH
    Disable support for Basic Access Authentication in the Treck Web Client. See RFC 2617.
  • TM_DISABLE_HTTPC_DIGEST_AUTH
    Disable support for Digest Access Authentication in the Treck Web Client. See RFC 2617.

ICMP Option Macros

  • TM_PING_REPLY_BROADCAST
    Enable this macro if you want the stack to reply to ping echo requests whose destination is a broadcast or a multicast address.
  • TM_PING_REPLY_MULTICAST
    Enable this macro if you want the stack to reply to ping echo requests whose destination is a multicast address (implied if TM_PING_REPLY_BROADCAST is enabled).
  • TM_RAW_SOCKET_INPUT_ICMP_REQUESTS
    Enable this macro if you want ICMP echo requests, and ICMP address mask requests to be delivered to a raw ICMP socket.
  • TM_USE_ECHO_CONFIG
    Enable dynamic configuration of IPv4 ICMP Echo Reples through the use of the TM_OPTION_ICMP_ECHO_ENABLE option to tfSetTreckOptions().

IGMP Option Macros

  • TM_USE_IGMP_FILTERING
    Allow IGMP datagrams to be delivered to a user-specified IGMP callback function on a per-interface basis. These callbacks can be enabled/disabled for each device however this macro must be enabled before any IGMP filter callback processing logic is processed.
  • TM_USE_IGMP_FILTERING_CONTIGUOUS_DATA
    With TM_USE_IGMP_FILTERING enabled, TM_USE_IGMP_FILTERING_CONTIGUOUS_DATA forces the IGMP header and IGMP data to be contiguous.

IKE Option Macros

  • TM_ISAKMPSA_VLIFETIME_SOFT_MARGIN_PCT
    Use this macro to specify the minimum percentage of the IKE SA hard byte lifetime allowed before the soft byte lifetime expires. The default value is 20 indicating the soft byte lifetime must be at least 20% of the hard byte lifetime.
  • TM_USE_IKE_TASK
    Enable IKE to run as its own task while processing received packets from the network.
  • TM_USE_IKE_DPD
    Enable the Dead Peer Detection code in IKE.
Note Note: TM_USE_IKE_DPD requires TM_USE_IKE_POLICIES to be defined.
  • TM_USE_NATT
    Enable the NAT traversal code in IKE.
Note Note: TM_USE_NATT requires TM_USE_IKE_POLICIES to be defined.
  • TM_USE_IKE_POLICIES
    Enable the use of IKE policies in conjunction with IPsec policies.
  • TM_IKE_VALIDATE_OUTGOING
    Enable a check to ensure that outgoing packet selectors match the addresses specified in the IPsec's associated IKE policy.
  • TM_IKE_DEBUG
    Enable debugging inside of IKE.
  • TM_IKE_SAD_MAX_SIZE
    Define the total number of IKE SAs that can be present at one time. When this limit is met, any new SA creation results in the removal of the oldest SA. The default is 100. To make the number of allowable SAs unlimited, set this to 0.
Note Note: This is limited to a tt16Bit value.
  • TM_IKE_PACKET_MAX_QUEUE_BYTES
    Each IKE policy content can only hold this maximum data waiting for IKE negotiation results. The default is 8000 bytes. To prevent any data from being queued, set this value to 0.
  • TM_IKE_DHSECRET_DEFAULT_SIZE
    Define the size in bytes of the Diffe-Hellman local secret size. The default value is 32 (256 bits) per the NIST recommendation.
  • TM_IKE_PFS_KEY_ENABLED
    Enable IKE phase 2 (quick mode) perfect forward secrecy (PFS)
  • TM_IKE_PHASE1_AGGRESSIVE_ENABLED
    Enable the use of IKE Aggressive mode instead of Main mode if Treck is the initiator for the IKE Phase 1 negotiation.
  • TM_IKE_AGGRESSIVE_DHGROUP
    Define the Diffie-Hellman group to use in IKE Phase 1 for Aggressive mode. This must be correct in order to send the proper KE payload. The default value is TM_DHGROUP_2. Valid values are
TM_DHGROUP_1
TM_DHGROUP_2
TM_DHGROUP_3
TM_DHGROUP_4
TM_DHGROUP_5
TM_DHGROUP_14
  • TM_IKE_INITIAL_CONTACT_ENABLED
    Enable the sending of the IKE Initial Contact message after encryption and authentication keys have been negotiated. Treck will only accept protected Initial Contact messages.
  • TM_IKE_USE_DEFAULT_PRESHARED_KEY
    When using pre-shared keys for phase one IKE negotiations Treck IKE will attempt to find a pre-shared key for the specified identification. If none is found and this feature is enabled, Treck IKE will use the default pre-shared key. If this feature is not enabled, Treck IKE will fail to find a pre-shared key corresponding to the specified identity and return an error.
  • TM_IPSEC_BYPASS_NESTIKE_PACKET
    Bypass policy checks for any nested IKE packet. With this feature enabled there will be no protection for nested IKE packets.
  • TM_USE_IKE_VENDOR_ATTR
    Enable advertisement of the Treck IKE Vendor ID during IKE negotiation.

IP Option Macros

  • TM_USE_RAW_SOCKET
    Enable this macro if you want to use raw sockets (tfRawSocket()) which allows you to send data above the IP layer or to send data with an IP header, and to receive data with an IP header.
  • TM_USE_REUSEADDR_LIST
    Enable the use of the SO_REUSEADDR socket level option with setsockopt(), which allows you to bind the same port number to multiple sockets using different local IP addresses.
  • TM_USE_REUSEPORT
    Enable the use of the SO_REUSEPORT socket level option with setsockopt(). This enables use of the socket reuse address list, and enables binding several sockets on the same port and same local IP address.
  • TM_USE_FILTERING
    Allow IPv4 datagrams to be delivered to a user-specified callback function on a per-interface basis. These callbacks can be enabled/disabled for each device however this macro must be enabled before any filter callback processing logic is processed.
  • TM_USE_FILTERING_CONTIGUOUS_DATA
    With TM_USE_FILTERING enabled, TM_USE_FILTERING_CONTIGUOUS_DATA allows the user to peek at the data in the user-specified call back routine. In that case the data will be contiguous with the IPv4 header, and Upper Layer Protocol (ULP) header.
  • TM_6_USE_FILTERING
    Allow IPv6 datagrams to be delivered to a user-specified callback function on a per-interface basis. These callbacks can be enabled/disabled for each device however this macro must be enabled before any filter callback processing logic is processed. When TM_6_USE_FILTERING is defined only the IPv6 header followed by two bytes is guaranteed to be contiguous. Please see also TM_6_USE_FILTERING_CONT_DATA.
  • TM_6_USE_FILTERING_CONT_DATA
    When TM_6_USE_FILTERING is enabled, TM_6_USE_FILTERING_CONT_DATA allows the user to peek at the ULP, and/or data in the user-specified call back routine. In that case the ULP and data will be contiguous with the IPv6 header.
  • TM_USE_LBCAST_CONFIG
    Enable dynamic configuration of IPv4 Limited Broadcasting through the use of the TM_OPTION_IP_LBCAST_ENABLE option to tfSetTreckOptions().
  • TM_USE_IFNAMEINDEX
    Include support for RFC 2553 functions if_nameindex() and if_freenameindex().
  • TM_6_IP_FRAGMENT
    Enable support for IPv6 fragmentation. Comment out to save code space when IPv6 fragmentation is not needed.
  • TM_6_IP_REASSEMBLY
    Enable support for IPv6 reassembly. Comment out to save code space when IPv6 reassembly is not needed.
  • TM_DISABLE_RFC3484
    Disable source address selection as defined in RFC 3484
  • TM_6_USE_IP_FORWARD
    Enable IPv6 forwarding code. Comment out to save code space when IPv6 forwarding is not needed.
  • TM_6_IP_SRC_ERROR_CHECKING
    Enable validation of the source address of received IPv6 packets.
  • TM_6_DISABLE_PMTU_DISC
    Disable automatic IPv6 Path MTU discovery.
  • TM_6_USE_NUD
    Enable IPv6 Neighbor Unreachability Detection code. Comment out to save code space when IPv6 Neighbor Unreachability Detection is not needed.
  • TM_6_USE_MLD
    Enable IPv6 Multicast Listener Discovery (MLD) code. Comment out to save code space when IPv6 Multicast Listener Discovery is not needed.
  • TM_6_USE_MLDV2
    Enable IPv6 Multicast Listener Discovery version 2 (MLDv2) code. Comment out to save code space when MLDv2 is not needed.
  • TM_6_USE_MULTICAST_LOOP
    Enable support for the IPV6_MULTICAST_LOOP socket option described in RFC 3493:
    • "If a multicast datagram is sent to a group to which the sending host itself belongs (on the outgoing interface), a copy of the datagram is looped back by the IP layer for local delivery."
    If TM_6_USE_MULTICAST_LOOP is undefined, outgoing IPv6 multicast packets are never looped back unless the user's device driver explicitly does so.
    If TM_6_USE_MULTICAST_LOOP is defined, loopback of outgoing IPv6 multicast packets is controlled by the IPV6_MULTICAST_LOOP socket option, with loopback being the default action (as stated in RFC 3493).
  • TM_6_USE_DAD
    Enable IPv6 Duplicate Address Detection code. Comment out to save code space when IPv6 Duplicate Address Detection is not needed.
  • TM_6_DAD_ALLOW_NO_WAIT
    Include code that allows the user to bypass the typical 1 second wait for responses when performing Duplicate Address Detection on an interface. See Fast Reboot when using Autoconfigured Addresses and tfInterfaceSetOptions() flag TM_6_DEV_OPTIONS_DAD_NO_WAIT for details. This macro is undefined, by default, to save code space. If you define this macro, you must also define TM_6_USE_DAD.
  • TM_6_USE_FAST_TEMP_BOOT
    Include code that allows the user to configure a temporary address for immediate use while waiting for autoconfiguration of the same address via DHCPv6 or Router Advertisement. See Fast Reboot when using Autoconfigured Addresses and tfNgOpenInterface() flag TM_6_DEV_IP_FAST_BOOT for details. This macro is undefined, by default, to save code space.
  • TM_6_USE_PREFIX_DISCOVERY
    Enable IPv6 Prefix Discovery code, part of stateless address auto-configuration. Comment out to save code space when IPv6 Prefix Discovery is not needed.
  • TM_6_ENABLE_ONLINK_ASSUMPTION
    RFC 4861 (Neighbor Discovery for IPv6) obsoletes RFC 2461 and removes the following text from section 5.2 for reasons explained in RFC 4943: If the Default Router List is empty, the sender assumes that the destination is on-link. Define this macro in trsystem.h to undo this change and re-enable the on-link assumption code.
  • TM_MAX_IPS_PER_IF
    The maximum number of manually configured IP addresses per interface. This value should either be a multiple of 4 unless TM_SINGLE_INTERFACE_HOME is defined, in which case the default is 1.

IPsec Option Macros

  • TM_USE_IPSEC_TASK
    Enable IPsec to run in a separate task.
  • TM_IPSEC_TASK_MAX_QUEUE_SIZE
    When running IPsec as its own task, this macro specifies the maximum amount of allocated memory (in bytes) that the task queue can contain. The default is 16384.
  • TM_USE_IPSEC_HANDOFF_TASK
    If you are using the IPsec task (TM_USE_IPSEC_TASK), this macro will allow you to set up another task to finish transmission of the packet after crypto processing has completed. This will allow the IPsec task to push another packet into the crypto engine as quickly as possible.
  • TM_IPSEC_HANDOFF_TASK_MAX_QUEUE_SIZE
    When running the IPsec handoff task, this macro specifies the maximum amount of allocated memory (in bytes) that the task queue can contain. The default is 16384.
  • TM_DISABLE_IPSEC_SA_TIMERS
    Disable the lifetime timers. If this is done, there should be some external timer that manages the callback to invoke the soft and hard lifetime logic responsible for expiring security associations.
  • TM_IPSECSA_VLIFETIME_SOFT_MARGIN_PCT
    Use this macro to specify the minimum percentage of the IPsec SA hard byte lifetime allowed before the soft byte lifetime expires. The default value is 20 indicating the soft byte lifetime must be at least 20% of the hard byte lifetime.
  • TM_USE_MULTIPLE_PROPOSALS
    Enable the use of bundled SAs (i.e. AH/ESP/IPComp, for example).
  • TM_USE_PRIORITIES
    Enable the use of IPsec priorities when IPsec is used with IKE policies and/or Multiple Proposals.
  • TM_USE_PRI_PROC
    Enable processing of IPsec policies in priority-based order instead of index-based order. This requires enabling TM_USE_PRIORITIES.
  • TM_IPSEC_USE_ANTIREPLAY
    Enable antireplay checking of IPsec sequence numbers for authenticated ESP packets.
Note Note: Treck does not recommend enabling antireplay detection when used with manual keying. If enabled all cycled sequence packets will be dropped unless the user manually update the SA before the cycle happens.
  • TM_IPSEC_INCOMING_ICMP_BYPASS
    Disable IPsec policy checking on incoming ICMP packets.
  • TM_IPSEC_INCOMING_ICMP_NOSRCCHK
    Disable source address checking on incoming ICMP packets. If a router is tunneling ICMP packet generated by other routers, the source address of the inner header will not be the tunnel's end address, the source address check at the destination will fail. Enabling TM_IPSEC_INCOMING_ICMP_NOSRCCHK will skip ICMP source address checking for these packets.
  • TM_6_IPSEC_ICMPV6_NDMLD_BYPASS
    Enable this feature to bypass IPsec protection for ICMPv6 Neighbor Discovery and Multicast Listener Discovery messages. If IKE is to be used over IPv6 you should enable this feature to avoid the chicken-and-egg problem when trying to establish an initial IPsec Security Association (SA), otherwise you must manually add an IPsec SA to allow the processing of the initial IKE messages.
  • TM_IPSEC_DEFAULT_REPLAY_SIZE
    Define this macro to be the default replay window size for IPsec. If this macro is not defined to a value, the replay window size is 32.
  • TM_IPSEC_SAD_MAX_SIZE
    Define the total number of IPsec SA pairs that can be present at one time. When this limit is met, any new SA creation results in the removal of the oldest SA. The default is 100 pairs (100 incoming, 100 outgoing). To make the number of allowable SAs unlimited, set this to 0.
Note Note: This is limited to a tt16Bit value.
  • TM_IPSEC_POLICY_USER_DATA
    Allow the user to add IPsec policies that contain user-defined opaque data via tfPolicyAddWithUserData().
  • TM_USE_IPSEC_IPCOMP
    IKE provides for negotiation of IP Compression algorithms. However, IPsec and the required cryptography support is not currently implemented. For the time being, leave this undefined.
  • TM_IPSEC_USE_64BIT_SEQ_NO
    Enable negotiation of 64-bit IPsec sequence numbers.
  • TM_USE_IPSEC_64BIT_KB_LIFETIMES
    Enable negotiation of 64-bit IPsec SA lifetimes.
  • TM_IPSEC_DEBUG
    Enable debugging of encryption and authentication in IPsec.
  • TM_IPSEC_ONLY_WHEN_REQUIRED
    Enable code that allows the user to designate IPsec policies as on-demand. This allows communication with IPsec and non-IPsec peers when the peer IP address is not known. A peer sending an initial IKE packet to port 500 or 4500 will result in the creation of IPsec SAs based on the policy selected. A peer sending to any other port will bypass the IPsec policy.

Mobile IPv6 Option Macros

  • TM_6_USE_MIP_CN
    Enable Mobile IPv6 correspondent node code. Comment out to save code space when Mobile IPv6 correspondent node functionality is not needed.
  • TM_6_USE_MIP_MN
    Enable Mobile IPv6 mobile node code. Comment out to save code space when Mobile IPv6 mobile node functionality is not needed.
  • TM_6_MIP_DRAFT24
    Use Mobility Header protocol ID and ICMPv6 message types per draft-ietf-mobileip-ipv6-24.txt, rather than IANA assignments.
  • TM_6_USE_MIP_HA
    Enable Mobile IPv6 home agent code. Comment out to save code space when Mobile IPv6 mobile node functionality is not needed.
Note Note: As of IPv6 phase II release, this is only a HA lite that doesn't implement the whole functionality of a MIP6 home agent.
  • TM_6_USE_MIP_RO
    Enable Mobile IPv6 route optimization. Comment out to save code space when Mobile IPv6 route optimization is not needed.
    ([MIPV6_18++].R14.4.5:10, [MIPV6_18++]R14.4.5:20)

  • TM_6_MN_DISABLE_HOME_DETECT
    Disable Mobile IPv6 Mobile Node home detection/return to home functionality. If you know that the mobile node never returns home, then you can define this macro to save some code space.
  • TM_6_USE_MIP_RA_RTR_ADDR
    When enabled, the mobile node uses the Router Address option (when available) in received Router Advertisement messages to determine if a Router Advertisement is from the current default router.

MLD Option Macros

  • TM_USE_RFC_3590
    Enable Source Address Selection for the Multicast Listener Discovery (MLD) Protocol as defined in RFC 3590.
  • TM_6_MLD_DEF_ROBUSTNESS
    Set the transmission count for sending MLDv2 change reports on a lossy link. Default: 2

NAT Option Macros

  • TM_NAT_STRICT
    Enable this macro to discard packets that NAT does not transform.
    Default: enabled
  • TM_IP_MCAST_FORWARD
    Uncomment this macro to enable the IP multicast forwarding code (RFC 5135).
    Default: disabled
  • TM_IP_MCAST_ALLOW_ADMIN_FORWARD
    Uncomment this macro to allow forwarding of Administratively Scoped IP (RFC 2365) multicast addresses in the range 239.0.0.0 to 239.255.255.255, inclusive.
    Default: disabled

PKI Option Macros

  • TM_PKI_CERT_CHECK_ALIVE
    Enable a check to ensure certificates did not expire prior to a specified date and time. If this check is enabled, the certificate expiration date will be checked against TM_PKI_TIME. The default value of TM_PKI_TIME is "090824200000Z" meaning 2009 Aug 24 20:00:00 Zulu (aka. Greenwich Mean Time).
  • TM_PKI_CERT_NOT_VERIFY
    Disable certificate verification by skipping Basic Constraints checks and bypassing checks to ensure certificates were signed by a trusted CA.
Warning Warning: This can be considered a security risk.
  • TM_PKI_ROOTCA_IGNORE_BCCRITICAL
    Disable checking that the Root CA's Basic Constraints extension is set to "critical".
Warning Warning: This can be considered a security risk.
  • TM_PUBKEY_USE_DIFFIEHELLMAN
    Enable the software implementation of Diffie-Hellman. Diffie-Hellman groups 1, 2, 5,and 14 are supported.
  • TM_USE_DIFFIEHELLMAN_PADDING
    Enable padding of the Diffie-Hellman shared secret with leading zeros when the length is less than our prime vector. This behavior is widely accepted. This option should be enabled unless you are certain that the peer does not support padding. A mismatch between peers will cause the peers to generate different shared secrets and the negotiation will fail.
Note Note: This feature is required for IKE and IPsec to operate properly
  • TM_PUBKEY_USE_RSA
    Enable the software implementation of RSA. User must also define TM_USE_PKI in order to use RSA.
  • TM_PUBKEY_USE_DSA
    Enable the software implementation of DSA. User must also define TM_USE_PKI in order to use DSA.

PPP Option Macros

  • TM_USE_PPP_MSCHAP
    This macro is commented out by default. Uncomment this macro if you want to use MS-CHAP for PPP authentication.
  • TM_PPP_LQM
    Enable this macro if you want to use PPP Link Quality Monitoring.
  • TM_USE_EAP
    Enable this macro to enable Extensible Authentication Protocol with PPP.
  • TM_USE_EAPTLS
    Enables the EAP-TLS method (RFC 5216) for use with EAP. You will also need to define TM_USE_SSL_CLIENT and/or TM_USE_SSL_SERVER, depending on your application needs.
  • TM_DISABLE_EAPTLS_AUTHENTICATOR
    Disable the Authenticator (server) portion of EAP-TLS (marginal reduction of code size).
  • TM_DISABLE_EAPTLS_PEER
    Disable the Peer (client) portion of EAP-TLS (marginal reduction of code size).
  • TM_DISABLE_EAPTLS_KEY_GEN
    Disable the portion of EAP-TLS that generates and exports EAP key material, documented in RFC 5247 (reduces code size and execution time).
  • TM_DISABLE_EAPTLS_ID_PRIVACY
    Disable support for EAP-TLS identity privacy, documented in RFC 5216 section 2.1.4 (marginal reduction of code size).
  • TM_USE_IPHC
    Enable this macro to enable IP header compression (RFC 2507) with PPP.
  • TM_USE_PPPOE_CLIENT
    Enable the Point-to-Point over Ethernet client link layer.
  • TM_USE_PPPOE_SERVER
    Enable the Point-to-Point over Ethernet server link layer.
  • TM_USE_PPP_SERVER_NAK
    Enable code to allow the user on the PPP server to set a PPP option (using tfPppSetOption()) to repeatedly NAK an IP address from the PPP client until the user is ready to ACK a valid address.
  • TM_USE_PPP_SERVER_START
    Enable code to allow the user to set a delay (in seconds) (using tfInterfaceSetOptions()), after which the PPP server will start the LCP negotiation with the client if the client has failed to connect within this set time.

SNMP Option Macros

  • TM_SNMP_VERSION
    Specify the version of the Simple Network Management Protocol. Valid values are 1, 2, and 3 for SNMPv1, SNMPv2c (bilingual), and SNMPv3 (trilingual) respectively. Without this macro defined SNMP is disabled.
  • TM_SNMP_CACHE
    Allow the stack to keep a cache of the UDP sockets, TCP vectors, ARP table, and Routing table for SNMP.
    Enable the use of the deprecated RFC 1213 MIB2 objects that are designed only for IPv4 to be included in the SNMP agent. This option requires enabling TM_USE_IPV4 and TM_USE_SNMP_CACHE to be fully functional. If you are running the stack in dual mode (IPv4 and IPv6), IPv6 objects will not be displayed in these tables.
  • TM_USE_NG_MIB2
    Enable the Next Generation MIB2, which consists of tables that support both IPv4 and IPv6 entities. This option requires to enable TM_SNMP_CACHE to be fully functional.
  • TM_SNMP_8BIT_SUBIDS
    Enable 8-bit SNMP Object Identifiers (OIDs).
  • TM_SNMP_16BIT_SUBIDS
    Enable 16-bit SNMP Object Identifiers (OIDs).

SSL/TLS Option Macros

  • TM_SSL_DEBUG
    Enable SSL debugging for SSL encryption/decryption, MAC calculation, and padding.
  • TM_USE_SSL_VERSION_30
    Enable SSL 3.0 support. Disabled by default.
  • TM_USE_TLS_VERSION_10 / TM_USE_SSL_VERSION_31
    Enable TLS 1.0 (SSL 3.1) support. Enabled by default.
  • TM_USE_TLS_VERSION_11
    Enable TLS 1.1 support. Enabled by default.
  • TM_USE_TLS_VERSION_12
    Enable TLS 1.2 support. Enabled by default.
  • TM_SSL_ACCEPT_20_CLIENTHELLO
    Allow SSL 2.0 hello
  • TM_SSL_IMMEDIATE_CLOSE_NOTIFY
    Immediately flush the send queue, shutdown SSL, and reply with a close_notify message when a close_notify message is received. If this feature is not enabled, it is up to the user to call tfSslConnectUserClose() or tfClose() to shutdown the SSL send path.
Note Note: If the user doesn't call anything, the SSL send path is still ON until the socket is closed.
  • TM_SSL_SEND_DATA_MIN_SIZE
    Specify the minimum user data bytes needed to trigger SSL send. Data less than this size will not trigger SSL send. Instead these bytes will be queued. Once SSL send has been triggered, all queued user data will be sent. SSL will again wait for the next trigger event to send again. The default value is set to zero meaning SSL will not queue any data. If user chooses to specify a value, he should be aware that if the application does not meet this threshold, nothing will be sent unless user flushes the channel by calling tfSslUserSendFlush().
  • TM_SSL_SEND_DATA_MAX_SIZE
    Specify the maximum value (in bytes) of user data in one single SSL record. By RFC, this value is 16384. However, it is often the case with embedded systems that peer does not have a large enough receive buffer to queue 16384 bytes. For this reason Treck reduces the default value to 8000. Using the default value, if the user wants to send more than 8000 bytes of data, Treck is forced to cut it into multiple SSL records however the original size will be used as the trigger and all bytes will be sent as long as enough bytes are sent to trigger SSL.
  • TM_SSL_USE_EPHEMERAL_DH
    Enable the use of the ephemeral Diffie-Hellman key exchange method. Oftentimes this is not needed and may be disabled to save code space. For example, if your SSL cipher suite is something like SSL_RSA_XXXX or TLS_RSA_XXXX (The most popular case in real world), you do not require this feature.
  • TM_SSL_USE_MUTUAL_AUTH
    Enable mutual authentication in SSL.
  • TM_SSL_REJECT_EXPORTABLE_CIPHER
    Reject any exportable cipher suites. Exportable cipher suites are oftentimes less secure than non-exportable cipher suites. Disabling exportable cipher suites provides increased security at the cost of interoperability with peers who only support exportable cipher suites. If TM_EXPORT_RESTRICT is enabled, TM_SSL_REJECT_EXPORTABLE_CIPHE has no effect on Treck SSL behavior.
  • TM_SSL_DHE_PRIME_GROUP
    If TM_EXPORT_RESTRICT is not enabled, Treck will use OAKLEY group 1 prime (768 bits)if Ephemeral Diffie-Hellman is going to be used. TM_DHGROUP_2 is 1024 bits, and TM_DHGROUP_EXPORT is 512 bits. According to draft draft-ietf-tls-56-bit-ciphersuites-01.txt, Changes in US export regulations in 1999 permitted the export of software programs using 56-bit data encryption and 1024-bit key exchange.
Note Note: This macro is only valid if Ephemeral Diffie-Hellman is enabled and is chosen as the key exchange method.
  • TM_SSL_DHE_GENERATOR
    Specify the Diffie-Hellman generator. The default value is TM_DH_GENERATOR_2
Note Note: This macro is only valid if Ephemeral Diffie-Hellman is enabled and is chosen as the key exchange method.
  • TM_SSL_DHSECRET_DEFAULT_SIZE
    Specify the default size, in bytes, of the private secret. Default value is 32.
Note Note: This macro is only valid if Ephemeral Diffie-Hellman is enabled and is chosen as the key exchange method.
  • TM_SSL_DH_HASH_WITH_PADDING
    In releases prior to 5.0.1.40, Treck did not strip the leading zeros off of the padded Diffie-Hellman shared secret before performing the hash. This caused hash mismatches between peers on rare occasions where the shared secret length was not equal to the prime length. These hash mismatches were recoverable but required a new SSL negotiation to take place. This macro is here for interoperability with old versions. This macro only has an effect when TM_USE_DIFFIEHELLMAN_PADDING is defined.
  • TM_SSL_CLIENT_ALLOW_NO_CERT
    Enable this option if the client allows no certificate operation even in client-authentication situation. If the macro is defined, the SSL_CLIENT will ignore Cert_Request message if it doesn't have any certificate, and continue normal SSL negotiation. To close the connection or not will be up to the server to decide. In any case the client will send an alert-warning message to server.
  • TM_SSL_DISABLE_CLIENT_SEC_RENEG
    Disable the client-side secure renegotiation code. This will force Treck to act as an un-upgraded (legacy) client. This is highly discouraged and should only be used to target specific cases where renegotiation is required and the server is unable to handle upgraded clients. See RFC 5746 for more information.
  • TM_SSL_DISABLE_SERVER_SEC_RENEG
    Disable the server-side secure renegotiation code. This will force Treck to act as an un-upgraded (legacy) server. This is highly discouraged and should only be used to target specific cases where renegotiation is required and the client is unable to handle upgraded servers. See RFC 5746 for more information.
  • TM_PKI_ALLOW_DN_SET_BUG
    Relax Distinguished Name syntax checking on X.509 certificates to permit missing SET tags on attributes. This syntax violates the RFCs but some old certificates may still have this bug. (This was initially addressed in Treck BUG ID 2339.)

TCP Option Macros

  • TM_USE_TCP_PACKET
    Enable this macro if you wish to enable code that modifies TCP behavior and forces TCP to send data on user send packet boundaries. Note that this will only enable the code. You must also set the TM_TCP_PACKET option at the IPPROTO_TCP level as described in the setsockopt API page.
Warning Warning: Uncommenting this macro will make TCP less efficient and will disable Path MTU discovery and TCP Selective Acknowledgements.
  • TM_USE_TCP_SMALL_IW_DIRECT
    By default the stack will start sending with a full size TCP Initial Window on direct routes. Enable this macro if you want the stack to start sending using a reduced TCP Initial Window as it does on indirect routes.
  • TM_USE_TCP_CERT_VU464113
    By default the stack will discard any SYN segment that has the FIN, or PSH, or URG bit set, and have the ACK bit not set, if there is no data. Enable this macro if you want the stack to discard these segments even when there is data. For more details see US-CERT VU#464113
Note Note: Defining TM_USE_TCP_CERT_VU464113 will not allow T/TCP to work.
  • TM_DISABLE_TCP_KEEPALIVE
    Remove the TCP KEEPALIVE code. This will save some code space, but will prevent the use of the TCP keep alive option..
  • TM_USE_TCP_HYBLA
    Compile the TCP HYBLA Congestion Avoidance Algorithm code. See Configuring TCP Congestion Avoidance Algorithm for more details.
  • TM_USE_TCP_PACING
    Compile the TCP PACING code. See Configuring TCP Congestion Avoidance Algorithm for more details.
  • TM_USE_TCP_WESTWOOD
    Compile the TCP Westwood+ Congestion Avoidance Algorithm code. See Configuring TCP Congestion Avoidance Algorithm for more details.
  • TM_DISABLE_TCP_SACK
    Disable the TCP Selective Acknowledgment Options (RFC 2018) code to save code space.
  • TM_DISABLE_TCP_FACK
    Disable the TCP Forward Acknowledgement algorithm code. Disabling TCP FACK prohibits TCP SACK from retransmitting more than one SACK'ed segment. This option is recommended for lossy links and should only be disabled if there is no packet loss on the link. TCP FACK requires TCP SACK, therefore TM_DISABLE_TCP_SACK implies TM_DISABLE_TCP_FACK.
  • TM_DISABLE_TCP_RFC2414
    Disable the TCP Initial Send Window Increase as described in RFC 2414.
  • TM_DISABLE_TCP_RFC2581
    Disable the TCP congestion control update to RFC 2001 as described in RFC 2581.
  • TM_DISABLE_TCP_RFC2861
    Disable the TCP congestion window validation as described in RFC 2861.
  • TM_DISABLE_TCP_RFC3042
    Disable the Limited Transmit Algorithm that enhances TCP's Loss Recovery as described in RFC 3042.
  • TM_DISABLE_TCP_RFC3390
    Disable the TCP Initial Send Window Increase as described in RFC 3390.
  • TM_USE_USER_PARAM
    Enable Treck to supply and manage a user defined data item that is unique for each TCP connection. This data can be stored and retrieved using the TM_TCP_USER_PARAM option when calling setsockopt() and getsockopt(), respectively. When TM_USE_DRV_SCAT_RECV and TM_USE_DRV_ONE_SCAT_SEND are also defined, this data item can be accessed by your device driver, as follows:
  • TM_USE_TCP_REXMIT_CONTROL
    Enable dynamic control of the TCP Retransmission timer (pause, resume, reset via setsockopt()). See the "Dynamically Control the TCP Retransmission Timer" section for more information.
  • TM_USE_TCP_INCOMING_CB
    Enable code that can provide socket specific notification of valid incoming TCP packets. When enabled, the user can call tfRegisterSocketPacketCB() to install a function on a particular TCP streaming socket that will be called once for every valid incoming packet that is destined for that socket.
  • TM_USE_TCP_PURE_ACK
    Enable code that allows the user to use the TM_TCP_PURE_ACK_SEGS option when calling setsockopt() to set the number of outstanding un-ACKed segments, before a pure ACK is sent (even if the recv window has not changed.) Default value is zero, in which case the stack will behave as if TM_USE_TCP_PURE_ACK had not been defined.
  • TM_TCPTMWT_MAX_COUNT
    Specify the default maximum number of TCP Time-Wait vectors. The default is TM_TCPVECT_MAX_COUNT * 8. See Configuring TCP Time-Wait Vector Management for more details.
  • TM_TCP_HYBLA_RTT0
    Specify the TCP HYBLA reference Round Trip Time. The default is 25 (in milliseconds). See Configuring TCP Congestion Avoidance Algorithm for more details.
  • TM_TCP_WESTWOOD_INIT_RTT
    Specify the TCP Westwood+ initial RTT used prior to the first RTT measurement . The default is 50 (in milliseconds). See Configuring TCP Congestion Avoidance Algorithm for more details.
  • TM_TCP_WESTWOOD_RTT_MIN
    Specify the TCP Westwood+ minimum elapsed time before a new Band Width Estimate can be taken. The default is 50 (in milliseconds). See Configuring TCP Congestion Avoidance Algorithm for more details.
  • TM_USE_TCP_SYN_COOKIES
    Enable TCP SYN cookies code. See tfSetTreckOptions, option TM_OPTION_ENABLE_SYN_COOKIES for more details.
  • TM_USE_TCP_SYN_COOKIES_MD5
    Enable use of the MD5 cryptographic hashing algorithm to compute the TCP SYN cookies. If this macro is not defined, the less secure sdbm general hashing function is used instead.

SCTP Option Macros

  • TM_USE_SCTP
Define this macro to enable support for SCTP. This is a prerequisite for all macros that follow.
Default: undefined.
  • TM_SCTP_FAVOR_PRIMARY_PATH
Define this macro to always use the primary path when it is available. The primary path is the path that was used when the connection was established. If this is undefined, data will continue to be sent on the current path even after the primary path becomes usable again.
Default: undefined.
  • TM_SCTP_ADDIP_ENABLE
Define this macro to enable support for RFC 5061 (dynamic address reconfiguration). If you define this macro, you must also define either TM_SCTP_AUTH_ENABLE or TM_SCTP_ADDIP_NOAUTH_ENABLE.
Default: undefined.
  • TM_SCTP_ADDIP_NOAUTH_ENABLE
Define this macro to allow dynamic address reconfiguration to operate without authentication (in violation of RFC 5061). This may be required to interoperate with older SCTP implementations.
Default: undefined.
  • TM_SCTP_AUTH_ENABLE
Define this macro to enable SCTP chunk authentication RFC 4895.
Default: undefined.
  • TM_SCTP_AUTH_HMAC_ALG
Define the authentication method to use for signing the server state cookie. You may use MD5, SHA-1 or SHA-256.
Valid Options: SCTP_AUTH_HMAC_MD5, SCTP_AUTH_HMAC_SHA1 or SCTP_AUTH_HMAC_SHA256.
Default: SCTP_AUTH_HMAC_SHA1.
  • TM_SCTP_SERVER_DISABLE
Define this macro to exclude the SCTP server code. This can reduce the code size for SCTP client applications.
Default: undefined.
  • TM_SCTP_FAST_REXMIT_DISABLE
Define this macro to exclude the SCTP fast retransmission code. This can reduce the code size by a small amount.
Default: undefined.
  • TM_DISABLE_TCP
Define this macro to exclude the TCP code. This can reduce the code size for applications that use SCTP exclusively.
Default: undefined.
  • TM_SCTP_DEF_RTO_INITIAL
Initial retransmission timeout (RTO.Initial) in milliseconds.
Default: 3s.
  • TM_SCTP_DEF_RTO_MIN
Minimum retransmission timeout (RTO.Min) in milliseconds.
Default: 1s.
  • TM_SCTP_DEF_RTO_MAX
Maximum retransmission timeout (RTO.Max) in milliseconds.
Default: 60s.
  • TM_SCTP_DEF_MAX_BURST
Maximum number of packets to send in one shot.
Default: 4 packets.
  • TM_SCTP_DEF_RTO_ALPHA
RTO Calculation variable 'Alpha' (RTO.Alpha) in thousandths.
Default: 125.
  • TM_SCTP_DEF_RTO_BETA
RTO Calculation variable 'Beta' (RTO.Beta) in thousandths.
Default: 250.
  • TM_SCTP_DEF_COOKIE_LIFE
Cookie lifetime (Valid.Cookie.Life) in milliseconds.
Default: 60s.
  • TM_SCTP_DEF_ASSOC_MAX_RETRANS
Maximum number of consecutive retransmissions (Association.Max.Retrans) before declaring association failure.
Default: 10.
  • TM_SCTP_DEF_PATH_MAX_RETRANS
Maximum number of consecutive retransmissions (Path.Max.Retrans) before declaring path failure.
Default: 5.
  • TM_SCTP_DEF_PATH_HIGH_RETRANS
High water mark on number of consecutive retransmissions before changing paths.
Default: 2.
  • TM_SCTP_DEF_MAX_INIT_RETRANS
Maximum number of consecutive INIT or COOKIE-ECHO retransmissions (Max.Init.Retransmits) before declaring failure.
Default: 8.
  • TM_SCTP_DEF_HB_INTERVAL
Interval for HEARTBEAT transmissions (HB.interval) in milliseconds.
Default: 30s.
  • TM_SCTP_DELAY_ACK_TIME
Delayed acknowledgement timeout in milliseconds.
Default: 200ms.
  • TM_SCTP_ACK_STATE_THRESH
The number of unacknowledged data chunks to receive before sending an acknowledgement.
Default: 2.
  • TM_SCTPVECT_MAX_COUNT
Maximum number of sockets SCTP is permitted to consume.
Default: TM_SOC_INDEX_MAX (all sockets).
  • TM_SCTP_SECRET_SIZE
Size (in bytes) of the secret used to authenticate a server state cookie.
Default: 16.
  • TM_SCTP_DEF_SECRET_LIFE_SEC
Secret lifetime in seconds, at which time a new secret will be generated.
Default: 600s.
  • TM_SCTP_MAPPING_ARRAY_MAX
Maximum number of entries in the TSN mapping array, which is used to indicate the data chunk sequence numbers that have been received.
Default: 512.
  • TM_SCTP_MAPPING_ARRAY_INITIAL
Initial number of entries in the TSN mapping array.
Default: 128.
  • TM_SCTP_MAPPING_ARRAY_INCR
Entry increment for growing the TSN mapping array.
Default: 128.
  • TM_SCTP_AUTH_MAX_SHARED_KEYS
Maximum number of endpoint pair shared keys.
Default: 1.

Universal Plug and Play Option Macros

  • TM_USE_UNICODE
    Enable Treck UPnP support for Unicode. By default, Treck UPnP assumes that all service state variables of UPnP type "string" or "char" are ASCII, not Unicode.
  • TM_USE_FLOATING_POINT
    Enable Treck UPnP support for the UPnP floating point types "r4", "r8", "fixed.14.4" and "float".

Privacy Extensions for Stateless Address Autoconfiguration in IPv6

  • TM_6_USE_TEMPADDR
    Enable support for RFC 4941, Privacy Extensions for Stateless Address Autoconfiguration in IPv6. By default, the supporting code is disabled and excluded from compilation. For details, refer to the Main Article.
  • TM_6_PREFER_TEMPADDR
    In the case where Treck must select an appropriate source address for an outbound packet, a public IPv6 address will typically be preferred to a temporary address. The user can reverse this preference (as discussed in RFC 3484, section 5) by defining this macro. This macro does not require TM_6_USE_TEMPADDR, as the user can manually configure a temporary address by using the TM_6_DEV_IP_TEMPORARY IPv6 flag when calling tfNgOpenInterface() or tfNgConfigInterface().
  • TM_6_MAX_TEMP_IPS_PER_IF
    Maximum number of temporary IPv6 addresses per interface. If a temporary address cannot be generated because of space restrictions, the node's public address may be selected as the only non-deprecated alternative. Increase this number if you shorten the preferred lifetime, lengthen the valid lifetime or you are using Mobile IP or have more than one global prefix per interface. Default: 8
  • TM_6_TEMP_VALID_LIFETIME
    Time from creation (seconds) that a temporary address remains valid. An address is removed from the interface when it becomes invalid. If you increase this number you should increase TM_6_MAX_TEMP_IPS_PER_IF. Default: 7 days
  • TM_6_TEMP_PREFER_LIFETIME
    Time from creation (seconds) that a temporary address remains preferred. This determines the rate at which preferred addresses become deprecated and new addresses are created. If you decrease this number you should increase TM_6_MAX_TEMP_IPS_PER_IF. Default: 1 day
  • TM_6_TEMP_MAX_DESYNC_FACTOR
    Maximum desynchronizing factor (seconds). The desynchronizing factor is a randomly chosen value subtracted from the preferred lifetime to help reduce network congestion caused by simultaneous autoconfiguration of multiple interfaces. Default: 10 minutes
  • TM_6_TEMP_REGEN_ADVANCE
    Time (seconds) to start address regeneration in advance of a temporary address becoming deprecated. The advance is necessary to prevent a gap during autoconfiguration when there are no preferred temporary addresses available. Default: 5 seconds
  • TM_6_TEMP_REGEN_MAX_RETRY
    Maximum attempts to generate a valid address. This is a limit on the number of consecutive Duplicate Address Detection failures. If this limit is reached, temporary address generation will be disabled for the interface. Default: 3 attempts
  • TM_6_TEMP_MAX_POLL_SEC
    Maximum polling interval (seconds) for checking the age of temporary addresses. This is used to avoid 32-bit overflow when converting the timer interval from seconds to milliseconds. There should be no need to change this value. Default: 7 days
  • TM_6_TEMP_MIN_IFID_RETRY
    Minimum number of attempts to try to generate a unique random temporary interface identifier. There should be no need to change this value. Default: 10

Example File System Macros

  • TM_USE_DOS_FS
    Enable the example DOS File System Interface.
  • TM_USE_RAM_FS
    Enable the example RAM File System Interface.
  • TM_USE_ROM_FS
    Enable the example ROM File System Interface.
  • TM_USE_EMU_UNIX_FS
    Enable the example Unix emulated DOS File System Interface. This file interface is based on the example DOS file system but translates filenames and paths to Unix format. This is especially helpful for the FTP server where directory listings are often expected to be returned in Unix format.

Feature Macros

  • TM_USE_STOP_TRECK
    Enable the ability to stop the Treck stack. To stop Treck and free the memory for all contexts the user must call tfStopTreck(). tfStopTreckMultipleContext() may be called to stop Treck and free the memory used for a specific context.
Warning Warning: All tasks making calls to the Treck stack should be stopped prior to calling tfStopTreck() or tfStopTreckMultipleContext().
  • TM_USE_NETSTAT
    Enable the use of the NETSTAT tool for for outputting the routing entries, ARP entries and socket entries. The NETSTAT tool is described in the Application Reference.
  • TM_USE_POLL
    Enable the use of the poll() socket API. The poll() socket API is described in the BSD 4.4 Socket API section of the Programmer's Reference.
  • TM_ERROR_CHECKING
    This macro is used to turn on error checking for the protocol stack. It is used for debugging purposes; it is not intended for use in your released product. The error checking will send messages to the functions tfKernelError() and tfKernelWarning() for you to log. There is a performance and size impact when using this macro.
  • TM_DISABLE_ANSI_LINE_FILE
    This macro is only relevant when TM_ERROR_CHECKING is defined, in which case the tm_assert macro uses the ANSI __LINE__ and __FILE__ macros (if available) to print the source line number and source file name identifying where in the code an assertion failure occurred. Uncomment the TM_DISABLE_ANSI_LINE_FILE macro if your compiler does not support the ANSI__LINE__ and __FILE__ macros.
  • TM_LOOP_TO_DRIVER
    If this macro definition is added to <trsystem.h>, it will allow the user to loop back application data all the way to the device driver when sending to an interface configured IP address. By default, this macro is not defined in <trsystem.h>, and this causes the Treck TCP/IP stack to loop back application data above the link layer when the user is sending to an interface configured IP address. This is useful when debugging a device driver, or link layer.
  • TM_MULTIPLE_CONTEXT
    This macro is commented out by default. Uncomment this macro if you want to run multiple instances of the Treck TCP/IP stack. Running multiple instances of the Treck stack is further described in Appendix A: Configuration Notes.
  • TM_USER_PACKET_DATA_ALLOC
    If the user defines this macro, packet data buffer allocation will be done by the stack using the macros tm_alloc_packet_data_buffer and tm_free_packet_data_buffer (which then also need to be defined by the user). This can be used to have Treck TCP/IP allocate packet data buffers in fast onchip RAM, which can significantly improve throughput.
  • TM_USE_VCHAN
    Enable this macro to support splitting out IPv4 and IPv6 traffic in the send path to separate virtual channels to simulate multiple hosts as multiple IP aliases. Note that this is incompatible with the default mode of IPv6 operation, therefore IPv6 prefix discovery must be disabled.
  • TM_USE_SNIFF
    If TM_USE_SNIFF is defined, interface drivers will dump the packets to the file system in libpcap format, to be opened by tcpdump, windump, ethereal, or other libpcap file readers.Models for Running Treck
  • TM_DISABLE_TCP_128BIT_RANDOM_ISS
    Disable TCP from using the MD5 hash algorithm to generate the TCP initial sequence number based on an 128 bit random number.
Warning Warning: WARNING: If you define that macro, then the code will use a 32-bit random number instead and the stack will be more susceptible to security attacks described in US-CERT VU#498440.
  • TM_NO_COPY_OVER_USER_DATA
    Prevent the stack from copying the TCP header in the ACK'ed data area of a user owned buffer. The stack will copy for efficiency, but it may be the case that the user buffer is stored in a memory region that is not writable by the stack.
  • TM_USE_LOGGING_LEVELS
    Enable enhanced logging in the supported Treck protocols.
Note Note: Each module and level will also need to be defined (i.e. TM_LOG_ENB_ALL_LEVELS and TM_LOG_ENB_ALL_MODULES or specific levels/modules as required). For more information see <trmacro.h>.
Note Note: TM_USE_DCACHE_MANAGEMENT will not work on byte-stuffing interfaces (PPP, SLIP, etc.)
  • TM_USE_STRONG_ESL
    Enable the Strong End-System Model. This should be done to allow binding of a socket to an interface/device, which will restrict traffic to and from that socket to traffic on the bound device.
  • TM_USE_STRICT_STRONG_ESL
    Allow the stack to automatically bind a TCP accepted socket (whose listening socket was not bound to a device) to the incoming device.
  • TM_DEMO_TIME_LIMIT
    Restrict the stack's use to a specified time for use with demo applications. The timer system and APIs will function for TM_DEMO_LIMIT_SEC seconds before needing to be restarted. This is useful for pre-compiled libraries/applications intended for demonstrations.
  • TM_6_USE_TEMPADDR
    Enable support for RFC 4941, Privacy Extensions for Stateless Address Autoconfiguration in IPv6. See the Main Section above for a full list of associated macros.
  • TM_6_PREFER_TEMPADDR
    In the case where Treck must select an appropriate source address for an outbound packet, a public IPv6 address will typically be preferred to a temporary address. The user can reverse this preference (as discussed in RFC 3484, section 5) by defining this macro. This macro does not require TM_6_USE_TEMPADDR, as the user can manually configure a temporary address by using the TM_6_DEV_IP_TEMPORARY IPv6 flag when calling tfNgOpenInterface() or tfNgConfigInterface().
  • TM_USE_KERNEL_PRECISE_TIME
    Indicate that the hardware has a high frequency counter/timer that can be used for precise interval timing. Hardware/kernel support functions tfKernelGetPreciseTime() and tfKernelGetPreciseFreq() must be provided in the user's kernel support module (typically trkernel.c).

Memory and Code Size Optimization Macros

  • TM_OPTIMIZE_SIZE
    This macro is used to optimize the code in favor of size over speed. When using this macro you will get the smallest code size available. You will notice that the performance of the system is degraded when you use this macro. This macro is to be used when the performance of the system does not matter but code size does.
  • TM_DISABLE_SOCKET_HASH_LIST
    Disables the use of hash tables during socket table lookups. This macro may be desired if you have limited data space or do not plan on having many sockets.
  • TM_USE_SOCKET_RB_TREE
    Enable the use of a Red-Black tree for socket table lookups. The Red-Black tree will require less memory than hash tables but will provide increased performance when hash tables have been disabled.
  • TM_IP_FRAGMENT
    If this macro definition is removed from <trsystem.h>, the IP fragmentation code is not compiled in. If you expect to send IP fragments, you need to keep this macro in <trsystem.h>. Otherwise, you can remove the TM_IP_FRAGMENT macro from <trsystem.h>, thereby reducing code size.
  • TM_IP_REASSEMBLY
    If this macro definition is removed from <trsystem.h>, the IP reassembly code is not compiled in. If you expect to receive IP fragments, you need to keep this macro in <trsystem.h>. Otherwise, you can remove the TM_IP_REASSEMBLY macro from <trsystem.h>, thereby reducing code size.
  • TM_DISABLE_PMTU_DISC
    By default, the TCP Path MTU Discovery code is compiled in and turned on. Adding this macro will prevent the compilation of the TCP Path MTU Discovery code, thereby reducing code size.
  • TM_DISABLE_TCP_SACK
    By default, the TCP Selective Acknowledgement code is compiled in and turned on. Adding this macro will prevent the compilation of the TCP Selective Acknowledgement code, thereby reducing code size.
  • TM_SINGLE_INTERFACE_HOME
    If this macro definition is added to <trsystem.h>, it will reduce code size by approximately 4.5 kilobytes by removing support for multiple interfaces and multi-homing.
Warning Warning: When this macro is enabled, you can only have a single interface and a single IP address configured on that interface.


Warning Warning: Defining this will prevent addition of the loop back device.
  1. Packets sent to the single interface IP address will be sent all the way to the driver, instead of being loop back by the stack.
  2. Packets cannot be sent to the IP loop back address, 127.0.0.1.
  • TM_SINGLE_INTERFACE
    If you have only a single interface, and you are using IPv6, then enable TM_SINGLE_INTERFACE macro to reduce code size.
Note Note: All IPv6 interfaces are multi-homed, so you cannot use the TM_SINGLE_INTERFACE_HOME macro with IPv6.
  • TM_SOC_INDEX_MAX
    Specify the default maximum number of sockets allowed simultaneously. Once this number has been reached existing sockets must be freed before new sockets may be allocated.

Performance Optimization Macros

  • TM_OPTIMIZE_SPEED
    This performance macro is used to optimize the code in favor of speed over size. When using this macro you will notice that the code is much larger than without it. However, you will see a noticeable increase in speed. Typically, this macro is used to in-line functions that are used repeatedly.
  • TM_BYPASS_ETHER_LL
    This performance macro is used to "in-line" the Ethernet processing. When this macro is enabled, it allows us to process Ethernet packets much faster than sending them to a separate link layer. The disadvantage to using this macro is that it costs a little more code space to do the Ethernet processing. If you are not using Ethernet, then you do not want to have this macro defined.
  • TM_IP_FRAGMENT_NO_COPY
    If you define TM_IP_FRAGMENT and your device driver supports scattered send, then define TM_IP_FRAGMENT_NO_COPY to avoid an extra internal data copy when IP datagrams need to be fragmented.
  • TM_TCP_FACK
    Define the TM_TCP_FACK macro to enable the Forward Acknowledgment algorithm. It an only be enabled if TM_DISABLE_TCP_SACK is not defined. Enabling TM_TCP_FACK will allow the TCP Sack to retransmit more than one SACKed segment.
  • TM_USE_DRV_ONE_SCAT_SEND
    This macro is commented out by default. Define the TM_USE_DRV_ONE_SCAT_SEND macro if you wish to use a single call to the device driver, passing the packet handle, even when sending a frame with scattered buffers. Note: to enable this feature, this macro must be added and tfUseInterfaceOneScatSend() must be called on the interface that supports it.
  • TM_USE_DRV_SCAT_RECV
    This macro is commented out by default. Define the TM_USE_DRV_SCAT_RECV macro, if you want to allow the device driver recv function to pass back a frame to the stack in scattered buffers ("Gather Read"). Note that to enable this feature, this macro needs to be added, and tfUseInterfaceScatRecv() needs to be called on the interface that supports it.
  • TM_INDRV_INLINE_SEND_RECV
    This macro is defined by default. Undefine/delete the TM_INDRV_INLINE_SEND_RECV macro to test loop back/intra machine driver with a separate recv task. In that case, the intra machine received data will no longer be processed in the send path, but will be processed when tfRecvInterface()/tfRecvScatInterface() is called. In the `examples` directory, the txscatlp.c, and txscatdr.c modules contain sample code that uses this feature.
  • TM_DEV_SEND_OFFLOAD
    Enable this macro if you want to use the device driver TCP segmentation/checksum offload capabilities.
  • TM_DEV_RECV_OFFLOAD
    Enable this macro if you want to use the device driver recv packet checksum offload capabilities.
  • TM_USER_OCS
    Enable this macro to use a user defined checksum routine, e.g. in Assembly, rather than the standard C routine.
  • TM_CUSTOM_OCS
    TM_USER_OCS and TM_CUSTOM_OCS allow the use of user defined checksum routines.
    1. If neither is defined, the stack will use a standard C implementation of the checksum or include a CPU-specific implementation if the user has defined an additional CPU specific macro such as TM_BORLAND_ASM_OCS, TM_GNUXSCALE_ASM_OCS, etc.
    2. TM_USER_OCS will cause the stack to include the file <ocksum/trcsuser.c>, which must be created by the user and must contain the function tfPacketChecksum().
    3. TM_CUSTOM_OCS will cause the stack to not compile in any checksum routine, meaning the user must link in a module containing the function tfPacketChecksum().
    See the file <trpkt.c> for the standard implementation of this function.
  • TM_OPTIMIZE_MANY_MHOMES
    Enable this macro to speed up lookup in the recieve-path of IP aliases configured on the interface. This is intended for situations where the user has configured many (i.e. >50) IP aliases on a single interface.
  • TM_USE_KERNEL_RNG
    Enable the use of a user defined random number generator. TM_USE_KERNEL_RNG will cause Treck's internal random number generator to be replaced by the user-defined tfKernelGetRandom() function.
  • TM_SOTB_TCP_CON_HASH_SIZE
    Specify the number of buckets in the TCP sockets hash table. Default is TM_SOCK_INDEX_MAX.
  • TM_SOTB_NON_CON_HASH_SIZE
    Specify the number of buckets in the non-TCP sockets hash table. Default is TM_SOCK_INDEX_MAX.
  • TM_SOTB_TCP_CON_PORT_THRS
    Specify the threshold of concurrent TCP sockets that will cause the stack to switch to a sequential port selection when a port conflict occurs when inserting a connecting socket in the socket table lookup.
  • TM_SOTB_NON_CON_PORT_THRS
    Specify the threshold of concurrent non-TCP sockets that will cause the stack to switch to a sequential port selection when a port conflict occurs when inserting a non TCP socket in the socket table lookup.
  • TM_USE_UDP_LOOKUP_PERF
    Enhance UDP and raw socket lookup performance when you have a very large number of sockets. This is useful only if your application has UDP or raw sockets that are receiving on the same port but have different address or device bindings. Incoming packets can be dispatched to the proper socket quicker based on detailed binding information. This enhancement will add code (3 to 4 Kbytes for x86) and probably run slightly slower for most applications, so use it only if necessary.

Kernel Configuration Macros

  • TM_TRECK_NO_KERNEL
    This macro is used to compile the stack so that it will not use an RTOS/Kernel. When you do not have a real time operating system, you will not need to use the locking system that the Treck protocol stack provides.
Warning Warning: You will not be able to make any calls that will cause the system to block. You must ensure that any call into the Treck protocol stack will not block. Critical sections for the driver interface are still enabled when you are using Treck without a kernel.
  • TM_TRECK_NONPREEMPTIVE_KERNEL
    This macro is used to compile the stack so that it will use a non-preemptive kernel. You must ensure that your kernel is not preemptive before you define this macro. This macro disables the locking system, which is not needed by a non-preemptive kernel. When you are using a non-preemptive kernel you may still make calls to the Treck protocol stack that are either blocking or non-blocking. Critical sections for the driver interface are still enabled when you are using Treck with a nonpreemptive kernel.
  • TM_TRECK_TASK
    This macro is used to compile the stack so that it can be used as an independent task. When using Treck in this manner, no ISR may call any Treck function. In this model, there are no critical sections and no blocking may occur. This model is typically used when the application and the Treck code are in the same task and the device driver sends messages through the operating system to the task. It is similar to using Treck without a kernel. It may be used with either a preemptive or a non-preemptive kernel.
  • TM_TRECK_PREEMPTIVE_KERNEL
    This macro is used to compile the stack so it can be used with a preemptive kernel. In this model, all critical sections are enabled. You may also feel free to make blocking or non-blocking calls in this environment. This model is the most popular for systems integrating Treck into their environment.
  • TM_TASK_RECV
    This macro is used to notify the stack that a separate blocking receive task will be used. It is not required to use a separate receive task. However, it is usually efficient to do so. The receive task will be responsible for processing all received packets from a given interface. If more than one interface is defined on the system, more than one receive task may be used. If you wish to make the decision to use a blocking receive task at run time, then you should define this macro. A separate blocking receive task can only be used if you are using a real-time operating system, and you are using the Treck protocols as a shared library.
Note Note: It is possible to use a polling (i.e. non blocking) separate receive task, in which case you do not need to define TM_TASK_RECV.
  • TM_TASK_XMIT
    This macro is used to notify the stack that a separate blocking transmit task will be used to send packets to the device driver. A separate blocking transmit task can only be used if you are using a real time operating system, and you are using the Treck protocols as a shared library. If more than one interface is defined on the system, more than one transmit task may be used. It is not required to use a separate blocking transmit task. If no transmit task is used, then the packets are queued to the device driver send queue, and are sent to the driver in the context of the sending thread. The sending thread could be a user application task sending data, or the receive task sending a TCP acknowledgment, or a PING echo reply, or the timer task re-transmitting data. If a separate transmit task is used, then packets are queued to the device send queue in the context of the sending thread. Then, when a context switch occurs, the packets are sent to the driver in the context of the transmit task. In most cases it is inefficient to use a separate blocking transmit task because it requires a context switch on nearly every packet sent by the sending thread.
Note Note: It is possible to use a polling (i.e. non blocking) separate transmit task, in which case you do not need to define TM_TASK_XMIT.
  • TM_TASK_SEND
    This macro is used to notify the stack that a separate blocking send complete task will be used. Notice that this is not a send task but a send complete task. The user calls the send complete function in the context of the send complete task, and this allows the user to adjust the priority of that task. In most cases, it is inefficient to use a separate send complete task. The most efficient means of processing send completes is in the context of the task that is calling the actual driver send routine. The reason that it is inefficient is because a separate send complete task requires a context switch on nearly every packet that was sent.
Note Note: It is possible to use a polling (i.e. non blocking) separate send complete task, in which case you do not need to define TM_TASK_SEND.
  • TM_USE_KERNEL_CONTEXT
    If you have defined TM_TRECK_PREEMPTIVE_KERNEL and TM_MULTIPLE_CONTEXT then you should also define TM_USE_KERNEL_CONTEXT to make sure that the current Treck context is preserved for each task. Normally, the current Treck context is maintained in a global variable that is shared between all tasks. You must also provide public functions tfKernelSetContext() and tfKernelGetContext() so that Treck can store and retrieve this data in thread-local storage.

Timer Macros

  • TM_TICK_LENGTH
    This macro is used to define the default value that will be used to specify the interval between timer updates for the protocol stack. This is a default value and can be changed at run-time. The value specified is in milliseconds. The accuracy of this time is not critical. This value should be the average time in between updates to the Treck Timer System. The typical values used for this macro are between 10 and 100 milliseconds.
  • TM_DISABLE_TIMER_CACHE
    Disable the timer cache if you have limited data space, and do not plan on having a lot of sockets, routes, IPSEC SAs, and therefore won't have a lot of timers. In that case the timer code will just use one active timer queue, and won't use a timer wheel for timers set to expire within TM_TIM_MAX_WHEEL_INTV ms.
Note Note: The timer execute thread will use more CPU time if this macro is defined.
Note Note: If TM_OPTIMIZE_SIZE is defined, the timer cache is already disabled.
  • TM_USE_TIMER_MULT_ACTIVE_LIST
    If you have not disabled the timer cache via TM_DISABLE_TIMER_CACHE, you may enable TM_USE_TIMER_MULT_ACTIVE_LIST if you will need a lot of timers but do not have enough memory to extend the timer wheel. In that case you can keep the timer wheel relatively small, and will have four active queues instead of one.
  • TM_DISABLE_TIMER_ACTIVE_LISTS
    If you have not disabled the timer cache via TM_DISABLE_TIMER_CACHE, you may disable the timer active queue(s) via TM_DISABLE_TIMER_ACTIVE_LISTS if you will need a lot of timers, and have a lot of memory, and have extended the timer wheel. Make sure that you also increase the Timer wheel size.
  • TM_USE_64BIT_TIME
    If you have disabled the timer active queues via TM_DISABLE_TIMER_ACTIVE_LISTS, and have extended the timer wheel, define this macro to enable the global variable tvTime64, but only if you are running on a 64-bit CPU. In that case, make sure to update tvTime64 at the same time you update the global variable tvTime.
  • TM_USE_TIMER_CB
    Enable the stack to call a user defined CB function (registered when the user calls tfRegisterTimerCB()) that lets the user know when to call tfTimerExecute() next. In that case, the user is responsible for updating tvTime, and tvTimeRollOver prior to calling tfTimerExecute(). This can be used to save power by avoiding unnecessary calls to tfTimerUpdate() and tfTimerExecute().
Note Note: The timer cache must be enabled for this to work. See TM_DISABLE_TIMER_CACHE.
Note Note: For power save mode, it is best to also define TM_USE_TIMER_MULT_ACTIVE_LIST, if the timer wheel is relatively small.

TM_TIM_MAX_WHEEL_INTV

  • Specify the maximum timer interval on the timer wheel in milliseconds.

Word Order

You do need to know if your processor is big endian or little endian. "Endian" refers to the byte order of integers (both long and short) on the processor. For more information on the difference between big and little endian, please see the Introduction to TCP/IP.

  • TM_LITTLE_ENDIAN
    This macro is used to let the stack know at compile time that the processor is a little endian processor. If you choose to use this macro on a big endian processor, you will see your packets with the word fields reversed.
  • TM_BIG_ENDIAN
    This macro is used to let the stack know at compile time that the processor is a big endian processor. If you choose to use this macro on a little endian processor, you will see your packets with the word fields reversed.


Memory Allocation

  • TM_USE_SHEAP
    If the user defines this macro, the stack allocates its blocks of memory from the Treck simple heap static array using the simple heap allocation routine, tfSheapMalloc(), instead of calling the RTOS tfKernelMalloc(). Similarly the Treck stack will release an allocated block of memory (of size bigger than 4096 bytes) by calling the Treck simple heap free routine tfSheapFree(), instead of calling the RTOS tfKernelFree. The user will define this macro if the user's RTOS does not provide heap management routines, or if the user does not want the Treck stack to allocate its blocks of memory from the RTOS heap.
  • TM_SHEAP_SIZE size
    If you do define TM_USE_SHEAP, then you also have to define TM_SHEAP_SIZE, to specify the size of the Treck simple heap array. On a DSP platform, the heap size should be specified in words; on all other targets the heap size should be specified in bytes.
  • TM_SHEAP_MIN_BLOCK_SIZE size
    Specify the minimum block size in bytes when using the simple heap, either when allocating a new block, or when refragmenting a freed block. If not defined here, default value is 8 if TM_ERROR_CHECKING is defined, 4 otherwise.
  • TM_DYNAMIC_CREATE_SHEAP
    Normally, the Treck simple heap is implemented as a static array. However, you can override this behavior by defining the macro TM_DYNAMIC_CREATE_SHEAP in your <trsystem.h> file, in which case you decide how you want to implement it (i.e. dynamic memory allocation specific to your RTOS) by customizing the API tfKernelSheapCreate().
  • TM_SHEAP_NUM_PAGE 1
    Number of memory pages. Instead of a unique array, the simple heap can be divided into several ones. Uncomment TM_SHEAP_NUM_PAGE and indicate the number of pages if you are using the simple heap with a system that has paged memory and that one page is too small to hold the whole simple heap memory (static or preallocated by tfKernelSheapCreate()). In this case the simple heap will be divided in several non-contiguous pages. If you do define TM_SHEAP_NUM_PAGE to a number bigger than 1, then you will likely need to define TM_DYNAMIC_CREATE_SHEAP also. The default for TM_SHEAP_NUM_PAGE is 1. Each page of memory must have the same size. The default page size is TM_SHEAP_SIZE/TM_SHEAP_NUM_PAGE.
Warning Warning: If the page size is lower or equal to 4Kb (TM_BUF_Q6_SIZE), you cannot use dynamic memory and must define TM_DISABLE_DYNAMIC_MEMORY.
  • TM_DISABLE_DYNAMIC_MEMORY
    By default, when the Treck stack allocates blocks of memory of size less than 4096 bytes, it keeps them in its internal buffer management system when they are freed, instead of releasing them to the heap. Adding this macro will prevent the compilation of the Treck internal buffer management system code, thereby reducing code size. However, this is not recommended, as this will reduce performance, since this will force the Treck stack to call the Operating system every time it needs to allocate or free a block of memory. If the user has not disabled the Treck Dynamic Memory (i.e. not defined this macro), then the user can free all the unused dynamic memory held by the Treck stack at any time, by calling the API tfFreeDynamicMemory().
  • TM_SHEAP_MARK_MEMORY
    Enable the simple heap to mark memory with a pattern to help detect memory access violations and corruption. Initially memory is marked with 0xFE, allocated simple heap memory is filled with 0xA0, freed simple heap memory is filled with 0xFA. This helps check whether memory is accessed after having been freed.

Compiler Qualification

  • TM_FAR
    This macro is used to allow access to far data on an Intel processor (normally running in real mode). It should be defined to far if you need to access far data. For other processors, it should not be defined.
  • TM_CODE_FAR
    This macro is used to allow access to far code sections on an Intel processor. If the stack is compiled in small model, you may have functions that are in other code segments that are called by the Treck protocol stack. In this case, you should define this macro to be far. For other processors, it should not be defined.
  • TM_INTERRUPT interrupt
    If your system requires a interrupt keyword, then define TM_INTERRUPT to be that keyword.
  • TM_GLOBAL_QLF
    Default qualifier for global variables. If you would like to put all global variables into one memory type (e.g. far, huge, near), then #define TM_GLOBAL_QLF here to be that qualifier and leave TM_GLOBAL_NEAR undefined.
  • TM_GLOBAL_NEAR
    Default qualifier for frequently used global variables. If you would like to put the frequently used global variables into one memory type (e.g. near) and the rest of them into a different memory type (e.g. far, huge), then the memory type for frequently used global variables here as TM_GLOBAL_NEAR and leave TM_GLOBAL_QLF undefined.
Warning Warning: Concerning TM_GLOBAL_QLF and TM_GLOBAL_NEAR: Only one of them can be redefined to have a value, otherwise compiler errors will occur.
  • TM_CONST_QLF
    Default qualifier for constants. If you would like to put all constants into one memory type (e.g. far, huge, near), the TM_CONST_QLF here to be that qualifier.
  • TM_USE_CLIB
    Enable the use of an external standard C library instead of the equivalent library routines provided by Treck.
Note Note: You may need to include the following external header files in <trsystem.h>

/* For isupper, tolower ... */
#include <ctype.h>
/* For memcpy, strchr ... */
#include <string.h>
/* For printf, sprintf... */
#include <stdio.h>
/* For strtoul... */
#include <stdlib.h>

  • TM_BSD_CLASH
    Define this macro if your compiler or kernel already provides definitions for standard types and symbols, e.g. AF_INET and sockaddr. When TM_BSD_CLASH is defined, Treck will change its own definitions of standard types and symbols to avoid compiler errors from conflicting definitions. Note: TM_BSD_CLASH and TM_BSD_TYPES_CLASH are mutually exclusive.
  • TM_BSD_TYPES_CLASH
    Define this macro to include sys/types.h for definitions like u_long, FD_SET and struct timeval. Otherwise, Treck will define these and other similar names. Note: TM_BSD_CLASH and TM_BSD_TYPES_CLASH are mutually exclusive.

Data Alignment

  • TM_ETHER_HW_ALIGN
    Various Ethernet chips exist with the ability to make use of DMA. Many of these chips also come with the requirement that their buffers be aligned on a certain byte-boundary (4-byte and 16-byte being most common). TM_ETHER_HW_ALIGN defines how many bytes each Ethernet buffer obtained with tfGetEthernetBuffer() will be aligned to. This macro defaults to 4.
  • TM_NEED_ETHER_32BIT_ALIGNMENT
    Uncomment TM_NEED_ETHER_32BIT_ALIGNMENT and uncomment TM_USE_DRV_SCAT_RECV, (without using tfUseInterfaceScatRecv()), if you want tfRecvInterface() to make the TCP/IP header aligned on a 4-byte boundary, if it is not aligned coming from a single buffer in the Ethernet device driver receive function.
  • TM_PACKET_BUF_CACHE_ALIGN
    If your processor has a data cache and your network hardware supports DMA, you should define this macro to be the cache line size (in bytes) of your data cache. This ensures that all packet buffers will be allocated to start and end at cache line boundaries, making cache flushing and invalidation in the driver much easier to handle. This option will cause extra RAM utilization in your system. Up to ((2 * TM_PACKET_BUF_CACHE_ALIGN) - 2) extra bytes will be allocated for each packet buffer to fulfill the alignment requirements.
  • TM_ETHER_HW_TX_ALIGN
    TM_ETHER_HW_TX_ALIGN is used to make sure that allocated buffers for transmission end up being aligned on a certain boundary. TM_ETHER_HW_TX_ALIGN specifies what type of boundary (4-byte, 16-byte, etc.) an Ethernet buffer to be transmitted needs to be aligned on. This is useful for devices that require a transmit buffer to be aligned on a certain boundary. Default: 2 bytes

Compatibility Macros

  • TM_6_DHCP_OLD_SET_OPTION
    Enable a backward compatible version of tf6DhcpSetOption()
  • TM_6_USE_OBSOLETE_TF6GETROUTERID
    Enable the use of the obsoleted version of tf6GetRouterId() that returns an aggregate. tf6GetRouterId() has been replaced by tf6NgGetRouterId() in <sockapi6/t6grtrid.c>.
  • TM_USE_ETHER_8023_LL
    Enable the use of the new 802.3 Ethernet link-layer, which supports Ethernet II (DIX) in addition to IEEE 802.3
  • TM_CHECK_TAGGED_ETHER_HEADER
    Enable Ethernet link layer to be able to ignore the 802.1Q VLAN tag on a packet and continue processing it.
  • TM_THREAD_STOP
    Thread stop is used to stop a thread which has had an unrecoverable error. By default, it is defined as a forever loop. You can define this macro to supersede the default definition.
  • TM_PROTO_EXTERN
    By default the prototypes declared in the Treck header files are not declared extern. If your linker dictates that they should be declared extern, then add the following macro:
#define TM_PROTO_EXTERN extern.
  • TM_DISABLE_TCP_ACK_PUSH
    This macro is uncommented by default. When this macro is commented out, Treck TCP will ACK every TCP segment that it receives that has the PUSH bit set. Comment out this macro if you need the Treck stack to interoperate well with a peer that runs Windows 2000, because Internet Explorer waits for the ACK response to the PUSH bit being set before sending any new data.
Note Note: TM_DISABLE_TCP_ACK_PUSH should be commented out when the peer runs Windows 2000.
  • TM_PING_MILLISECONDS_INTERVAL
    Change the pingInterval parameter passed to the obsolete tfPingOpenStart() API to be in milliseconds rather than in seconds.
  • TM_USE_INDRT
    Enable the GHS INDRT debugging tools . You also need to call tfUseIndrt() on the Ethernet interface you want the INDRT debug messages to be sent and received on.
  • TM_IN6ADDR_NO_NESTED_BRACES
    Define this macro, if compiler cannot handle nested braces in the constant initialization of in the constant initialization of in6_addr structure in <trsocket.h>/<trglobal.h>/<trinit.c>.
  • TM_NO_NESTED_BRACES
    Define this macro, if compiler cannot handle nested braces in the constant initialization of tlFtpdCmdArray in <trftpd.c>.
  • TM_INT_LE16
    Enable to avoid compiler warnings, if your processor integer size is 16 bits.
  • TM_SSL30_DSSSIGN_NETSCAPE_FORMAT
    Only enable this feature in the following are all true
    1. You wish to negotiate EDH_DSS_XXX cipher.
    2. You wish to negotiate with Netscape only.
    3. You wish to negotiate in SSL version 3.0 version only.
    If any of these three conditions is false, do not enable this feature. The description of how to encode DSS signature in the SSLv3 specification is insufficiently specific and Netscape interprets it differently from most other vendors. Instead of DER encoding r and s, Netscape merely concatenates them into a single 40-byte field. Thus, although Netscape implements DSS for client authentication, it is not interoperable with other implementations. Despite widespread agreement on the "right thing" Netscape has refused to change their implementation, claiming that it complies with the SSL v3 specification and citing installed base. The TLS specification clears up this issue; ALL TLS implementations must DER encode DSS signature
  • TM_DISABLE_UDP_CACHE
    Treck maintains a UDP socket cache to speed socket lookups. This requires some code that is too complicated for some compilers (specifically the SHC compiler) to handle correctly. Enabling this option will remove the UDP socket cache forcing a slower socket lookup but reducing code size and complexity.
  • TM_NO_COPY_OVER_USER_DATA
    Define this macro to prevent Treck from copying into user buffers. By default Treck assumes that the user buffers passed to it can be written to and it may write into them after the data contained in those portions is no longer needed by the stack.

Predefined Processor Macros

These macros are used to specify the processor you are using and your environment. They simply set up the proper word order or endian for the processor:

TM_INTEL_X86

TM_MOTOROLA_CPU32

TM_MOTOROLA_68K

TM_MOTOROLA_PPC

TM_TMS320_C3

TM_TMS320_C3_BIG_ENDIAN (For TI C3 like DSP with byte order reversed)

TM_TMS320_C5

TM_TMS320_C6

TM_ARM7

TM_EZ80


Compiler Specification

These optional macros are used to define the compiler that you are using. They are used to allow in-line assembly for the critical sections and assembly cores for one's compliment checksums on some platforms. Not all of the supported compilers are listed here, because some of them are automatically determined during compilation (see the <trmacro.h> file).

  • TM_COMPILER_GHS_ARM
    This is used for the Green Hills ARM compiler
  • TM_COMPILER_GHS_PPC
    This is used for the Green Hills PowerPC compiler
  • TM_COMPILER_SDS
    This is used for the SDS 68K compiler
  • TM_COMPILER_DDI_PPC
    This is used for the Diab Data Power PC compiler
  • TM_COMPILER_MRI_68K
    This is used for the Microtec Research (Mentor Graphics) 68K compiler

RTOS/Kernel Environments

These macros are used for various predefined kernels. With these macros, you can use one of the real time operating systems listed below and most of the above settings will be set for you. Feel free to use these as examples if you decide to add a different RTOS.

  • TM_KERNEL_ELX_86
    This is used for the ELX-86 RTOS
  • TM_KERNEL_UCOS_X86
    This is used for uC/OS for the Intel Platform
  • TM_KERNEL_UCOS_PPC
    This is used for uC/OS for the Motorola Power PC Platform
  • TM_KERNEL_UCOS_CPU32
    This is used for uC/OS for the Motorola CPU32 Core (683xx)
  • TM_KERNEL_UCOS_MIPS
    This is used for uC/OS for the MIPS processor
  • TM_KERNEL_UCOS_XSCALE
    This is used for uC/OS for the XSCAL processor
  • TM_KERNEL_UCOS_SH2
    This is used for uC/OS for the SH2 platform
  • TM_KERNEL_AMX_CPU32
    This is used for AMX for the Motorola CPU32 Core (683xx)
  • TM_KERNEL_THREADX_ARM7
    This is used for ThreadX for the ARM7 platform
  • TM_KERNEL_AMX_X86
    This is used for AMX for the Intel Platform
  • TM_KERNEL_THREADX_CPU32
    This is used for ThreadX for the Motorola CPU32 Core (683xx)
  • TM_KERNEL_DOS_X86
    This is used for DOS for the Intel Platform
  • TM_KERNEL_CMX_C16X
    This is used for CMX RTOS for the Siemens C16X processors
  • TM_KERNEL_NONE_EZ80
    This is used for Zilog EZ80 target board, no OS
  • TM_KERNEL_NONE_H8S
    This is used for Hitachi H8S platform, no OS
  • TM_KERNEL_RZK_EZ80
    This is used for RZK RTOS for Zilog EZ80 target board
  • TM_KERNEL_REALOS_FR
    This is used for REALOS RTOS for the Fujitsu MBxxxxx platform
  • TM_KERNEL_TI_DSP_BIOS
    This is used for DSO_BIOS RTOS for the TI DSPs
  • TM_KERNEL_WIN32_X86
    This is used for Win32
  • TM_KERNEL_VISUAL_X86
    This is used for testing under VC++ environment, single threaded, for automated testing.
  • TM_KERNEL_LINUX_APP
    This is used for Linux
  • TM_KERNEL_NONE_S56XX
    This is used for Stretch S56XX
  • TM_KERNEL_NONE_XILINX_MICROBLAZE
    This is used for Xilinx MicroBlaze
  • TM_KERNEL_NONE_XILINX_POWERPC
    This is used for Xilinx PowerPC


<< Preparing for Integration
Building the Library >>