Cover image for Zero Configuration Networking: The Definitive Guide

Book description

It used to be that two laptops, sitting side by side, couldn't communicate with each other; they may as well have been a thousand miles apart. But that was then, before the advent of Zero Configuration Networking technology. This amazing cross-platform open source technology automatically connects electronic devices on a network, allowing them to interoperate seamlessly-without any user configuration. So now you don't have to lift a finger! Needless to say, it has completely changed the way people connect to devices and programs for printing, file sharing, and other activities.

Zero Configuration Networking: The Definitive Guide walks you through this groundbreaking network technology, with a complete description of the protocols and ways to implement network-aware applications and devices.

Written by two Zero Configuration Networking experts, including one of Apple's own computer scientists, the book covers more than just file sharing and printing. Zero Configuration Networking also enables activities such as music and photo sharing and automatic buddy discovery on Instant Messaging applications. In fact, Zero Configuration Networking can be used for virtually any device that can be controlled by a computer. And this handy guide has the inside scoop on all of its capabilities-and how you can easily apply them in your own environment.

For the technically advanced, Zero Configuration Networking: The Definitive Guide examines the three core technologies that make up Zero Configuration Networking: Link-Local Addressing, Multicast DNS, and DNS Service Discovery. It also reviews a series of APIs, including C-API, Java API, CFNetServices, and Cocoa's NSNetServices.

Whether you want to understand how iTunes works, or you want to network a series of laptops and other devices at your office for maximum efficiency, you'll find all the answers in this authoritative guide.

Table of Contents

  1. Zero Configuration Networking: The Definitive Guide
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. A Note Regarding Supplemental Files
    3. Praise for Zero Configuration Networking: The Definitive Guide
    4. Foreword
    5. Preface
      1. Audience for This Book
      2. The Zeroconf Technology
      3. The Zeroconf DNS Service Discovery APIs
      4. Conventions Used in This Book
      5. Using Code Examples
      6. Comments and Questions
      7. Safari Enabled
      8. Acknowledgments
        1. Stuart Cheshire
        2. Daniel H. Steinberg
    6. 1. Introduction to Bonjour and Zeroconf
      1. Service Discovery with Zeroconf
        1. Service Discovery
          1. Browse for services
          2. Available services
          3. Easy browsing
        2. Names and Addresses
          1. Claiming an IP address
          2. Claiming a name
      2. Replacing the AppleTalk Name Binding Protocol
        1. Name Services, Not Hardware
        2. Late Binding
        3. Finding Named Services
        4. Ease of Use
      3. Summary
    7. 2. IP Addresses Without DHCP
      1. Obtaining an IP Address
        1. Manual Assignment
          1. Entering an IP address
          2. Choosing an IP address
        2. Using DHCP
          1. DHCP-provided address
          2. DHCP with manual addresses
        3. Zeroconf Selection of IP Address
          1. Link-local range
          2. Choosing a link-local address
      2. Claiming a Link-Local IP Address
        1. Probing for Address Availability
          1. Address Resolution Protocol
          2. How to probe
          3. Results of probing
          4. When to probe
        2. Announcing
          1. Announcing your address
        3. Defending Your Address
        4. Late Conflicts and Misbehaving Peers
      3. Summary
    8. 3. Names Without DNS
      1. A Brief Tour of DNS
        1. The Namespace
        2. Administration of DNS
        3. Resolving Names
      2. The Zeroconf Namespace
        1. The local Domain
        2. Choosing a Name
      3. Multicast DNS
        1. The mDNS Multicast Address
        2. Multicast DNS Queries
          1. Reducing traffic
      4. Claiming Your Local Name
        1. Probing to Check for Uniqueness
        2. Announcing
      5. The Structure of the Multicast DNS Message
      6. Summary
    9. 4. Browsing for Services
      1. Zero Configuration Operation
      2. Finding Services, Not Devices
      3. Knowing the Protocol
      4. Building on DNS
        1. Browsing for Services
        2. Service Instance Names
        3. What You See Is What You Get
        4. Flagship Service Types
        5. Subtypes of Service Types
      5. Late Binding
      6. DNS-SD TXT Records
        1. Format for DNS TXT Records
        2. Content of DNS-SD TXT Records
        3. Interpreting DNS-SD TXT Records
      7. Summary
    10. 5. Service Discovery Beyond the Local Link
      1. Domain Enumeration
      2. Advertising Static Services
      3. Wide-Area Preference Settings
        1. Hostname
        2. Registration
        3. Browsing
      4. Dynamic DNS Updates
        1. Dynamic DNS Update Leases (DNS-UL)
          1. Changes to the message format
          2. Refresh messages
      5. DNS Long-Lived Queries (DNS-LLQ)
        1. LLQ Message Format
        2. LLQ Setup Four-way Handshake
          1. Step 1: initial request
          2. Step 2: challenge
          3. Step 3: challenge response
          4. Step 4: ACK and answers
        3. Refreshes and Expiration
        4. Event Responses
        5. Identifying Whether the Local DNS Cache Supports LLQ
      6. NAT Port Mapping Protocol (NAT-PMP)
        1. Network Address Translation
        2. Obtaining the Public Address
        3. Creating and Destroying a Mapping
      7. Summary
    11. 6. Getting Started with Bonjour/Zeroconf
      1. Working with Bonjour/Zeroconf
        1. Installing Bonjour
          1. Macintosh
          2. Windows
          3. Linux/Unix
          4. Other platforms
        2. Understanding Zeroconf
      2. The Command-Line Tool
        1. Browsing
        2. Registering (Advertising) a Service
        3. Resolving
        4. Proxying
        5. Monitoring
      3. Summary
    12. 7. Using the C APIs
      1. Asynchronous Programming Model
      2. Event Handling with a select() Loop
        1. Event Callbacks
        2. Accessing the Underlying Unix Domain Sockets
          1. DNSServiceRefSockFD()
          2. DNSServiceProcessResult()
          3. DNS Service Discovery error codes
          4. DNSServiceRefDeallocate()
      3. Using the DNSServiceDiscovery APIs
        1. Browsing for Services
          1. DNSServiceBrowse()
          2. DNSServiceBrowseReply()
          3. DNSServiceDiscovery flags
          4. Browsing example
        2. Resolving a Service
          1. DNSServiceResolve
          2. DNSServiceResolveReply
          3. Resolution example
        3. Registering a Service
          1. DNSServiceRegister
          2. DNSServiceRegisterReply
          3. DNSServiceAddRecord
          4. DNSServiceUpdateRecord
          5. DNSServiceRemoveRecord
          6. Registration example
        4. Enumerating Domains
          1. DNSServiceEnumerateDomain
          2. DNSServiceDomainEnumReply
          3. Enumeration example
        5. Other Operations
      4. Event Handling with Cocoa RunLoop or Core Foundation CFRunLoop
      5. Event Handling with Microsoft Windows GetMessage() Message Loop
      6. Event Handling with Microsoft Windows MFC
      7. Event Handling with Independent Threads
      8. Summary
    13. 8. Using the Java APIs
      1. Understanding the APIs
        1. The DNSSD Class
        2. The Listener Interfaces
          1. BaseListener
        3. DNSSDException
      2. Using the APIs
        1. Registering a Service
          1. The DNSSD.register() call
          2. The RegisterListener
          3. Complete TestRegister program listing
          4. Testing the registration program
        2. Browsing for Services
        3. Resolving a Service
        4. Registering a Service with DNS TXT Record Attributes
        5. Adding, Updating, and Removing Additional Records
      3. An Extended Example: Tic-Tac-Toe
    14. 9. Using the CFNetwork and Cocoa APIs
      1. Using the CFNetServices API
        1. Advertising a Service in CFNetServices
        2. Browsing in CFNetServices
        3. Resolving in CFNetServices
      2. Using the NSNetServices API in Cocoa
        1. Advertising a Service in Cocoa
        2. Browsing in Cocoa
        3. Resolving in Cocoa
      3. A Cocoa Bonjour Extended Example
        1. Creating the GUI
        2. The Generated MoodBeacon and MoodBrowser Header Files
        3. Advertising the Service with MoodBeacon
        4. Finding and Using the Service with MoodBrowser
    15. 10. Ruby, Python, and Other Languages
      1. Ruby
        1. Registering a Service in Ruby
        2. Browsing for Services in Ruby
        3. Resolving a Service in Ruby
      2. Python
        1. Registering a Service in Python
        2. Browsing for Services in Python
        3. Resolving a Service in Python
      3. Embedded Responders
    16. Index
    17. About the Authors
    18. Colophon
    19. SPECIAL OFFER: Upgrade this ebook with O’Reilly