mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-25 16:44:04 +00:00
added compilation macro to eui64.[ch] and cleaned unix-dependant code
This commit is contained in:
parent
c36d73f42a
commit
cd7894dfc9
@ -35,19 +35,16 @@
|
|||||||
* $Id: eui64.c,v 1.6 2002/12/04 23:03:32 paulus Exp $
|
* $Id: eui64.c,v 1.6 2002/12/04 23:03:32 paulus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define RCSID "$Id: eui64.c,v 1.6 2002/12/04 23:03:32 paulus Exp $"
|
#include "lwip/opt.h"
|
||||||
|
#if PPP_SUPPORT && PPP_IPV6_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include "pppd.h"
|
#include "ppp_impl.h"
|
||||||
|
#include "eui64.h"
|
||||||
static const char rcsid[] = RCSID;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* eui64_ntoa - Make an ascii representation of an interface identifier
|
* eui64_ntoa - Make an ascii representation of an interface identifier
|
||||||
*/
|
*/
|
||||||
char *
|
char *eui64_ntoa(eui64_t e) {
|
||||||
eui64_ntoa(e)
|
|
||||||
eui64_t e;
|
|
||||||
{
|
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
|
|
||||||
snprintf(buf, 32, "%02x%02x:%02x%02x:%02x%02x:%02x%02x",
|
snprintf(buf, 32, "%02x%02x:%02x%02x:%02x%02x:%02x%02x",
|
||||||
@ -55,3 +52,5 @@ eui64_ntoa(e)
|
|||||||
e.e8[4], e.e8[5], e.e8[6], e.e8[7]);
|
e.e8[4], e.e8[5], e.e8[6], e.e8[7]);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */
|
||||||
|
@ -35,30 +35,12 @@
|
|||||||
* $Id: eui64.h,v 1.6 2002/12/04 23:03:32 paulus Exp $
|
* $Id: eui64.h,v 1.6 2002/12/04 23:03:32 paulus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
#if PPP_SUPPORT && PPP_IPV6_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#ifndef __EUI64_H__
|
#ifndef __EUI64_H__
|
||||||
#define __EUI64_H__
|
#define __EUI64_H__
|
||||||
|
|
||||||
#if !defined(INET6)
|
|
||||||
#error "this file should only be included when INET6 is defined"
|
|
||||||
#endif /* not defined(INET6) */
|
|
||||||
|
|
||||||
#if defined(SOL2)
|
|
||||||
#include <netinet/in.h>
|
|
||||||
|
|
||||||
typedef union {
|
|
||||||
uint8_t e8[8]; /* lower 64-bit IPv6 address */
|
|
||||||
uint32_t e32[2]; /* lower 64-bit IPv6 address */
|
|
||||||
} eui64_t;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Declare the two below, since in.h only defines them when _KERNEL
|
|
||||||
* is declared - which shouldn't be true when dealing with user-land programs
|
|
||||||
*/
|
|
||||||
#define s6_addr8 _S6_un._S6_u8
|
|
||||||
#define s6_addr32 _S6_un._S6_u32
|
|
||||||
|
|
||||||
#else /* else if not defined(SOL2) */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
*
|
*
|
||||||
@ -71,8 +53,6 @@ typedef union
|
|||||||
u_int32_t e32[2];
|
u_int32_t e32[2];
|
||||||
} eui64_t;
|
} eui64_t;
|
||||||
|
|
||||||
#endif /* defined(SOL2) */
|
|
||||||
|
|
||||||
#define eui64_iszero(e) (((e).e32[0] | (e).e32[1]) == 0)
|
#define eui64_iszero(e) (((e).e32[0] | (e).e32[1]) == 0)
|
||||||
#define eui64_equals(e, o) (((e).e32[0] == (o).e32[0]) && \
|
#define eui64_equals(e, o) (((e).e32[0] == (o).e32[0]) && \
|
||||||
((e).e32[1] == (o).e32[1]))
|
((e).e32[1] == (o).e32[1]))
|
||||||
@ -111,4 +91,4 @@ typedef union
|
|||||||
char *eui64_ntoa __P((eui64_t)); /* Returns ascii representation of id */
|
char *eui64_ntoa __P((eui64_t)); /* Returns ascii representation of id */
|
||||||
|
|
||||||
#endif /* __EUI64_H__ */
|
#endif /* __EUI64_H__ */
|
||||||
|
#endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user