Briar: Source Code
We're currently working on a prototype of Briar. If you'd like to lend a hand or see what we're working on, you can browse the source code or clone the Git repository:git://briar.git.sourceforge.net/gitroot/briar/prototype
Projects
The repository contains four projects: briar-android, briar-api, briar-core and briar-tests. Each project can be built using Eclipse or Ant.The briar-android project contains the user interface for the Android version of Briar. To build this project you'll need the Android SDK.
The briar-api project contains the APIs of the various components that make up the Briar application. Each component has its own package within the net.sf.briar namespace. For example, the API of the database component is in the package net.sf.briar.api.db. All classes in this project are public in scope.
The briar-core project contains the implementations of the components. For example, the implementation of the database component is in the package net.sf.briar.db. Classes within each component can only depend on classes in the same component, and on the APIs of other components. To enforce this rule, most classes in the briar-core project are package-private. The utility classes in net.sf.briar.util are an exception - they may be used by any component, and may not depend on any component.
The libs directory contains the libraries Briar depends on. Libraries used by Briar must be compatible with Java 1.5 so they can be used on Android and J2SE.
The briar-tests project contains unit tests for each component. The tests use JUnit and jMock. You can run the tests from the command line by invoking ant test and ant test-slow. (The test-slow target contains a handful of heavyweight tests.)
Guice
Briar uses Guice for dependency injection. Instead of constructing its dependencies or calling static factory methods, each class receives its dependencies as constructor arguments (usually in the form of interfaces). This decouples classes from their dependencies so they can be tested separately.Components
Each component has its own packages within the briar-api and briar-core projects. For example, the database component's API is in net.sf.briar.api.db and its implementation is in net.sf.briar.db.crypto - This component uses JCE and Bouncy Castle. Most of the relevant code is in net.sf.briar.crypto.CryptoComponentImpl, or can be found by following call heirarchies from there.
db - This component uses JDBC and H2. You can get an idea of the database's structure by looking at net.sf.briar.db.JdbcDatabase. The high-level database API is described in net.sf.briar.api.db.DatabaseComponent.
lifecycle - This component will manage the lifecycle of the application (startup, shutdown, periodic tasks). Right now the only substantial code here is the shutdown manager, which ensures the JVM shuts down cleanly on Windows if the user logs out without shutting down the app.
messaging - This component contains the high-level messaging protocol, BMP.
plugins - This component is where transport plugins live. Currently there are four plugins: Bluetooth, removable drives, TCP and Tor.
serial - This component contains the serialisation library used by BMP.
transport - This component contains the low-level transport protocol, BTP.