Code associated with Thomas F. Herbert's "Implementing Network Protocols and Drivers with Streams" April 1997 on page 28 Listing 1 Multiplexing module declarations. #include static int mopen(queue_t *q, int dev, int flag, int sflag); static int mclose(queue_t *q); static int murput(queue_t *q, mblk_t *mp); static int mursrv(queue_t *q); static int muwput(queue_t *q, mblk_t *mp); static int muwsrv(queue_t *q); /* * The following 4 routines allow this module * to support lower multiplexing. */ static int mlrput(queue_t *q, mblk_t *mp); static int mlrsrv(queue_t *q); static int mlwput(queue_t *q, mblk_t *mp); static int mlwsrv(queue_t *q); /* * The module_info structure below consists of: * Mod ID, Name, Min Size, Max Size, Hi wat, Lo wat */ static struct module_info muinfo = { 0, ³mod², 0, INFPSZ, 1024, 256}; static struct qinit murinit = { /* upper read */ murput, mursrc, mopen, mclose, NULL, &muinfo, NULL }; static struct qinit muwinit = { /* upper write */ muwput, muwsrc, NULL, NULL, NULL, &muinfo, NULL }; /* * The following 2 structures are to support lower * multiplexing. */ static struct qinit mlrinit = { /* lower read */ mlrput, mlrsrc, NULL, NULL, NULL, &muinfo, NULL }; static struct qinit mlwinit = { /* lower write */ mlwput, mlwsrc, NULL, NULL, NULL, &muinfo, NULL }; /* The following declaration must be global */ struct streamtab minfo = { murinit; /* Upper read q */ mwinit; /* Upper write q*/ /* The next 2 queues are for multiplexing.*/ mlrinit; /* Lower read q */ mlwinit; /* Lower write q*/ }