| Title and Copyright Information |
| About This Manual |
| Audience |
| New and Changed Features |
| Organization |
| Related Documents |
| Reader's Comments |
| Conventions |
| 1 | Introduction to the Network Programming Environment |
| 1.1 | Data Link Interfaces |
| 1.2 | Sockets and STREAMS Frameworks |
| 1.3 | X/Open Transport Interface |
| 1.4 | Extensible SNMP |
| 1.5 | RSVP Application Programming Interface |
| 1.6 | Sockets and STREAMS Interaction |
| 1.7 | Putting It All Together |
| 2 | Data Link Provider Interface |
| 2.1 | Modes of Communication |
| 2.2 | Types of Service |
| 2.2.1 | Local Managment Services |
| 2.2.2 | Connection-Mode Services |
| 2.2.3 | Connectionless-Mode Services |
| 2.2.4 | Acknowledged Connectionless-Mode Data Transfer |
| 2.3 | DLPI Addressing |
| 2.4 | DLPI Primitives |
| 2.5 | Identifying Available PPAs |
| 3 | X/Open Transport Interface |
| 3.1 | Overview of XTI |
| 3.2 | XTI Features |
| 3.2.1 | Modes of Service and Execution |
| 3.2.1.1 | Connection-Oriented and Connectionless Service |
| 3.2.1.2 | Asynchronous and Synchronous Execution |
| 3.2.2 | The XTI Library, TLI Library, and Header Files |
| 3.2.2.1 | XTI and TLI Header Files |
| 3.2.2.2 | XTI Library Calls |
| 3.2.3 | Events and States |
| 3.2.3.1 | XTI Events |
| 3.2.3.2 | XTI States |
| 3.2.4 | Tracking XTI Events |
| 3.2.4.1 | Outgoing Events |
| 3.2.4.2 | Incoming Events |
| 3.2.5 | Map of XTI Functions, Events, and States |
| 3.2.6 | Synchronization of Multiple Processes and Endpoints |
| 3.3 | Using XTI |
| 3.3.1 | Guidelines for Sequencing Functions |
| 3.3.2 | State Management by the Transport Provider |
| 3.3.3 | Writing a Connection-Oriented Application |
| 3.3.3.1 | Initializing an Endpoint |
| 3.3.3.2 | Using XTI Options |
| 3.3.3.3 | Establishing a Connection |
| 3.3.3.4 | Transferring Data |
| 3.3.3.5 | Releasing Connections |
| 3.3.3.6 | Deinitializing Endpoints |
| 3.3.4 | Writing a Connectionless Application |
| 3.3.4.1 | Initializing an Endpoint |
| 3.3.4.2 | Transferring Data |
| 3.3.4.3 | Deinitializing Endpoints |
| 3.4 | Phase-Independent Functions |
| 3.5 | Porting to XTI |
| 3.5.1 | Protocol Independence and Portability |
| 3.5.2 | XTI and TLI Compatibility |
| 3.5.3 | Rewriting a Socket Application to Use XTI |
| 3.6 | Differences Among XPG3, XNS4.0, and XNS5.0 |
| 3.6.1 | Major Differences Between XPG3 and XNS4.0 |
| 3.6.2 | Major Differences Between XNS4.0 and XNS5.0 |
| 3.6.3 | Source Code Migration |
| 3.6.3.1 | Use the Older Binaries of your Application |
| 3.6.3.2 | Unaltered Sources |
| 3.6.3.3 | XNS4.0 Compliant Application |
| 3.6.3.4 | XNS5.0 Compliant Application |
| 3.6.4 | Binary Compatibility |
| 3.6.5 | Packaging |
| 3.6.6 | Interoperability |
| 3.6.7 | Using XTI Options |
| 3.6.7.1 | Using XTI Options in XNS4.0 and XNS5.0 |
| 3.6.7.2 | Negotiating Protocol Options in XPG3 |
| 3.7 | XTI Errors |
| 3.8 | Configuring XTI Transport Providers |
| 4 | Sockets |
| 4.1 | Overview of the Sockets Framework |
| 4.1.1 | Communication Properties of Sockets |
| 4.1.1.1 | Socket Abstraction |
| 4.1.1.2 | Communication Domains |
| 4.1.1.3 | Socket Types |
| 4.1.1.4 | Socket Names |
| 4.2 | Application Interface to Sockets |
| 4.2.1 | Modes of Communication |
| 4.2.1.1 | Connection-Oriented Communication |
| 4.2.1.2 | Connectionless Communication |
| 4.2.2 | Client/Server Paradigm |
| 4.2.3 | System Calls, Library Calls, Header Files, and Data Structures |
| 4.2.3.1 | Socket System Calls |
| 4.2.3.2 | Socket Library Calls |
| 4.2.3.3 | Header Files |
| 4.2.3.4 | Socket Related Data Structures |
| 4.3 | Using Sockets |
| 4.3.1 | Creating Sockets |
| 4.3.1.1 | Setting Modes of Execution |
| 4.3.2 | Binding Names and Addresses |
| 4.3.3 | Establishing Connections |
| 4.3.4 | Accepting Connections |
| 4.3.5 | Setting and Getting Socket Options |
| 4.3.6 | Transferring Data |
| 4.3.6.1 | Using the read System Call |
| 4.3.6.2 | Using the write System Call |
| 4.3.6.3 | Using the send, sendto, recv and recvfrom System Calls |
| 4.3.6.4 | Using the sendmsg and recvmsg System Calls |
| 4.3.7 | Shutting Down Sockets |
| 4.3.8 | Closing Sockets |
| 4.4 | Creating Internet Applications |
| 4.4.1 | Creating IPv4 Applications |
| 4.4.2 | Creating IPv6 Applications |
| 4.4.3 | Address Testing Macros |
| 4.5 | BSD Socket Interface |
| 4.5.1 | Variable-Length Network Addresses |
| 4.5.2 | Receiving Protocol Data with User Data |
| 4.6 | Common Socket Errors |
| 4.7 | Advanced Topics |
| 4.7.1 | Porting Applications to Use AF_INET6 Sockets |
| 4.7.1.1 | Making Name Changes |
| 4.7.1.2 | Making Structure Changes |
| 4.7.1.3 | Making Function Call Changes |
| 4.7.1.4 | Making Other Application Changes |
| 4.7.1.5 | Using the ipv6_sniff Utility |
| 4.7.2 | Using IPv6 Raw Sockets |
| 4.7.2.1 | Accessing ICMPv6 Messages |
| 4.7.2.2 | Accessing the IPv6 Header |
| 4.7.2.3 | Accessing the IPv6 Routing Header |
| 4.7.2.4 | Accessing the IPv6 Options Headers |
| 4.7.3 | Selecting Specific Protocols |
| 4.7.4 | Binding Names and Addresses |
| 4.7.4.1 | Binding to the Wildcard Address |
| 4.7.4.2 | Binding in the UNIX Domain |
| 4.7.5 | Out-of-Band Data |
| 4.7.6 | Internet Protocol Multicasting |
| 4.7.6.1 | Sending IPv4 Multicast Datagrams |
| 4.7.6.2 | Receiving IPv4 Multicast Datagrams |
| 4.7.6.3 | Sending IPv6 Multicast Datagrams |
| 4.7.6.4 | Receiving IPv6 Multicast Datagrams |
| 4.7.7 | Broadcasting and Determining Network Configuration |
| 4.7.8 | The inetd Daemon |
| 4.7.9 | Input/Output Multiplexing |
| 4.7.10 | Interrupt Driven Socket I/O |
| 4.7.11 | Signals and Process Groups |
| 4.7.12 | Pseudoterminals |
| 5 | Tru64 UNIX STREAMS |
| 5.1 | Overview of the STREAMS Framework |
| 5.1.1 | Review of STREAMS Components |
| 5.1.2 | ioctl Processing |
| 5.2 | Application Interface to STREAMS |
| 5.2.1 | Header Files and Data Types |
| 5.2.2 | STREAMS Functions |
| 5.2.2.1 | The open Function |
| 5.2.2.2 | The close Function |
| 5.2.2.3 | The read Function |
| 5.2.2.4 | The write Function |
| 5.2.2.5 | The ioctl Function |
| 5.2.2.6 | The mkfifo Function |
| 5.2.2.7 | The pipe Function |
| 5.2.2.8 | The putmsg and putpmsg Functions |
| 5.2.2.9 | The getmsg and getpmsg Functions |
| 5.2.2.10 | The poll Function |
| 5.2.2.11 | The isastream Function |
| 5.2.2.12 | The fattach Function |
| 5.2.2.13 | The fdetach Function |
| 5.3 | Kernel Level Functions |
| 5.3.1 | Module Data Structures |
| 5.3.2 | Message Data Structures |
| 5.3.3 | STREAMS Processing Routines for Drivers and Modules |
| 5.3.3.1 | Open and Close Processing |
| 5.3.3.2 | Configuration Processing |
| 5.3.3.3 | Read Side Put and Write Side Put Processing |
| 5.3.3.4 | Read Side Service and Write Side Service Processing |
| 5.3.4 | Tru64 UNIX STREAMS Concepts |
| 5.3.4.1 | Synchronization |
| 5.3.4.2 | Timeout |
| 5.4 | Configuring a User-Written STREAMS-Based Module or Driver in the Tru64 UNIX Kernel |
| 5.5 | Device Special Files |
| 5.6 | Error and Event Logging |
| 6 | Extensible SNMP Application Programming Interface |
| 6.1 | Overview of eSNMP |
| 6.1.1 | Components of eSNMP |
| 6.1.2 | Architecture |
| 6.1.3 | SNMP Versions |
| 6.1.4 | AgentX |
| 6.2 | Overview of the Extensible SNMP Application Programming Interface |
| 6.2.1 | MIB Subtrees |
| 6.2.2 | Object Tables |
| 6.2.2.1 | The subtree_tbl.h File |
| 6.2.2.2 | The subtree_tbl.c File |
| 6.2.3 | Implementing a Subagent |
| 6.2.4 | Subagent Protocol Operations |
| 6.2.4.1 | Order of Operations |
| 6.2.4.2 | Function Return Values |
| 6.3 | Extensible SNMP Application Programming Interface |
| 6.3.1 | Calling Interface |
| 6.3.1.1 | The esnmp_init Routine |
| 6.3.1.2 | The esnmp_allocate Routine |
| 6.3.1.3 | The esnmp_deallocate Routine |
| 6.3.1.4 | The esnmp_register Routine |
| 6.3.1.5 | The esnmp_unregister Routine |
| 6.3.1.6 | The esnmp_register2 Routine |
| 6.3.1.7 | The esnmp_unregister2 Routine |
| 6.3.1.8 | The esnmp_capabilities Routine |
| 6.3.1.9 | The esnmp_uncapabilities Routine |
| 6.3.1.10 | The esnmp_poll Routine |
| 6.3.1.11 | The esnmp_are_you_there Routine |
| 6.3.1.12 | The esnmp_trap Routine |
| 6.3.1.13 | The esnmp_term Routine |
| 6.3.1.14 | The esnmp_sysuptime Routine |
| 6.3.2 | Method Routine Calling Interface |
| 6.3.2.1 | The *_get Routine |
| 6.3.2.2 | The *_set Method Routine |
| 6.3.2.3 | Method Routine Applications Programming |
| 6.3.3 | The libsnmp Support Routines |
| 6.3.3.1 | The o_integer Routine |
| 6.3.3.2 | The o_octet Routine |
| 6.3.3.3 | The o_oid Routine |
| 6.3.3.4 | The o_string Routine |
| 6.3.3.5 | The str2oid Routine |
| 6.3.3.6 | The sprintoid Routine |
| 6.3.3.7 | The instance2oid Routine |
| 6.3.3.8 | The oid2instance Routine |
| 6.3.3.9 | The inst2ip Routine |
| 6.3.3.10 | The cmp_oid Routine |
| 6.3.3.11 | The cmp_oid_prefix Routine |
| 6.3.3.12 | The clone_oid Routine |
| 6.3.3.13 | The free_oid Routine |
| 6.3.3.14 | The clone_buf Routine |
| 6.3.3.15 | The mem2oct Routine |
| 6.3.3.16 | The cmp_oct Routine |
| 6.3.3.17 | The clone_oct Routine |
| 6.3.3.18 | The free_oct Routine |
| 6.3.3.19 | The free_varbind_data Routine |
| 6.3.3.20 | The set_debug_level Routine |
| 6.3.3.21 | The is_debug_level Routine |
| 6.3.3.22 | The ESNMP_LOG Routine |
| 7 | RSVP Application Programming Interface |
| 7.1 | Network Quality of Service |
| 7.2 | Network Quality of Service Components |
| 7.2.1 | Traffic Control |
| 7.2.2 | RSVP |
| 7.2.3 | RAPI |
| 7.2.4 | Interoperation of Components |
| 7.3 | Traffic Control |
| 7.4 | RSVP |
| 7.4.1 | Components of RSVP |
| 7.4.2 | rsvpd Daemon |
| 7.5 | RSVP Application Programming Interface |
| 7.5.1 | Supported Routines |
| 7.5.2 | Writing a RAPI-Enabled Application |
| 7.5.2.1 | Linking Your Application |
| 7.5.3 | Debugging RAPI Applications |
| 8 | Tru64 UNIX STREAMS/Sockets Coexistence |
| 8.1 | Bridging STREAMS Drivers to Sockets Protocol Stacks |
| 8.1.1 | The STREAMS Driver |
| 8.1.1.1 | Using the ifnet STREAMS Module |
| 8.1.1.2 | Data Link Provider Interface Primitives |
| 8.2 | Bridging BSD Drivers to STREAMS Protocol Stacks |
| 8.2.1 | Supported DLPI Primitives and Media Types |
| 8.2.2 | Using the STREAMS Pseudodriver |
| A | Sample STREAMS Module |
| B | Socket and XTI Programming Examples |
| B.1 | Connection-Oriented Programs |
| B.1.1 | Socket Server Program |
| B.1.2 | Socket Client Program |
| B.1.3 | XTI Server Program |
| B.1.4 | XTI Client Program |
| B.2 | Connectionless Programs |
| B.2.1 | Socket Server Program |
| B.2.2 | Socket Client Program |
| B.2.3 | XTI Server Program |
| B.2.4 | XTI Client Program |
| B.3 | Common Code |
| B.3.1 | The common.h Header File |
| B.3.2 | The server.h Header File |
| B.3.3 | The serverauth.c File |
| B.3.4 | The serverdb.c File |
| B.3.5 | The xtierror.c File |
| B.3.6 | The client.h Header File |
| B.3.7 | The clientauth.c File |
| B.3.8 | The clientdb.c File |
| C | IPv4 and IPv6 Sockets Programming Examples |
| C.1 | Programs Using AF_INET Sockets |
| C.1.1 | Client Program Using AF_INET Sockets |
| C.1.2 | Server Program Using AF_INET Sockets |
| C.2 | Programs Using AF_INET6 Sockets |
| C.2.1 | Client Program Using AF_INET6 Sockets |
| C.2.2 | Server Program Using AF_INET6 Sockets |
| C.3 | Sample Program Output |
| D | TCP Specific Programming Information |
| D.1 | TCP Throughput and Window Size |
| D.1.1 | Programming the TCP Socket Buffer Sizes |
| D.1.2 | TCP Window Scale Option |
| D.1.2.1 | Increasing the System Socket Buffer Size Limit |
| D.2 | TCP Performance and Error Recovery |
| D.3 | TCP Performance and Round-Trip Measurement |
| D.4 | TCP Reliability and Sequence Numbers |
| E | Information for Token Ring Driver Developers |
| E.1 | Enabling Source Routing |
| E.2 | Using Canonical Addresses |
| E.3 | Avoiding Unaligned Access |
| E.4 | Setting Fields in the softc Structure of the Driver |
| F | The Data Link Interface |
| F.1 | Prerequisites for DLI Programming |
| F.2 | DLI Overview |
| F.2.1 | DLI Services |
| F.2.2 | Hardware Support |
| F.2.3 | Using DLI to Access the Local Area Network |
| F.2.4 | Including Higher-Level Services |
| F.3 | DLI Socket Address Data Structure |
| F.3.1 | Standard Frame Formats |
| F.3.2 | How the sockaddr_dl Structure Works |
| F.3.3 | Ethernet Substructure |
| F.3.3.1 | How Ethernet Frames Work |
| F.3.3.2 | Defining Ethernet Substructure Values |
| F.3.4 | 802.2 Substructure |
| F.3.4.1 | Defining 802 Substructure Values |
| F.4 | Writing DLI Programs |
| F.4.1 | Supplying Data Link Services |
| F.4.2 | Using Tru64 UNIX System Calls |
| F.4.3 | Creating a Socket |
| F.4.4 | Setting Socket Options |
| F.4.5 | Binding the Socket |
| F.4.6 | Filling in the sockaddr_dl Structure |
| F.4.6.1 | Specifying the Address Family |
| F.4.6.2 | Specifying the I/O Device ID |
| F.4.6.3 | Specifying the Substructure Type |
| F.4.7 | Calculating the Buffer Size |
| F.4.8 | Transferring Data |
| F.4.9 | Deactivating the Socket |
| F.5 | DLI Programming Examples |
| F.5.1 | Sample DLI Client Program Using Ethernet Format Packets |
| F.5.2 | Sample DLI Server Program Using Ethernet Format Packets |
| F.5.3 | Sample DLI Client Program Using 802.3 Format Packets |
| F.5.4 | Sample DLI Server Program Using 802.3 Format Packets |
| F.5.5 | Sample DLI Program Using getsockopt and setsockopt |
| Glossary |
| Examples |
| 5-1 | Sample Module |
| B-1 | Connection-Oriented Socket Server Program |
| B-2 | Connection-Oriented Socket Client Program |
| B-3 | Connection-Oriented XTI Server Program |
| B-4 | Connection-Oriented XTI Client Program |
| B-5 | Connectionless Socket Server Program |
| B-6 | Connectionless Socket Client Program |
| B-7 | Connectionless XTI Server Program |
| B-8 | Connectionless XTI Client Program |
| B-9 | The common.h Header File |
| B-10 | The server.h Header File |
| B-11 | The serverauth.c File |
| B-12 | The serverdb.c File |
| B-13 | The xtierror.c File |
| B-14 | The client.h File |
| B-15 | The clientauth.c File |
| B-16 | The clientdb.c File |
| C-1 | Client Stub Routine |
| C-2 | Server Stub Routine |
| C-3 | Client Stub Routine |
| C-4 | Server Stub Routine |
| F-1 | Filling the sockaddr_dl Structure for Ethernet |
| F-2 | Filling the sockaddr_dl Structure for 802.2 |
| Figures |
| 1-1 | Sockets and STREAMS Frameworks |
| 1-2 | XTI, STREAMS, and Sockets Interactions |
| 1-3 | Bridging STREAMS Drivers to Sockets Protocol Stacks |
| 1-4 | Bridging BSD Drivers to STREAMS Protocol Stacks |
| 1-5 | The Network Programming Environment |
| 2-1 | DLPI Interface |
| 2-2 | DLPI Service Interface |
| 2-3 | Identifying Components of a DLPI Address |
| 3-1 | X/Open Transport Interface |
| 3-2 | A Transport Endpoint |
| 3-3 | State Transitions for Connection-Oriented Transport Services |
| 3-4 | State Transitions for the Connectionless Transport Service |
| 4-1 | The Sockets Framework |
| 4-2 | Using AF_INET Socket for IPv4 Communications |
| 4-3 | Using AF_INET6 Socket for IPv6 Communications |
| 4-4 | Using AF_INET6 Socket for IPv4 Communications (Send) |
| 4-5 | Using AF_INET6 Socket for IPv4 Communications (Receive) |
| 4-6 | 4.3BSD and 4.4BSD sockaddr Structures |
| 4-7 | 4.3BSD, 4.4BSD, XNS4.0, and POSIX 1003.1g msghdr Structures |
| 5-1 | The STREAMS Framework |
| 5-2 | Example of a Stream |
| 8-1 | The ifnet STREAMS module |
| 8-2 | DLPI STREAMS Pseudodriver |
| E-1 | Typical Frame |
| F-1 | DLI and the Network Programming Environment |
| F-2 | The Ethernet Frame Format |
| F-3 | The 802.3 Frame Format |
| F-4 | The FDDI Frame Format |
| F-5 | The 802.2 Structures |
| Tables |
| 1-1 | Components of the Network Programming Environment |
| 2-1 | Supported DLPI Primitives |
| 3-1 | Header Files for XTI and TLI |
| 3-2 | XTI Library Calls |
| 3-3 | Asynchronous XTI Events |
| 3-4 | Asynchronous Events and Consuming Functions |
| 3-5 | XTI Functions that Return TLOOK |
| 3-6 | XTI States |
| 3-7 | Outgoing XTI Events |
| 3-8 | Incoming XTI Events |
| 3-9 | State Transitions for Initialization of Connection-Oriented or Connectionless Transport Services |
| 3-10 | State Transitions for Connectionless Transport Services |
| 3-11 | State Transitions for Connection-Oriented Transport Services: Part 1 |
| 3-12 | State Transitions for Connection-Oriented Transport Services: Part 2 |
| 3-13 | Phase-Independent Functions |
| 3-14 | Comparison of XTI and Socket Functions |
| 3-15 | Comparison of Socket and XTI Messages |
| 4-1 | Characteristics of the UNIX and Internet Communication Domains |
| 4-2 | Socket System Calls |
| 4-3 | Socket Library Calls |
| 4-4 | Header Files for the Socket Interface |
| 4-5 | Summary of Address Testing Macros |
| 4-6 | Common Errors and Diagnostics |
| 4-7 | Summary of IPv6 Extensions to the BSD Socket API |
| 4-8 | Name Changes |
| 4-9 | Differences Between IPv4 and IPv6 Raw Sockets |
| 4-10 | Summary of ICMPv6 Filtering Macros |
| 4-11 | Optional Information and Socket Options |
| 4-12 | Socket Calls for Routing Header |
| 4-13 | Socket Calls for Options Headers |
| 5-1 | I_STR and Transparent ioctl Processing Comparison |
| 5-2 | STREAMS Reference Pages |
| 7-1 | Client Library Services Routines |
| 7-2 | RAPI Formatting Routines |
| F-1 | Calling Sequence for DLI Programs |
| F-2 | Data Transfer System Calls Used with DLI |
| Index |