DMNETREGISTER(3dm)DMNETREGISTER(3dm)NAME
dmNetRegisterPool, dmNetRegisterBuffer - register memory with dmNet
SYNOPSIS
#include <dmedia/dmnet.h>
DMstatus dmNetRegisterPool(DMnetconnection, DMbufferpool);
DMstatus dmNetRegisterBuffer(DMnetconnection);
DESCRIPTION
dmNetRegisterPool and dmNetRegisterBuffer are the suite of dmNet memory
registration calls, relevant only to the receiver process. One of these
two calls must be made before a call to dmNetRecv is made, or dmNetRecv
will fail with ENOMEM.
dmNetRegisterPool allows an application to specify a buffer pool from
which dmNetRecv may allocate memory for incoming DMbuffers. The buffer
must be returned to the pool with a call to dmBufferFree after the
application is done with it, or dmNetRecv may fail with ENOMEM when no
buffers remain in the pool.
It is also possible to pre-allocate buffers for dmNetRecv to use, in
which case dmNetRegisterBuffer must be called. dmNetRegisterBuffer does
not register a particular buffer, but indicates to dmNet that the
DMbuffer reference passed to dmNetRecv is valid.
Each registration call has the effect of cancelling all previous
registrations, i.e, only the last invocation of
dmNetRegisterPool/dmNetRegisterBuffer will be remembered by dmNet.
EXAMPLE
This is a contrived example to illustrate how multiple memory
registration calls may be made. 3 buffers are received, the first into
pool1, and the others into pool2.
DMbuffer dmbuf[3];
dmNetRegisterPool(cnp, pool1);
dmNetRecv(cnp, &dmbuf[0]);
dmNetRegisterPool(cnp, pool2);
dmNetRecv(cnp, &dmbuf[1]);
dmNetRegisterBuffer(cnp);
dmBufferAllocate(pool2, &dmbuf[2]);
dmNetRecv(cnp, &dmbuf[2]);
dmNetRegisterPool(cnp, pool1);
etc.
SEE ALSOdmNetRecv(3dm)
Page 1