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