idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
37,200 | public void setTransactionID ( byte [ ] tranID ) throws StunException { if ( tranID == null || ( tranID . length != TRANSACTION_ID_LENGTH && tranID . length != RFC3489_TRANSACTION_ID_LENGTH ) ) throw new StunException ( StunException . ILLEGAL_ARGUMENT , "Invalid transaction id length" ) ; int tranIDLength = tranID . l... | Copies the specified tranID and sets it as this message s transactionID . | 137 | 17 |
37,201 | public String getName ( ) { switch ( messageType ) { case ALLOCATE_REQUEST : return "ALLOCATE-REQUEST" ; case ALLOCATE_RESPONSE : return "ALLOCATE-RESPONSE" ; case ALLOCATE_ERROR_RESPONSE : return "ALLOCATE-ERROR-RESPONSE" ; case BINDING_REQUEST : return "BINDING-REQUEST" ; case BINDING_SUCCESS_RESPONSE : return "BINDI... | Returns the human readable name of this message . Message names do not really matter from the protocol point of view . They are only used for debugging and readability . | 426 | 32 |
37,202 | public byte [ ] encode ( ) throws IllegalStateException { prepareForEncoding ( ) ; // make sure we have everything necessary to encode a proper message validateAttributePresentity ( ) ; final char dataLength = getDataLength ( ) ; byte binMsg [ ] = new byte [ HEADER_LENGTH + dataLength ] ; int offset = 0 ; // STUN Messa... | Returns a binary representation of this message . | 695 | 8 |
37,203 | private void prepareForEncoding ( ) { // remove MESSAGE-INTEGRITY and FINGERPRINT attributes so that we can // make sure they are added at the end. StunAttribute msgIntAttr = removeAttribute ( StunAttribute . MESSAGE_INTEGRITY ) ; StunAttribute fingerprint = removeAttribute ( StunAttribute . FINGERPRINT ) ; // add a SO... | Adds attributes that have been requested vis configuration properties . Asserts attribute order where necessary . | 261 | 18 |
37,204 | private static void performAttributeSpecificActions ( StunAttribute attribute , byte [ ] binMessage , int offset , int msgLen ) throws StunException { // check finger print CRC if ( attribute instanceof FingerprintAttribute ) { if ( ! validateFingerprint ( ( FingerprintAttribute ) attribute , binMessage , offset , msgL... | Executes actions related specific attributes like asserting proper fingerprint checksum . | 112 | 13 |
37,205 | protected void validateAttributePresentity ( ) throws IllegalStateException { if ( ! rfc3489CompatibilityMode ) { return ; } for ( char i = StunAttribute . MAPPED_ADDRESS ; i < StunAttribute . REFLECTED_FROM ; i ++ ) { if ( getAttributePresentity ( i ) == M && getAttribute ( i ) == null ) { throw new IllegalStateExcept... | Verify that the message has all obligatory attributes and throw an exception if this is not the case . | 111 | 20 |
37,206 | public static SessionDescription buildSdp ( boolean offer , String localAddress , String externalAddress , MediaChannel ... channels ) { // Session-level fields SessionDescription sd = new SessionDescription ( ) ; sd . setVersion ( new VersionField ( ( short ) 0 ) ) ; String originAddress = ( externalAddress == null ||... | Builds a Session Description object to be sent to a remote peer . | 312 | 14 |
37,207 | public static void rejectMediaField ( SessionDescription answer , MediaDescriptionField media ) { MediaDescriptionField rejected = new MediaDescriptionField ( ) ; rejected . setMedia ( media . getMedia ( ) ) ; rejected . setPort ( 0 ) ; rejected . setProtocol ( media . getProtocol ( ) ) ; rejected . setPayloadTypes ( m... | Rejects a media description from an SDP offer . | 100 | 12 |
37,208 | protected void setDescriptor ( Text line ) throws ParseException { line . trim ( ) ; try { //split using equal sign Iterator < Text > it = line . split ( ' ' ) . iterator ( ) ; //skip first token (m) Text t = it . next ( ) ; //select second token (media_type port profile formats) t = it . next ( ) ; //split using white... | Reads values from specified text line | 270 | 7 |
37,209 | protected void addAttribute ( Text attribute ) { if ( attribute . startsWith ( SessionDescription . RTPMAP ) ) { addRtpMapAttribute ( attribute ) ; return ; } if ( attribute . startsWith ( SessionDescription . FMTP ) ) { addFmtAttribute ( attribute ) ; return ; } if ( attribute . startsWith ( SessionDescription . WEBRT... | Parses attribute . | 242 | 5 |
37,210 | private void addCandidate ( Text attribute ) { // Copy and trim the attribute Text attr = new Text ( ) ; attribute . copy ( attr ) ; attr . trim ( ) ; // Parse the candidate field and add it to list of candidates CandidateField candidateField = new CandidateField ( attr ) ; this . candidates . add ( candidateField ) ; ... | Parses a candidate field for ICE and register it on internal list . | 104 | 15 |
37,211 | protected void setConnection ( Text line ) throws ParseException { connection = new ConnectionField ( ) ; connection . strain ( line ) ; Collections . sort ( this . candidates ) ; } | Modify connection attribute . | 38 | 5 |
37,212 | private RTPFormat createFormat ( int payload , Text description ) { MediaType mtype = MediaType . fromDescription ( mediaType ) ; switch ( mtype ) { case AUDIO : return createAudioFormat ( payload , description ) ; case VIDEO : return createVideoFormat ( payload , description ) ; case APPLICATION : return createApplica... | Creates or updates format using payload number and text format description . | 83 | 13 |
37,213 | private RTPFormat createAudioFormat ( int payload , Text description ) { Iterator < Text > it = description . split ( ' ' ) . iterator ( ) ; //encoding name Text token = it . next ( ) ; token . trim ( ) ; EncodingName name = new EncodingName ( token ) ; //clock rate //TODO : convert to sample rate token = it . next ( )... | Creates or updates audio format using payload number and text format description . | 293 | 14 |
37,214 | private RTPFormat createVideoFormat ( int payload , Text description ) { Iterator < Text > it = description . split ( ' ' ) . iterator ( ) ; //encoding name Text token = it . next ( ) ; token . trim ( ) ; EncodingName name = new EncodingName ( token ) ; //clock rate //TODO : convert to frame rate token = it . next ( ) ... | Creates or updates video format using payload number and text format description . | 224 | 14 |
37,215 | private RTPFormat createApplicationFormat ( int payload , Text description ) { Iterator < Text > it = description . split ( ' ' ) . iterator ( ) ; //encoding name Text token = it . next ( ) ; token . trim ( ) ; EncodingName name = new EncodingName ( token ) ; //clock rate token = it . next ( ) ; token . trim ( ) ; RTPF... | Creates or updates application format using payload number and text format description . | 159 | 14 |
37,216 | private boolean isTypeValid ( char type ) { return ( type == MAPPED_ADDRESS || type == RESPONSE_ADDRESS || type == SOURCE_ADDRESS || type == CHANGED_ADDRESS || type == REFLECTED_FROM || type == XOR_MAPPED_ADDRESS || type == ALTERNATE_SERVER || type == XOR_PEER_ADDRESS || type == XOR_RELAYED_ADDRESS || type == DESTINATI... | Verifies that type is a valid address attribute type . | 121 | 11 |
37,217 | public static boolean isSubclass ( Class a , Class b ) { if ( a == b ) return false ; if ( ! ( b . isAssignableFrom ( a ) ) ) return false ; return true ; } | Is a a subclass of b? Strict . | 46 | 10 |
37,218 | public void append ( byte [ ] data , int len ) { if ( data == null || len <= 0 || len > data . length ) { throw new IllegalArgumentException ( "Invalid combination of parameters data and length to append()" ) ; } int oldLimit = buffer . limit ( ) ; // grow buffer if necessary grow ( len ) ; // set positing to begin wri... | Append a byte array to the end of the packet . This may change the data buffer of this packet . | 136 | 22 |
37,219 | public int readInt ( int off ) { this . buffer . rewind ( ) ; return ( ( buffer . get ( off ++ ) & 0xFF ) << 24 ) | ( ( buffer . get ( off ++ ) & 0xFF ) << 16 ) | ( ( buffer . get ( off ++ ) & 0xFF ) << 8 ) | ( buffer . get ( off ++ ) & 0xFF ) ; } | Read a integer from this packet at specified offset | 88 | 9 |
37,220 | public byte [ ] readRegion ( int off , int len ) { this . buffer . rewind ( ) ; if ( off < 0 || len <= 0 || off + len > this . buffer . limit ( ) ) { return null ; } byte [ ] region = new byte [ len ] ; this . buffer . get ( region , off , len ) ; return region ; } | Read a byte region from specified offset with specified length | 78 | 10 |
37,221 | public void readRegionToBuff ( int off , int len , byte [ ] outBuff ) { assert off >= 0 ; assert len > 0 ; assert outBuff != null ; assert outBuff . length >= len ; assert buffer . limit ( ) >= off + len ; buffer . position ( off ) ; buffer . get ( outBuff , 0 , len ) ; } | Read a byte region from specified offset in the RTP packet and with specified length into a given buffer | 75 | 20 |
37,222 | public int readUnsignedShortAsInt ( int off ) { this . buffer . position ( off ) ; int b1 = ( 0x000000FF & ( this . buffer . get ( ) ) ) ; int b2 = ( 0x000000FF & ( this . buffer . get ( ) ) ) ; int val = b1 << 8 | b2 ; return val ; } | Read an unsigned short at specified offset as a int | 79 | 10 |
37,223 | public long readUnsignedIntAsLong ( int off ) { buffer . position ( off ) ; return ( ( ( long ) ( buffer . get ( ) & 0xff ) << 24 ) | ( ( long ) ( buffer . get ( ) & 0xff ) << 16 ) | ( ( long ) ( buffer . get ( ) & 0xff ) << 8 ) | ( ( long ) ( buffer . get ( ) & 0xff ) ) ) & 0xFFFFFFFF L ; } | Read an unsigned integer as long at specified offset | 100 | 9 |
37,224 | public void shrink ( int delta ) { if ( delta <= 0 ) { return ; } int newLimit = buffer . limit ( ) - delta ; if ( newLimit <= 0 ) { newLimit = 0 ; } this . buffer . limit ( newLimit ) ; } | Shrink the buffer of this packet by specified length | 55 | 11 |
37,225 | public void recycle ( ) { while ( buffer . size ( ) > 0 ) buffer . poll ( ) . recycle ( ) ; if ( activeFrame != null ) activeFrame . recycle ( ) ; activeFrame = null ; activeData = null ; byteIndex = 0 ; } | Recycles input stream | 56 | 5 |
37,226 | public void bind ( boolean isLocal ) throws IOException , SocketException { try { rtpChannel = udpManager . open ( rtpHandler ) ; // if control enabled open rtcp channel as well if ( channelsManager . getIsControlEnabled ( ) ) { rtcpChannel = udpManager . open ( new RTCPHandler ( ) ) ; } } catch ( IOException e ) { thr... | Binds channel to the first available port . | 273 | 9 |
37,227 | public void setPeer ( SocketAddress address ) { this . remotePeer = address ; boolean connectImmediately = false ; if ( rtpChannel != null ) { if ( rtpChannel . isConnected ( ) ) try { rtpChannel . disconnect ( ) ; } catch ( IOException e ) { logger . error ( e ) ; } connectImmediately = udpManager . connectImmediately... | Sets the address of remote peer . | 235 | 8 |
37,228 | public void close ( ) { if ( rtpChannel != null ) { if ( rtpChannel . isConnected ( ) ) { try { rtpChannel . disconnect ( ) ; } catch ( IOException e ) { logger . error ( e ) ; } try { rtpChannel . socket ( ) . close ( ) ; rtpChannel . close ( ) ; } catch ( IOException e ) { logger . error ( e ) ; } } } if ( rtcpChanne... | Closes this socket . | 221 | 5 |
37,229 | public boolean isAvailable ( ) { // The channel is available is is connected boolean available = this . rtpChannel != null && this . rtpChannel . isConnected ( ) ; // In case of WebRTC calls the DTLS handshake must be completed if ( this . isWebRtc ) { available = available && this . webRtcHandler . isHandshakeComplete... | Checks whether the data channel is available for media exchange . | 86 | 12 |
37,230 | public void enableWebRTC ( Text remotePeerFingerprint ) { this . isWebRtc = true ; if ( this . webRtcHandler == null ) { this . webRtcHandler = new DtlsHandler ( this . dtlsServerProvider ) ; } this . webRtcHandler . setRemoteFingerprint ( "sha-256" , remotePeerFingerprint . toString ( ) ) ; } | Enables WebRTC encryption for the RTP channel . | 93 | 12 |
37,231 | public void open ( ) { // generate a new unique identifier for the channel this . ssrc = SsrcGenerator . generateSsrc ( ) ; this . statistics . setSsrc ( this . ssrc ) ; this . open = true ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " channel " + this . ssrc + " is open" ) ; } } | Enables the channel and activates it s resources . | 88 | 10 |
37,232 | public void close ( ) throws IllegalStateException { if ( this . open ) { // Close channels this . rtpChannel . close ( ) ; if ( ! this . rtcpMux ) { this . rtcpChannel . close ( ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " channel " + this . ssrc + " is closed" ) ; } // Reset state ... | Disables the channel and deactivates it s resources . | 122 | 12 |
37,233 | private void reset ( ) { // Reset codecs resetFormats ( ) ; // Reset channels if ( this . rtcpMux ) { this . rtcpMux = false ; } // Reset ICE if ( this . ice ) { disableICE ( ) ; } // Reset WebRTC if ( this . dtls ) { disableDTLS ( ) ; } // Reset statistics this . statistics . reset ( ) ; this . cname = "" ; this . ssr... | Resets the state of the channel . | 105 | 8 |
37,234 | protected void setFormats ( RTPFormats formats ) { try { this . rtpChannel . setFormatMap ( formats ) ; this . rtpChannel . setOutputFormats ( formats . getFormats ( ) ) ; } catch ( FormatNotSupportedException e ) { // Never happens logger . warn ( "Could not set output formats" , e ) ; } } | Sets the supported codecs of the RTP components . | 78 | 12 |
37,235 | public void bind ( boolean isLocal , boolean rtcpMux ) throws IOException , IllegalStateException { this . rtpChannel . bind ( isLocal , rtcpMux ) ; if ( ! rtcpMux ) { this . rtcpChannel . bind ( isLocal , this . rtpChannel . getLocalPort ( ) + 1 ) ; } this . rtcpMux = rtcpMux ; if ( logger . isDebugEnabled ( ) ) { log... | Binds the RTP and RTCP components to a suitable address and port . | 250 | 17 |
37,236 | public void connectRtp ( SocketAddress address ) { this . rtpChannel . setRemotePeer ( address ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " RTP channel " + this . ssrc + " connected to remote peer " + address . toString ( ) ) ; } } | Connected the RTP component to the remote peer . | 73 | 11 |
37,237 | public void bindRtcp ( boolean isLocal , int port ) throws IOException , IllegalStateException { if ( this . ice ) { throw new IllegalStateException ( "Cannot bind when ICE is enabled" ) ; } this . rtcpChannel . bind ( isLocal , port ) ; this . rtcpMux = ( port == this . rtpChannel . getLocalPort ( ) ) ; } | Binds the RTCP component to a suitable address and port . | 87 | 14 |
37,238 | public void connectRtcp ( SocketAddress remoteAddress ) { this . rtcpChannel . setRemotePeer ( remoteAddress ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " RTCP channel " + this . ssrc + " has connected to remote peer " + remoteAddress . toString ( ) ) ; } } | Connects the RTCP component to the remote peer . | 80 | 12 |
37,239 | protected RTPFormats buildRTPMap ( RTPFormats profile ) { RTPFormats list = new RTPFormats ( ) ; Formats fmts = new Formats ( ) ; if ( this . rtpChannel . getOutputDsp ( ) != null ) { Codec [ ] currCodecs = this . rtpChannel . getOutputDsp ( ) . getCodecs ( ) ; for ( int i = 0 ; i < currCodecs . length ; i ++ ) { if ( ... | Constructs RTP payloads for given channel . | 253 | 10 |
37,240 | public void negotiateFormats ( MediaDescriptionField media ) { // Clean currently offered formats this . offeredFormats . clean ( ) ; // Map payload types to RTP Format for ( String payloadType : media . getPayloadTypes ( ) ) { RTPFormat format ; try { int payloadTypeInt = Integer . parseInt ( payloadType ) ; if ( payl... | Negotiates the list of supported codecs with the remote peer over SDP . | 406 | 17 |
37,241 | public void enableICE ( String externalAddress , boolean rtcpMux ) { if ( ! this . ice ) { this . ice = true ; this . rtcpMux = rtcpMux ; this . iceAuthenticator . generateIceCredentials ( ) ; // Enable ICE on RTP channels this . rtpChannel . enableIce ( this . iceAuthenticator ) ; if ( ! rtcpMux ) { this . rtcpChannel... | Enables ICE on the channel . | 148 | 7 |
37,242 | public void disableICE ( ) { if ( this . ice ) { this . ice = false ; this . iceAuthenticator . reset ( ) ; // Disable ICE on RTP channels this . rtpChannel . disableIce ( ) ; if ( ! rtcpMux ) { this . rtcpChannel . disableIce ( ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " channel " ... | Disables ICE and closes ICE - related resources | 109 | 9 |
37,243 | public void disableDTLS ( ) { if ( this . dtls ) { this . rtpChannel . disableSRTP ( ) ; if ( ! this . rtcpMux ) { this . rtcpChannel . disableSRTCP ( ) ; } this . dtls = false ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " channel " + this . ssrc + " disabled DTLS" ) ; } } } | Disables DTLS and closes related resources . | 103 | 9 |
37,244 | public static long calculateLastSrTimestamp ( long ntp1 , long ntp2 ) { byte [ ] high = uIntLongToByteWord ( ntp1 ) ; byte [ ] low = uIntLongToByteWord ( ntp2 ) ; low [ 3 ] = low [ 1 ] ; low [ 2 ] = low [ 0 ] ; low [ 1 ] = high [ 3 ] ; low [ 0 ] = high [ 2 ] ; return bytesToUIntLong ( low , 0 ) ; } | Calculates the time stamp of the last received SR . | 108 | 12 |
37,245 | private static byte [ ] uIntLongToByteWord ( long j ) { int i = ( int ) j ; byte [ ] byteWord = new byte [ 4 ] ; byteWord [ 0 ] = ( byte ) ( ( i >>> 24 ) & 0x000000FF ) ; byteWord [ 1 ] = ( byte ) ( ( i >> 16 ) & 0x000000FF ) ; byteWord [ 2 ] = ( byte ) ( ( i >> 8 ) & 0x000000FF ) ; byteWord [ 3 ] = ( byte ) ( i & 0x00... | Converts an unsigned 32 bit integer stored in a long into an array of bytes . | 125 | 17 |
37,246 | public void commit ( ) throws IOException { // assures we perform the close operation only once. if ( open . compareAndSet ( true , false ) ) { // flush & close fout . force ( true ) ; fout . close ( ) ; // if the current file exists, and append is true, then append samples and remove temp file // otherwise write heade... | Commit this sink . Causes to prevent any further write operations and commits temporary file to target . When this returns Sink is done and cannot be used again . | 193 | 32 |
37,247 | protected void release ( ) { stack . getLocalTransactions ( ) . remove ( Integer . valueOf ( localTID ) ) ; stack . getRemoteTxToLocalTxMap ( ) . remove ( Integer . valueOf ( remoteTID ) ) ; cancelTHISTTimerTask ( ) ; cancelLongtranTimer ( ) ; cancelReTransmissionTimer ( ) ; if ( originalPacket != null ) stack . releas... | Release this transaction and frees all allocated resources . | 103 | 10 |
37,248 | private void send ( JainMgcpCommandEvent event ) { sent = true ; String host = "" ; int port = 0 ; switch ( event . getObjectIdentifier ( ) ) { case Constants . CMD_NOTIFY : Notify notifyCommand = ( Notify ) event ; NotifiedEntity notifiedEntity = notifyCommand . getNotifiedEntity ( ) ; if ( notifiedEntity == null ) { ... | Sends MGCP command from the application to the endpoint specified in the message . | 635 | 16 |
37,249 | private void send ( JainMgcpResponseEvent event ) { cancelLongtranTimer ( ) ; // to send response we already should know the address and port // number from which the original request was received if ( remoteAddress == null ) { throw new IllegalArgumentException ( "Unknown orinator address" ) ; } // restore the origina... | Sends MGCP response message from the application to the host from wich origination command was received . | 367 | 21 |
37,250 | public void receiveResponse ( byte [ ] data , SplitDetails [ ] msg , Integer txID , ReturnCode returnCode ) { cancelReTransmissionTimer ( ) ; cancelLongtranTimer ( ) ; JainMgcpResponseEvent event = null ; try { event = decodeResponse ( data , msg , txID , returnCode ) ; } catch ( Exception e ) { logger . error ( "Could... | Used by stack for relaying received MGCP response messages to the application . | 174 | 15 |
37,251 | private void fireEvent ( RecorderEventImpl event ) { eventSender . event = event ; scheduler . submit ( eventSender , PriorityQueueScheduler . INPUT_QUEUE ) ; } | Fires specified event | 44 | 4 |
37,252 | public void accept ( Task task ) { if ( ( activeIndex + 1 ) % 2 == 0 ) { if ( ! task . isInQueue0 ( ) ) { taskList [ 0 ] . offer ( task ) ; task . storedInQueue0 ( ) ; } } else { if ( ! task . isInQueue1 ( ) ) { taskList [ 1 ] . offer ( task ) ; task . storedInQueue1 ( ) ; } } } | Queues specified task using tasks dead line time . | 95 | 10 |
37,253 | public boolean reverseTransformPacket ( RawPacket pkt ) { boolean decrypt = false ; int tagLength = policy . getAuthTagLength ( ) ; int indexEflag = pkt . getSRTCPIndex ( tagLength ) ; if ( ( indexEflag & 0x80000000 ) == 0x80000000 ) { decrypt = true ; } int index = indexEflag & ~ 0x80000000 ; /* Replay control */ if (... | Transform a SRTCP packet into a RTCP packet . This method is called when a SRTCP packet was received . | 439 | 26 |
37,254 | private void computeIv ( byte label ) { for ( int i = 0 ; i < 14 ; i ++ ) { ivStore [ i ] = masterSalt [ i ] ; } ivStore [ 7 ] ^= label ; ivStore [ 14 ] = ivStore [ 15 ] = 0 ; } | Compute the initialization vector used later by encryption algorithms based on the label . | 61 | 15 |
37,255 | public void deriveSrtcpKeys ( ) { // compute the session encryption key byte label = 3 ; computeIv ( label ) ; KeyParameter encryptionKey = new KeyParameter ( masterKey ) ; cipher . init ( true , encryptionKey ) ; Arrays . fill ( masterKey , ( byte ) 0 ) ; cipherCtr . getCipherStream ( cipher , encKey , policy . getEnc... | Derives the srtcp session keys from the master key . | 342 | 13 |
37,256 | public static TransportAddress applyXor ( TransportAddress address , byte [ ] transactionID ) { byte [ ] addressBytes = address . getAddressBytes ( ) ; char port = ( char ) address . getPort ( ) ; char portModifier = ( char ) ( ( transactionID [ 0 ] << 8 & 0x0000FF00 ) | ( transactionID [ 1 ] & 0x000000FF ) ) ; port ^=... | Returns the result of applying XOR on the specified attribute s address . The method may be used for both encoding and decoding XorMappedAddresses . | 193 | 31 |
37,257 | public TransportAddress getAddress ( byte [ ] transactionID ) { byte [ ] xorMask = new byte [ 16 ] ; System . arraycopy ( StunMessage . MAGIC_COOKIE , 0 , xorMask , 0 , 4 ) ; System . arraycopy ( transactionID , 0 , xorMask , 4 , 12 ) ; return applyXor ( xorMask ) ; } | Returns the result of applying XOR on this attribute s address using the specified transaction ID when converting IPv6 addresses . | 82 | 23 |
37,258 | public void setAddress ( TransportAddress address , byte [ ] transactionID ) { byte [ ] xorMask = new byte [ 16 ] ; System . arraycopy ( StunMessage . MAGIC_COOKIE , 0 , xorMask , 0 , 4 ) ; System . arraycopy ( transactionID , 0 , xorMask , 4 , 12 ) ; TransportAddress xorAddress = applyXor ( address , xorMask ) ; super... | Applies a XOR mask to the specified address and then sets it as the value transported by this attribute . | 102 | 22 |
37,259 | public void setErrorClass ( byte errorClass ) throws IllegalArgumentException { if ( errorClass < 0 || errorClass > 99 ) { throw new IllegalArgumentException ( errorClass + "Only error classes between 0 and 99 are valid. Current class: " + errorClass ) ; } this . errorClass = errorClass ; } | Sets the class of the error . | 69 | 8 |
37,260 | public static String getDefaultReasonPhrase ( char errorCode ) { switch ( errorCode ) { case BAD_REQUEST : return "(Bad Request): The request was malformed. The client should not " + "retry the request without modification from the previous attempt." ; case UNAUTHORIZED : return "(Unauthorized): The Binding Request did... | Returns a default reason phrase corresponding to the specified error code as described by rfc 3489 . | 414 | 19 |
37,261 | @ Override public void write ( RtpPacket packet , RTPFormat format ) { // checking format if ( format == null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "No format specified. Packet dropped!" ) ; } return ; } boolean locked = false ; try { locked = this . lock . tryLock ( ) || this . lock . tryLock ( 5 ,... | Accepts specified packet | 174 | 4 |
37,262 | public Frame read ( long timestamp ) { Frame frame = null ; boolean locked = false ; try { locked = this . lock . tryLock ( ) || this . lock . tryLock ( 5 , TimeUnit . MILLISECONDS ) ; if ( locked ) { frame = safeRead ( ) ; } else { this . ready . set ( false ) ; } } catch ( InterruptedException e ) { if ( logger . isT... | Polls packet from buffer s head . | 143 | 8 |
37,263 | public void reset ( ) { boolean locked = false ; try { locked = lock . tryLock ( ) || lock . tryLock ( 5 , TimeUnit . MILLISECONDS ) ; if ( locked ) { while ( queue . size ( ) > 0 ) { queue . remove ( 0 ) . recycle ( ) ; } } } catch ( InterruptedException e ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Cou... | Resets buffer . | 124 | 4 |
37,264 | public void addFieldParser ( char type , SdpParser < ? extends SdpField > parser ) { synchronized ( this . fieldParsers ) { this . fieldParsers . put ( type , parser ) ; } } | Adds a parser to the pipeline . | 48 | 7 |
37,265 | public void addAttributeParser ( String type , SdpParser < ? extends AttributeField > parser ) { synchronized ( this . attributeParsers ) { this . attributeParsers . put ( type , parser ) ; } } | Adds an attribute parser to the pipeline . | 48 | 8 |
37,266 | private Transition find ( String name ) { for ( Transition t : transitions ) { if ( t . getName ( ) . matches ( name ) ) { return t ; } } return null ; } | Searches transition with specified name . | 40 | 8 |
37,267 | public void joinRtpSession ( ) { if ( ! this . joined . get ( ) ) { // Schedule first RTCP packet long t = this . statistics . rtcpInterval ( this . initial . get ( ) ) ; this . tn = this . statistics . getCurrentTime ( ) + t ; scheduleRtcp ( this . tn , RtcpPacketType . RTCP_REPORT ) ; // Start SSRC timeout timer this... | Upon joining the session the participant initializes tp to 0 tc to 0 senders to 0 pmembers to 1 members to 1 we_sent to false rtcp_bw to the specified fraction of the session bandwidth initial to true and avg_rtcp_size to the probable size of the first RTCP packet that the application will later construct . | 163 | 74 |
37,268 | private void scheduleRtcp ( long timestamp , RtcpPacketType packetType ) { // Create the task and schedule it long interval = resolveInterval ( timestamp ) ; this . scheduledTask = new TxTask ( packetType ) ; try { this . reportTaskFuture = this . scheduler . schedule ( this . scheduledTask , interval , TimeUnit . MILL... | Schedules an event to occur at a certain time . | 145 | 12 |
37,269 | private void rescheduleRtcp ( TxTask task , long timestamp ) { // Cancel current execution of the task this . reportTaskFuture . cancel ( true ) ; // Re-schedule task execution long interval = resolveInterval ( timestamp ) ; try { this . reportTaskFuture = this . scheduler . schedule ( task , interval , TimeUnit . MILL... | Re - schedules a previously scheduled event . | 121 | 8 |
37,270 | private void closeChannel ( ) { if ( this . channel != null ) { if ( this . channel . isConnected ( ) ) { try { this . channel . disconnect ( ) ; } catch ( IOException e ) { logger . warn ( e . getMessage ( ) , e ) ; } } if ( this . channel . isOpen ( ) ) { try { this . channel . close ( ) ; } catch ( IOException e ) {... | Disconnects and closes the datagram channel used to send and receive RTCP traffic . | 111 | 19 |
37,271 | private boolean decode_WSP ( ) { boolean decoded = false ; if ( index < totalChars && ( chars [ index ] == 0x20 || chars [ index ] == 0x09 ) ) { index ++ ; decoded = true ; } return decoded ; } | Decode Space or HTAB | 58 | 7 |
37,272 | public double [ ] perform ( double [ ] buffer , int len ) { int size = ( int ) ( ( double ) F / f * len ) ; double signal [ ] = new double [ size ] ; double dx = 1. / ( double ) f ; double dX = 1. / ( double ) F ; signal [ 0 ] = buffer [ 0 ] ; double k = 0 ; for ( int i = 1 ; i < size - 1 ; i ++ ) { double X = i * dX ;... | Performs resampling of the given signal . | 206 | 10 |
37,273 | public void strain ( byte [ ] data , int pos , int len ) { this . chars = data ; this . pos = pos ; this . len = len ; this . linePointer = 0 ; } | Strains this object into the memory area . | 43 | 9 |
37,274 | public void duplicate ( Text destination ) { System . arraycopy ( chars , pos , destination . chars , destination . pos , len ) ; destination . len = len ; } | Copies data from this buffer to another buffer . | 35 | 10 |
37,275 | public int divide ( char separator , Text [ ] parts ) { int pointer = pos ; int limit = pos + len ; int mark = pointer ; int count = 0 ; while ( pointer < limit ) { if ( chars [ pointer ] == separator ) { parts [ count ] . strain ( chars , mark , pointer - mark ) ; mark = pointer + 1 ; count ++ ; if ( count == parts . ... | Divides text into parts using given separator and writes results into the parts array . | 129 | 17 |
37,276 | public void trim ( ) { try { //cut white spaces from the head while ( len > 0 && chars [ pos ] == ' ' ) { pos ++ ; len -- ; } //cut from the end while ( len > 0 && ( chars [ pos + len - 1 ] == ' ' || chars [ pos + len - 1 ] == ' ' || chars [ pos + len - 1 ] == ' ' ) ) { len -- ; } } catch ( Exception e ) { System . out... | Removes whitespace from the head and tail of the string . | 119 | 13 |
37,277 | public Text nextLine ( ) { if ( linePointer == 0 ) { linePointer = pos ; } else { linePointer ++ ; } int mark = linePointer ; int limit = pos + len ; while ( linePointer < limit && chars [ linePointer ] != ' ' ) { linePointer ++ ; } return new Text ( chars , mark , linePointer - mark ) ; } | Extracts next line from this text . | 86 | 9 |
37,278 | private boolean compareChars ( byte [ ] chars , int pos ) { for ( int i = 0 ; i < len ; i ++ ) { if ( differentChars ( ( char ) this . chars [ i + this . pos ] , ( char ) chars [ i + pos ] ) ) return false ; } return true ; } | Compares specified character string with current string . The upper and lower case characters are considered as equals . | 69 | 20 |
37,279 | public boolean startsWith ( Text pattern ) { if ( pattern == null ) { return false ; } return this . subSequence ( 0 , pattern . len ) . equals ( pattern ) ; } | Indicates whether the text starts with a certain pattern . | 40 | 11 |
37,280 | private boolean differentChars ( char c1 , char c2 ) { if ( 65 <= c1 && c1 < 97 ) { c1 += 32 ; } if ( 65 <= c2 && c2 < 97 ) { c2 += 32 ; } return c1 != c2 ; } | Compares two chars . | 61 | 5 |
37,281 | public int toInteger ( ) throws NumberFormatException { int res = 0 ; byte currChar ; int i = 1 ; currChar = chars [ pos ] ; boolean isMinus = false ; if ( currChar == minus_byte ) isMinus = true ; else if ( currChar >= zero_byte && currChar <= nine_byte ) res += currChar - zero_byte ; else throw new NumberFormatExcept... | Converts string value to integer | 191 | 6 |
37,282 | public void copyRemainder ( Text other ) { other . chars = this . chars ; other . pos = this . linePointer + 1 ; other . len = this . len - this . linePointer - 1 ; } | Copies substring from the current line upto the end to the specified destination . | 48 | 17 |
37,283 | public boolean contains ( char c ) { for ( int k = pos ; k < len ; k ++ ) { if ( chars [ k ] == c ) return true ; } return false ; } | Checks does specified symbol is present in this text . | 40 | 11 |
37,284 | public void attach ( RequestIdentifier reqID , JainMgcpListener listener ) { this . requestListeners . put ( reqID . toString ( ) . trim ( ) , listener ) ; } | Attaches listener to the specific request . | 43 | 8 |
37,285 | public void deattach ( JainMgcpListener listener ) { int identifier = - 1 ; //search identifier of the specified listener Set < Integer > IDs = txListeners . keySet ( ) ; for ( Integer id : IDs ) { if ( txListeners . get ( id ) == listener ) { identifier = id ; break ; } } //remove it from list if found if ( identifier... | Deattaches transaction listener upon user request . | 98 | 9 |
37,286 | public boolean isSenderTimeout ( ) { long t = rtcpReceiverInterval ( false ) ; long minTime = getCurrentTime ( ) - ( 2 * t ) ; if ( this . rtpSentOn < minTime ) { removeSender ( this . ssrc ) ; } return this . weSent ; } | Checks whether this SSRC is still a sender . | 70 | 11 |
37,287 | public void strain ( Text line ) throws ParseException { try { Iterator < Text > it = line . split ( ' ' ) . iterator ( ) ; it . next ( ) ; Text token = it . next ( ) ; it = token . split ( ' ' ) . iterator ( ) ; name = it . next ( ) ; name . trim ( ) ; sessionID = it . next ( ) ; sessionID . trim ( ) ; sessionVersion ... | Reads attribute from text . | 179 | 6 |
37,288 | private void setupAudioChannelInbound ( MediaDescriptionField remoteAudio ) throws IOException { // Negotiate audio codecs this . audioChannel . negotiateFormats ( remoteAudio ) ; if ( ! this . audioChannel . containsNegotiatedFormats ( ) ) { throw new IOException ( "Audio codecs were not supported" ) ; } // Bind audio... | Reads the remote SDP offer and sets up the available resources according to the call type . | 331 | 19 |
37,289 | private void setupAudioChannelOutbound ( MediaDescriptionField remoteAudio ) throws IOException { // Negotiate audio codecs this . audioChannel . negotiateFormats ( remoteAudio ) ; if ( ! this . audioChannel . containsNegotiatedFormats ( ) ) { throw new IOException ( "Audio codecs were not supported" ) ; } // connect t... | Reads the remote SDP answer and sets up the proper media channels . | 433 | 15 |
37,290 | public boolean removeHandler ( PacketHandler handler ) { synchronized ( this . handlers ) { boolean removed = this . handlers . remove ( handler ) ; if ( removed ) { this . count . decrementAndGet ( ) ; } return removed ; } } | Removes an existing packet handler from the pipeline . | 52 | 10 |
37,291 | public PacketHandler getHandler ( byte [ ] packet ) { synchronized ( this . handlers ) { // Search for the first handler capable of processing the packet for ( PacketHandler protocolHandler : this . handlers ) { if ( protocolHandler . canHandle ( packet ) ) { return protocolHandler ; } } // Return null in case no handl... | Gets the protocol handler capable of processing the packet . | 80 | 11 |
37,292 | public void close ( ) { stopped = true ; try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Closing socket" ) ; } // selector.close(); socket . close ( ) ; if ( this . channel != null ) { this . channel . close ( ) ; } for ( int i = 0 ; i < decodingThreads . length ; i ++ ) { decodingThreads [ i ] . shutdown ... | Closes the stack and it s underlying resources . | 132 | 10 |
37,293 | public boolean reverseTransformPacket ( RawPacket pkt ) { int seqNo = pkt . getSequenceNumber ( ) ; if ( ! seqNumSet ) { seqNumSet = true ; seqNum = seqNo ; } // Guess the SRTP index (48 bit), see rFC 3711, 3.3.1 // Stores the guessed roc in this.guessedROC long guessedIndex = guessIndex ( seqNo ) ; // Replay control i... | Transform a SRTP packet into a RTP packet . This method is called when a SRTP packet is received . | 404 | 23 |
37,294 | private void authenticatePacketHMCSHA1 ( RawPacket pkt , int rocIn ) { ByteBuffer buf = pkt . getBuffer ( ) ; buf . rewind ( ) ; int len = buf . remaining ( ) ; buf . get ( tempBuffer , 0 , len ) ; mac . update ( tempBuffer , 0 , len ) ; rbStore [ 0 ] = ( byte ) ( rocIn >> 24 ) ; rbStore [ 1 ] = ( byte ) ( rocIn >> 16 ... | Authenticate a packet . Calculated authentication tag is returned . | 172 | 12 |
37,295 | private void computeIv ( long label , long index ) { long key_id ; if ( keyDerivationRate == 0 ) { key_id = label << 48 ; } else { key_id = ( ( label << 48 ) | ( index / keyDerivationRate ) ) ; } for ( int i = 0 ; i < 7 ; i ++ ) { ivStore [ i ] = masterSalt [ i ] ; } for ( int i = 7 ; i < 14 ; i ++ ) { ivStore [ i ] = ... | Compute the initialization vector used later by encryption algorithms based on the lable the packet index key derivation rate and master salt key . | 161 | 27 |
37,296 | @ Override public Dsp newProcessor ( ) throws InstantiationException , ClassNotFoundException , IllegalAccessException { int numClasses = this . classes . size ( ) ; Codec [ ] codecs = new Codec [ numClasses ] ; for ( int i = 0 ; i < numClasses ; i ++ ) { String fqn = this . classes . get ( i ) ; Class < ? > codecClass... | Creates new DSP . | 139 | 6 |
37,297 | private Node < E > extract ( ) { Node < E > current = head ; head = head . next ; current . item = head . item ; head . item = null ; return current ; } | Removes a node from head of queue | 41 | 8 |
37,298 | private void estimateJitter ( RtpPacket packet ) { long transit = rtpClock . getLocalRtpTime ( ) - packet . getTimestamp ( ) ; long d = transit - this . currentTransit ; this . currentTransit = transit ; if ( d < 0 ) { d = - d ; } this . jitter += d - ( ( this . jitter + 8 ) >> 4 ) ; } | Calculates interarrival jitter interval . | 89 | 10 |
37,299 | public static AudioFormat createAudioFormat ( EncodingName name ) { //check name and create specific if ( name . equals ( DTMF ) ) { return new DTMFFormat ( ) ; } //default format return new AudioFormat ( name ) ; } | Creates new audio format descriptor . | 55 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.