Beispiel #1
0
        private static err_t Accepting(object arg, tcp_pcb newpcb, err_t err)
        {
            TcpRep _this = (TcpRep)arg;

            _this.m_TcpCep.NewSession(newpcb);

            _this.m_AcceptQueue.AddLast(newpcb);

            if (_this.m_TskQueue.First != null)
            {
                Task task = _this.m_TskQueue.First.Value;
                _this.m_TskQueue.RemoveFirst();

                if (!task.ReleaseWait())
                {
                    return(err_t.ERR_WOULDBLOCK);
                }
            }

            return(err);
        }
Beispiel #2
0
        internal ER CreateTcpRep(ID cepid, ref T_TCP_CREP pk_ccep, out ID p_cepid)
        {
            int i;

            //if (pk_ccep == null)
            //	return ER.E_PAR;

            if (cepid == ID.ID_AUTO)
            {
                //if (p_cepid == 0)
                //	return ER.E_PAR;

                cepid.Value = 1;

                for (i = 0; ; i++)
                {
                    if (i >= m_TcpRepTable.Count)
                    {
                        TcpRep tcpRep = new TcpRep(cepid, ref pk_ccep, this, m_lwIP);
                        m_TcpRepTable.Add(tcpRep);
                        break;
                    }

                    if (cepid == m_TcpRepTable[i].RepID)
                    {
                        cepid.Value++;
                    }
                    else
                    {
                        TcpRep tcpRep = new TcpRep(cepid, ref pk_ccep, this, m_lwIP);
                        m_TcpRepTable.Insert(i, tcpRep);
                        break;
                    }
                }
                p_cepid = cepid;
            }
            else
            {
                ID tmpid;

                p_cepid = ID.NULL;

                for (i = 0; i < m_TcpRepTable.Count; i++)
                {
                    tmpid = m_TcpRepTable[i].RepID;

                    if (cepid == tmpid)
                    {
                        return(ER.E_OBJ);
                    }
                    else if (cepid < tmpid)
                    {
                        break;
                    }
                }
                TcpRep tcpRep = new TcpRep(cepid, ref pk_ccep, this, m_lwIP);
                m_TcpRepTable.Insert(i, tcpRep);
            }

            return(ER.E_OK);
        }
Beispiel #3
0
        public ER Accept(TcpRep tcpRep, T_IPV4EP p_dstaddr, TMO tmout)
        {
            tcp_pcb_listen pcb = m_lwIP.tcp.tcp_listen(m_Pcb);

            return(tcpRep.Accept(pcb, this, p_dstaddr, tmout));
        }