public ER udp_cre_cep(ID cepid, ref T_UDP_CCEP pk_ccep, out ID p_cepid) { ER Result = ER.E_NOEXS; p_cepid = ID.NULL; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.CreateUdpCep(cepid, ref pk_ccep, out p_cepid); } finally { g_Kernel.UnlockCPU(); } return Result; }
internal ER CreateUdpCep(ID cepid, ref T_UDP_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_UdpCepTable.Count) { UdpCep udpCep = new UdpCep(cepid, ref pk_ccep, this, m_lwIP); m_UdpCepTable.Add(udpCep); break; } if (cepid == m_UdpCepTable[i].CepID) { cepid.Value++; } else { UdpCep udpCep = new UdpCep(cepid, ref pk_ccep, this, m_lwIP); m_UdpCepTable.Insert(i, udpCep); break; } } p_cepid = cepid; } else { ID tmpid; p_cepid = ID.NULL; for (i = 0; i < m_UdpCepTable.Count; i++) { tmpid = m_UdpCepTable[i].CepID; if (cepid == tmpid) { return ER.E_OBJ; } else if (cepid < tmpid) { break; } } UdpCep udpCep = new UdpCep(cepid, ref pk_ccep, this, m_lwIP); m_UdpCepTable.Insert(i, udpCep); } return ER.E_OK; }