コード例 #1
0
ファイル: netif.cs プロジェクト: mxslcn/uITron3
        internal void input(byte[] packet, ip_addr srcn, ip_addr destn, byte proto)
        {
            ip_addr src = new ip_addr(lwip.lwip_htonl(srcn.addr));
            ip_addr dest = new ip_addr(lwip.lwip_htonl(destn.addr));
            pbuf    p = lwip.pbuf_alloc(pbuf_layer.PBUF_RAW, (ushort)packet.Length, pbuf_type.PBUF_POOL);
            int     pos = 0, rest = packet.Length;

            for (pbuf q = p; q != null; q = q.next)
            {
                int len = rest;
                if (len > q.len)
                {
                    len = q.len;
                }

                Buffer.BlockCopy(packet, pos, q.payload.data, q.payload.offset, len);
                pos  += len;
                rest -= len;
            }

            if (lwip.ip.ip_input(p, src, dest, proto, this) != err_t.ERR_OK)
            {
                lwip.pbuf_free(p);
            }
        }
コード例 #2
0
ファイル: netif.cs プロジェクト: mxslcn/uITron3
        internal static err_t output(netif netif, pbuf p, ip_addr src, ip_addr dest, byte proto)
        {
            int pos = 0, rest = p.tot_len;

            byte[]  packet = new byte[rest];
            ip_addr srch   = new ip_addr(lwip.lwip_ntohl(src.addr));
            ip_addr desth  = new ip_addr(lwip.lwip_ntohl(dest.addr));

            for (pbuf q = p; q != null; q = q.next)
            {
                int len = rest;
                if (len > q.len)
                {
                    len = q.len;
                }

                Buffer.BlockCopy(q.payload.data, q.payload.offset, packet, pos, len);
                pos  += len;
                rest -= len;
            }

            netif.m_output(netif, packet, srch, desth, proto);

            return(err_t.ERR_OK);
        }
コード例 #3
0
ファイル: netif.cs プロジェクト: h7ga40/uITron3
 public netif(lwip lwip, string name, ip_addr ipaddr, ip_addr netmask, ip_addr gw, netif_output_t output)
 {
     this.lwip = lwip;
     this.name = name;
     this.m_output = output;
     set_ipaddr(ipaddr);
     set_netmask(netmask);
     set_gw(gw);
 }
コード例 #4
0
ファイル: netif.cs プロジェクト: mxslcn/uITron3
 public netif(lwip lwip, string name, ip_addr ipaddr, ip_addr netmask, ip_addr gw, netif_output_t output)
 {
     this.lwip     = lwip;
     this.name     = name;
     this.m_output = output;
     set_ipaddr(ipaddr);
     set_netmask(netmask);
     set_gw(gw);
 }
コード例 #5
0
ファイル: netif.cs プロジェクト: h7ga40/uITron3
 public void set_gw(ip_addr gw)
 {
     ip_addr.ip_addr_set(this.gw, gw);
     lwip.LWIP_DEBUGF(opt.NETIF_DEBUG | lwip.LWIP_DBG_TRACE | lwip.LWIP_DBG_STATE, "netif: GW address of interface {0}{1} set to {2}.{3}.{4}.{5}\n",
         name[0], name[1],
         ip_addr.ip4_addr1_16(this.gw),
         ip_addr.ip4_addr2_16(this.gw),
         ip_addr.ip4_addr3_16(this.gw),
         ip_addr.ip4_addr4_16(this.gw));
 }
コード例 #6
0
ファイル: netif.cs プロジェクト: mxslcn/uITron3
 public void set_netmask(ip_addr netmask)
 {
     ip_addr.ip_addr_set(this.netmask, netmask);
     lwip.LWIP_DEBUGF(opt.NETIF_DEBUG | lwip.LWIP_DBG_TRACE | lwip.LWIP_DBG_STATE, "netif: netmask of interface {0}{1} set to {2}.{3}.{4}.{5}\n",
                      name[0], name[1],
                      ip_addr.ip4_addr1_16(this.netmask),
                      ip_addr.ip4_addr2_16(this.netmask),
                      ip_addr.ip4_addr3_16(this.netmask),
                      ip_addr.ip4_addr4_16(this.netmask));
 }
コード例 #7
0
ファイル: netif.cs プロジェクト: mxslcn/uITron3
 public void set_gw(ip_addr gw)
 {
     ip_addr.ip_addr_set(this.gw, gw);
     lwip.LWIP_DEBUGF(opt.NETIF_DEBUG | lwip.LWIP_DBG_TRACE | lwip.LWIP_DBG_STATE, "netif: GW address of interface {0}{1} set to {2}.{3}.{4}.{5}\n",
                      name[0], name[1],
                      ip_addr.ip4_addr1_16(this.gw),
                      ip_addr.ip4_addr2_16(this.gw),
                      ip_addr.ip4_addr3_16(this.gw),
                      ip_addr.ip4_addr4_16(this.gw));
 }
コード例 #8
0
ファイル: netif.cs プロジェクト: mxslcn/uITron3
        private void set_ipaddr(ip_addr ipaddr)
        {
            ip_addr.ip_addr_set(this.ip_addr, ipaddr);

            lwip.LWIP_DEBUGF(opt.NETIF_DEBUG | lwip.LWIP_DBG_TRACE | lwip.LWIP_DBG_STATE, "netif: IP address of interface {0}{1} set to {2}.{3}.{4}.{5}\n",
                             name[0], name[1],
                             ip_addr.ip4_addr1_16(this.ip_addr),
                             ip_addr.ip4_addr2_16(this.ip_addr),
                             ip_addr.ip4_addr3_16(this.ip_addr),
                             ip_addr.ip4_addr4_16(this.ip_addr));
        }
コード例 #9
0
ファイル: netif.cs プロジェクト: h7ga40/uITron3
 public void set_netmask(ip_addr netmask)
 {
     ip_addr.ip_addr_set(this.netmask, netmask);
     lwip.LWIP_DEBUGF(opt.NETIF_DEBUG | lwip.LWIP_DBG_TRACE | lwip.LWIP_DBG_STATE, "netif: netmask of interface {0}{1} set to {2}.{3}.{4}.{5}\n",
         name[0], name[1],
         ip_addr.ip4_addr1_16(this.netmask),
         ip_addr.ip4_addr2_16(this.netmask),
         ip_addr.ip4_addr3_16(this.netmask),
         ip_addr.ip4_addr4_16(this.netmask));
 }
コード例 #10
0
ファイル: netif.cs プロジェクト: h7ga40/uITron3
        private void set_ipaddr(ip_addr ipaddr)
        {
            ip_addr.ip_addr_set(this.ip_addr, ipaddr);

            lwip.LWIP_DEBUGF(opt.NETIF_DEBUG | lwip.LWIP_DBG_TRACE | lwip.LWIP_DBG_STATE, "netif: IP address of interface {0}{1} set to {2}.{3}.{4}.{5}\n",
                name[0], name[1],
                ip_addr.ip4_addr1_16(this.ip_addr),
                ip_addr.ip4_addr2_16(this.ip_addr),
                ip_addr.ip4_addr3_16(this.ip_addr),
                ip_addr.ip4_addr4_16(this.ip_addr));
        }
コード例 #11
0
ファイル: netif.cs プロジェクト: h7ga40/uITron3
        internal void input(byte[] packet, ip_addr srcn, ip_addr destn, byte proto)
        {
            ip_addr src = new ip_addr(lwip.lwip_htonl(srcn.addr));
            ip_addr dest = new ip_addr(lwip.lwip_htonl(destn.addr));
            pbuf p = lwip.pbuf_alloc(pbuf_layer.PBUF_RAW, (ushort)packet.Length, pbuf_type.PBUF_POOL);
            int pos = 0, rest = packet.Length;

            for (pbuf q = p; q != null; q = q.next)
            {
                int len = rest;
                if (len > q.len)
                    len = q.len;

                Buffer.BlockCopy(packet, pos, q.payload.data, q.payload.offset, len);
                pos += len;
                rest -= len;
            }

            if (lwip.ip.ip_input(p, src, dest, proto, this) != err_t.ERR_OK)
                lwip.pbuf_free(p);
        }
コード例 #12
0
ファイル: netif.cs プロジェクト: h7ga40/uITron3
        internal static err_t output(netif netif, pbuf p, ip_addr src, ip_addr dest, byte proto)
        {
            int pos = 0, rest = p.tot_len;
            byte[] packet = new byte[rest];
            ip_addr srch = new ip_addr(lwip.lwip_ntohl(src.addr));
            ip_addr desth = new ip_addr(lwip.lwip_ntohl(dest.addr));

            for (pbuf q = p; q != null; q = q.next)
            {
                int len = rest;
                if (len > q.len)
                    len = q.len;

                Buffer.BlockCopy(q.payload.data, q.payload.offset, packet, pos, len);
                pos += len;
                rest -= len;
            }

            netif.m_output(netif, packet, srch, desth, proto);

            return err_t.ERR_OK;
        }
コード例 #13
0
ファイル: netif.cs プロジェクト: h7ga40/uITron3
 internal static void netif_init(lwip lwip, string name, ip_addr ipaddr, ip_addr netmask, ip_addr gw, netif_output_t output)
 {
     lwip.netif = new netif(lwip, name, ipaddr, netmask, gw, output);
 }
コード例 #14
0
ファイル: netif.cs プロジェクト: mxslcn/uITron3
 internal static void netif_init(lwip lwip, string name, ip_addr ipaddr, ip_addr netmask, ip_addr gw, netif_output_t output)
 {
     lwip.netif = new netif(lwip, name, ipaddr, netmask, gw, output);
 }