I thought about this, and I came to the following conclusion about how I would do it.
The Freenet core should have an field that contains an object of the interface Protocol. The Protocol interface should contain something like the following methods (at least) : /** * Performs a key exchange or other initalization of a new connection * @param c The Connection to initialize * @return An object with information about this connection **/ public ConnectionInfo initialize(Connection c); /** * Creates a new RawMessage of an inputstream by reading this protocol. This * method locks until an entire message has been read (excluding trailing) * @param i The InputStream to read * @param ci An object containing information about the connection * @return A new RawMessage **/ public RawMessage newMessage(InputStream i, ConnectionInfo ci) throws IOException; /** * Creates a new RawMessage of a given type that uses this protocol * @param s The name of the message type * @param ci An object containing information about the connection **/ public RawMessage newMessage(String s, ConnectionInfo ci); The ConnectionInfo class would just need to be an empty abstract class, expanded by each implementation of Protocol. It would hold the BlockCipher object for example, so that a new one didn't have to be created for each message. Along with this would be making RawMessage an abstract class, with (at least) writeMessage and the InputStream constructor being abstract to be overwritten by protocol specific versions. It should be possible to use a completely different message based protocol by simply using a different implementation of Protocol that creates a different subclass of RawMesage. The Protocol class and the ConnectionInfo object would be given to the ConnectionHandler on creation so that it can use them to create new RawMessages on send and receive. This probably seems to clumsy and wrong to you, but hopefully you see what my goals are. I want to make the RawMessage pluggable so it can be replaced by something that writes and reads messages in a completely different format. I also want the Encryption to be easily exchangeable together with these new message formats. On Wed, 03 May 2000, Scott G. Miller wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > connections.. I'm probably going to back out my changes and try the > > RawMessage approach. We want to plug it in where it doesn't need to know > > anything at all about *anything* except the actual streams. Currently its > > having to sidestep around addresses, protocols, and connections, which > > makes me ill. > > As an addendum. Putting it in RawMessage is too close, since the > key-exchange needs to happen once, when the connection is forged. Where > should this go? > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.1 (GNU/Linux) > Comment: For info see http://www.gnupg.org > > iD8DBQE5EDDYpXyM95IyRhURAjTUAKCzSbyIKFmq2mhH2vlOJ0u6FqDyIwCg0Znh > RkA1nW5L7pkXe9Vo2PKmtYM= > =t1oi > -----END PGP SIGNATURE----- > > > _______________________________________________ > Freenet-dev mailing list > Freenet-dev at lists.sourceforge.net > http://lists.sourceforge.net/mailman/listinfo/freenet-dev -- Oskar Sandberg md98-osa at nada.kth.se #!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj $/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1 lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/) _______________________________________________ Freenet-dev mailing list Freenet-dev at lists.sourceforge.net http://lists.sourceforge.net/mailman/listinfo/freenet-dev
