Commit Graph

84 Commits

Author SHA1 Message Date
akwizgran
f9f41acde9 Added a connection registry to avoid creating redundant connections. 2011-12-09 17:34:58 +00:00
akwizgran
b7c3224618 Decouple the database from IO.
This will enable asynchronous access to the database for IO threads.
2011-12-07 00:23:35 +00:00
akwizgran
046becd388 Shutdown manager (untested on Windows). 2011-11-18 17:13:55 +00:00
akwizgran
f6ae4734ce Forward secrecy.
Each connection's keys are derived from a secret that is erased after
deriving the keys and the secret for the next connection.
2011-11-16 15:35:16 +00:00
akwizgran
d02a68edfc Return a connection context for outgoing connections (the secret will
be included in this context in the near future).
2011-11-15 17:47:30 +00:00
akwizgran
9220bb3426 Key derivation function based on NIST SP 800-108. 2011-11-15 17:19:11 +00:00
akwizgran
6a15c03e81 Store the incoming and outgoing secrets separately. 2011-11-15 16:07:14 +00:00
akwizgran
effa5c9d8e Throw checked exception if concurrent attempts are made to remove a
contact.
2011-11-15 09:51:51 +00:00
akwizgran
6fd8493d3d Singleton lists and singleton sets aren't equal, so use lists
consistently.
2011-11-15 09:42:21 +00:00
akwizgran
72be34768b Minor refactoring. 2011-11-14 22:14:52 +00:00
akwizgran
73aa7d14d7 Split transport identifiers into two: TransportId (globally unique)
and TransportIndex (locally unique).

This is the first step towards forward secrecy. Also removed the
Writable interface and unnecessary user-defined types, moved various
constants to ProtocolConstants and renamed some classes.
2011-11-14 21:40:05 +00:00
akwizgran
6d91603bf7 Moved MessageHeader into DB component and added read/starred flags. 2011-10-26 17:07:09 +01:00
akwizgran
94722a9f2a Broadcast an event when an author's rating changes. 2011-10-26 15:40:38 +01:00
akwizgran
097d11f471 Exposed getMessageHeaders() through DatabaseComponent interface. 2011-10-26 15:18:02 +01:00
akwizgran
f2d80825bc Separated the subject line from the message body. 2011-10-21 18:25:25 +01:00
akwizgran
c828db2e95 Don't send subscription or transport updates unless an update is due.
An update is due if the information has changed since the last update,
or if no update has been sent for 12 hours (to ensure that lost
updates are eventually replaced).
2011-10-19 16:34:58 +01:00
akwizgran
93cd31fa2d Simplify Database methods, move logic to DatabaseComponent. 2011-10-19 15:54:56 +01:00
akwizgran
c8b2cc38de Record when the transports and subscriptions visible to each contact
were last modified.

In future this will be used to determine when to send updates.
2011-10-18 17:32:32 +01:00
akwizgran
2f457162a5 Attach the affected contact IDs to subscription update events. 2011-10-17 23:24:23 +01:00
akwizgran
ec56b12384 Converted database events from an enum to classes to allow them to
carry data.
2011-10-17 22:47:38 +01:00
akwizgran
631f4e74b5 Nudge the database API in the direction of sanity. 2011-10-11 19:08:10 +01:00
akwizgran
a49a95347f Use dedicated classes for transport properties and configs. 2011-10-11 17:28:47 +01:00
akwizgran
68b82ae826 Retrieve all remote transports from the DB in a single call. 2011-10-10 22:35:46 +01:00
akwizgran
74ca71d9c1 Check for symlinks when deleting directories. Allow Database.open()
and close() to throw IOExceptions as well as DatabaseExceptions.
2011-10-03 18:35:18 +01:00
akwizgran
72b594d270 Type-safe transport IDs. 2011-09-30 12:52:29 +01:00
akwizgran
7190509ede Use numeric IDs rather than names to identify transports. 2011-09-29 15:40:09 +01:00
akwizgran
a40c081815 Record when the latest subscription/transport update was sent. 2011-09-26 18:13:48 +01:00
akwizgran
53b5a61ab3 Replaced Database.getParent() with getGroupMessageParent().
The new method checks whether the parent is present in the database
and belongs to the same group, so separate methods for those checks
have been removed.
2011-09-26 18:00:56 +01:00
akwizgran
124188a0a1 DatabaseComponent.setSeen() should call setStatusSeenIfVisible().
Otherwise an exception may be thrown if an offered message is no
longer in the DB.
2011-09-25 14:39:31 +01:00
akwizgran
98ab523092 Database refactoring to fix injection problems. 2011-09-23 18:52:56 +01:00
akwizgran
b470afb4ef Added DatabaseComponent.setSeen() for handling requests.
Also moved IO out of the lock in receiveOffer().
2011-09-23 16:06:14 +01:00
akwizgran
b675c38953 Don't do IO while holding database locks. 2011-09-23 12:55:23 +01:00
akwizgran
52f3b70c3f Added size-unlimited version of Database.getSendableMessages(). 2011-09-21 18:10:22 +01:00
akwizgran
95c3fb4fed Removed getCapacity() from BatchWriter interface. 2011-09-21 12:37:19 +01:00
akwizgran
3dd3742a96 Folded findLostBatches() into receiveAck(). 2011-09-19 18:45:19 +01:00
akwizgran
7aeb6029a6 Assertions and comments. 2011-09-19 16:42:27 +01:00
akwizgran
53f02f7a52 Fixed unit tests for database component. 2011-09-16 13:13:27 +01:00
akwizgran
5f05a7f898 Unit tests for private messages. 2011-09-16 11:33:55 +01:00
akwizgran
b78cfa6c88 More DB support for private messages - needs unit tests. 2011-09-13 15:40:33 +01:00
akwizgran
de5caca578 Basic database support for private messages. 2011-09-13 14:43:48 +01:00
akwizgran
1d25b5a92e Use null instead of MessageId.NONE and AuthorId.NONE, as for other
optional fields.
2011-09-13 14:04:23 +01:00
akwizgran
64548375cc Offer IDs no longer need to be calculated or echoed in requests.
The initiator flag in the transport protocol makes this unnecessary by
linking the two sides of a stream-mode connection, making it
impossible for an attacker to replay the responder's side of a
different connection.
2011-09-12 16:21:17 +01:00
akwizgran
5e0aadd373 Moved the subscription and transport timestamps out of the contacts
table so it's not necessary to hold a write lock on the (heavily used)
contacts table to update them.
2011-08-14 14:46:12 +02:00
akwizgran
2c13e35dc4 Calculate the timestamp outside the subscription/transport update
writer - this will allow it to be saved so new connections can work
out whether they should send updates.
2011-08-14 13:36:21 +02:00
akwizgran
c2b0f0ab5a Each request packet should contain the unique ID of the offer to which
it responds.
2011-08-13 17:46:19 +02:00
akwizgran
3edfa5d1ba Call the listeners when contacts are added and removed. 2011-08-11 15:55:30 +01:00
akwizgran
151a360587 Store shared secrets in the database (the crypto component will be
responsible for wrapping/unwrapping them).
2011-08-11 15:41:52 +01:00
akwizgran
07b34cfbab Added a lock for the connectionWindows table and exposed
getConnectionWindow() and setConnectionWindow() through the
DatabaseComponent interface.
2011-08-11 15:19:32 +01:00
akwizgran
c2045296eb Associate a timestamp with every subscription, indicating the earliest
acceptable timestamp of subscribed messages. For a new subscription,
the timestamp is initialised to the current time, so a new subscriber
to a group will not immediately receive any messages. (Subscribing to
a group is therefore more like joining a mailing list than joining a
Usenet group - you only receive messages written after you joined.)

Once the database fills up and starts expiring messages, the
timestamps of subscriptions are updated so that contacts need not send
messages that would expire immediately. This is done using the
*approximate* timestamp of the oldest message in the database, to
avoid revealing the presence or absence of any particular message.
2011-08-05 13:34:58 +01:00
akwizgran
5cb4075cfd Added the ability to store transport configuration details in the
database - unlike transport properties, these are not shared with
contacts. For example, when using email as a transport, the address
for sending and receiving emails would be a transport property, while
the username and password for the email server would be transport
configuration details. Transport plugins can update their
configuration details atomically.

Also clarified the terminology for transport and subscription updates.
2011-08-04 13:41:41 +01:00