croczilla.com 
 home   zap   svg   xtf   jssh   bits&pieces   blog   personal   
  home > zap > Zap Sourcecode Documentation

Zap Sourcecode Documentation

Overview

The zap source code consists of a number of components which integrate into the Mozilla build to form a custom version of XULRunner, xulrunner-zapi. Graphical client applications, such as the Zap SIP client or the Zap Sandbox are built on top of xulrunner-zapi.

xulrunner-zapi.png

The zap modules are loosly organized into layers. At the bottom, base provides shared utility code, such as a JavaScript class framework and facilities for asynchronous code execution.

On the next layer, the netutils module implements basic networking facilities not provided natively by Mozilla, such as UDP socket support and advanced DNS queries (SRV/NAPTR). The STUN module implements NAT-traversal mechanisms (STUN, TURN, ICE, draft-ietf-behave-rfc3489bis-18, draft-ietf-mmusic-ice-19). ZMK, the Zap Media Kit, provides a framework for dataflow-oriented media processing.

The next layer up provides support for the higher level protocols. The SIP module contains an implementation of the Session Initiation Protocol (RFC3261 and many others). The SDP module implements the Session Description Protocol (RFC4566), media negotiation protocols (RFC3264) and the media session logic.

At the top level, the zappshell, or Zap Application Shell, provides shell-like access to the lower level APIs. The idea is that user-level applications communicate to the Zap APIs only through the zappshell. (Note: This component is still under development and not checked into Mercurial yet).

Locating the code

For an overview of the Mozilla sourcecode directory structure please see here.

Most of the zap code is located under the directory 'zap/' in the zap-central sources. (Please refer to the build documentation for information on how to clone the repository.)

There are also a number of patches into the Mozilla source code. Most of these are tracked in bugzilla on bug #317491. Those patches not tracked on this bug are enclosed by "#ifdef MOZ_ZAP" / "#endif" pairs, so can easily be located using grep.

Doxygen-generated documentation

We periodically generate documentation of the ZAP APIs using doxygen. Please see here. (Note: this is currently out-of-date, pending integration into our buildbot cluster.)


base module

Common shared (mostly JS) utility code.

Note

To be expanded.


STUN module

NAT traversal facilities: STUN, TURN , ICE (draft-ietf-behave-rfc3489bis-18, draft-ietf-mmusic-ice-19).

Note

To be expanded.


netutils module

  • UDP socket support
  • SRV/NAPTR DNS queries

Note

To be expanded.


The Zap Media Kit (ZMK)

The ZMK is a media processing framework featuring a "mediagraph" component which runs with its own thread and event queue and manages a set of media processing nodes and the data connections between them.

Some features include:

  • new node classes (codecs, filters, etc) can be implemented as xpcom plugins by implementing the zapIMediaNode interface.
  • nodes can be composed to form larger nodes.
  • the media graph itself is media-type agnostic. Data packets moved between nodes implement the zapIMediaFrame interface.
  • the media graph only handles media dataflow, control protocols are implemented externally.
  • the media graph can be dynamically reconfigured at any time (by adding/removing nodes and/or connections).
  • both 'push' and 'pull' dataflow. Sinks and sources can be 'active', 'passive' or 'neutral'.
  • control interfaces for media nodes (e.g. for changing codec parameters or for UI feedback) are proxied onto the media thread using the xpcom proxy mechanism.
  • built-in media node types include: audioin, audioout, rtp-session, speex-encoder, speex-decoder, speex-rtp-packetizer, speex-rtp-depacketizer, buffer, udp-socket, udp-socket-pair.

See also slides 11ff of this FOSDEM presentation.

ZMK in doxygen

See here for the ZMK module doxygen documentation.


SIP module

Implementation of the Session Initiation Protocol. Further split into submodules:

  • syntax layer
  • transport layer
  • transaction layer
  • UA layer

Note

To be expanded.


SDP module

Implements the Session Description Protocol (RFC4566), media negotiation protocol (RFC3264) and the media session logic.

Note

To be expanded.


The Zap Application Shell

Note

Documentation still to be written. This module is not checked into Mercurial yet.


Zap SIP client

Zap SIP client application chrome.

Note

Documentation still to be written.