Exemple #1
0
        public TcpCep(ID tcpid, ref T_TCP_CCEP pk_ctcp, Nucleus pNucleus, lwip lwip)
        {
            m_CepID   = tcpid;
            m_ctcp    = pk_ctcp;
            m_Nucleus = pNucleus;
            m_lwIP    = lwip;

            m_Pcb = m_lwIP.tcp.tcp_new();
            tcp.tcp_arg(m_Pcb, this);
            tcp.tcp_err(m_Pcb, Error);
        }
Exemple #2
0
        internal ER CreateTcpCep(ID cepid, ref T_TCP_CCEP 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_TcpCepTable.Count)
                    {
                        TcpCep tcpCep = new TcpCep(cepid, ref pk_ccep, this, m_lwIP);
                        m_TcpCepTable.Add(tcpCep);
                        break;
                    }

                    if (cepid == m_TcpCepTable[i].CepID)
                    {
                        cepid.Value++;
                    }
                    else
                    {
                        TcpCep tcpCep = new TcpCep(cepid, ref pk_ccep, this, m_lwIP);
                        m_TcpCepTable.Insert(i, tcpCep);
                        break;
                    }
                }
                p_cepid = cepid;
            }
            else
            {
                ID tmpid;

                p_cepid = ID.NULL;

                for (i = 0; i < m_TcpCepTable.Count; i++)
                {
                    tmpid = m_TcpCepTable[i].CepID;

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

            return(ER.E_OK);
        }