|
Changes Made in Code Generation from Release 5.1 to Release 6
Changes Made in Code Generation from Release 6.0 Beta to Release 6
Changes in Code Generation from Release 5.1 to Release 6 - Standalone TL1 Agent
The generated AID Structure has been changed depending on AID Type specified in TCS. AID type may be one among List, Range, ListRange, and Compound.
If AID type is "Range", the AID structure is defined as follows:
|
typedef struct <commandcode>+AidType{ INT32 startx; INT32 endx; }<commandcode>+Aid; |
If AID type is "List", the AID structure is defined as follows:
|
/* AID structure definition */ typedef struct <commandcode>+AidType{ INT32 noOfElements; INT32 *x; }<commandcode>+Aid; |
If AID type is "Listrange", the AID structure is defined as follows:
|
/* AID structure definition */ typedef struct <commandcode>+RangeType{ FLOAT startx; FLOAT endx; }<commandcode>+Range; typedef struct <commandcode>+AidType{ INT32 noOfElements; <commandcode>+Range *<commandcode>+RangeVar; }<commandcode>+Aid; |
If AID type is "Compound", the AID structure is defined as follows:
|
/* AID structure definition */ typedef struct <commandcode>+CompndType{ CHAR *x; }<commandcode>+Compnd; typedef struct CompAidType{ INT32 noOfElements; <commandcode>+Compnd * <commandcode>+CompndVar; }<commandcode>+Aid; |
In the Action() Method declaration, an additional parameter TL1Info * has been added. In Release 5.1, the Action() Method declaration would be like
U_CHAR RdMemAction(InputCmdType *,Vector *,INT32 ,U_CHAR *);
This has been modified in Release 6 to
U_CHAR RdMemAction(InputCmdType *,Vector *,INT32 ,U_CHAR *,TL1Info *);
A new method for initializing the AID and MPB structures has been added.
U_CHAR RdMemEnvDataInitAndValidationMethod(InputCmdType *incmd,void *
AidVar ,void* MesgBlockVar,INT32 sessionID,U_CHAR *errStatus);
The function name would be <commandcode>+DataInitAndValidationMethod
The CmdRegNodeType structure includes another member to hold the command syntax. In the hdlr.c while initializing the CmdRegNodeType structure, it has the command syntax as the fourth parameter. In Release 5.1, it would be like CmdRegNodeType gv_rdMemCmdInfo = {"RD-MEM",RdMemAction,RdMemAck};
This has been modified in Release 6 to
CmdRegNodeType gv_rdMemCmdInfo = {"RD-MEM",RdMemAction,RdMemAck,"RD-MEM::<AID>:<ctag>:[GB]:<addr>,<numbytes>;"};
The Action() method generated in <AdventNet>\C-Agent\projects\<ProjectName>\agent\stubs\<tcs file name>\<cmd>+hdlr.c file has an additional argument "TL1Info* ". This is mainly used when there is a need of tracking some value or data when the Action method for a command is called repetitively, such as in an RTRV operation.
Action(InputCmdType *,Vector *,INT32 ,U_CHAR *,TL1Info *);
The Action() Method parameter list has been modified to include TL1Info *. In Release 5.1, it would be like
U_CHAR RdMemAction(InputCmdType *incmd, Vector* textBlockVector,INT32 sessionID,U_CHAR *errStatus).
This has been modified in 6 to
U_CHAR RdMemAction(InputCmdType *incmd, Vector* textBlockVector,INT32 sessionID,U_CHAR *errStatus,TL1Info *tl1InfoPtr)
In the Action() Method after the DEBUGMSG1() line, the function call <commandcode>+DataInitAndValidationMethod() has been added. The AID and MPB structure initialization done in the Action() Method in Release 5.1 has been shifted to the <commandcode>+DataInitAndValidationMethod() which is defined below the Ack() Method definition. AID initialization code can be removed/commented from Action Metod().
The DataInitAndValidationMethod() requires 5 parameters :
InputCmdType * which is got as a parameter in the Action() Method
Address of AID structure variable declared in the Action() Method. If AID is not defined then pass NULL as parameter.
Address of MPB structure variable declared in the Action() Method. If MPB is not defined then pass NULL as parameter.
Session ID which is got as a parameter in the Action() Method.
errStatus which is got as a parameter in the Action() Method.
|
if(RdMemDataInitAndValidationMethod(incmd,rdMemAidVar,rdMemMesgBlockVar,sessionID,errStatus) == DENY) |
In the generated code, a method <cmd>+DataInitAndValidationMethod() is generated where the AID and MPB data from the input message are assigned to the defined structures and validated if required.
U_CHAR <cmdcode>DataInitAndValidationMethod(InputCmdType *incmd,void * AidVar ,void * MesgBlockVar,INT32 sessionID,U_CHAR *errStatus);
This method is called from the Action Method. The AID and MPB variables are declared in the Action Method and are passed to the DataInitAndValidationMethod() for assigning the values and validating the values.
The definition of DataInitAndValidationMethod() is added below the Ack() Method definition.
U_CHAR RdMemDataInitAndValidationMethod(InputCmdType *incmd,void * AidVar ,void * MesgBlockVar,INT32 sessionID,U_CHAR *errStatus)
A pointer variable for AID and MPB structures with names as in the Action() Method has been declared.
Declare CHAR * rsltPtr;
If AID or MPB has been defined, then AID or MPB variables declared in Action() Method are passed as parameters to the DataInitAndValidationMethod() call. The AID or MPB variables declared in DataInitAndValidationMethod() are to reference the AID/MPB variables received as parameters in DataInitAndValidationMethod() Method.
|
if(AidVar != NULL) { rdMemAidVar = (RdMemAid * )AidVar; } if(MesgBlockVar != NULL) { rdMemMesgBlockVar = (RdMemMesgBlock * )MesgBlockVar; } /* AID Initialization */ if(incmd->aid == NULL) { ERRMSG1("Invalid Access Identifier\n"); *errStatus = IIAC; return DENY; } |
For initializing MPB block, the Release 5.1 code from Action() Method has been moved to DataInitAndValidationMethod() method. Just the MPB structure name in them has been replaced with that declared in DataInitAndValidationMethod() method. In the MPB code moved from Action() method, replace . with -> while accessing the structure member. For initializing AID, code is modified depending on the type of AID defined for that command.
For "List" type: The following variable also has been declared:
|
INT32 j=0; for(j=0;incmd->aid[j] != NULL;j++); rtrvAidVar->noOfElements = j; if(SubString(incmd->aidString,"&&") != NULL || SubString(incmd->aidString,"-") != NULL ||SubString(incmd->aidString,",") != NULL) { *errStatus = IIAC; return DENY; } rtrvAidVar->x = (INT32 *)__Calloc(rtrvAidVar->noOfElements,sizeof(INT32 *)); for(j=0;incmd->aid[j] != NULL;j++) { rsltPtr = GetAid(incmd,j); if( rsltPtr == NULL) { ERRMSG1("Access Identifier missing\n"); *errStatus = IIAC; return DENY; } else { rtrvAidVar->x[j] = __atoi(rsltPtr); /*Range checking or value check to be done here*/ } } here j refers to the aid index. For "Range " type : rsltPtr = GetAid(incmd,0); if( rsltPtr == NULL) { ERRMSG1("Access Identifier missing\n"); *errStatus = IIAC; return DENY; } else { rtrvRscAaaAidVar->startx = __atoi(rsltPtr); /*Range checking or value check to be done here*/ } rsltPtr = GetAid(incmd,1); if( rsltPtr == NULL) { ERRMSG1("Access Identifier missing\n"); *errStatus = IIAC; return DENY; } else { rtrvRscAaaAidVar->endx = __atoi(rsltPtr); /*Range checking or value check to be done here*/ } |
For "Range" type: The following variable also has been declared:
|
if(SubString(incmd->aidString,"-") != NULL ||SubString(incmd->aidString,",") != NULL) { *errStatus = IIAC; return DENY; } rsltPtr = GetAid(incmd,0); if( rsltPtr == NULL) { ERRMSG1("Access Identifier missing\n"); *errStatus = IIAC; return DENY; } else { rtrvRscAaaAidVar->startx = __atoi(rsltPtr); /*Range checking or value check to be done here*/ } rsltPtr = GetAid(incmd,1); if( rsltPtr == NULL) { ERRMSG1("Access Identifier missing\n"); *errStatus = IIAC; return DENY; } else { rtrvRscAaaAidVar->endx = __atoi(rsltPtr); /*Range checking or value check to be done here*/ } |
For "ListRange " type: The following variable also has been declared:
|
INT32 j=0; /*aid index*/ INT32 ampcnt=0; /* count of &*/ INT32 aididx=0; INT32 i=0; for(j=0;incmd->aid[j] != NULL;j++); entAidVar->noOfElements = j; if(SubString(incmd->aidString,"-") != NULL ||SubString(incmd->aidString,",") != NULL) { *errStatus = IIAC; return DENY; } if(incmd->aidString != NULL) { for(j=0;incmd->aidString[j] != '\0';j++) { if((incmd->aidString[j] == '&') && (incmd->aidString[j+1] =='&')) { ampcnt++; j++; } else { ampcnt++; } } } entAidVar->EntRangeVar = (EntRange *)__Calloc(ampcnt+1,sizeof(EntRange)); for(j=0,i=0;(incmd->aidString[j] != '\0') && (incmd->aid[aididx] != NULL);j++,i++) { if((incmd->aidType[j] == '&') && (incmd->aidType[j+1] =='&')) { entAidVar->EntRangeVar[i].startx = __atoi(incmd->aid[aididx++]); entAidVar->EntRangeVar[i].endx = __atoi(incmd->aid[aididx++]); j++; } else { entAidVar->EntRangeVar[i].startx = __atoi(incmd->aid[aididx]); entAidVar->EntRangeVar[i].endx = __atoi(incmd->aid[aididx++]); } } |
For "Compound " type: The following variables also have been declared:
|
INT32 j=0; INT32 aididx=0; if(incmd->aidString != NULL) { for(j=0;incmd->aidString[j] != '\0';j++) { if((incmd->aidString[j] == '&') && (incmd->aidString[j+1] == '-') ) { aididx++; j++; } else if((incmd->aidString[j] == '&') && (incmd->aidString[j+1] == '&') && (incmd->aidString[j+2] == '-') ) { aididx++; j=j+2; } else if(__Strchr(incmd->aidString,',') != NULL) { aididx=2; break; } } compAidVar->CompCompndVar = (CompCompnd *)__Calloc(aididx+1,sizeof(CompCompnd)); for(j=0,aididx = 0;GetAid(incmd,aididx) != NULL;j++,aididx++) { rsltPtr = GetAid(incmd,aididx); if( rsltPtr == NULL) { ERRMSG1("Access Identifier missing\n"); *errStatus = IIAC; return DENY; } else { compAidVar->CompCompndVar[j].c = rsltPtr; } } compAidVar->noOfElements = j; } |
At the end of DataInitandValidation() method, "return SUCCESS;" has been added.
Similar to the creating and formatting response functions for a normal Response, functions are generated for forming an error response which can be called to send user-defined error response (when CompletionCode is DENY). Error response functions are generated only if defined in the TCS file.
|
|
Note:
The following changes in the files structure will not have any effect on the migration of the project from Release 5.1 and 6.0 Beta to Release 6:
|
Changes in Code Generation from Release 6.0 Beta to Release 6 - Standalone TL1 Agent
The following code changes in Release 6.0 Beta have been effected in Release 6 in the DataInitAndValidationMethod() method:
For List type: The following code has been added after the lines:
INT32 j=0;
for(j=0;incmd->aid[j] != NULL;j++);
rtrvAidVar->noOfElements = j;
|
if(SubString(incmd->aidString,"&&") != NULL || SubString(incmd->aidString,"-") != NULL ||SubString(incmd->aidString,",") != NULL) { *errStatus = IIAC; return DENY; } |
For Range type: The following code has been added before the first line in the Method for Range type:
|
if(SubString(incmd->aidString,"-") != NULL ||SubString(incmd->aidString,",") != NULL) { *errStatus = IIAC; return DENY; } |
For ListRange type: The following code has been added immediately after the lines:
for(j=0;incmd->aid[j] != NULL;j++);
entAidVar->noOfElements = j;
|
if(SubString(incmd->aidString,"-") != NULL ||SubString(incmd->aidString,",") != NULL) { *errStatus = IIAC; return DENY; } |
Also, the line
if((incmd->aidString[j] == '&') && (incmd->aidString[j+1] =='&'))
has been modified to
if((incmd->aidType[j] == '&') && (incmd->aidType[j+1] =='&'))
For Compound type: The line
&& (incmd->aidString[j+1] == '-') )
has been modified to
&& (incmd->aidString[j+2] == '-') )
and the line
for(j=0,aididx = 0;incmd->aid[aididx] != NULL;j++,aididx++)
has been modified to
for(j=0,aididx = 0;GetAid(incmd,aididx) != NULL;j++,aididx++)
|