Extension
Interoperability
Introduction
Why is it that extensions using common functionality must each
implement that functionality individually? Why all of the
redundant code? There are some times when it would nice if one
extension could simply make use of some functionality in a
different extension. Wouldn't that be nice? I'm not sure how much
redundant code exists in the Click extension community, but I
know that I personally have had to replicate Blowfish encryption
in three objects. Why not just have the Blowfish object expose
the algorithms to the other two objects and to all extensions in
general? (See also: A Proposal for
Encryption Objects)
The Problems
It's pretty clear why extension interoperability would be
nice, but what are the drawbacks?
- An extension that requires four other extensions to work
properly (and each of those four may require some more
extensions) would be a burden to the user.
- Extension developers would need to be convinced to expose
functionality, so doing it would need to be simple.
- Exposed functionality would need to be simple to use.
The Rules
In order to make this work, developers will need to adhere to
some basic rules.
- An extensions should never require the
functionality of another extension. Instead, extra functionality
of an extension may require the functionality of another
extension. For example, a data storing object that uses
the Blowfish object to save encrypted files. By no means
if the Blowfish object required to use the data storing
object, but if it is present, the data storing object can
then use it to save encrypted files.
- The method for exposing general functionality needs to be
uniform (exposing specific functionality may have its own
standards).
- Since exposed functionality will be in the form of
pointers, developers will need to verify that the user
actually sent correct interop information.
The InteropInfo Structure
- unsigned int anHeader[2]: An 8-byte header used to ensure
that an InteropInfo structure was passed.
- unsigned int nIndetifier: The 4-byte identifier of the
extension (same one used by MMF).
- unsigned char nVersion: The version of the extension's
InteropInfo structure.
- void apfunFunctions: An array of pointers to functions
exposed by the extension. Documentation will be required
to know the function prototypes.