NicheStack Technical Reference

51 E. Campbell Ave
Suite 160
Campbell, CA.  95008
Copyright © 1995-2006
InterNiche Technologies Inc.
email: Support@iNiche.com
http://www.iniche.com
support: 408.540.1160 ext: 218
fax: 408.540.1161

InterNiche Technologies Inc. has made every effort to assure the accuracy of the information contained in this documentation. We appreciate any feedback you may have for improvements. Please send your comments to support@iniche.com.

The software described in this document is furnished under a license and may be used, or copied, only in accordance with the terms of such license.

Revised: January 5, 2006

Portions of the InterNiche source code are provided under the copyright of the respective owners and are also acknowledged in the appropriate source files:

Copyright © 1984, 1985, 1986 by the Massachusetts Institute of Technology

Copyright © 1982, 1985, 1986 by the Regents of the University of California.

All Rights Reserved

Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this paragraph are duplicated in all such forms and that any documentation, advertising materials, and other materials related to such distribution and use acknowledge that the software was developed by the University of California, Berkeley. The name of the University may not be used to endorse or promote products derived from this software without specific prior written permission.

Copyright © 1988, 1989 by Carnegie Mellon University

All Rights Reserved

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of CMU not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.

Trademarks

All terms mentioned in this document that are known to be service marks, tradenames, trademarks, or registered trademarks are property of their respective holders and have been appropriately capitalized. InterNiche Technologies Inc. cannot attest to the complete accuracy of this information. The use of a term in this document should not be regarded as affecting the validity of any service mark, tradename, trademark, or registered trademark.

Table of Contents

0. Table of Contents
1. OVERVIEW
1.1 Terms and Conventions
1.2 What Is a Port?
1.3 Requirements
1.3.1 Memory Requirements
1.3.2 CPU Requirements
1.3.3 Operating System Requirements
1.4 TCP/IP Stack Source Code Organization
1.4.1 Target System Independent Directories
1.4.2 Target System Dependent Directories
1.4.3 Other Product Directories
1.4.4 Build Directories
1.4.5 Target System Include Directory /h
1.4.6 Portable Files vs. Port Dependent Files
1.4.7 Make Files
1.5 Overview of NicheStack Source Code Files
1.5.1 Why Not Modify Portable Files?
1.5.2 ip Directory Source Files
1.5.3 net Directory Source Files
1.5.4 h Directory Source Files
1.5.5 tcp Directory Source Files
1.5.6 misclib Directory Source Files
2. PORTING GUIDE
2.1 Creating an InterNiche Source Code Tree
2.2 The IP Port File: ipport.h_h
2.2.1 Standard Macros and Definitions
2.2.2 CPU Architecture
2.2.3 Mutual Exclusion
2.2.3.1 Critical Section Method
2.2.3.2 Net Resource Method
2.2.3.3 Net Resource Method, Walkthrough
2.2.4 Debugging Aids
2.2.5 Timers and Multitasking
2.2.6 Stack Features and Options
2.2.7 Package Options
2.2.8 Error Codes
2.3 The "glue" Layer
2.4 Task Control
2.4.1 Multitasking vs. Superloop
2.4.1.1 The Superloop Method
2.4.1.2 Multitasking
2.4.2 TCP
2.5 Data Structures
2.5.1 The netbuf Structure and the Packet Queues
2.5.2 The net Structure, the nets[] Array, and the netlist
2.5.3 The IfMib Structure
2.6 Initialization
2.6.1 Initialization of net Structure IP Addressing Fields
2.6.2 Initialization of the Packet Buffer Queue Sizes
2.6.3 Initialization of the IP and TCP Layers: ip_startup()
2.6.4 Dynamic Internet Configuration with DHCP
2.6.5 Initialization of Application Servers
2.6.6 Dynamically-Created Network Interfaces
2.7 Servicing the Stack
2.8 Applications and Testing
3. PORTING ENGINEER PROVIDED FUNCTIONS
3.1 General Functions
3.2 Network Interfaces
3.2.1.1 netbuf Allocation
3.2.1.2 netbuf Initialization
3.2.1.3 Copy Received Data to netbuf Packet Buffer
3.2.1.4 Enqueuing netbuf structure to rcvdq
3.2.1.5 Signal Packet Demultiplexor
4. INTERNAL FUNCTIONS
4.1 ARP
4.2 IP
4.3 ICMP
4.4 UDP
4.5 MISCLIB
4.6 Dynamic Network Interfaces
4.7 Syslog Client
4.7.1 Usability notes.
4.7.2 Interoperability notes
4.7.3 Integration notes
4.7.4 Syslog API
5. SOCKETS
5.1 Overview
5.2 Sockets Errors
5.3 Quick List for Sockets Prototypes
5.4 Quick List for Socket Options
5.5 Sockets API Calls Reference
6. TCP ZERO-COPY
6.1 Overview
6.2 Sending Data with the TCP Zero-Copy API
6.2.1 Allocate a Packet Buffer
6.2.2 Fill the Allocated Buffer with Data
6.2.3 Send the Packet
6.3 Receiving Data with the TCP Zero-Copy API
6.3.1 Writing a Callback Function
6.3.2 Registering the Callback Function
6.4 TCP Zero-Copy API Reference
7. IP FILTERING (AS PER RFC2669)
7.1 Overview
7.2 Files
7.3 How does IP filtering work ?
7.4 IP Filter Table Implementation
7.5 How to use IP filtering ?
8. Introduction to NicheStack IPv6
9. Differences between IPv6 and IPv4.
9.1 Bigger IP address
9.2 More header layers (IP options)
9.3 Different hardware limits
9.3.1 PMTU of 1280
9.3.2 No Fragmenting in routers
9.3.3 Larger Datagrams
9.4 Multicast is required
9.5 Unified Pseudo Checksum
9.6 Multiple IP address per Interface
9.7 Neighbor Discovery Vs ARP
10 Build issues
10.1 Adding IPv6 to legacy IPv4 builds
10.2 nsref_c10.htm#defines
10.3 The ipv6 directory
10.4 File list
10.5 scatter/gather
10.6 Where are the headers?
10.7 Porting macros - IP6EQ(), IP6CPY(),
11 IPv6 Addresses
11.1 InterNiche interfaces
11.2 Address Notation
11.3 Address passing and storage
11.4 Address classes
11.5 link local Vs global
11.6 site local, node local
11.7 Predefined
11.7.1 Loopback - ::1
11.7.2 All nodes multicast - FF02::1
11.7.3 All routers multicast FF02::2
11.7.4 MAC specific multicast
11.7.5 Unspecified address
11.8 Routing table vs. Neighbor cache.
12 IPv6 Sockets
12.1 Definitions and headers
12.2 Socket Creation
12.3 Connecting
12.4 FTP and IP addressing in the data stream
12.5 Socket domain field
12.6 DNS (getnodebyname())
13 Other API
13.1 - ICMPv6 callbacks
13.2 - IP6EQ(), IP6CPY(),
13.3 Utility functions
14 IPv6 console commands
14.1 ip6 - IPv6 MIB statistics
14.2 icmp6 - ICMPv6 MIB statistics
14.3 ndcache - Show Neighbor discovery cache
14.4 ping6 - Start ICMPv6 ping
14.5 rt6add - Create an IPv6 route table entry
14.6 rt6del - Delete an IPv6 route table entry
14.7 rt6list - List current IPv6 routes table
14.8 6host - Set default IPv6 host
14.9 Setip6 - Set IPv6 address for an interface
14.10 6iface - Set the default IPv6 interface
15 MAC Drivers
15.1 Scatter gather (performance)
15.1.1 nb_tlen length (primarily on sends)
15.2 Multicast is required

Table of Chapters