mozdev.org

Protozilla   

Home | Download | Getting Started | Contact | White Paper | Examples | Documentation | Troubleshooting | Newsgroup | Mailing List | Source Code | Bugs | Screenshots

Protozilla: pipes, protocols, and P2P in Mozilla

(If you were directed to this page from a recent Slashdot discussion on Protozilla, you may want to check out a posting on the Protozilla newsgroup that addresses some of issues raised in that discussion.)

Protozilla is a browser add-on that makes it very easy to implement protocols in Mozilla (or Netscape 6.x). It is not a traditional browser plugin, but may be described as a "socket adapter", like the kind that you may carry around with your laptop when you travel internationally. With Protozilla, implementing a new protocol becomes as easy as typing a one line URL prefix, or dragging-and-dropping a file. Protozilla enables any CGI program or Unix/MSDOS command line program to instantly become a Mozilla "plugin" with little or no modification. These external programs, which may be written in any language, communicate with Mozilla through their standard input/output and the environment variables.

Before you begin to wonder why anyone would want to do this, here are some applications: interprocess communication, client-side CGI, protocol handlers, and peer-to-peer applications. (See the Examples and Documentation pages for more information on using Protozilla.)

Here is a brief technical overview of Protozilla: Mozilla communicates with the outside world using TCP sockets and multi-threaded asynchronous I/O. What Protozilla does is to execute an external program as a separate process, but makes it appear to Mozilla like a TCP socket. Protozilla communicates with the process using pipes and synchronous I/O, but uses asynchronous I/O to communicate with the rest of Mozilla. The core portion of Protozilla, which deals with pipes and IPC, is an XPCOM component written in C++. It provides an interface called nsIPipeTransport similar to the nsISocketTransport interface for sockets. The rest of Protozilla, dealing with protocols, is implemented as a Javascript component. (At present, the C++ portion of Protozilla has been tested on Unix/Linux and Windows platforms only.)

Of course, an out-of-process implementation of a protocol is not going to be as efficient as a multi-threaded, in-process implementation. But there is a trade-off between efficiency and ease of implementation. Protozilla is better suited for experimental protocol implementations, rather than for mature protocols. Out-of-process CGI execution is considered a *bad* thing on an HTTP server with a large number of users, but it is not as serious a performance issue on a client that is serving just one user. An out-of-process implementation does have one advantage though--if an experimental protocol implementation hangs or crashes, it will not drag the rest of the browser down with it!

For questions or comments about protozilla, please send a message to the protozilla mailing list.
Copyright © 2000-2008. All rights reserved. Terms of Use & Privacy Policy.