|
RE: .0
> The Management Module Programming manual says on page C-11:
>
> "Note: May want to alloc new 'temp_outp' (size=size 2)
> if you ever get ILVTOOBIG - and then re-execute this
> module (i = 1)"
I have found the section in the Management Module Programming
guide (page C-11) which you commented on, and it will be fixed
for the v1.2 release.
> The toolkit routine MCC_DESFRAME_SET_CVR_AND_REPLY returns a
> condition value of MCC_S_ILVTOOBIG when trying to build an
> Out_P with about 200 Attributes (it works ok up to some 50
> attributes).
The workaround for an MCC_S_ILVTOOBIG status from the
"mcc_desframe_set_cvr_and_reply" routine requires changes to:
o the "end_directive" routine which calls the
"mcc_desframe_set_cvr_and_reply" routine
o the "init_handle_more" routine
Sorry for the inconvenience and thank you for pointing out the
problem with the documentation.
If you have any problems with this workaround, please let me know.
Thanks,
Keith Roberts
DECmcc Toolkit Team
>>> end_directive ---------------------------------------------------
Add following the call to "mcc_desframe_set_cvr_and_reply":
/*
* ---------------- Process ILVTOOBIG error status ---------------------
*
* If ILV has returned the MCC_S_ILVTOOBIG error status, then Out-P isn't
* big enough for the reply we're trying to construct. In this case:
*
* o We'll ask for twice as much space (curlen = maxstrlen * 2)
* o Set the the 'more_data' flag to TRUE (to save the call context)
* o and return the MCC_S_INSUF_BUF status.
*
* The caller should reallocate the Out-P buffer with the buffer byte
* count we specified in 'curlen' - then call us back. The directive
* Init-handle-more code will detect the last-status of MCC_S_INSUF_BUF
* thereby calling mcc_desframe_set_cvr_and_reply again.
*
* Hopefully this time the buffer will be big enough.
*/
if (status == MCC_S_ILVTOOBIG) {
p_callargs->p_out_p->mcc_w_curlen = p_callargs->p_out_p->mcc_w_maxstrlen * 2;
(*p_context)->flags.more_data = TRUE;
status = MCC_S_INSUF_BUF;
}
>>> init_handle_more ------------------------------------------------
Replace your "init_handle_more" routine with the following:
/************************************************************************
* *
* init_handle_more TEMPLATE FOR A DIRECTIVE *
* *
************************************************************************
* *
* FUNCTIONAL DESCRIPTION: *
* *
* This routine is called during module initialization: MORE *
* *
* This module has been previously (one or more times) called. The *
* Local Context Block address must be extracted from the Call *
* Handle argument. The address was put into the Handle when *
* the MM returned the last time (with a state of 'more') *
* *
* To comply with the DECmcc Call Interface and Design Framework, *
* certain operations must be performed during this time: *
* *
* o Get the Local Context Block address *
* o Re-initialize Local Context block fields *
* - Set the More-loop flag to TRUE *
* - Set the More-data flag to FALSE *
* o If the 'last-status' wasn't INSUF_BUF *
* - Set the Reply-index to 0 *
* *
* Any steps needed by your MM can then be executed - Don't forget *
* to test 'status' for Normal *
* *
* FORMAL PARAMETERS: *
* Inputs *
* p_callargs, p_context *
* *
* Outputs *
* p_callargs, p_context *
* *
* IMPLICIT PARAMETERS: *
* Inputs *
* none *
* *
* Outputs *
* none *
* *
* RETURN VALUES: *
* *
* MCC_S_NORMAL Initialization completed sucessfully *
* MCC_S_INV_HANDLE Problem with the Call Handle *
* any other MCC status value *
* *
************************************************************************/
static MCC_T_CVR init_handle_more (p_callargs, p_context)
dt_callargs *p_callargs;
dt__LocalContext **p_context;
{
MCC_T_CVR status = MCC_S_NORMAL;
/*
* ----------------------- Generic processing --------------------------
*
* Get the Local Context Block address from the Handle
*/
status = mcc_ahs_get_context(
p_callargs->p_handle,
p_context );
if ((status != MCC_S_NORMAL) || (*p_context == MCC_K_NULL_PTR))
status = MCC_S_INV_HANDLE;
/*
* Re-initialize Local Context fields
* o We are in a 'more loop'
* o The call hasn't resulted in 'more data' (yet)
*/
if (status == MCC_S_NORMAL) {
(*p_context)->flags.more_loop = TRUE;
(*p_context)->flags.more_data = FALSE;
}
/*
* ------------------ Your initialization goes here --------------------
*
* Place your own MM initialization code here. Do not forget to test
* for a Normal 'status' before executing any code !!!
*
* if (status == MCC_S_NORMAL) {
* :
* :
* }
*/
/*
* ------------------- Process INSUF_BUF status ------------------------
*
* Continue re-initializing the Local Context Block
* o Set the Reply-index to undefined ...
*
* ... If the 'last-status' (status returned from the previous
* call) was *not* INSUF_BUF - then the 'reply-index' can
* be set to undefined and a Normal status returned.
*
* If the 'last-status' *was* INSUF_BUF, then we want to
* return that status, skipping the 'do-directive' code and going
* directly to 'end-directive'.
*
* The INSUF_BUF status indicates that the previous call
* could not complete because the Callers Out-P buffer was too
* small - by now, they should have increased the buffer size,
* and we can proceed to building Out-P again. Leaving the
* Reply-index value as it was set before enables us to remember
* which reply was being built.
*
* If we have a BAD status,
* Set the reply_index to 0. This will allow the bad status to
* be reported to the calling management module
*/
if (status == MCC_S_NORMAL) {
if ((*p_context)->last_status != MCC_S_INSUF_BUF)
(*p_context)->reply_index = 0;
else
status = MCC_S_INSUF_BUF;
} else /* BAD(status) */
(*p_context)->reply_index = 0;
return( status );
}
/***** end init_handle_more *****/
|