Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagetext
themeEclipse
table tmp_tab;

initialize {
  tmp_tab = tableCreate("select SUBSCRIBER from VALID_SUBSCRIBERS");
}


consume {
  list<drudr> reqList = listCreate(drudr);
  radius.Radius r = (radius.Radius) input;
  string err = udrDecode("Radius.Request_Dec", 
                           reqList, r.requestMessage, true);
   
  if ( (err != null) || (listSize(reqList) != 1) ) {
    debug("Decoding error: " + err);
    return;
  } 

  drudr elem = (drudr) listGet(reqList, 0);
  
  if (instanceOf(elem, Default.extendedRadius.Access_Request_Int)) {
        Default.extendedRadius.Access_Request_Int  req  = 
            (Default.extendedRadius.Access_Request_Int) elem;            
        table rowFound = tableLookup( tmp_tab, 
                         "SUBSCRIBER", "=", req.User_Name );
               
           if (tableRowCount(rowFound) > 0) {
             Default.extendedRadius.Access_Accept_Int   resp =
                    udrCreate(Default.extendedRadius.Access_Accept_Int);
             resp.Identifier = req.Identifier;
             r.responseMessage =
                    udrEncode("Default.extendedRadius.Response_Enc", resp);
              udrRoute( r );                 
           } else {
              Default.extendedRadius.Access_Reject_Int   resp =
                     udrCreate(Default.extendedRadius.Access_Reject_Int);
              resp.Identifier = req.Identifier;
              r.responseMessage =
                     udrEncode("Default.extendedRadius.Response_Enc", resp);
              udrRoute( r, "Response" );
           }
            
    } else {
       debug("Invalid request type");
    }
} 

Scroll pagebreak