#include #include #include "/home/cjdns/rust-fcp/picotcp-sys/target/debug/build/picotcp-sys-cd06b602a1ad2b2a/out/picotcp/include/pico_stack.h" #include "/home/cjdns/rust-fcp/picotcp-sys/target/debug/build/picotcp-sys-cd06b602a1ad2b2a/out/picotcp/include/pico_device.h" #include "/home/cjdns/rust-fcp/picotcp-sys/target/debug/build/picotcp-sys-cd06b602a1ad2b2a/out/picotcp/include/pico_ipv4.h" #include "/home/cjdns/rust-fcp/picotcp-sys/target/debug/build/picotcp-sys-cd06b602a1ad2b2a/out/picotcp/include/pico_addressing.h" void main() { assert(!pico_stack_init()); struct pico_ip4 zero_addr, addr, other_addr, netmask, gateway; zero_addr.addr = 0; assert(!pico_string_to_ipv4("192.168.1.100", &addr.addr)); assert(!pico_string_to_ipv4("8.8.8.8", &other_addr.addr)); assert(!pico_string_to_ipv4("255.255.255.0", &netmask.addr)); assert(!pico_string_to_ipv4("192.168.1.1", &gateway.addr)); struct pico_device eth0; memset(ð0, 0, sizeof(eth0)); assert(!pico_device_init(ð0, "eth0", NULL)); assert(!pico_ipv4_link_add(ð0, addr, netmask)); struct pico_ipv4_link *link; assert(link = pico_ipv4_link_get(&addr)); // Add a route for the network assert(!pico_ipv4_route_add(addr, netmask, gateway, 10, link)); // Add a default route assert(!pico_ipv4_route_add(zero_addr, zero_addr, gateway, 10, link)); pico_err = PICO_ERR_NOERR; printf("%u\n", pico_ipv4_route_get_gateway(&other_addr)); if (pico_err == PICO_ERR_NOERR) printf("pico_err == PICO_ERR_NOERR\n"); else printf("pico_err != PICO_ERR_NOERR\n"); } /* void main() { pico_stack_init(); // pico_stack_tick(); struct pico_device eth0; memset(ð0, 0, sizeof(eth0)); pico_device_init(ð0, "eth0", NULL); pico_stack_tick(); }*/