ru.bitel.bgbilling.kernel.network.radius

## Class AbstractRadiusProcessor<C extends ru.bitel.bgbilling.kernel.network.radius.nas.NasConnection<?>,N extends ru.bitel.bgbilling.kernel.network.radius.nas.Nas<C,?,?>,P>

- java.lang.Object
- - ru.bitel.bgbilling.kernel.network.processor.Processor
  - - ru.bitel.bgbilling.kernel.network.radius.RadiusProcessor<C,N,P>
    - - ru.bitel.bgbilling.kernel.network.radius.AbstractRadiusProcessor<C,N,P>

- Type Parameters:
    `N` -
    `P` -

      public abstract class AbstractRadiusProcessor<C extends ru.bitel.bgbilling.kernel.network.radius.nas.NasConnection<?>,N extends ru.bitel.bgbilling.kernel.network.radius.nas.Nas<C,?,?>,P>
      extends RadiusProcessor<C,N,P>

  Расширенная версия процессора, здесь уже напрямую используется структура и api биллинга
  Author:
    amir

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class ru.bitel.bgbilling.kernel.network.radius.RadiusProcessor

      `RadiusProcessor.ConnectionIterator<C extends ru.bitel.bgbilling.kernel.network.radius.nas.NasConnection<?>,N extends ru.bitel.bgbilling.kernel.network.radius.nas.Nas<C,?,?>>`

  - ### Field Summary

    - ### Fields inherited from class ru.bitel.bgbilling.kernel.network.radius.RadiusProcessor

      `accountingStartCounter, accountingStopCounter, accountingUpdateCounter, accountingUpdateIgnoreCount, antispamIgnoreCount, authenticationAcceptCounter, authenticationIgnoreCount, authenticationRejectCounter, forwardAfterPreprocess, forwardAfterProcess, module, nasList, setup`

    - ### Fields inherited from class ru.bitel.bgbilling.kernel.network.processor.Processor

      `applicationId, moduleId`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractRadiusProcessor(RadiusSetup setup, java.lang.String module, int mid, ru.bitel.bgbilling.kernel.network.radius.nas.NasList<C,N> nasList)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `accessRequestImpl(RadiusListenerWorker<N> req, N nas, RadiusPacket request, RadiusPacket response, java.util.Date date, RadiusSession<N,P> radiusSession, int logRecordId, ConnectionSet connectionSet)`
    `protected void` | `addCommonStatusData(java.lang.StringBuilder report)`
    `protected int` | `authentication(RadiusListenerWorker<?> req, N nas, RadiusSession<N,P> session, RadiusPacket request, RadiusPacket response, ConnectionSet connectionSet, int log_record_id)` Обработка Access-Request разделяется на два этапа - аутентификацию и авторизацию.
    `protected int` | `authenticationImpl(RadiusListenerWorker<?> req, N nas, RadiusSession<N,P> session, RadiusPacket request, RadiusPacket response, ConnectionSet connectionSet, int log_record_id, boolean realtimeTariff)`
    `protected void` | `checkLoginAndContract(Login login, Contract contract)`
    `protected boolean` | `checkService(java.sql.Connection con, int cid, java.util.Set<java.lang.Integer> sidSet)`
    `protected int` | `executeError(java.sql.Connection con, N nas, RadiusPacket request, RadiusPacket response, int cid, int lid, int errorCode, int log_record_id)`
    `protected abstract Login` | `getLogin(java.sql.Connection con, int cid, Card card)`
    `protected abstract Login` | `getLogin(N nas, RadiusPacket req, RadiusPacket resp, java.sql.Connection con, java.lang.String userName)`
    `protected abstract LocalEvent` | `newRadiusAuthenticationEvent(RadiusPacket request, RadiusPacket response, RadiusSession<N,P> radiusSession, int logRecordId)`

    - ### Methods inherited from class ru.bitel.bgbilling.kernel.network.radius.RadiusProcessor

      `accessRequest, accounting, accountingRequest, addToLog, afterNasListReload, authorization, connections, executeCommand, getAccessAcceptPerMinute, getAccessRejectPerMinute, getAccessRequestIgnorePerMinute, getAccountingStartPerMinute, getAccountingStopPerMinute, getAccountingUpdateIgnorePerMinute, getAccountingUpdatePerMinute, getActiveConnectionsCount, getAntispamIgnorePerMinute, getConnectionList, getNas, getNasList, getStatus, getStoppedConnectionCount, getSuspendedConnectionCount, insertToLog, newInstance, newRadiusSession, postprocessAccessRequest, postprocessAccountingRequest, preprocessAccessRequest, preprocessAccountingRequest, processConnections, reloadConfig, reloadNasList`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractRadiusProcessor

          public AbstractRadiusProcessor(RadiusSetup setup,
                                         java.lang.String module,
                                         int mid,
                                         ru.bitel.bgbilling.kernel.network.radius.nas.NasList<C,N> nasList)
                                  throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

  - ### Method Detail

    - #### checkLoginAndContract

          protected void checkLoginAndContract(Login login,
                                               Contract contract)

    - #### executeError

          protected int executeError(java.sql.Connection con,
                                     N nas,
                                     RadiusPacket request,
                                     RadiusPacket response,
                                     int cid,
                                     int lid,
                                     int errorCode,
                                     int log_record_id)

    - #### getLogin

          protected abstract Login getLogin(N nas,
                                            RadiusPacket req,
                                            RadiusPacket resp,
                                            java.sql.Connection con,
                                            java.lang.String userName)

    - #### getLogin

          protected abstract Login getLogin(java.sql.Connection con,
                                            int cid,
                                            Card card)

    - #### accessRequestImpl

          protected void accessRequestImpl(RadiusListenerWorker<N> req,
                                           N nas,
                                           RadiusPacket request,
                                           RadiusPacket response,
                                           java.util.Date date,
                                           RadiusSession<N,P> radiusSession,
                                           int logRecordId,
                                           ConnectionSet connectionSet)

      Overrides:
        `accessRequestImpl` in class `RadiusProcessor<C extends ru.bitel.bgbilling.kernel.network.radius.nas.NasConnection<?>,N extends ru.bitel.bgbilling.kernel.network.radius.nas.Nas<C,?,?>,P>`

    - #### newRadiusAuthenticationEvent

          protected abstract LocalEvent newRadiusAuthenticationEvent(RadiusPacket request,
                                                                     RadiusPacket response,
                                                                     RadiusSession<N,P> radiusSession,
                                                                     int logRecordId)

    - #### authentication

          protected int authentication(RadiusListenerWorker<?> req,
                                       N nas,
                                       RadiusSession<N,P> session,
                                       RadiusPacket request,
                                       RadiusPacket response,
                                       ConnectionSet connectionSet,
                                       int log_record_id)

      Description copied from class: `RadiusProcessor`
      Обработка Access-Request разделяется на два этапа - аутентификацию и авторизацию.
      В данном методе должна проходить аутентификация.
      Этот метод вызывается один раз за радиус сессию, т.е. сразу на Access-Request, если сессии нет,
      или в конце обработки eap запросов.
      Метод вызывается из `RadiusSession`
      Внутри логики должен найтись логин, провериться пароль, и, если все нормально, вызваться `#authorization(Nas, RadiusSession, RadiusPacket, RadiusPacket, Connection, Connection, int, Contract, Login, String)`
      Specified by:
        `authentication` in class `RadiusProcessor<C extends ru.bitel.bgbilling.kernel.network.radius.nas.NasConnection<?>,N extends ru.bitel.bgbilling.kernel.network.radius.nas.Nas<C,?,?>,P>`

    - #### authenticationImpl

          protected int authenticationImpl(RadiusListenerWorker<?> req,
                                           N nas,
                                           RadiusSession<N,P> session,
                                           RadiusPacket request,
                                           RadiusPacket response,
                                           ConnectionSet connectionSet,
                                           int log_record_id,
                                           boolean realtimeTariff)

    - #### checkService

          protected boolean checkService(java.sql.Connection con,
                                         int cid,
                                         java.util.Set<java.lang.Integer> sidSet)

    - #### addCommonStatusData

          protected void addCommonStatusData(java.lang.StringBuilder report)