Dbuzilla report

From CDOT Wiki
Jump to: navigation, search

Back to DBus Project Page

DBuzilla Report

By Mohamed Attar & Man Choi Kwan November 7th 2006

1.0 - The DBuzilla Project

The DBuzilla project by Christophe Nowicki was sponsered by Google in the summer of 2006. The goal of this project is to allow Mozilla components to communicate through D-Bus using XPCOM to allow better Linux Desktop integration. The source is provided under the MPL license.

The complete project outline is available at [1].

The Project Homepage can be found at [2].

The source can be found at [3] ,or can be download via svn at [4].

2.0 - Project Status

Mohamed Attar has tried to contact Christophe (late October) about the status on the DBuzilla project. As of now (November 7th, 2006) he has not received a reply. Mohamed has sent another email recently with a different recipient address in case spam filters blocked the message. He used Christophe's email form on his website. On the project's homepage, Christophe has posted several progress updates. The last on August 29th, 2006.

2.1 - Excerpts from last update posting:

"...Here is my current progress on that project :

  • Signals are supported, you can send en receive signals
  • Introspection XML data is now parsed by my component
  • I’ve wrote an dbus-viewer clone in XUL
  • I’ve integrated Threads

...But I did not release a 0.1 version because my wrapper produce a dead lock... I continue to work on my project (after the end of the summer of code) and I will release version 0.1 as soon as the dead lock issue is solved." (C. Nowicki, Project homepage as of November 7th 2006)

2.2 - Last specification update:

Client side:

  • method call (synchronous and asynchronous)
  • marshaling (from XPCOM to D-BUS and from D-BUS to XPCOM)
  • error handling via an exception system
  • send and receive signals

Server side:

  • introspection
  • remote interface

3.0 - Source Code Analysis

3.1 - File Breakdown

The following is a general description and comment of each source code file.

File: nsDBusConnectionLoop (h/cpp)

Description: This file includes an IRunnable class to maintain DBus connection threads.

Comments: Most of the code is commented out. Looks as if the author was using the glib library, and is switching to native. Most the functionality doesn't work (commented out). No documentation!!!


File: nsDBusInterface (h/cpp)

Description: This file inherits a IDL interface (nsIDBusInterface) which uses nsISupports. This code implements several DBus features to call, get, and list DBus methods (as well as some other things).

Comments: This file seems very messy. I found some code that say TODO, but seem implemented in other files. Some code in this file shouldn't belong, but I might be wrong. No documentation!!!


File: nsDBusMessage (h/cpp)

Description: This file seems to handle (un)marshallings, type signatures, and conversions (such as toVariant) of a DBus Message. It implements a IDL interface (nsIDBusMessage) which uses nsISupports.

Comments: Several features are TODO (DBus_Message_Type_Method_Return and DBus_Message_Type_Error). This file has a lot of conversions. Documentation would be helpful. The author mentions several "Fix Me" comments in his code. Needs some cleaning up and fixing.


File: nsDBusThreads (h/cpp)

Description: This file provides several methods to manipulate a mutex (mutal exclusion object). It uses several low level dbus functions with some NSPR libraries (prlock.h and prcvar.h).

Comments: This code seems to be global (no classes). Author mentions memory leaks. File is unclear. According to postings, the author seemed to have trouble around this section. No documentation.


File: nsDBusXMLParser (h/cpp)

Description: This file contains a parser to strip the dbus data from an xml file using the Mozilla DOM Parser. Also has methods to display the data.

Comments: Seems like some good code.


File: nsDBus (h/cpp)

Description: This object set up session connections, handle signals between dbus and mozilla, and check for authentication.

Comments: Commented out all the thread codes on this file. The author has FIX ME and TO DO for threads and check for services. No documentation.


File: nsDBusArgument (cpp/h)

Description: this object sets and gets the dbus message argument type and name.

Comments: No documentation, but the codes are easy to read.


File: nsDBusMethod (cpp/h)

Description: this object sets up the dbus message method calls by sets and gets the method name and input/output arguments.

Comments: No documentation. The author comment out a for loop in one of the function.


File: nsDBusSignal (cpp/h)

Description: this file has functions to gets the signals identifier and handle the dbus signal hook.

Comments: Codes are clean and easy to read, no documentation.


File: nsDBusError (cpp/h)

Description: this object handles errors with exception, error reporting.

Comments: has some commented out codes. No documentation.


File: nsDBusModule (cpp/h)

Description: this object creates modules that support nsIClassInfo.

Comments: this is the only file that has documentation for the codes. The codes are clear and easy to read.

3.2 - Overall Analysis

The code is barely documented. There seems to be several locations where the code is not complete or needs to be fixed. I do not believe security was considered in the design. There is an authentication protocol in the DBus specification that seems to be missing. The current code seems to give some communication between XPCOM and DBus code, but more implementation needs to be done and some supporting classes should exist for stability. Threading needs more work.

Overall, what exists supplies the fundamental DBus communication which is a lot of work. This project is big and complex, and the author has done a good job (Mohamed's opinion). There is a lot of work that needs to be done, and definitely more testing. Some security issues should be investigated after the fundamentals are stable for use. The API has been frozen for DBus 1.0 as of July 17. This DBuzilla project seems to be started mid-late March, so the code might not be up to specification.

4.0 - The New Project Proposal

Man Choi Kwan and Mohamed Attar propose to continue the work on DBuzilla. This project will take longer than the rest of the semester, but if approved Mohamed is willing to continue this project and possibly Man Choi Kwan. We will encourage others to support the development, testing, and documentation of DBuzilla.

4.1 - What is required:

  • Understanding Mozilla's requirements for DBus Integration
  • Finish and improve the code that exists
  • Test current DBuzilla code
  • Document all the source code
  • Update design and code skeleton to new specification
  • Complete and update message protocol and various data type handlers with current DBus version
  • Improve DBus message and interface code
  • Improve threading and connection management
  • Clean up various bugs and TODOs
  • Improve logging and error handling
  • Update the code to meet the specification
  • Data Transport for Sockets and Unix
  • Data Transport Objects
  • Unix Internals
  • Internal System-Dependant API (Unix and Windows)
  • Authentication protocol
  • Session and System bus
  • Custom Application to Application bus
  • etc.... <-- comparing against new specification
  • Update the design to meet security requirements
  • DBus security specification
  • Mozilla security requirements
  • Implement the security design
  • Allow extension specific security options (User customizes extension's access)
  • Allow generic security options (User customizes all external communicate access)

4.2 - How to get there:

  1. Document and analyze the current code
  2. Get some running code sending and receiving messages
  3. Update the working code to specification (DBus, Message, Connection, etc...)
  4. Improve and update fundamental classes (Interface, Method, Signal, Thread, etc...)
  5. Build architectural classes (Thread Manager, Connection Manager, etc...)
  6. Code missing specification features

4.3 - Important Practices:

  • Documentation
  • Consistent Coding Conventions
  • Early Releases

4.4 - Expectations and Time line

Considering both Man and Mohamed are enrolled as full time students and both have part time jobs, we must be realistic in our first deliverable.

We expect by the end of semester 7 (December 2006) we plan:

  • to be comfortable with the related Mozilla and DBus technologies (learning curve)
  • produce some research examples of DBus code interacting with Mozilla
  • document (and possibly extract) important DBuzilla code
  • have some basic DBuzilla functionality running with current version of DBus
  • write a tutorial for people interested in joining the project

For next semester (January - April 2007) we plan:

  • to reuse, improve, and update on the fundamental classes in DBuzilla
  • try to build some architectural classes and continue implementing specification
  • design security requirements
  • implement security design

The time after this point is too far to predict.