public Udp6Cep(ID udpid, ref T_UDP6_CCEP pk_cudp, Nucleus pNucleus, lwip lwip) { m_CepID = udpid; m_cudp = pk_cudp; m_Nucleus = pNucleus; m_lwIP = lwip; ip6_addr addr = new ip6_addr(pk_cudp.myaddr.ipaddr); m_Pcb = m_lwIP.udp.udp_new(); //m_lwIP.udp.udp_bind(m_Pcb, addr, pk_cudp.myaddr.portno); //udp.udp_recv(m_Pcb, recv, this); }
private void recv(object arg, udp_pcb pcb, pbuf p, ip6_addr addr, ushort port) { System.Diagnostics.Debug.Assert((arg == this) && (pcb == m_Pcb)); pointer data = new pointer(new byte[sizeof(ushort) + T_IPV6EP.length + p.tot_len], 0); T_IPV6EP p_dstaddr = new T_IPV6EP(data, sizeof(ushort)); pointer p_dat = new pointer(data, sizeof(ushort) + T_IPV6EP.length); data.SetValue(p.tot_len); pointer.memcpy(p_dstaddr.ipaddr, addr, T_IPV6ADDR.length); p_dstaddr.portno = lwip.lwip_ntohs(port); for (pbuf q = p; q != null; q = q.next) { pointer.memcpy(p_dat, q.payload, q.len); p_dat += q.len; } lock (m_CallBack) { m_CallBack.Enqueue(data); } SetState(true, TMO.TMO_POL, null, OnTimeOut); }
internal memp memp_malloc(memp_t type) { memp memp; switch (type) { #if LWIP_RAW case memp_t.MEMP_RAW_PCB: memp = new raw_pcb(this); break; #endif #if LWIP_UDP case memp_t.MEMP_UDP_PCB: memp = new udp_pcb(this); break; #endif #if LWIP_TCP case memp_t.MEMP_TCP_PCB: memp = new tcp_pcb(this); break; case memp_t.MEMP_TCP_PCB_LISTEN: memp = new tcp_pcb_listen(this); break; case memp_t.MEMP_TCP_SEG: memp = new tcp_seg(this); break; #endif #if IP_REASSEMBLY case memp_t.MEMP_REASSDATA: memp = new ip_reassdata(this); break; case memp_t.MEMP_FRAG_PBUF: memp = new frag_pbuf(this); break; #endif #if LWIP_NETCONN case memp_t.MEMP_NETBUF: memp = new netbuf(this); break; case memp_t.MEMP_NETCONN: memp = new netconn(this); break; #endif #if false //!NO_SYS case memp_t.MEMP_TCPIP_MSG_API: memp = new tcpip_msg(this); break; case memp_t.MEMP_TCPIP_MSG_INPKT: memp = new tcpip_msg(this); break; #endif #if LWIP_ARP && ARP_QUEUEING case memp_t.MEMP_ARP_QUEUE: memp = new etharp_q_entry(this); break; #endif #if LWIP_IGMP case memp_t.MEMP_IGMP_GROUP: memp = new igmp_group(this); break; #endif #if false //(!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) case memp_t.MEMP_SYS_TIMEOUT: memp = new sys_timeo(this); break; #endif #if LWIP_SNMP case memp_t.MEMP_SNMP_ROOTNODE: memp = new mib_list_rootnode(this); break; case memp_t.MEMP_SNMP_NODE: memp = new mib_list_node(this); break; case memp_t.MEMP_SNMP_VARBIND: memp = new snmp_varbind(this); break; case memp_t.MEMP_SNMP_VALUE: memp = new snmp_value(this); break; #endif #if LWIP_DNS && LWIP_SOCKET case memp_t.MEMP_NETDB: memp = new netdb(this); break; #endif #if LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC case memp_t.MEMP_LOCALHOSTLIST: memp = new local_hostlist_entry(this); break; #endif #if PPP_SUPPORT && PPPOE_SUPPORT case memp_t.MEMP_PPPOE_IF: memp = new pppoe_softc(this); break; #endif default: throw new InvalidOperationException(); } memp._type = type; memp_heap.AddLast(memp); return memp; }
internal memp memp_malloc(memp_t type) { memp memp; switch (type) { #if LWIP_RAW case memp_t.MEMP_RAW_PCB: memp = new raw_pcb(this); break; #endif #if LWIP_UDP case memp_t.MEMP_UDP_PCB: memp = new udp_pcb(this); break; #endif #if LWIP_TCP case memp_t.MEMP_TCP_PCB: memp = new tcp_pcb(this); break; case memp_t.MEMP_TCP_PCB_LISTEN: memp = new tcp_pcb_listen(this); break; case memp_t.MEMP_TCP_SEG: memp = new tcp_seg(this); break; #endif #if IP_REASSEMBLY case memp_t.MEMP_REASSDATA: memp = new ip_reassdata(this); break; case memp_t.MEMP_FRAG_PBUF: memp = new frag_pbuf(this); break; #endif #if LWIP_NETCONN case memp_t.MEMP_NETBUF: memp = new netbuf(this); break; case memp_t.MEMP_NETCONN: memp = new netconn(this); break; #endif #if false //!NO_SYS case memp_t.MEMP_TCPIP_MSG_API: memp = new tcpip_msg(this); break; case memp_t.MEMP_TCPIP_MSG_INPKT: memp = new tcpip_msg(this); break; #endif #if LWIP_ARP && ARP_QUEUEING case memp_t.MEMP_ARP_QUEUE: memp = new etharp_q_entry(this); break; #endif #if LWIP_IGMP case memp_t.MEMP_IGMP_GROUP: memp = new igmp_group(this); break; #endif #if false //(!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) case memp_t.MEMP_SYS_TIMEOUT: memp = new sys_timeo(this); break; #endif #if LWIP_SNMP case memp_t.MEMP_SNMP_ROOTNODE: memp = new mib_list_rootnode(this); break; case memp_t.MEMP_SNMP_NODE: memp = new mib_list_node(this); break; case memp_t.MEMP_SNMP_VARBIND: memp = new snmp_varbind(this); break; case memp_t.MEMP_SNMP_VALUE: memp = new snmp_value(this); break; #endif #if LWIP_DNS && LWIP_SOCKET case memp_t.MEMP_NETDB: memp = new netdb(this); break; #endif #if LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC case memp_t.MEMP_LOCALHOSTLIST: memp = new local_hostlist_entry(this); break; #endif #if PPP_SUPPORT && PPPOE_SUPPORT case memp_t.MEMP_PPPOE_IF: memp = new pppoe_softc(this); break; #endif default: throw new InvalidOperationException(); } memp._type = type; memp_heap.AddLast(memp); return(memp); }