예제 #1
0
        public bool sameAs(ReConfigChunk other)
        {
            // we ignore other var types for now....
            bool ret = false; // assume the negative.

            if (other != null)
            {
                // if there are 2 params and both match
                if ((this.hasIncomingReset() && other.hasIncomingReset()) &&
                    (this.hasOutgoingReset() && other.hasOutgoingReset()))
                {
                    ret = this.getIncomingReset().sameAs(other.getIncomingReset()) &&
                          this.getOutgoingReset().sameAs(other.getOutgoingReset());
                }
                else
                {
                    // there is only one (of these) params
                    // that has to match too
                    if (this.hasIncomingReset() && other.hasIncomingReset())
                    {
                        ret = this.getIncomingReset().sameAs(other.getIncomingReset());
                    }
                    if (this.hasOutgoingReset() && other.hasOutgoingReset())
                    {
                        ret = this.getOutgoingReset().sameAs(other.getOutgoingReset());
                    }
                }
            }
            return(ret);
        }
예제 #2
0
        /*
         * https://tools.ietf.org/html/rfc6525
         */
        public Chunk[] deal(ReConfigChunk rconf)
        {
            Chunk[]       ret   = new Chunk[1];
            ReConfigChunk reply = null;

            //logger.LogDebug("Got a reconfig message to deal with");
            if (haveSeen(rconf))
            {
                // if not - is this a repeat
                reply = getPrevious(rconf); // then send the same reply
            }
            if (reply == null)
            {
                // not a repeat then
                reply = new ReConfigChunk(); // create a new thing
                if (rconf.hasOutgoingReset())
                {
                    OutgoingSSNResetRequestParameter oreset = rconf.getOutgoingReset();
                    int[] streams = oreset.getStreams();
                    if (streams.Length == 0)
                    {
                        streams = assoc.allStreams();
                    }
                    if (timerIsRunning())
                    {
                        markAsAcked(rconf);
                    }
                    // if we are behind, we are supposed to wait until we catch up.
                    if (oreset.getLastAssignedTSN() > assoc.getCumAckPt())
                    {
                        //logger.LogDebug("Last assigned > farTSN " + oreset.getLastAssignedTSN() + " v " + assoc.getCumAckPt());
                        foreach (int s in streams)
                        {
                            SCTPStream defstr = assoc.getStream(s);
                            // AC: All this call did was set an unused local variable. Removed for now.
                            //defstr.setDeferred(true);
                        }
                        ReconfigurationResponseParameter rep = new ReconfigurationResponseParameter();
                        rep.setSeq(oreset.getReqSeqNo());
                        rep.setResult(ReconfigurationResponseParameter.IN_PROGRESS);
                        reply.addParam(rep);
                    }
                    else
                    {
                        // somehow invoke this when TSN catches up ?!?! ToDo
                        //logger.LogDebug("we are up-to-date ");
                        ReconfigurationResponseParameter rep = new ReconfigurationResponseParameter();
                        rep.setSeq(oreset.getReqSeqNo());
                        int result = streams.Length > 0 ? ReconfigurationResponseParameter.SUCCESS_PERFORMED : ReconfigurationResponseParameter.SUCCESS_NOTHING_TO_DO;
                        rep.setResult((uint)result); // assume all good
                        foreach (int s in streams)
                        {
                            SCTPStream cstrm = assoc.delStream(s);
                            if (cstrm == null)
                            {
                                //logger.LogError("Close a non existant stream");
                                rep.setResult(ReconfigurationResponseParameter.ERROR_WRONG_SSN);
                                break;
                                // bidriectional might be a problem here...
                            }
                            else
                            {
                                cstrm.reset();
                            }
                        }
                        reply.addParam(rep);
                    }
                }
                // ponder putting this in a second chunk ?
                if (rconf.hasIncomingReset())
                {
                    IncomingSSNResetRequestParameter ireset = rconf.getIncomingReset();

                    /*The Re-configuration
                     *                  Response Sequence Number of the Outgoing SSN Reset Request
                     *                  Parameter MUST be the Re-configuration Request Sequence Number
                     *                  of the Incoming SSN Reset Request Parameter. */
                    OutgoingSSNResetRequestParameter rep = new OutgoingSSNResetRequestParameter(nextNearNo(), ireset.getReqNo(), assoc.getNearTSN());
                    int[] streams = ireset.getStreams();
                    rep.setStreams(streams);
                    if (streams.Length == 0)
                    {
                        streams = assoc.allStreams();
                    }
                    foreach (int s in streams)
                    {
                        SCTPStream st = assoc.getStream(s);
                        if (st != null)
                        {
                            st.setClosing(true);
                        }
                    }
                    reply.addParam(rep);
                    // set outbound timer running here ???
                    //logger.LogDebug("Ireset " + ireset);
                }
            }
            if (reply.hasParam())
            {
                ret[0] = reply;
                // todo should add sack here
                //logger.LogDebug("about to reply with " + reply.ToString());
            }
            else
            {
                ret = null;
            }
            return(ret);
        }