Dear Alan,<br><br>I have completed my coding to achieve my task. I tried my best not to disturb much of the server code. Here is my code snippet. I request you to suggest me If my  added code is correct or wrong. Also, suggest me if there is any other best way to achieve this or you think my added can be optimized more.<br><br>/* Structure */<br><br>/**     Return codes indicating the result of the module call<br> *  *<br> *   *  All module functions must return one of the codes listed below (apart from<br> *    * RLM_MODULE_NUMCODES, which is used to check for validity).<br> *     */<br>typedef enum rlm_rcodes {<br>        RLM_MODULE_REJECT = 0,  //!< Immediately reject the request.<br>        RLM_MODULE_FAIL,             //!< Module failed, don't reply.<br>        RLM_MODULE_OK,              //!< The module is OK, continue.<br>        RLM_MODULE_HANDLED,    //!< The module handled the request, so stop.<br>        RLM_MODULE_INVALID,       //!< The module considers the request invalid.<br>        RLM_MODULE_USERLOCK,  //!< Reject the request (user is locked out).<br>        RLM_MODULE_NOTFOUND,    //!< User not found.<br>        RLM_MODULE_NOOP,           //!< Module succeeded without doing anything.<br>        RLM_MODULE_UPDATED,     //!< OK (pairs modified).<br>        RLM_MODULE_NUMCODES,  //!< How many valid return codes there are.<br>        RLM_MODULE_UNKNOWN      //!< Error resolving rcode (should not be<br>                                                      //!< returned by modules).<br>} rlm_rcode_t;<br><br>typedef struct module_t {<br>        uint64_t                magic;               //!< Used to validate module struct.<br>        char const              *name;             //!< The name of the module (without rlm_ prefix).<br>        int                     type;                     //!< One or more of the RLM_TYPE_* constants.<br>        size_t                  inst_size;            //!< Size of the instance data<br>        CONF_PARSER const       *config;                        //!< Configuration information<br>        instantiate_t           instantiate;                    //!< Function to use for instantiation.<br>        detach_t                detach;                         //!< Function to use to free module instance.<br>        packetmethod            methods[RLM_COMPONENT_COUNT];   //!< Pointers to the various section  <span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    //</span><span></span>functions, ordering<br>                                                                //!< determines which function is mapped <span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span>//to                                           <br>                                                                 //!< which section <span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>   </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span><span>    </span>                                                                                                                                                                                                                   <br>        <b>uint64_t                rtcode[RLM_MODULE_NUMCODES];    //Used for module return codes</b>                  <br>} module_t;<br><br>Now in function: modcall_recurse() I added<br><br>modcall_recurse() {<br><br>rlm_rcode_t result;<br><b>module_t const *module;</b><br><br>result = call_modsingle(c->method, sp, request);<br><b>module->rtcode[result] = module->rtcode[result] + 1;</b><br>}  <br><br>Also, in radius.c in function main I will use memset to initialize my rtcode array to zero.<br>will add this statement:<br><br><b>memset(module->rtcode,0,sizeof(module->rtcode));<br></b><br>Regards,<br>Sonu<br><br><br>From: Alan DeKok <aland@deployingradius.com><br>Sent: Fri, 26 Sep 2014 23:43:18 <br>To: FreeRadius users mailing list <freeradius-users@lists.freeradius.org><br>Subject: Re: Module Statistics in freeradius<br>Himanshu Pandey wrote:<br>
> But as we discussed, the server does NOT keep track of statistics for<br>
> each module return codes.<br>
<br>
  Yes... I've said that repeatedly.  Perhaps you could repeat it some<br>
more, to be sure that I understand how the server works?<br>
<br>
> The very first thing that I did was finding out the basic module<br>
> structure in freeradius, if I am not wrong this is the basic module<br>
> structure used:<br>
<br>
  Yes.<br>
<br>
> Now I added an unsigned long array in this structure in which module<br>
> return code act as an index. Please see the snippet below:<br>
<br>
  That's not a good idea.  For one, the module return codes are already<br>
in a typedef.  Just use that one.  There's no reason to create a new one.<br>
<br>
  And "unsigned long" isn't used anywhere else in the server.  Just use<br>
"uint64_t".<br>
<br>
> Please advice me that how should I update this my unsigned long<br>
> rtcode[RLM_RETCODE_COUNT] array with each module return code.<br>
<br>
  Use C code to increment the array entry.  See modcall.c, call_modsingle().<br>
<br>
  Alan DeKok.<br>
-<br>
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html<br>
<br><A HREF="http://sigads.rediff.com/RealMedia/ads/click_nx.ads/www.rediffmail.com/signatureline.htm@Middle?" target="_blank"><IMG SRC="http://sigads.rediff.com/RealMedia/ads/adstream_nx.ads/www.rediffmail.com/signatureline.htm@Middle"></A><table cellpadding="0" cellspacing="0"><tbody><tr><td><div style="font-family: Arial, Helvetica, sans-serif; font-size:14px">Get your own <span style="padding-bottom: 0px; background-color: #cc0000; padding-left: 3px; padding-RIGHT: 3px; font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 12px; padding-top: 0px"><b>FREE</b></span> website,  <span style="padding-bottom: 0px; background-color: #c00; padding-left: 3px; padding-RIGHT: 3px; font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 12px; padding-top: 0px"><b>FREE</b></span> domain & <span style="padding-bottom: 0px; background-color: #c00; padding-left: 3px; padding-RIGHT: 3px; font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 12px; padding-top: 0px"><b>FREE</b></span> mobile app with Company email.  </div></td><td><a href="http://track.rediff.com/click?url=___http://businessemail.rediff.com/email-ids-for-companies-with-less-than-50-employees?sc_cid=sign-1-10-13___&cmp=host&lnk=sign-1-10-13&nsrv1=host" style="font-family: Arial, Helvetica, sans-serif; color: #fff; font-size: 14px; color:#0000cc" target="_blank"><b>Know More ></b></a><!-- <in-put type="button" cl-ass="button" on-click="parent.location='http://track.rediff.com/click?url=___http://businessemail.rediff.com/company-email-hosting-services?sc_cid=signature-23-9-13___&cmp=signature-23-9-13&lnk=mypagelogout&nsrv1=host'" value="Know more >"> </input> --></td></tr></tbody></table>