Table of Contents

1 Introduction

2 TCP/IP Initialization

2.1 TCP/IP Stack Configuration
2.1.1 Multiple Interface Support
2.1.2 Interface Selection Macros
2.1.2.1 Link Layer Drivers
2.1.3 Single Interface Support
2.1.3.1 Configuration Macros for Link Layer Driver - Single Interface
2.1.4 TCP/IP Stack Initialization
2.2 Interface Configuration
2.2.1 Configuration Overview
2.2.2 Sources of Configuration Information
2.2.2.1 Predefined Configurations
2.2.2.2 Static Configuration
2.2.2.3 Dynamic Configuration via the Network
2.2.2.4 Runtime Configuration Using ifconfig()
2.2.2.5 Directed Ping
2.2.2.6 Console Configuration Via Zconsole.lib
2.2.2.7 Media Access Control (MAC) Address
2.3 Dynamically Starting and Stopping Interfaces
2.3.1 Testing Interface Status
2.3.2 Bringing an Interface Up
2.3.3 Bringing an Interface Down
2.4 Setting Up Wi-Fi Interfaces
2.4.1 Wi-Fi Compile Time Configuration
2.4.1.1 Infrastructure, Open (No Encryption) Configuration
2.4.1.2 Ad-hoc, Open (No Encryption) Configuration
2.4.1.3 Infrastructure, WEP Encryption Configuration
2.4.1.4 Infrastructure, WPA/TKIP Encryption Configuration
2.4.1.5 Infrastructure, WPA2/CCMP Encryption Configuration
2.4.1.6 Specifying a Pre-Shared Key
2.4.1.7 Ad-hoc, WPA/TKIP or WPA2/CCMP Encryption Configuration
2.4.2 Wi-Fi RunTime Configuration
2.4.2.1 RunTime Configuration Starting with Dynamic C 10.40
2.4.2.2 RunTime Configuration Prior to Dynamic C 10.40
2.5 Setting Up PPP Interfaces
2.5.1 PPP over Asynchronous Serial
2.5.2 PPP over Ethernet
2.6 Configuration Macro Reference
2.6.1 Removing Unnecessary Functions
2.6.2 Including Additional Functions
2.6.3 BOOTP/DHCP Control Macros
2.6.4 BOOTP/DHCP Global Variables
2.6.5 Buffer and Resource Sizing
2.6.6 Network Configuration Prior to Dynamic C 7.30
2.6.7 Network Configuration Starting with Dynamic C 7.30
2.6.8 Time-Outs and Retry Counters
2.6.9 Program Debugging
2.6.10 Miscellaneous Macros
2.6.10.1 TOS and TTL
2.6.11 Wi-Fi Configuration Macros

3 TCP and UDP Socket Interface

3.1 What is a Socket?
3.1.1 Port Numbers
3.2 Allocating TCP and UDP Sockets
3.2.1 Allocating Socket Buffers
3.2.2 Socket Buffer Sizes
3.2.2.1 User-Supplied Buffers
3.3 Opening TCP Sockets
3.3.1 Passive Open
3.3.2 Active Open
3.3.3 Waiting for Connection Establishment
3.3.4 Specifying a Listen Queue
3.4 TCP Socket Functions
3.4.1 Control Functions for TCP Sockets
3.4.2 Status Functions for TCP Sockets
3.4.3 I/O Functions for TCP Sockets
3.5 UDP Socket Overview
3.6 UDP Socket Functions (7.05 and later)
3.6.1 Control Functions for UDP Sockets
3.6.2 Status Function for UDP Sockets
3.6.3 I/O Functions for UDP Sockets
3.7 UDP Socket Functions (pre 7.05)
3.7.1 I/O Functions for UDP Sockets
3.7.2 Opening and Closing a UDP Socket
3.7.3 Writing to a UDP Socket
3.7.4 Reading From a UDP Socket
3.7.5 Porting Programs from the older UDP API to the new UDP API
3.8 Skeleton Program
3.8.1 TCP/IP Stack Initialization
3.8.2 Packet Processing
3.9 TCP/IP Daemon: tcp_tick()
3.9.1 tcp_tick() for Robust Applications
3.9.2 Global Timer Variables
3.10 State-Based Program Design
3.10.1 Blocking vs. Non-Blocking
3.10.1.1 Non-Blocking Functions
3.10.1.2 Blocking Functions
3.11 TCP and UDP Data Handlers
3.11.1 UDP Data Handler
3.11.2 TCP Data Handler
3.12 Multitasking and TCP/IP
3.12.1 µC/OS-II
3.12.2 Cooperative Multitasking

4 Optimizing TCP/IP Performance

4.1 DBP and Sizing of TCP Buffers
4.2 TCP Performance Tuning
4.2.1 The Nagle Algorithm
4.2.2 Time-Out Settings
4.2.2.1 Time-Out Setting Constants
4.2.3 Reserved Ports
4.2.4 Type of Service (TOS)
4.2.5 ARP Cache Considerations
4.3 Writing a Fast UDP Request/Response Server
4.4 Tips and Tricks for TCP Applications
4.4.1 Bulk Loader Applications
4.4.2 Casual Server Applications
4.4.3 Master Controller Applications
4.4.4 Web Server Applications
4.4.5 Protocol Translator Applications

5 Network Addressing: ARP & DNS

5.1 ARP Functions
5.2 Configuration Macros for ARP
5.3 DNS Functions
5.4 Configuration Macros for DNS Lookups

6 IGMP and Multicasting

6.1 Multicasting
6.1.1 Multicast Addresses
6.1.2 Host Group Membership
6.2 IGMP
6.3 Multicast Macros

7 PPP Driver

7.1 PPP Libraries
7.2 External Modem Library
7.3 Operation Details for PPP over Serial
7.3.1 The Modem Interface
7.3.1.1 Rabbit Pin Connections to Modem
7.3.2 Flow Control
7.4 Operation Details for PPPoE
7.5 Link Control Protocol Options
7.6 Configuring PPP
7.6.1 Serial Port Selection
7.6.2 PPPoE Port Selection
7.6.3 ifconfig() Options for PPP
7.6.4 ifconfig() Options for Serial PPP
7.6.4.1 Additional Rules for Send/Expect Scripts
7.6.5 Starting and Stopping PPP Interfaces

8 Function Reference

Index