A version of LWIP, provided for backwards compatibility.

Dependents:   AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers util.h Source File

util.h

00001 #ifndef LWIP_UTILS_H
00002 #define LWIP_UTILS_H
00003 
00004 #include "ipv4/lwip/ip_addr.h"
00005 #include "netif/etharp.h"
00006 #include "mbed.h"
00007 
00008 /**
00009  * This method converts 4 given IPv4 tuples to struct ip_addr classes.
00010  * The Byte are seperated by ,
00011  * Does only work with seperated 4 Byte tuple.
00012  */
00013 inline struct ip_addr ipv4addr(u8_t ip0, u8_t ip1, u8_t ip2, u8_t ip3) {
00014   struct ip_addr addr;
00015   IP4_ADDR(&addr, ip0, ip1, ip2, ip3);
00016   return addr;
00017 }
00018 
00019 /**
00020  * This method converts 6 given ethernet addresses tuples to struct eth_addr classes.
00021  * The Byte are seperated by ,
00022  */
00023 inline struct eth_addr ethaddr(u8_t ip0, u8_t ip1, u8_t ip2, u8_t ip3, u8_t ip4, u8_t ip5) {
00024   struct eth_addr addr;
00025   addr.addr[0] = ip0;
00026   addr.addr[1] = ip1;
00027   addr.addr[2] = ip2;
00028   addr.addr[3] = ip3;
00029   addr.addr[4] = ip4;
00030   addr.addr[5] = ip5;
00031   return addr;
00032 }
00033 
00034 #endif /* LWIP_UTILS_H */