Package ru.bitel.bgbilling.modules.inet.server

# Class InetUtils

java.lang.Object
ru.bitel.bgbilling.modules.inet.server.InetUtils

public class InetUtils extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InetUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `awaitTermination(ScheduledExecutorService scheduledExecutorService, String name, long seconds)`
  `static boolean`
  `checkAccountingRootDeviceId(Setup setup, int moduleId)`
  Проверка что в moduleSetup указаны типы устройств - аккаунтинг
  `static boolean`
  `checkAliveAndType(InetConnection connection, boolean checkDeviceState, int type)`
  Возвращает true если сессия жива и тип подходящий.
  `static Boolean`
  `checkIdentifier(InetServ inetServ, String identifier)`
  `static Boolean`
  `checkMacAddress(InetServ inetServ, byte[] macAddress)`
  Возвращает true, если в сервисе не назначен MAC-адрес, или один из назначенных адресов совпадает с указанным.
  `static <A> boolean`
  `checkSessionCountLimit(List<A> connectionList, Function<A,InetConnection> converter, boolean alive, int sessionCountLimit)`
  `static long`
  `dateFrom(Calendar dateFrom)`
  `static long`
  `dateFrom(Date dateFrom, Calendar utilCalendar)`
  `static long`
  `dateTo(Calendar dateTo)`
  `static long`
  `dateTo(Date dateTo, Calendar utilCalendar)`
  `static int`
  `getAccountingRootDeviceId(int moduleId, Set<Integer> accountingDeviceTypeIds, int deviceId)`
  `static int`
  `getAccountingRootDeviceId(Setup setup, int moduleId, int deviceId)`
  `static InetConnection`
  `getConnection(Connection con, int moduleId, long connectionId, Date connectionStart)`
  `static Object[]`
  `getConnectionAndLastSessionLog(Connection con, int moduleId, long connectionId, Date connectionStart)`
  `static int`
  `getConnectionType(InetConnection connection)`
  TODO-XXX
  `static Map<Integer,AccountingTrafficAmount>`
  `getCounterTraffics(ru.bitel.bgbilling.apps.inet.accounting.InetConnectionCallRuntime connectionCallRuntime, RadiusPacket request)`
  `static Map<Integer,AccountingTrafficAmount>`
  `getCounterTraffics(ru.bitel.bgbilling.modules.inet.server.runtime.InetServRuntime inetServRuntime, ru.bitel.bgbilling.apps.inet.accounting.InetConnectionCallRuntime parentConnectionCallRuntime, InetConnection connection, RadiusPacket request)`
  `static Map<Integer,AccountingTrafficAmount>`
  `getCounterTraffics(ru.bitel.bgbilling.modules.inet.server.runtime.TrafficTypeLinkRuntime link, RadiusPacket packet, String realm, String acctService)`
  `static final Long`
  `getHour(long millis)`
  `static final long`
  `getInputOctets(RadiusPacket packet)`
  `static final long`
  `getOutputOctets(RadiusPacket packet)`
  `static String`
  `getRealm(String username)`
  `static int`
  `getSessionCountLimit(InetServType inetServType, InetServ inetServ)`
  `static String`
  `internRealm(String realm)`
  `static String`
  `internServiceName(String realm)`
  `static long`
  `macAddressToLong(byte[] mac)`
  `static long`
  `macAddressToLong(String macAddress)`
  `static String`
  `macAddressToString(byte[] macAddress)`
  `static RadiusAttributeSetRealmMap`
  `newRadiusAttributeSetRealmMap(int moduleId, ParameterMap deviceConfig, String prefix)`
  Набор атрибутов по релмам и опциям, с добавлением атрибутов, прописанных в опциях и атрибутов, прописанных шаблоном radius.inetOption.1.template=Speed=$speed
  `static RadiusAttributeSetRealmMap`
  `newRadiusAttributeSetRealmMap(ConnectionSet connectionSet, int moduleId, ParameterMap deviceConfig, String prefix)`
  Набор атрибутов по релмам и опциям, с добавлением атрибутов, прописанных в опциях и атрибутов, прописанных шаблоном radius.inetOption.1.template=Speed=$speed
  `static int`
  `parseInt(byte[] data, int pos, int length)`
  Преобразует 1-4 байта в int
  `static byte[]`
  `parseMacAddress(String macAddress)`
  `static int[][]`
  `parseSearchModes(String value)`
  `static long`
  `roundToSeconds(long millis)`

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

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

- ## Constructor Details

  - ### InetUtils

    public InetUtils()

- ## Method Details

  - ### dateFrom

    public static long dateFrom(Date dateFrom, Calendar utilCalendar)

  - ### dateTo

    public static long dateTo(Date dateTo, Calendar utilCalendar)

  - ### dateFrom

    public static long dateFrom(Calendar dateFrom)

  - ### dateTo

    public static long dateTo(Calendar dateTo)

  - ### getHour

    public static final Long getHour(long millis)

  - ### awaitTermination

    public static boolean awaitTermination(ScheduledExecutorService scheduledExecutorService, String name, long seconds) throws InterruptedException
    Throws:
      `InterruptedException`

  - ### getRealm

    public static String getRealm(String username)

  - ### internRealm

    public static String internRealm(String realm)

  - ### internServiceName

    public static String internServiceName(String realm)

  - ### getCounterTraffics

    public static Map<Integer,AccountingTrafficAmount> getCounterTraffics(ru.bitel.bgbilling.modules.inet.server.runtime.InetServRuntime inetServRuntime, ru.bitel.bgbilling.apps.inet.accounting.InetConnectionCallRuntime parentConnectionCallRuntime, InetConnection connection, RadiusPacket request)

  - ### getCounterTraffics

    public static Map<Integer,AccountingTrafficAmount> getCounterTraffics(ru.bitel.bgbilling.apps.inet.accounting.InetConnectionCallRuntime connectionCallRuntime, RadiusPacket request)

  - ### getCounterTraffics

    public static Map<Integer,AccountingTrafficAmount> getCounterTraffics(ru.bitel.bgbilling.modules.inet.server.runtime.TrafficTypeLinkRuntime link, RadiusPacket packet, String realm, String acctService)

  - ### getInputOctets

    public static final long getInputOctets(RadiusPacket packet)

  - ### getOutputOctets

    public static final long getOutputOctets(RadiusPacket packet)

  - ### getSessionCountLimit

    public static int getSessionCountLimit(InetServType inetServType, InetServ inetServ)

  - ### checkSessionCountLimit

    public static <A> boolean checkSessionCountLimit(List<A> connectionList, Function<A,InetConnection> converter, boolean alive, int sessionCountLimit)
    Parameters:
      `connectionList` -
      `sessionCountLimit` -
      `active` - проверяем ли активную сессию, т.е. в списке текущих она уже есть
    Returns:

  - ### getConnection

    public static InetConnection getConnection(Connection con, int moduleId, long connectionId, Date connectionStart) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### getConnectionAndLastSessionLog

    public static Object[] getConnectionAndLastSessionLog(Connection con, int moduleId, long connectionId, Date connectionStart) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### roundToSeconds

    public static long roundToSeconds(long millis)

  - ### parseInt

    public static int parseInt(byte[] data, int pos, int length)
    Преобразует 1-4 байта в int
    Parameters:
      `data` -
      `pos` -
      `length` -
    Returns:

  - ### checkMacAddress

    public static Boolean checkMacAddress(InetServ inetServ, byte[] macAddress)
    Возвращает true, если в сервисе не назначен MAC-адрес, или один из назначенных адресов совпадает с указанным.
    Parameters:
      `inetServ` -
      `macAddress` -
      `trueIfEmpty` - нужно ли возвращать true, если ни один MAC-адрес на сервисе не задан.
    Returns:

  - ### checkIdentifier

    public static Boolean checkIdentifier(InetServ inetServ, String identifier)

  - ### newRadiusAttributeSetRealmMap

    public static RadiusAttributeSetRealmMap newRadiusAttributeSetRealmMap(ConnectionSet connectionSet, int moduleId, ParameterMap deviceConfig, String prefix) throws Exception
    Набор атрибутов по релмам и опциям, с добавлением атрибутов, прописанных в опциях и атрибутов, прописанных шаблоном radius.inetOption.1.template=Speed=$speed
    Parameters:
      `connectionSet` -
      `moduleId` -
      `deviceConfig` -
      `prefix` -
    Returns:
    Throws:
      `ru.bitel.bgbilling.common.BGException`
      `Exception`

  - ### newRadiusAttributeSetRealmMap

    public static RadiusAttributeSetRealmMap newRadiusAttributeSetRealmMap(int moduleId, ParameterMap deviceConfig, String prefix) throws Exception
    Набор атрибутов по релмам и опциям, с добавлением атрибутов, прописанных в опциях и атрибутов, прописанных шаблоном radius.inetOption.1.template=Speed=$speed
    Parameters:
      `deviceConfig` -
      `prefix` -
    Returns:
    Throws:
      `ru.bitel.bgbilling.common.BGException`
      `Exception`

  - ### parseSearchModes

    public static int[][] parseSearchModes(String value)

  - ### getAccountingRootDeviceId

    public static int getAccountingRootDeviceId(int moduleId, Set<Integer> accountingDeviceTypeIds, int deviceId) throws Exception
    Throws:
      `Exception`

  - ### getAccountingRootDeviceId

    public static int getAccountingRootDeviceId(Setup setup, int moduleId, int deviceId) throws Exception
    Throws:
      `Exception`

  - ### checkAccountingRootDeviceId

    public static boolean checkAccountingRootDeviceId(Setup setup, int moduleId)
    Проверка что в moduleSetup указаны типы устройств - аккаунтинг
    Parameters:
      `setup` -
      `moduleId` -
    Returns:

  - ### getConnectionType

    public static int getConnectionType(InetConnection connection)
    TODO-XXX
    Parameters:
      `connection` -
    Returns:

  - ### checkAliveAndType

    public static boolean checkAliveAndType(InetConnection connection, boolean checkDeviceState, int type)
    Возвращает true если сессия жива и тип подходящий.
    Parameters:
      `connection` -
      `type` -
    Returns:
    See Also:
      - `InetConnection.TYPE_DHCPv4`

  - ### macAddressToLong

    public static long macAddressToLong(byte[] mac)

  - ### macAddressToLong

    public static long macAddressToLong(String macAddress)

  - ### parseMacAddress

    public static byte[] parseMacAddress(String macAddress)

  - ### macAddressToString

    public static String macAddressToString(byte[] macAddress)