User's Manual

Table Of Contents
Boomer II User Manual & Integrator’s Guide ______________________________________________ SDK SCRAPI
BM210012WT27 157 Wavenet Technology
error
Return value > 0 Operation was successful .and the decoded message is returned
in l_msg.
Example
#include <scrapi.h>
{
SCRMsg lmsg; /* SCR message struct
*/
byte lbuffer[SCR_MAX_LEN];/*buffer for received SCR msg
*/
int llen; /* length of received SCR msg
*/
int lused; /* return code from scr_Decode
*/
. . .
/* receive data into lbuffer */
llen = x25recv( . . . lbuffer, . . .);
. . .
lused = scr_Decode(llen, lbuffer, &lmsg);
if (lused > 0) {
/* process message */
. . .
scr_FreeDecoding(lmsg); /* free decoded message */
}
else if (lused == 0) {
/* incomplete message received */
}
else {
/* report an.error */
. . .
}
}
scr_FreeDecoding()
Prototype:
void scr_FreeDecoding(SCRMsg *l_msg)
Description
This routine is used to free any memory allocated inside an SCRMsg
structure by a successful call to scr_Decode(). All calls to scr_Decode()
that return a successfully decoded SCR message (the return value is a
positive value) must be followed by a call to scr_FreeDecoding(), after
the caller has fully processed the decoded message. If
scr_FreeDecoding() is not called, memory leaks will occur.
Note: The SCRMsg structure itself is not freed. Only allocated memory
within this structure is freed. After scr_FreeDecoding() has been
called, all pointers within the SCRMsg structure will be invalid.
Input: