docs: def accounting(dbfile,config):
      ''' update radius accounting
      '''
      try:
          nas_id = config.get('DEFAULT', 'nas_id')
          nas_addr = config.get('DEFAULT', 'nas_addr')
          secret = config.get('DEFAULT', 'radius_secret')
          radius_addr = config.get('DEFAULT', 'radius_addr')
          radius_acct_port = config.getint('DEFAULT', 'radius_acct_port')
          radius_timeout = config.getint('DEFAULT', 'radius_timeout')
          status_dbfile = config.get('DEFAULT', 'statusdb')
  
          clients = statusdb.query_client(status_dbfile)
  
          ctime = int(time.time())
          for cli in clients:
              if (ctime - int(cli['uptime'])) < int(cli['acct_interval']):
                  continue
  
              session_id = cli['session_id']
              req = {'User-Name':cli['username']}
              req['Acct-Status-Type'] = ACCT_UPDATE
              req['Acct-Session-Id'] = session_id
              req["Acct-Output-Octets"]  =  int(cli['outbytes'])
              req["Acct-Input-Octets"]  =  int(cli['inbytes'])
              req['Acct-Session-Time'] = (ctime - int(cli['ctime']))
              req["NAS-IP-Address"]     = nas_addr
              req["NAS-Port-Id"]     = '0/0/0:0.0'
              req["NAS-Port"]           = 0
              req["Service-Type"]       = "Login-User"
              req["NAS-Identifier"]     = nas_id
              req["Called-Station-Id"]  = '00:00:00:00:00:00'
              req["Calling-Station-Id"] = '00:00:00:00:00:00'
              req["Framed-IP-Address"]  = cli['userip']
  
              def update_uptime(radresp):
                  statusdb.update_client_uptime(status_dbfile,session_id)
                  log.msg('online<%s> client accounting update'%session_id)
  
              def onresp(r):
                  try:
                      update_uptime(r)
                  except Exception as e:
                      log.err('online update uptime error')
                      log.err(e)
  
              d = client.send_acct(str(secret), get_dictionary(), radius_addr, 
                  acctport=radius_acct_port, debug=True,**req)
              d.addCallbacks(onresp,log.err)
  
      except Exception, e:
          log.err('accounting error')
          log.err(e)