idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
37,400
private static RtcpReceiverReport buildReceiverReport ( RtpStatistics statistics , boolean padding ) { RtcpReceiverReport report = new RtcpReceiverReport ( padding , statistics . getSsrc ( ) ) ; long ssrc = statistics . getSsrc ( ) ; List < Long > members = statistics . getMembersList ( ) ; for ( Long memberSsrc : memb...
Builds a packet containing an RTCP Receiver Report
37,401
public static RtcpPacket buildReport ( RtpStatistics statistics ) { boolean padding = false ; RtcpReport report ; if ( statistics . hasSent ( ) ) { report = buildSenderReport ( statistics , padding ) ; } else { report = buildReceiverReport ( statistics , padding ) ; } RtcpSdes sdes = buildSdes ( statistics , padding ) ...
Builds a packet containing an RTCP Report .
37,402
public static RtcpPacket buildBye ( RtpStatistics statistics ) { boolean padding = false ; RtcpReport report ; if ( statistics . hasSent ( ) ) { report = buildSenderReport ( statistics , padding ) ; } else { report = buildReceiverReport ( statistics , padding ) ; } RtcpSdes sdes = buildSdes ( statistics , padding ) ; R...
Builds a packet containing an RTCP BYE message .
37,403
public void addLocalCandidates ( List < LocalCandidateWrapper > candidatesWrapper ) { for ( LocalCandidateWrapper candidateWrapper : candidatesWrapper ) { addLocalCandidate ( candidateWrapper , false ) ; } sortCandidates ( ) ; }
Registers a collection of local candidates to the component .
37,404
private void addLocalCandidate ( LocalCandidateWrapper candidateWrapper , boolean sort ) { IceCandidate candidate = candidateWrapper . getCandidate ( ) ; candidate . setPriority ( calculatePriority ( candidate ) ) ; synchronized ( this . localCandidates ) { if ( ! this . localCandidates . contains ( candidateWrapper ) ...
Attempts to registers a local candidate .
37,405
private Enumeration < NetworkInterface > getNetworkInterfaces ( ) throws HarvestException { try { return NetworkInterface . getNetworkInterfaces ( ) ; } catch ( SocketException e ) { throw new HarvestException ( "Could not retrieve list of available Network Interfaces." , e ) ; } }
Finds all Network interfaces available on this server .
37,406
private boolean useNetworkInterface ( NetworkInterface networkInterface ) throws HarvestException { try { return ! networkInterface . isLoopback ( ) && networkInterface . isUp ( ) ; } catch ( SocketException e ) { throw new HarvestException ( "Could not evaluate whether network interface is loopback." , e ) ; } }
Decides whether a certain network interface can be used as a host candidate .
37,407
private List < InetAddress > findAddresses ( ) throws HarvestException { List < InetAddress > found = new ArrayList < InetAddress > ( 3 ) ; Enumeration < NetworkInterface > interfaces = getNetworkInterfaces ( ) ; while ( interfaces . hasMoreElements ( ) ) { NetworkInterface iface = interfaces . nextElement ( ) ; if ( !...
Finds available addresses that will be used to gather candidates from .
37,408
private DatagramChannel openUdpChannel ( InetAddress localAddress , int port , Selector selector ) throws IOException { DatagramChannel channel = DatagramChannel . open ( ) ; channel . configureBlocking ( false ) ; channel . register ( selector , SelectionKey . OP_READ | SelectionKey . OP_WRITE ) ; channel . bind ( new...
Opens a datagram channel and binds it to an address .
37,409
private boolean gatherCandidate ( IceComponent component , InetAddress address , int startingPort , RtpPortManager portManager , Selector selector ) { if ( startingPort == portManager . peek ( ) ) { return false ; } try { int port = portManager . current ( ) ; DatagramChannel channel = openUdpChannel ( address , port ,...
Gathers a candidate and registers it in the respective ICE Component . A datagram channel will be bound to the local candidate address .
37,410
public byte [ ] process ( byte [ ] media ) { frame ++ ; float [ ] new_speech = new float [ media . length ] ; short [ ] shortMedia = Util . byteArrayToShortArray ( media ) ; for ( int i = 0 ; i < LD8KConstants . L_FRAME ; i ++ ) { new_speech [ i ] = ( float ) shortMedia [ i ] ; } preProc . pre_process ( new_speech , LD...
Perform compression .
37,411
public void exclude ( String formatName ) { for ( int i = 0 ; i < count ; i ++ ) { md [ i ] . exclude ( formatName ) ; } }
Excludes specified formats from descriptor .
37,412
public boolean contains ( String encoding ) { if ( encoding . equalsIgnoreCase ( "sendrecv" ) || encoding . equalsIgnoreCase ( "fmtp" ) || encoding . equalsIgnoreCase ( "audio" ) || encoding . equalsIgnoreCase ( "AS" ) || encoding . equalsIgnoreCase ( "IP4" ) ) { return true ; } for ( int i = 0 ; i < count ; i ++ ) { i...
Checks that specified format is described by this sdp .
37,413
private void cancelSignals ( ) { Iterator < String > keys = this . signals . keySet ( ) . iterator ( ) ; while ( keys . hasNext ( ) ) { cancelSignal ( keys . next ( ) ) ; } }
Cancels any ongoing signal .
37,414
public static boolean isInRangeV4 ( byte [ ] network , byte [ ] subnet , byte [ ] ipAddress ) { if ( network . length != 4 || subnet . length != 4 || ipAddress . length != 4 ) return false ; return compareByteValues ( network , subnet , ipAddress ) ; }
Checks whether ipAddress is in IPV4 network with specified subnet
37,415
public static boolean isInRangeV6 ( byte [ ] network , byte [ ] subnet , byte [ ] ipAddress ) { if ( network . length != 16 || subnet . length != 16 || ipAddress . length != 16 ) return false ; return compareByteValues ( network , subnet , ipAddress ) ; }
Checks whether ipAddress is in IPV6 network with specified subnet
37,416
private static boolean compareByteValues ( byte [ ] network , byte [ ] subnet , byte [ ] ipAddress ) { for ( int i = 0 ; i < network . length ; i ++ ) if ( ( network [ i ] & subnet [ i ] ) != ( ipAddress [ i ] & subnet [ i ] ) ) return false ; return true ; }
Checks whether ipAddress is in network with specified subnet by comparing byte logical end values
37,417
public static IPAddressType getAddressType ( String ipAddress ) { if ( IPAddressUtil . isIPv4LiteralAddress ( ipAddress ) ) return IPAddressType . IPV4 ; if ( IPAddressUtil . isIPv6LiteralAddress ( ipAddress ) ) return IPAddressType . IPV6 ; return IPAddressType . INVALID ; }
Gets IP address type
37,418
public void start ( ) { synchronized ( LOCK ) { if ( ! this . active ) { this . active = true ; logger . info ( "Starting UDP Manager" ) ; try { generateTasks ( ) ; logger . info ( "Initialized UDP interface[" + inet + "]: bind address=" + bindAddress ) ; } catch ( IOException e ) { logger . error ( "An error occurred ...
Starts polling the network .
37,419
public void stop ( ) { synchronized ( LOCK ) { if ( this . active ) { this . active = false ; logger . info ( "Stopping UDP Manager" ) ; stopTasks ( ) ; closeSelectors ( ) ; cleanResources ( ) ; logger . info ( "UDP Manager has stopped" ) ; } } }
Stops polling the network .
37,420
public IceMediaStream getMediaStream ( String streamName ) { IceMediaStream mediaStream ; synchronized ( mediaStreams ) { mediaStream = this . mediaStreams . get ( streamName ) ; } return mediaStream ; }
Gets a media stream by name
37,421
public void harvest ( RtpPortManager portManager ) throws HarvestException , NoCandidatesGatheredException { if ( this . selector == null || ! this . selector . isOpen ( ) ) { try { this . selector = Selector . open ( ) ; } catch ( IOException e ) { throw new HarvestException ( "Could not initialize selector" , e ) ; }...
Gathers all available candidates and sets the components of each media stream .
37,422
private void fireCandidatePairSelectedEvent ( ) { this . stop ( ) ; List < IceEventListener > listeners ; synchronized ( this . iceListeners ) { listeners = new ArrayList < IceEventListener > ( this . iceListeners ) ; } SelectedCandidatesEvent event = new SelectedCandidatesEvent ( this ) ; for ( IceEventListener listen...
Fires an event when all candidate pairs are selected .
37,423
public void getPayload ( byte [ ] buff , int offset ) { buffer . position ( FIXED_HEADER_SIZE ) ; buffer . get ( buff , offset , buffer . limit ( ) - FIXED_HEADER_SIZE ) ; }
Reads the data transported by RTP in a packet for example audio samples or compressed video data .
37,424
public void wrap ( boolean mark , int payloadType , int seqNumber , long timestamp , long ssrc , byte [ ] data , int offset , int len ) { buffer . clear ( ) ; buffer . rewind ( ) ; buffer . put ( ( byte ) 0x80 ) ; byte b = ( byte ) ( payloadType ) ; if ( mark ) { b = ( byte ) ( b | 0x80 ) ; } buffer . put ( b ) ; buffe...
Encapsulates data into the packet for transmission via RTP .
37,425
public int getExtensionLength ( ) { if ( ! getExtensionBit ( ) ) return 0 ; int extLenIndex = FIXED_HEADER_SIZE + getCsrcCount ( ) * 4 + 2 ; return ( ( buffer . get ( extLenIndex ) << 8 ) | buffer . get ( extLenIndex + 1 ) * 4 ) ; }
Returns the length of the extensions currently added to this packet .
37,426
public void grow ( int delta ) { if ( delta == 0 ) { return ; } int newLen = buffer . limit ( ) + delta ; if ( newLen <= buffer . capacity ( ) ) { buffer . limit ( newLen ) ; return ; } else { ByteBuffer newBuffer = buffer . isDirect ( ) ? ByteBuffer . allocateDirect ( newLen ) : ByteBuffer . allocate ( newLen ) ; buff...
Grow the internal packet buffer .
37,427
public MgcpEndpoint registerEndpoint ( String namespace ) throws UnrecognizedMgcpNamespaceException { MgcpEndpointProvider < ? > provider = this . providers . get ( namespace ) ; if ( provider == null ) { throw new UnrecognizedMgcpNamespaceException ( "Namespace " + namespace + " is unrecognized" ) ; } MgcpEndpoint end...
Registers a new endpoint .
37,428
public void unregisterEndpoint ( String endpointId ) throws MgcpEndpointNotFoundException { MgcpEndpoint endpoint = this . endpoints . remove ( endpointId ) ; if ( endpoint == null ) { throw new MgcpEndpointNotFoundException ( "Endpoint " + endpointId + " not found" ) ; } endpoint . forget ( ( MgcpMessageObserver ) thi...
Unregisters an active endpoint .
37,429
public void offer ( Event event ) { sequence += event . toString ( ) ; if ( patterns != null && sequence . length ( ) > 0 ) { for ( int i = 0 ; i < patterns . length ; i ++ ) { if ( sequence . matches ( patterns [ i ] ) ) { listener . patternMatches ( i , sequence ) ; sequence = "" ; return ; } } } if ( count > 0 && se...
Queues next event to the buffer .
37,430
private int getMax ( double data [ ] ) { int idx = 0 ; double max = data [ 0 ] ; for ( int i = 1 ; i < data . length ; i ++ ) { if ( max < data [ i ] ) { max = data [ i ] ; idx = i ; } } return idx ; }
Searches maximum value in the specified array .
37,431
private String getTone ( double f [ ] , double F [ ] ) { int fm = getMax ( f ) ; boolean fd = true ; for ( int i = 0 ; i < f . length ; i ++ ) { if ( fm == i ) { continue ; } double r = f [ fm ] / ( f [ i ] + 1E-15 ) ; if ( r < threshold ) { fd = false ; break ; } } if ( ! fd ) { return null ; } int Fm = getMax ( F ) ;...
Searches DTMF tone .
37,432
public void setMessageType ( char indicationType ) throws IllegalArgumentException { if ( ! isIndicationType ( indicationType ) && indicationType != StunMessage . OLD_DATA_INDICATION ) { throw new IllegalArgumentException ( ( int ) ( indicationType ) + " - is not a valid indication type." ) ; } super . setMessageType (...
Checks whether indicationType is a valid indication type and if yes sets it as the type of this instance .
37,433
public void run ( ) { if ( this . isActive ) { try { perform ( ) ; if ( this . listener != null ) { this . listener . onTerminate ( ) ; } } catch ( Exception e ) { logger . error ( "Could not execute task " + this . taskId + ": " + e . getMessage ( ) , e ) ; if ( this . listener != null ) { listener . handlerError ( e ...
call should not be synchronized since can run only once in queue cycle
37,434
public byte [ ] encode ( ) { char type = getAttributeType ( ) ; byte binValue [ ] = new byte [ HEADER_LENGTH + getDataLength ( ) ] ; binValue [ 0 ] = ( byte ) ( type >> 8 ) ; binValue [ 1 ] = ( byte ) ( type & 0x00FF ) ; binValue [ 2 ] = ( byte ) ( getDataLength ( ) >> 8 ) ; binValue [ 3 ] = ( byte ) ( getDataLength ( ...
Returns a binary representation of this attribute .
37,435
public void push ( String symbol ) { long now = System . currentTimeMillis ( ) ; if ( ! symbol . equals ( lastSymbol ) || ( now - lastActivity > interdigitInterval ) ) { lastActivity = now ; lastSymbol = symbol ; detectorImpl . fireEvent ( symbol ) ; } else lastActivity = now ; }
Handles inter digit intervals .
37,436
protected void queue ( DtmfEventImpl evt ) { if ( queue . size ( ) == size ) { queue . poll ( ) ; } queue . offer ( evt ) ; logger . info ( String . format ( "(%s) Buffer size: %d" , detectorImpl . getName ( ) , queue . size ( ) ) ) ; }
Queues specified event .
37,437
public void flush ( ) { logger . info ( String . format ( "(%s) Flush, buffer size: %d" , detectorImpl . getName ( ) , queue . size ( ) ) ) ; while ( queue . size ( ) > 0 ) detectorImpl . fireEvent ( queue . poll ( ) ) ; }
Flushes the buffer content .
37,438
public Date getCreationTime ( ) { calendar . set ( Calendar . YEAR , 1904 ) ; calendar . set ( Calendar . MONTH , Calendar . JANUARY ) ; calendar . set ( Calendar . DATE , 1 ) ; calendar . set ( Calendar . HOUR_OF_DAY , 0 ) ; calendar . set ( Calendar . MINUTE , 0 ) ; calendar . set ( Calendar . SECOND , 0 ) ; calendar...
Gets the creation time of this presentation .
37,439
public String generateFingerprint ( String hashFunction ) { try { this . hashFunction = hashFunction ; org . bouncycastle . crypto . tls . Certificate chain = TlsUtils . loadCertificateChain ( certificateResources ) ; Certificate certificate = chain . getCertificateAt ( 0 ) ; return TlsUtils . fingerprint ( this . hash...
Gets the fingerprint of the Certificate associated to the server .
37,440
public void getCipherStream ( BlockCipher aesCipher , byte [ ] out , int length , byte [ ] iv ) { System . arraycopy ( iv , 0 , cipherInBlock , 0 , 14 ) ; int ctr ; for ( ctr = 0 ; ctr < length / BLKLEN ; ctr ++ ) { cipherInBlock [ 14 ] = ( byte ) ( ( ctr & 0xFF00 ) >> 8 ) ; cipherInBlock [ 15 ] = ( byte ) ( ( ctr & 0x...
Computes the cipher stream for AES CM mode . See section 4 . 1 . 1 in RFC3711 for detailed description .
37,441
private void processComponents ( MAPDialogImpl mapDialogImpl , Component [ ] components ) { for ( Component c : components ) { doProcessComponent ( mapDialogImpl , c ) ; } }
private service methods
37,442
private void fireTCAbortACNNotSupported ( Dialog tcapDialog , MAPExtensionContainer mapExtensionContainer , ApplicationContextName alternativeApplicationContext , boolean returnMessageOnError ) throws MAPException { if ( this . getTCAPProvider ( ) . getPreviewMode ( ) ) { return ; } if ( tcapDialog . getApplicationCont...
Issue TC - U - ABORT with the abort reason = application - content - name - not - supported
37,443
protected void fireTCAbortUser ( Dialog tcapDialog , MAPUserAbortChoice mapUserAbortChoice , MAPExtensionContainer mapExtensionContainer , boolean returnMessageOnError ) throws MAPException { if ( this . getTCAPProvider ( ) . getPreviewMode ( ) ) { return ; } if ( tcapDialog . getApplicationContextName ( ) == null ) th...
Issue TC - U - ABORT with the ABRT apdu with MAPUserAbortInfo userInformation
37,444
protected void fireTCAbortProvider ( Dialog tcapDialog , MAPProviderAbortReason mapProviderAbortReason , MAPExtensionContainer mapExtensionContainer , boolean returnMessageOnError ) throws MAPException { if ( this . getTCAPProvider ( ) . getPreviewMode ( ) ) { return ; } if ( tcapDialog . getApplicationContextName ( ) ...
Issue TC - U - ABORT with the ABRT apdu with MAPProviderAbortInfo userInformation
37,445
protected void fireTCAbortV1 ( Dialog tcapDialog , boolean returnMessageOnError ) throws MAPException { if ( this . getTCAPProvider ( ) . getPreviewMode ( ) ) { return ; } TCUserAbortRequest tcUserAbort = this . getTCAPProvider ( ) . getDialogPrimitiveFactory ( ) . createUAbort ( tcapDialog ) ; if ( returnMessageOnErro...
Issue TC - U - ABORT without any apdu - for MAP V1
37,446
protected void startInitialAlignment ( boolean resetTxOffset ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( String . format ( "(%s) Starting initial alignment" , name ) ) ; } if ( resetTxOffset ) { this . txFrame . offset = 3 ; } this . reset ( ) ; this . setState ( MTP2_NOT_ALIGNED ) ; start_T2 ( ) ; }
should not be used
37,447
private void processRx ( byte [ ] buff , int len ) { int i = 0 ; while ( i < len ) { while ( rxState . bits <= 24 && i < len ) { int b = buff [ i ++ ] & 0xff ; hdlc . fasthdlc_rx_load_nocheck ( rxState , b ) ; if ( rxState . state == 0 ) { nCount = ( nCount + 1 ) % 16 ; if ( nCount == 0 ) { countError ( "on receive" ) ...
Handles received data .
37,448
private void countFrame ( ) { if ( state == MTP2_ALIGNED_READY || state == MTP2_INSERVICE ) { dCount = ( dCount + 1 ) % 256 ; if ( dCount == 0 && eCount > 0 ) { eCount -- ; } } }
Increment number of received frames decrement error monitor countor for each 256 good frames .
37,449
public static void main ( String [ ] args ) throws Throwable { String homeDir = getHomeDir ( args ) ; System . setProperty ( TRACE_PARSER_HOME , homeDir ) ; String dataDir = homeDir + File . separator + "data" + File . separator ; System . setProperty ( TRACE_PARSER_DATA , dataDir ) ; if ( ! initLOG4JProperties ( homeD...
private int httpPort = - 1 ;
37,450
protected void encode ( ByteBuffer txBuffer ) { txBuffer . position ( 4 ) ; txBuffer . put ( data ) ; int length = txBuffer . position ( ) ; txBuffer . rewind ( ) ; txBuffer . putInt ( length ) ; txBuffer . position ( length ) ; }
Encodes this message . The protocol is first 4 bytes are length of this command followed by the byte stream of command
37,451
public void initializeMessageNumbering ( SccpConnDt2MessageImpl msg ) { sendSequenceNumber = getNextSequenceNumber ( ) ; msg . setSequencing ( sendSequenceNumber , sendSequenceNumberExpectedAtInput ) ; inputWindow . setLowerEdge ( sendSequenceNumberExpectedAtInput ) ; }
IT DT2 AK
37,452
public boolean checkInputMessageNumbering ( SccpConnectionImpl conn , SequenceNumber sendSequenceNumber , SequenceNumber receiveSequenceNumber ) throws Exception { if ( sendSequenceNumber != null ) { if ( expectingFirstMessageInputAfterInit && ! sendSequenceNumber . equals ( new SequenceNumberImpl ( 0 ) ) ) { conn . re...
if true then message can be accepted
37,453
public void reinitialize ( ) { inputWindow = new SccpFlowControlWindow ( new SequenceNumberImpl ( 0 ) , maximumWindowSize ) ; outputWindow = new SccpFlowControlWindow ( new SequenceNumberImpl ( 0 ) , maximumWindowSize ) ; sendSequenceNumberExpectedAtInput = new SequenceNumberImpl ( 0 ) ; lastReceiveSequenceNumberReceiv...
after connection establishing and on connection reset
37,454
private void rebind ( Object stack ) throws NamingException { if ( jndiName != null ) { Context ctx = new InitialContext ( ) ; String [ ] tokens = jndiName . split ( "/" ) ; for ( int i = 0 ; i < tokens . length - 1 ; i ++ ) { if ( tokens [ i ] . trim ( ) . length ( ) > 0 ) { try { ctx = ( Context ) ctx . lookup ( toke...
Binds trunk object to the JNDI under the jndiName .
37,455
private void unbind ( String jndiName ) throws NamingException { InitialContext initialContext = new InitialContext ( ) ; initialContext . unbind ( jndiName ) ; }
Unbounds object under specified name .
37,456
public void handleHeartbeat ( Heartbeat hrtBeat ) { HeartbeatAck hrtBeatAck = ( HeartbeatAck ) this . aspFactoryImpl . messageFactory . createMessage ( MessageClass . ASP_STATE_MAINTENANCE , MessageType . HEARTBEAT_ACK ) ; hrtBeatAck . setHeartbeatData ( hrtBeat . getHeartbeatData ( ) ) ; this . aspFactoryImpl . write ...
If we receive Heartbeat we send back response
37,457
protected void reset ( ) { for ( RouteMap . Entry < String , RouteAsImpl > e = this . route . head ( ) , end = this . route . tail ( ) ; ( e = e . getNext ( ) ) != end ; ) { String key = e . getKey ( ) ; RouteAsImpl routeAs = e . getValue ( ) ; routeAs . setM3uaManagement ( this . m3uaManagement ) ; routeAs . reset ( )...
Reset the routeTable . Called after the persistance state of route is read from xml file .
37,458
public Message createMessage ( ByteBuffer buffer ) { if ( ! isHeaderReady ) { int len = Math . min ( MESSAGE_HEADER_SIZE - pos , buffer . remaining ( ) ) ; buffer . get ( header , pos , len ) ; pos += len ; isHeaderReady = pos == header . length ; if ( ! isHeaderReady ) { return null ; } length = ( ( header [ 0 ] & 0xf...
The received buffer may not have necessary bytes to decode a message . Instance of this factory keeps data locally till next set of data is received and a message can be successfully decoded
37,459
protected void encodeMandatoryVariableParameters ( Map < Integer , ISUPParameter > parameters , ByteArrayOutputStream bos , boolean isOptionalPartPresent ) throws ParameterException { try { byte [ ] pointers = null ; if ( ! mandatoryVariablePartPossible ( ) ) { if ( optionalPartIsPossible ( ) ) { if ( isOptionalPartPre...
takes care of endoding parameters - poniters and actual parameters .
37,460
protected int decodeMandatoryParameters ( ISUPParameterFactory parameterFactory , byte [ ] b , int index ) throws ParameterException { int localIndex = index ; if ( b . length - index >= 3 ) { try { byte [ ] cic = new byte [ 2 ] ; cic [ 0 ] = b [ index ++ ] ; cic [ 1 ] = b [ index ++ ] ; this . cic = new CircuitIdentif...
Unfortunelty this cant be generic can it?
37,461
protected int decodeMandatoryVariableParameters ( ISUPParameterFactory parameterFactory , byte [ ] b , int index ) throws ParameterException { int readCount = 0 ; if ( b . length - index > 0 ) { byte extPIndex = - 1 ; try { int count = getNumberOfMandatoryVariableLengthParameters ( ) ; readCount = count ; for ( int par...
decodes ptrs and returns offset from passed index value to first optional parameter parameter
37,462
private boolean addIncomingInvokeId ( Long invokeId ) { synchronized ( this . incomingInvokeList ) { if ( this . incomingInvokeList . contains ( invokeId ) ) return false ; else { this . incomingInvokeList . add ( invokeId ) ; return true ; } } }
Adding the new incoming invokeId into incomingInvokeList list
37,463
public void resetTimer ( Long invokeId ) throws TCAPException { try { this . dialogLock . lock ( ) ; int index = getIndexFromInvokeId ( invokeId ) ; InvokeImpl invoke = operationsSent [ index ] ; if ( invoke == null ) { throw new TCAPException ( "No operation with this ID" ) ; } invoke . startTimer ( ) ; } finally { th...
TC - TIMER - RESET
37,464
public static String hexDump ( String label , byte [ ] bytes ) { final int modulo = 16 ; final int brk = modulo / 2 ; int indent = ( label == null ) ? 0 : label . length ( ) ; StringBuffer sb = new StringBuffer ( indent + 1 ) ; while ( indent > 0 ) { sb . append ( " " ) ; indent -- ; } String ind = sb . toString ( ) ; ...
Construct a String containing a hex - dump of a byte array
37,465
public void setMaxSequenceNumber ( int maxSequenceNumber ) throws Exception { if ( this . isStarted ) throw new Exception ( "MaxSequenceNumber parameter can be updated only when M3UA stack is NOT running" ) ; if ( maxSequenceNumber < 1 ) { maxSequenceNumber = 1 ; } else if ( maxSequenceNumber > MAX_SEQUENCE_NUMBER ) { ...
Set the maximum SLS that can be used by SCTP . Internally SLS vs SCTP Stream Sequence Number is maintained . Stream Seq Number 0 is for management .
37,466
public void startAsp ( String aspName ) throws Exception { AspFactoryImpl aspFactoryImpl = this . getAspFactory ( aspName ) ; if ( aspFactoryImpl == null ) { throw new Exception ( String . format ( M3UAOAMMessages . NO_ASP_FOUND , aspName ) ) ; } if ( aspFactoryImpl . getStatus ( ) ) { throw new Exception ( String . fo...
This method should be called by management to start the ASP
37,467
public void add ( Mtp2 link ) { for ( int i = 0 ; i < links . length ; i ++ ) { if ( links [ i ] == null ) { links [ i ] = link ; break ; } } count ++ ; remap ( ) ; }
Adds link to this link set .
37,468
private void remap ( ) { int k = - 1 ; for ( int i = 0 ; i < map . length ; i ++ ) { boolean found = false ; for ( int j = k + 1 ; j < links . length ; j ++ ) { if ( links [ j ] != null ) { found = true ; k = j ; map [ i ] = k ; break ; } } if ( found ) { continue ; } for ( int j = 0 ; j < k ; j ++ ) { if ( links [ j ]...
This method is called each time when number of links has changed to reestablish relation between link selection indicator and link
37,469
protected Dialog createNewTCAPDialog ( SccpAddress origAddress , SccpAddress destAddress , Long localTrId ) throws MAPException { try { return this . mapProviderImpl . getTCAPProvider ( ) . getNewDialog ( origAddress , destAddress , localTrId ) ; } catch ( TCAPException e ) { throw new MAPException ( e . getMessage ( )...
Creating new outgoing TCAP Dialog . Used when creating a new outgoing MAP Dialog
37,470
private synchronized Long getAvailableTxId ( ) throws TCAPException { if ( this . dialogs . size ( ) >= this . stack . getMaxDialogs ( ) ) throw new TCAPException ( "Current dialog count exceeds its maximum value" ) ; while ( true ) { if ( this . curDialogId < this . stack . getDialogIdRangeStart ( ) ) this . curDialog...
some help methods ... crude but will work for first impl .
37,471
protected int getNextSeqControl ( ) { int res = seqControl . getAndIncrement ( ) ; if ( this . stack . getSlsRangeType ( ) == SlsRangeType . Odd ) { if ( res % 2 == 0 ) res ++ ; } else if ( this . stack . getSlsRangeType ( ) == SlsRangeType . Even ) { if ( res % 2 != 0 ) res ++ ; } res = res & 0xFF ; return res ; }
get next Seq Control value available
37,472
protected Dialog createNewTCAPDialog ( SccpAddress origAddress , SccpAddress destAddress , Long localTrId ) throws CAPException { try { return this . capProviderImpl . getTCAPProvider ( ) . getNewDialog ( origAddress , destAddress , localTrId ) ; } catch ( TCAPException e ) { throw new CAPException ( e . getMessage ( )...
Creating new outgoing TCAP Dialog . Used when creating a new outgoing CAP Dialog
37,473
public int encodeDigits ( ByteArrayOutputStream bos ) { boolean isOdd = this . oddFlag == _FLAG_ODD ; byte b = 0 ; int count = ( ! isOdd ) ? address . length ( ) : address . length ( ) - 1 ; int bytesCount = 0 ; for ( int i = 0 ; i < count - 1 ; i += 2 ) { String ds1 = address . substring ( i , i + 1 ) ; String ds2 = a...
This method is used in encode . Encodes digits part . This is because
37,474
public ShellChannel accept ( ) throws IOException { SocketChannel newChannel = ( ( ServerSocketChannel ) channel ) . accept ( ) ; if ( newChannel == null ) return null ; return new ShellChannelExt ( chanProvider , newChannel ) ; }
Accepts a connection made to this channel s socket .
37,475
private void parseSmsSignalInfo ( SmsSignalInfo si , boolean isMo , boolean isMt ) { if ( si == null ) return ; if ( isMo ) { try { SmsTpdu tpdu = si . decodeTpdu ( true ) ; parseSmsTpdu ( tpdu ) ; } catch ( MAPException e ) { e . printStackTrace ( ) ; } } if ( isMt ) { try { SmsTpdu tpdu = si . decodeTpdu ( false ) ; ...
SMS service listener
37,476
protected AspImpl getAspForNullRc ( ) { AspImpl aspImpl = ( AspImpl ) this . aspFactoryImpl . aspList . get ( 0 ) ; if ( this . aspFactoryImpl . aspList . size ( ) > 1 ) { ErrorCode errorCodeObj = this . aspFactoryImpl . parameterFactory . createErrorCode ( ErrorCode . Invalid_Routing_Context ) ; sendError ( null , err...
Get s the ASP for any ASP Traffic Maintenance Management Signalling Network Management and Transfer m3ua message s received which has null Routing Context
37,477
protected void sendTransferMessageToLocalUser ( Mtp3TransferPrimitive msg , int seqControl ) { if ( this . isStarted ) { MsgTransferDeliveryHandler hdl = new MsgTransferDeliveryHandler ( msg ) ; seqControl = seqControl & slsFilter ; this . msgDeliveryExecutors [ this . slsTable [ seqControl ] ] . execute ( hdl ) ; } el...
Deliver an incoming message to the local user
37,478
protected static String getHomeDir ( String [ ] args ) { if ( System . getenv ( HOME_DIR ) == null ) { if ( args . length > index ) { return args [ index ++ ] ; } else { return "." ; } } else { return System . getenv ( HOME_DIR ) ; } }
Gets the Media Server Home directory .
37,479
private void linkUp ( Mtp2 link ) { if ( link . mtp2Listener != null ) { link . mtp2Listener . linkUp ( ) ; } linkset . add ( link ) ; if ( linkset . isActive ( ) && this . mtp3Listener != null ) { try { mtp3Listener . linkUp ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } if ( logger . isInfoEnabled ( ) ...
Notify that link is up .
37,480
private boolean checkPattern ( Mtp2Buffer frame , int sltmLen , byte [ ] pattern ) { if ( sltmLen != pattern . length ) { return false ; } for ( int i = 0 ; i < pattern . length ; i ++ ) { if ( frame . frame [ i + PATTERN_OFFSET ] != pattern [ i ] ) { return false ; } } return true ; }
+ 2 becuase frame . len contains 2B for CRC
37,481
public static String bcdToHexString ( int encodingScheme , byte bcdByte ) throws UnsupportedEncodingException { StringBuilder sb = new StringBuilder ( ) ; byte leftNibble = ( byte ) ( bcdByte & 0xf0 ) ; leftNibble = ( byte ) ( leftNibble >>> 4 ) ; leftNibble = ( byte ) ( leftNibble & 0x0f ) ; byte rightNibble = ( byte ...
Converts single BCD encoded byte into String Hex representation .
37,482
public static String bcdDecodeToHexString ( int encodingScheme , byte [ ] bcdBytes ) throws UnsupportedEncodingException { StringBuilder sb = new StringBuilder ( ) ; for ( byte b : bcdBytes ) { sb . append ( bcdToHexString ( encodingScheme , b ) ) ; } if ( GenericDigits . _ENCODING_SCHEME_BCD_ODD == encodingScheme ) { ...
Decoded BCD encoded string into Hex digits string .
37,483
private PowerShell initalize ( String powerShellExecutablePath ) throws PowerShellNotAvailableException { String codePage = PowerShellCodepage . getIdentifierByCodePageName ( Charset . defaultCharset ( ) . name ( ) ) ; ProcessBuilder pb ; if ( OSDetector . isWindows ( ) ) { pb = new ProcessBuilder ( "cmd.exe" , "/c" , ...
Initializes PowerShell console in which we will enter the commands
37,484
public static PowerShellResponse executeSingleCommand ( String command ) { PowerShellResponse response = null ; try ( PowerShell session = PowerShell . openSession ( ) ) { response = session . executeCommand ( command ) ; } catch ( PowerShellNotAvailableException ex ) { logger . log ( Level . SEVERE , "PowerShell not a...
Execute a single command in PowerShell console and gets result
37,485
private void handleResponse ( PowerShellResponseHandler response , PowerShellResponse powerShellResponse ) { try { response . handle ( powerShellResponse ) ; } catch ( Exception ex ) { logger . log ( Level . SEVERE , "PowerShell not available" , ex ) ; } }
Handle response in callback way
37,486
@ SuppressWarnings ( "WeakerAccess" ) public PowerShellResponse executeScript ( String scriptPath , String params ) { BufferedReader srcReader ; try { srcReader = new BufferedReader ( new FileReader ( new File ( scriptPath ) ) ) ; } catch ( FileNotFoundException fnfex ) { logger . log ( Level . SEVERE , "Unexpected err...
Executed the provided PowerShell script in PowerShell console and gets result .
37,487
public PowerShellResponse executeScript ( BufferedReader srcReader , String params ) { PowerShellResponse response ; if ( srcReader != null ) { File tmpFile = createWriteTempFile ( srcReader ) ; if ( tmpFile != null ) { this . scriptMode = true ; response = executeCommand ( tmpFile . getAbsolutePath ( ) + " " + params ...
Execute the provided PowerShell script in PowerShell console and gets result .
37,488
private File createWriteTempFile ( BufferedReader srcReader ) { BufferedWriter tmpWriter = null ; File tmpFile = null ; try { tmpFile = File . createTempFile ( "psscript_" + new Date ( ) . getTime ( ) , ".ps1" , this . tempFolder ) ; if ( ! tmpFile . exists ( ) ) { return null ; } tmpWriter = new BufferedWriter ( new F...
Writes a temp powershell script file based on the srcReader
37,489
public void close ( ) { if ( ! this . closed ) { try { Future < String > closeTask = threadpool . submit ( ( ) -> { commandWriter . println ( "exit" ) ; p . waitFor ( ) ; return "OK" ; } ) ; if ( ! closeAndWait ( closeTask ) && this . pid > 0 ) { Logger . getLogger ( PowerShell . class . getName ( ) ) . log ( Level . I...
Closes all the resources used to maintain the PowerShell context
37,490
private File getTempFolder ( String tempPath ) { if ( tempPath != null ) { File folder = new File ( tempPath ) ; if ( folder . exists ( ) ) { return folder ; } } return null ; }
Return the temp folder File object or null if the path does not exist
37,491
public static String getIdentifierByCodePageName ( String cpName ) { if ( cpName != null ) { for ( Entry < String , String > codePage : codePages . entrySet ( ) ) { if ( codePage . getValue ( ) . toLowerCase ( ) . equals ( cpName . toLowerCase ( ) ) ) { return codePage . getKey ( ) ; } } } return "65001" ; }
Get the CodePage code from encoding value
37,492
public String call ( ) throws InterruptedException { StringBuilder powerShellOutput = new StringBuilder ( ) ; try { if ( startReading ( ) ) { readData ( powerShellOutput ) ; } } catch ( IOException ioe ) { Logger . getLogger ( PowerShell . class . getName ( ) ) . log ( Level . SEVERE , "Unexpected error reading PowerSh...
Calls the command and returns its output
37,493
private void readData ( StringBuilder powerShellOutput ) throws IOException { String line ; while ( null != ( line = this . reader . readLine ( ) ) ) { if ( this . scriptMode ) { if ( line . equals ( PowerShell . END_SCRIPT_STRING ) ) { break ; } } powerShellOutput . append ( line ) . append ( CRLF ) ; if ( ! this . sc...
Reads all data from output
37,494
private boolean startReading ( ) throws IOException , InterruptedException { while ( ! this . reader . ready ( ) ) { Thread . sleep ( this . waitPause ) ; if ( this . closed ) { return false ; } } return true ; }
Checks when we can start reading the output . Timeout if it takes too long in order to avoid hangs
37,495
private boolean canContinueReading ( ) throws IOException , InterruptedException { if ( ! this . reader . ready ( ) ) { Thread . sleep ( this . waitPause ) ; } if ( ! this . reader . ready ( ) ) { Thread . sleep ( 50 ) ; } return this . reader . ready ( ) ; }
Checks when we the reader can continue to read .
37,496
public static FilterBuilder any ( final Predicate ... alternatives ) { return new CommonFilterBuilder ( ) { public boolean matches ( Class < ? > klass ) { for ( Predicate alternative : alternatives ) { if ( alternative . matches ( klass ) ) { return true ; } } return false ; } } ; }
Returns a filter which satisfies any of the selected predicates .
37,497
protected final void indexAnnotations ( Class < ? > ... classes ) { for ( Class < ? > klass : classes ) { indexedAnnotations . add ( klass . getCanonicalName ( ) ) ; } annotationDriven = false ; }
Adds given annotations for indexing .
37,498
protected final void indexSubclasses ( Class < ? > ... classes ) { for ( Class < ? > klass : classes ) { indexedSuperclasses . add ( klass . getCanonicalName ( ) ) ; } annotationDriven = false ; }
Adds given classes for subclass indexing .
37,499
public final boolean isRouteExternal ( RouteHeader routeHeader ) { if ( routeHeader != null ) { javax . sip . address . SipURI routeUri = ( javax . sip . address . SipURI ) routeHeader . getAddress ( ) . getURI ( ) ; String routeTransport = routeUri . getTransportParam ( ) ; if ( routeTransport == null ) { routeTranspo...
Check if the route is external