Extended module framework to enable demanding data from upstream modules.

This commit is contained in:
Morten Rolland 1999-01-06 00:08:46 +00:00
parent 43330800f6
commit 9d4023b751
3 changed files with 26 additions and 2 deletions

View File

@ -27,6 +27,12 @@ typedef struct ifax_module {
*/
int (*handle_input)(struct ifax_module *self, void *data, size_t len);
/* This function is called to request data from the previous module
* in the chain. The resulting data is delivered by means of the
* 'handle_input' method.
*/
void (*handle_demand)(struct ifax_module *self, size_t len);
/* Use this to implement "commands" to modules like changing operating
* parameters "on-the-fly".
*/
@ -41,7 +47,13 @@ typedef struct ifax_module {
* Some modules (like replicate.c) have their own ideas about that.
*/
struct ifax_module *sendto;
/* We need a reverse chain as well, to be able to request data from
* from the previous module. The 'replicate' module and similar
* will have to know which chain to request data from.
*/
struct ifax_module *recvfrom;
} ifax_module;
/* A module instance is identified by that handle type.
@ -83,6 +95,10 @@ ifax_modp ifax_create_module(ifax_module_id what_kind,...);
*/
int ifax_handle_input(struct ifax_module *self,void *data,size_t len);
/* Request data from previous modules.
*/
void ifax_handle_demand(struct ifax_module *self, size_t len);
/* Send a command to a module. Semantics are defined by the module.
*/
int ifax_command(struct ifax_module *self, int command, ...);

View File

@ -10,4 +10,4 @@ isdnlib.a: $(LIBOBJS)
$(AR) rcs $@ $^
clean:
rm -f $(LIBOBJS) *~
rm -f $(LIBOBJS) isdnlib.a *~

View File

@ -100,6 +100,14 @@ int ifax_handle_input(struct ifax_module *self,void *data,size_t len)
return self->handle_input(self, data,len);
}
/* Request data from a module. Length is specified by the module,
* just like the 'handle_input' method.
*/
void ifax_handle_demand(struct ifax_module *self, size_t len)
{
self->handle_demand(self,len);
}
/* Send a command to a module. Note, that commands and data are defined
* by the module.
*/