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    Sockets and STREAMS Interaction
1.6    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 Between XPG3 and XNS4.0
3.6.1    Major Differences
3.6.2    Source Code Migration
3.6.2.1    Use the Older Binaries of your Application
3.6.2.2    Unaltered Sources
3.6.2.3    XNS4.0 Compliant Application
3.6.3    Binary Compatibility
3.6.4    Packaging
3.6.5    Interoperability
3.6.6    Using XTI Options
3.6.6.1    Using XTI Options in XNS4.0
3.6.6.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    BSD Socket Interface
4.4.1    Variable-Length Network Addresses
4.4.2    Receiving Protocol Data with User Data
4.5    Common Socket Errors
4.6    Advanced Topics
4.6.1    Selecting Specific Protocols
4.6.2    Binding Names and Addresses
4.6.2.1    Binding to the Wildcard Address
4.6.2.2    Binding in the UNIX Domain
4.6.3    Out-of-Band Data
4.6.4    Internet Protocol Multicasting
4.6.4.1    Sending IP Multicast Datagrams
4.6.4.2    Receiving IP Multicast Datagrams
4.6.5    Broadcasting and Determining Network Configuration
4.6.6    The inetd Daemon
4.6.7    Input/Output Multiplexing
4.6.8    Interrupt Driven Socket I/O
4.6.9    Signals and Process Groups
4.6.10    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
 
9    AF_INET6 Sockets
9.1    IPv6 Addresses
9.1.1    Address Text Representation
9.1.2    Types of Addresses
9.1.2.1    Unicast Address
9.1.2.2    Multicast Address
9.1.3    Address Prefixes
9.2    Developing Applications to Use AF_INET6 Sockets
9.2.1    Using AF_INET6 Sockets
9.2.2    Making Name Changes
9.2.3    Making Structure Changes
9.2.3.1    in_addr Structure
9.2.3.2    sockaddr_in Structure
9.2.3.3    sockaddr Structure
9.2.4    Making Function Call Changes
9.2.4.1    gethostbyaddr Function Call
9.2.4.2    gethostbyname Function Call
9.2.5    Making Other Application Changes
9.2.5.1    Comparing IP Addresses
9.2.5.2    Comparing an IP Address to the Wildcard Address
9.2.5.3    Using int Data Types to Hold IP Addresses
9.2.5.4    Using Functions that Return IP Addresses
9.2.5.5    Changing Socket Options
9.3    Sample Client/Server Programs
9.3.1    Programs Using AF_INET Sockets
9.3.1.1    Client Program Using AF_INET Sockets
9.3.1.2    Server Program Using AF_INET Sockets
9.3.2    Programs Using AF_INET6 Sockets
9.3.2.1    Client Program Using AF_INET6 Sockets
9.3.2.2    Server Program Using AF_INET6 Sockets
9.3.3    Sample Program Output
 
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    TCP Specific Programming Information
C.1    TCP Throughput and Window Size
C.2    Programming the TCP Socket Buffer Sizes
C.3    TCP Window Scale Option
C.3.1    Increasing the Socket Buffer Size Limit
 
D    Information for Token Ring Driver Developers
D.1    Enabling Source Routing
D.2    Using Canonical Addresses
D.3    Avoiding Unaligned Access
D.4    Setting Fields in the softc Structure of the Driver
 
E    The Data Link Interface
E.1    Prerequisites for DLI Programming
E.2    DLI Overview
E.2.1    DLI Services
E.2.2    Hardware Support
E.2.3    Using DLI to Access the Local Area Network
E.2.4    Including Higher-Level Services
E.3    DLI Socket Address Data Structure
E.3.1    Standard Frame Formats
E.3.2    How the sockaddr_dl Structure Works
E.3.3    Ethernet Substructure
E.3.3.1    How Ethernet Frames Work
E.3.3.2    Defining Ethernet Substructure Values
E.3.4    802.2 Substructure
E.3.4.1    Defining 802 Substructure Values
E.4    Writing DLI Programs
E.4.1    Supplying Data Link Services
E.4.2    Using Tru64 UNIX System Calls
E.4.3    Creating a Socket
E.4.4    Setting Socket Options
E.4.5    Binding the Socket
E.4.6    Filling in the sockaddr_dl Structure
E.4.6.1    Specifying the Address Family
E.4.6.2    Specifying the I/O Device ID
E.4.6.3    Specifying the Substructure Type
E.4.7    Calculating the Buffer Size
E.4.8    Transferring Data
E.4.9    Deactivating the Socket
E.5    DLI Programming Examples
E.5.1    Sample DLI Client Program Using Ethernet Format Packets
E.5.2    Sample DLI Server Program Using Ethernet Format Packets
E.5.3    Sample DLI Client Program Using 802.3 Format Packets
E.5.4    Sample DLI Server Program Using 802.3 Format Packets
E.5.5    Sample DLI Program Using getsockopt and setsockopt
 
Glossary
 
Examples
5-1    Sample Module
9-1    Client Stub Routine
9-2    Server Stub Routine
9-3    Client Stub Routine
9-4    Server Stub Routine
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
E-1    Filling the sockaddr_dl Structure for Ethernet
E-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    4.3BSD and 4.4BSD sockaddr Structures
4-3    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
9-1    Using AF_INET Socket for IPv4 Communications
9-2    Using AF_INET6 Socket for IPv4 Communications
9-3    Using AF_INET6 Socket for IPv6 Communications
D-1    Typical Frame
E-1    DLI and the Network Programming Environment
E-2    The Ethernet Frame Format
E-3    The 802.3 Frame Format
E-4    The FDDI Frame Format
E-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    Common Errors and Diagnostics
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
9-1    Well-known Multicast Addresses
9-2    IPv6 Address Types and Prefixes
9-3    Name Changes
E-1    Calling Sequence for DLI Programs
E-2    Data Transfer System Calls Used with DLI
 
Index