Netlib "runs" within contexts (MWContext). A browser window is an example of a context. The contexts are consumers of data that netlib gives them, and they consume the data via streams. In order for a context to consume data, it must register itself with netlib as being the consumer for that data. Data is identified by it's content-type/mime-type association and contexts register functions (content converters) to handle (load, parse, render, etc.) given mime-types via a call to NET_RegisterContentTypeConverter(). There can be only one converter registered for a given content-type, per output format (FO_Present_Types). A content-type's converter is called when netlib encounters data of the given content-type and output format combination. The converter returns a NET_StreamClass struct which includes write/write-ready/abort/complete routines. During a url load netlib pushes data to the stream returned by the converter by calling it's write routine. If the url load is interrupted, the abort routine is called. Once the url load is complete, the converter's complete routine is called.
The stream returned by the converter is stored in the connection data of an active entry, and remains there until the load is interrupted or complete.
Here's how the browser registers itself to handle html files:
NET_RegisterContentTypeConverter (TEXT_HTML, FO_PRESENT, NULL, INTL_ConvCharCode);
TEXT_HTML - is a macro that expands to "text/html" (these
macros are defined in ns/include/net.h)
FO_PRESENT - is a macro that expands to a bit flag
to designate the output format (these macros are defined in ns/include/net.h)
INTL_ConvCharCode - is the content converter (a function
pointer)
Judson Valeski, 1998