Example #1
0
 public TcpRep(ID tcpid, ref T_TCP_CREP pk_ctcp, Nucleus pNucleus, lwip lwip)
 {
     m_RepID   = tcpid;
     m_ctcp    = pk_ctcp;
     m_Nucleus = pNucleus;
     m_lwIP    = lwip;
 }
Example #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);
        }