38 #include "contiki-net.h"
41 #include "lib/error.h"
42 #include "net/ethernet-drv.h"
47 ipaddrtoa(uip_ipaddr_t *ipaddr,
char *buffer)
52 for(i = 0; i < 4; ++i) {
54 utoa(ipaddr->u8[i], ++ptr, 10);
63 config_read(
char *filename)
66 uip_ipaddr_t hostaddr;
69 uip_ipaddr_t resolvaddr;
70 struct ethernet_config ethernetcfg;
76 log_message(filename,
": File not found");
80 if(cfs_read(file, &config,
sizeof(config)) <
sizeof(config)
81 -
sizeof(config.ethernetcfg.name)) {
82 log_message(filename,
": No config file");
88 log_message(
"IP Address: ", ipaddrtoa(&config.hostaddr, uip_buf));
89 log_message(
"Subnet Mask: ", ipaddrtoa(&config.netmask, uip_buf));
90 log_message(
"Def. Router: ", ipaddrtoa(&config.draddr, uip_buf));
91 log_message(
"DNS Server: ", ipaddrtoa(&config.resolvaddr, uip_buf));
94 log_message(
"Eth. Driver: ", config.ethernetcfg.name);
96 #define _stringize(arg) #arg
97 #define stringize(arg) _stringize(arg)
98 log_message(
"Eth. Driver: ", stringize(ETHERNET));
102 log_message(
"Driver Port: $", utoa(config.ethernetcfg.addr, uip_buf, 16));
108 resolv_conf(&config.resolvaddr);
111 return &config.ethernetcfg;
#define uip_sethostaddr(addr)
Set the IP address of this host.
int cfs_open(const char *name, int flags)
Open a file.
#define CFS_READ
Specify that cfs_open() should open a file for reading.
#define uip_setdraddr(addr)
Set the default router's IP address.
#define CC_FASTCALL
Configure if the C compiler supports fastcall function declarations.
#define uip_setnetmask(addr)
Set the netmask.
void cfs_close(int fd)
Close an open file.