2015-02-03 22:07:22 +00:00
|
|
|
|
2015-12-10 20:21:27 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
|
2015-02-03 23:19:16 +00:00
|
|
|
#include <lwip/init.h>
|
2015-02-03 22:07:22 +00:00
|
|
|
#include <lwip/ip.h>
|
|
|
|
#include <lwip/sockets.h>
|
2015-02-08 23:08:26 +00:00
|
|
|
#include <netif/etharp.h>
|
|
|
|
|
|
|
|
static struct netif netif;
|
2015-02-03 22:07:22 +00:00
|
|
|
|
2015-02-04 22:52:17 +00:00
|
|
|
extern err_t ethernetif_init(struct netif *netif);
|
|
|
|
|
2015-02-03 22:07:22 +00:00
|
|
|
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);
|
2015-02-04 22:52:17 +00:00
|
|
|
netif_set_default(&netif);
|
|
|
|
netif_set_up(&netif);
|
|
|
|
|
2015-02-03 22:07:22 +00:00
|
|
|
lwip_socket(AF_INET, SOCK_STREAM, IP_PROTO_TCP);
|
|
|
|
|
2015-02-08 23:08:26 +00:00
|
|
|
while (1) { sleep(0); }
|
|
|
|
|
2015-02-03 22:07:22 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|