metal-cos/tests/lwiptest.c

35 lines
643 B
C
Raw Permalink Normal View History

2015-12-10 20:21:27 +00:00
#include <unistd.h>
2015-02-03 23:19:16 +00:00
#include <lwip/init.h>
#include <lwip/ip.h>
#include <lwip/sockets.h>
2015-02-08 23:08:26 +00:00
#include <netif/etharp.h>
static struct netif netif;
extern err_t ethernetif_init(struct netif *netif);
int
main(int argc, const char *argv[])
{
2015-02-03 23:19:16 +00:00
static ip_addr_t addr, mask, gw;
2015-02-08 23:08:26 +00:00
IP4_ADDR(&addr, 192, 168, 1, 2);
2015-02-03 23:19:16 +00:00
IP4_ADDR(&mask, 255, 255, 255, 0);
IP4_ADDR(&gw, 0, 0, 0, 0);
lwip_init();
2015-02-08 23:08:26 +00:00
netif_add(&netif, &addr, &mask, &gw, NULL, ethernetif_init, ethernet_input);
netif_set_default(&netif);
netif_set_up(&netif);
lwip_socket(AF_INET, SOCK_STREAM, IP_PROTO_TCP);
2015-02-08 23:08:26 +00:00
while (1) { sleep(0); }
return 0;
}