MgslDlWait


Prototype
ULONG MgslDlWait( HANDLE hDevice,
                  MGSL_DLPRIMITIVE* Primitive,
                  LPOVERLAPPED pOverlapped );
Parameters
hDevice
Handle to open port
Primitive
Pointer to MGSL_DLPRIMITIVE structure to hold returned confirm or indication primitive.
pOverlapped
Pointer to overlapped structure initialized with a WIN32 manual reset event object which will be signaled when the receive operation completes
Return Value
ERROR_SUCCESS
An INDICATION or CONFIRM primitive has been returned
ERROR_INVALID_HANDLE
hDevice or Link field of Primitive is invalid
ERROR_INVALID_PARAMETER
The Primitive or pOverlapped parameters are invalid.
ERROR_BUSY
a request of this type is already pending for the specified device
ERROR_IO_PENDING
An INDICATION or CONFIRM primitive is not immediately available. The WIN32 event object in the overlapped structure will be signaled when a primitive is available.

Wait for and return the next available CONFIRM or INDICATION primitive. The returned primitive can be associated with any link instance allocated for the specified device. Only one call to MgslDlWait may be pending for a device. Calling MgslDlWait while a previous call to this function is pending for the same device results in the return code ERROR_BUSY.

Before making this call, the application must initialize the Size member of the primitive structure to the total size in bytes of the Buffer member. The contents of other structure members are ignored. The application must also allocate an overlapped structure that is initialized with an application allocated WIN32 manual reset event.

If an error code other than ERROR_SUCCESS and ERROR_IO_PENDING is returned, no primitive is returned in the primitive structure.

If a primitive is immediately available, ERROR_SUCCESS is returned. Otherwise ERROR_IO_PENDING is returned. When a primitive becomes available, the API fills in the primitive structure and signals the WIN32 event object contained in the overlapped structure.

The memory allocated for the primitive structure must remain valid until after the function returns a code other than ERROR_IO_PENDING or the event is signaled.

If the next available primitive contains more data than can fit in the Buffer member of the primitive structure, then the Type member is set to DLERROR_INSUFFICIENT_BUFFER. A larger buffer must be allocated, and MgslDlWait called again to retrieve the primitive.

If a pending MgslDlWait call is cancelled with the MgslDlCancelWait call, then the Type member is set to DLERROR_CANCELLED and no primitive is returned.

When MgslDlWait returns a CONFIRM or INDICATION primitive, the Link member is set to the link instance identifier for which the primitive is associated. The Type field identifies the primitive type. The Flags, Size, and Buffer members may contain additional, primitive specific information. If the Flags field is unused, it will be set to 0. If the Buffer member is unused or empty, Size will be set to zero.


Previous Contents Next