tfInitTreckOptions

Jump to: navigation, search

Table of Contents >> Programmer's Reference


#include <trsocket.h>


void tfInitTreckOptions (
int optionName,
unsigned long optionValue
);


Function Description

This call is used to set various options that are used by the Treck TCP/IP stack.


Note Note: This function should be called only before calling tfStartTreck().


Parameters

  • optionName
    The option to change (see below).
  • optionValue
    The new value to assign.


Returns

  • TM_ENOERROR
    Success
  • TM_EINVAL
    The option or its value is invalid.


Note Note: The option names marked with an asterisk (*) can only be set using tfInitTreckOptions(). All of the other options are common with tfSetTreckOptions().


Option Name Meaning
*TM_OPTION_TICK_LENGTH The time in milliseconds between calls to tfTimerUpdate() or tfTimerUpdateIsr(). Cannot be set to 0.

DEFAULT: Specified in <trsystem.h>

*TM_OPTION_SOCKETS_MAX The maximum number of sockets allowed on the system. Allowed values are between 1 and 0x7FFF - 1.

DEFAULT: 64

*TM_OPTION_SOTB_TCP_CON_HASH_SIZE The number of entries in the TCP connected socket hash table.

DEFAULT: TM_SOC_INDEX_MAX (64)

*TM_OPTION_SOTB_NON_CON_HASH_SIZE The number of entries in the UDP, Raw and non-connected TCP socket hash table.

DEFAULT: TM_SOC_INDEX_MAX (64)

*TM_OPTION_TIMER_MAX_WHEEL_INTV The maximum timer interval (milliseconds) on the timer wheel. Use a reasonable value (to save memory). Increase this value if you have plenty of memory. The memory overhead is roughly ((optionValue / tvTimerTickLength) * 12 bytes).

DEFAULT: 500

*TM_OPTION_DHCP_MAX_ENTRIES The maximum user-controlled DHCP or BOOTP configuration entries per interface (on top of the TM_MAX_IPS_PER_IF automatic configuration entries).

DEFAULT: 0


Treck Options common to both tfInitTreckOptions() and tfSetTreckOptions().

Option Name Meaning
TM_OPTION_ARP_MAX_RETRY The maximum number of ARP retries before going into the ARP quiet time state.

Default: 6

TM_OPTION_ARP_TIMEOUT_TIME The amount of time in seconds between ARP retries.

Default: 1

TM_OPTION_ARP_QUIET_TIME The length of the ARP quiet time state in seconds.

Default: 20

TM_OPTION_ARP_TTL The length of time that an ARP entry should be kept in the ARP cache in seconds. (To disable ARP aging, set to TM_RTE_INF.)

Default: 600

TM_OPTION_ARP_MAX_ENTRIES Maximum number of ARP entries in the ARP cache. Each entry consumes about 100 bytes. Lower this value if your heap space is low.

Default: 64

TM_OPTION_ARP_SMART Boolean to indicate whether the ARP logic should store all ARP mappings broadcast on the local network, even if we were not waiting for a reply, or if the request was not for us. Set this option value to 0, if your heap space is low.

Default: 1 (ON)

TM_OPTION_CGI_MAX_ARG The maximum number of HTTPD CGI variables supported.

Default: 316

TM_OPTION_CGI_MIN_ARG Minimum number of HTTPD CGI variables per allocation.

Default: 16

TM_OPTION_HTTPC_MAX_LINE_LEN The maximum line length size for HTTPC.

Default: 256

TM_OPTION_HTTPD_BODY_MAX_RCV_BUF The maximum size of buffer to hold HTTPD CGI names and values.

Default: 3000

TM_OPTION_ICMP_ADDR_MASK_AGENT A Boolean to enable/disable the ICMP address mask agent.

Default: 0

TM_OPTION_ICMP_ECHO_ENABLE A Boolean to enable/disable the ICMP echo responses. Note: You must uncomment TM_USE_ECHO_CONFIG in trsystem.h to use this option.

Default: 1 (enabled)

TM_OPTION_ICMP_ROUTE_REPLY A boolean to enable the user to force the stack to consult the routing table before sending a PING reply packet. Default value is 0, i.e., the stack by default will respond to PING requests by swapping the source and destination addresses and send the reply back to the sender of the request. This approach will not work when routing paths are asymmetric, i.e. return packets do not necessarily follow the same path as incoming packets. In that case, the user should set this option value to 1.

Default: 0

TM_OPTION_IGMP_IP_MAX_SRC_FILTER The maximum Source Filters per IPv4 multicast group. See IGMPv3 for details.

Default: TM_IP_MAX_SOURCE_FILTER (128)

TM_OPTION_IGMP_SO_MAX_SRC_FILTER The maximum Source Filters per IPv4 socket. See IGMPv3 for details.

Default: TM_SO_MAX_SOURCE_FILTER (64)

TM_OPTION_IP_DBCAST_FORWARD A Boolean to enable directed broadcast forwarding.

Default: 0

TM_OPTION_IP_MCAST_FORWARD A NAT related boolean to globally enable forwarding of IP multicast packets. See the main page for details.

Default: 0

TM_OPTION_IP_FORWARDING A Boolean to enable IP forwarding.

Default: 0

TM_OPTION_IP_FRAGMENT A Boolean to enable IP fragmentation.

Default: 1

TM_OPTION_IP_FRAG_MAX_Q_SIZE Option to change the maximum number of IP datagrams waiting to be reassembled. If any fragment of a new datagram arrives when the maximum number of IP datagrams waiting to be reassembled has been reached, it is dropped.

Default: 5

TM_OPTION_IP_FRAG_ENTRY_MAX_SIZE Option to change the maximum size of an IP datagram waiting to be reassembled. Beyond that size, the entire IP datagram is dropped.

Default: 8200 (bytes)

TM_OPTION_IP_FRAG_ENTRY_MIN_SIZE Option to change the minimum data size of an IP fragment waiting to be reassembled. If any IP fragment (except for the last one) data size is below that size, the entire IP datagram is dropped.

Default: 68 (bytes)

TM_OPTION_IP_FRAG_FAILED_MAX Option to change the maximum number of IP datagrams that we will track that were too big or too tiny to be reassembled. If we receive a new "too large" IP datagram, or a "too tiny" fragment of a new IP datagram when we have already reached the maximum, we will free the oldest.

Default: 5 (IP datagrams)

TM_OPTION_IP_FRAG_TTL Fragment re-assembly timeout value in seconds.

Default: 60

TM_OPTION_IP_LBCAST_ENABLE Enable/Disable Limited Broadcast packets.

Default: 1(enabled)

TM_OPTION_IP_TTL The initial time-to-live for IP datagrams.

Default: 64

TM_OPTION_IP_TOS The default Type-Of-Service for IP datagrams.

Default: 0

TM_OPTION_PMTU_DECREASED_TTL The length of time (in seconds) before a path MTU estimate increase is tried, after having received an ICMP Datagram Too Big Message error.

Default: 600 (seconds)

TM_OPTION_DECREASED_PMTU_TTL Path MTU host routing entry timeout (in seconds), when the Path MTU estimate is decreased.

Default: 600 (seconds) as recommended by the RFC

TM_OPTION_PMTU_LARGER_TTL The length of time (in seconds) before another path MTU estimate increase is tried, after a previous path MTU estimate increase has been successful.

Default: 1200 (seconds)

TM_OPTION_LARGER_PMTU_TTL Path MTU host routing entry timeout (in seconds), when a larger path MTU estimate is attempted.

Default: 120 (seconds) as recommended by the RFC

TM_OPTION_RIP_ENABLE Boolean to enable/disable the RIPv2 Listener once it has been started.

Default: 0

To start RIP, the user should call tfUseRip().

TM_OPTION_RIP_SEND_MODE The mode used to send RIP packets.

Default: TM_RIP_2_BROADCAST

TM_RIP_NONE Ignore requests from the TCP/IP stack to send RIP requests.
TM_RIP_1 Send RIP version 1 packets
TM_RIP_2 Multicast RIP version 2 packets.
TM_RIP_2_BROADCAST Broadcast RIP version 2 packets.
TM_OPTION_RIP_RECV_MODE The mode used to receive RIP packets.

Default: TM_RIP_1|TM_RIP_2

TM_RIP_NONE Ignore incoming RIP packets.
TM_RIP_1 Accept RIP version 1 packets.
TM_RIP_2 Accept RIP version 2 packets.
TM_RIP_1|TM_RIP_2 Accept both RIP version 1 and version 2 packets.
TM_OPTION_ROUTE_MAX_ENTRIES Maximum number of dynamic route entries in the routing table.

Default: 10

TM_OPTION_ROUTER_AGE_LIMIT The maximum of time in seconds that a Router entry is kept.

Default: 600

TM_OPTION_ROUTER_ID IPv4 Router Id: Default 32-bit IPv4 address in network byte order (before configuration).

Default: 0x00000000

TM_OPTION_RT_TIMER_RES_MSEC Resolution (in milliseconds) of timer used to age ARP cache entries.

Default: 1000

TM_OPTION_SSI_MAX_TAG_LEN The maximum HTTPD SSI tag length in the SSI enabled pages.

Default: 256

TM_OPTION_SEND_TRAILER_SIZE Number of bytes of extra space to include at the end of outgoing packets. This could be used, for instance, if the user needs space to copy their own trailer onto outgoing packets.

Default: 0

TM_OPTION_ENABLE_SYN_COOKIES Enable/Disable usage of TCP SYN cookies. SYN cookie is a technique used to resist SYN flood attack. The use of SYN cookies allows a server to avoid dropping connections when the SYN queue fills up. This implementation of SYN cookies allows TCP connections with window scale, and SACK (Selective ACK) options. However it will drop TCP connections with the time stamp option on (when the SYN cookies threshold is reached). Note that this only occurs when under attack.

Default: 0 (disabled)

TM_OPTION_TCP_SOCKETS_MAX The maximum number of TCP sockets allowed on the system, including TCP sockets in the TIME_WAIT state. Allowed values are between 1 and 0x7FFF - 1.

Default: 64

TM_OPTION_TIME_WAIT_HASH_SIZE Specify the size of the TCP Time-Wait vector hash table. See Configuring TCP Time-Wait Vector Management for more details.
TM_OPTION_TCP_TMWT_MAX Specify the maximum number of TCP Time-Wait vectors. See Configuring TCP Time-Wait Vector Management for more details.
TM_OPTION_TIMER_MAX_EXECUTE The maximum number of timers to process in a single call to tfTimerExecute().

Default: 0

Meaning that there is no maximum. To minimize the latency of the tfTimerExecute() call, set to 1.

TM_OPTION_UDP_CHECKSUM A Boolean to enable/disable UDP checksums on outgoing packets.

Default: 1

TM_6_OPTION_ICMP_TX_ERR_BURST This new option has been added for ICMPv6 to support the token bucket method of limiting the rate of error packets generated by this node. This is the method recommended in RFC 4443 section 2.4(f).
TM_6_OPTION_ICMP_TX_ERR_LIMIT This existing option no longer refers to a fixed interval method of limiting the rate of error packets generated by this node. The option now refers a limit on the average rate of error packets generated. An occasional burst of error packets is allowed to exceed this rate limit. The burst length is limited by option TM_6_OPTION_ICMP_TX_ERR_BURST mentioned above.
TM_6_OPTION_ICMP_ECHO_ENABLE A Boolean to enable/disable the ICMPv6 echo responses. Note: You must uncomment TM_6_USE_ECHO_CONFIG in trsystem.h to use this option.

Default: 1 (enabled)

TM_6_OPTION_IP_FORWARDING A Boolean to enable IPv6 forwarding.

Default: 0

TM_6_OPTION_IP_FRAGMENT A Boolean to enable IPv6 fragmentation.

Default: 1

TM_6_OPTION_IP_FRAG_MAX_Q_SIZE Option to change the maximum number of IPv6 datagrams waiting to be reassembled. If any fragment of a new datagram arrives when the maximum number of IPv6 datagrams waiting to be reassembled has been reached, it is dropped.

Default: 5

TM_6_OPTION_IP_FRAG_ENTRY_MAX_SIZE Option to change the maximum size of an IPv6 datagram waiting to be reassembled. Beyond that size, the entire IPv6 datagram is dropped.

Default: 8200 (bytes)

TM_6_OPTION_IP_FRAG_ENTRY_MIN_SIZE Option to change the minimum data size of an IPv6 fragment waiting to be reassembled. If any IPv6 fragment (except for the last one) data size is below that size, the entire IPv6 datagram is dropped.

Default: 68 (bytes)

TM_6_OPTION_IP_FRAG_FAILED_MAX Option to change the maximum number of IPv6 datagrams that we will track that were too big or too tiny to be reassembled. If we receive a new "too large" IPv6 datagram, or a "too tiny" fragment of a new IPv6 datagram when we have already reached the maximum, we will free the oldest.

Default: 5 (IPv6 datagrams)

TM_6_OPTION_IP_FRAG_TTL IPv6 Fragment re-assembly timeout value in seconds.

Default: 60

TM_6_OPTION_MLD_IP_MAX_SRC_FILTER The maximum Source Filters per IPv6 multicast group. See MLDv2 for details.

Default: TM_IP_MAX_SOURCE_FILTER (128)

TM_6_OPTION_MLD_SO_MAX_SRC_FILTER The maximum Source Filters per IPv6 socket. See MLDv2 for details.

Default: TM_SO_MAX_SOURCE_FILTER (64)

TM_6_OPTION_USE_TEMPADDR Adjust the default level of support for RFC 4941, Privacy Extensions for Stateless Address Autoconfiguration in IPv6. The value you set will be inherited by all subsequently created interfaces when you call tfAddInterface(). Refer to the Main Article for details on this feature. Acceptable values for this option are:
  • TM_6_OPTION_TEMPADDR_DISABLE (0) - By default, temporary addresses will not be generated for newly created interfaces.
  • TM_6_OPTION_TEMPADDR_ENABLE (1) - By default, temporary addresses will be generated for newly created interfaces but public addresses will be used in preference to temporary addresses.
  • TM_6_OPTION_TEMPADDR_PREFER (2) - By default, temporary addresses will be generated for newly created interfaces and temporary addresses will be used in preference to public addresses.

Associated compile-time macros: TM_6_USE_TEMPADDR and TM_6_PREFER_TEMPADDR
Default: TM_6_OPTION_TEMPADDR_DISABLE

TM_6_OPTION_TEMP_VALID_LFT Time from creation (seconds) that an autoconfigured 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.

Associated compile-time macro: TM_6_TEMP_VALID_LIFETIME
Default: 7 days

TM_6_OPTION_TEMP_PREFER_LFT Time from creation (seconds) that an autoconfigured 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.

Associated compile-time macro: TM_6_TEMP_PREFER_LIFETIME
Default: 1 day

TM_6_OPTION_TEMP_MAX_DESYNC Maximum desynchronizing factor (seconds) for autoconfiguring temporary addresses. 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.

Associated compile-time macro: TM_6_TEMP_MAX_DESYNC_FACTOR
Default: 10 minutes

TM_6_OPTION_TEMP_MAX_RETRY Maximum attempts to generate and autoconfigure a valid temporary 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.

Associated compile-time macro: TM_6_TEMP_REGEN_MAX_RETRY
Default: 3 attempts

TM_OPTION_SCTP_SOCKETS_MAX The maximum number of SCTP sockets allowed on the system. Allowed values are between 1 and 0x7FFF - 1.

Default: 64

Table of Contents >> Programmer's Reference