public boolean checkInputMessageNumbering ( SccpConnectionImpl conn , SequenceNumber sendSequenceNumber , SequenceNumber receiveSequenceNumber ) throws Exception { if ( sendSequenceNumber != null ) { if ( expectingFirstMessageInputAfterInit && ! sendSequenceNumber . equals ( new SequenceNumberImpl ( 0 ) ) ) { // local procedure error conn . reset ( new ResetCauseImpl ( ResetCauseValue . MESSAGE_OUT_OF_ORDER_INCORRECT_PS ) ) ; return false ; } else if ( sendSequenceNumber . equals ( sendSequenceNumberExpectedAtInput ) && inputWindow . contains ( sendSequenceNumber ) ) { sendSequenceNumberExpectedAtInput = sendSequenceNumberExpectedAtInput . nextNumber ( ) ; } else { if ( ! inputWindow . contains ( sendSequenceNumber ) ) { conn . reset ( new ResetCauseImpl ( ResetCauseValue . REMOTE_PROCEDURE_ERROR_MESSAGE_OUT_OF_WINDOW ) ) ; } else if ( ! sendSequenceNumber . equals ( sendSequenceNumberExpectedAtInput ) ) { // local procedure error conn . resetSection ( new ResetCauseImpl ( ResetCauseValue . MESSAGE_OUT_OF_ORDER_INCORRECT_PS ) ) ; } return false ; } } if ( rangeContains ( lastReceiveSequenceNumberReceived , this . sendSequenceNumber . nextNumber ( ) , receiveSequenceNumber ) ) { outputWindow . setLowerEdge ( receiveSequenceNumber ) ; } else { conn . resetSection ( new ResetCauseImpl ( ResetCauseValue . MESSAGE_OUT_OF_ORDER_INCORRECT_PS ) ) ; return false ; } lastReceiveSequenceNumberReceived = receiveSequenceNumber ; expectingFirstMessageInputAfterInit = false ; return true ; }
if true then message can be accepted