routproc

The routproc function is a sample routing procedure. It must be supplied as part of the application. It is called by the DMOD with a message that may or may not be for this application; the DMOD calls routing procedures in turn until one accepts the message.

Win32

DWORD routproc(

    BUFHDR *msgptr,

    USHORT locl,

    USHORT retstat

   );


MS-DOS, Windows Version 3.x, and OS/2

USHORT FAR _loadds routproc(

    BUFHDR FAR *msgptr,

    USHORT locl,

    USHORT retstat

   );


Parameters

msgptr
Pointer to the message passed by the DMOD to the routing procedure.
locl
Locality from which message was received (if retstat indicates message returned), or locality to which path was lost (if retstat indicates path error).
retstat
Reason for call:

CEDINMSG (1)—message returned.

CEDINLLN (2)—path error (see Remarks below).

Return Values

TRUE
The routing procedure has accepted the message.
FALSE
The message is not for this routing procedure.

Remarks

The routing procedure should first call sbpurcvx, which handles any Open response messages, as follows:

sbpurcvx(&msgptr, locl, retstat)

A return code of TRUE from sbpurcvx indicates that sbpurcvx has accepted the message; an Open error response has been received for this application, and resource location is continuing. The routing procedure should not process the message any further and should return TRUE to prevent the DMOD from calling further routing procedures.

A return code of FALSE from sbpurcvx indicates that the routing procedure should:

If a path error is returned, msgptr will not point to a valid message, and no more FMI messages will be returned for the locality value indicated. The application is responsible for ending all sessions using this locality. The routing procedure must return FALSE; this ensures that the lost locality is reported to all other routing procedures.

If the message is for this application, the routing procedure can either process the message immediately or put the message on an application queue and then post the application using a semaphore. See Receiving Messages for more information.