xref: /nrf52832-nimble/rt-thread/components/net/lwip-2.0.2/src/netif/ppp/eui64.c (revision 104654410c56c573564690304ae786df310c91fc)
1*10465441SEvalZero /*
2*10465441SEvalZero  * eui64.c - EUI64 routines for IPv6CP.
3*10465441SEvalZero  *
4*10465441SEvalZero  * Copyright (c) 1999 Tommi Komulainen.  All rights reserved.
5*10465441SEvalZero  *
6*10465441SEvalZero  * Redistribution and use in source and binary forms, with or without
7*10465441SEvalZero  * modification, are permitted provided that the following conditions
8*10465441SEvalZero  * are met:
9*10465441SEvalZero  *
10*10465441SEvalZero  * 1. Redistributions of source code must retain the above copyright
11*10465441SEvalZero  *    notice, this list of conditions and the following disclaimer.
12*10465441SEvalZero  *
13*10465441SEvalZero  * 2. Redistributions in binary form must reproduce the above copyright
14*10465441SEvalZero  *    notice, this list of conditions and the following disclaimer in
15*10465441SEvalZero  *    the documentation and/or other materials provided with the
16*10465441SEvalZero  *    distribution.
17*10465441SEvalZero  *
18*10465441SEvalZero  * 3. The name(s) of the authors of this software must not be used to
19*10465441SEvalZero  *    endorse or promote products derived from this software without
20*10465441SEvalZero  *    prior written permission.
21*10465441SEvalZero  *
22*10465441SEvalZero  * 4. Redistributions of any form whatsoever must retain the following
23*10465441SEvalZero  *    acknowledgment:
24*10465441SEvalZero  *    "This product includes software developed by Tommi Komulainen
25*10465441SEvalZero  *     <[email protected]>".
26*10465441SEvalZero  *
27*10465441SEvalZero  * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
28*10465441SEvalZero  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
29*10465441SEvalZero  * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
30*10465441SEvalZero  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
31*10465441SEvalZero  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
32*10465441SEvalZero  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
33*10465441SEvalZero  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
34*10465441SEvalZero  *
35*10465441SEvalZero  * $Id: eui64.c,v 1.6 2002/12/04 23:03:32 paulus Exp $
36*10465441SEvalZero  */
37*10465441SEvalZero 
38*10465441SEvalZero #include "netif/ppp/ppp_opts.h"
39*10465441SEvalZero #if PPP_SUPPORT && PPP_IPV6_SUPPORT  /* don't build if not configured for use in lwipopts.h */
40*10465441SEvalZero 
41*10465441SEvalZero #include "netif/ppp/ppp_impl.h"
42*10465441SEvalZero #include "netif/ppp/eui64.h"
43*10465441SEvalZero 
44*10465441SEvalZero /*
45*10465441SEvalZero  * eui64_ntoa - Make an ascii representation of an interface identifier
46*10465441SEvalZero  */
eui64_ntoa(eui64_t e)47*10465441SEvalZero char *eui64_ntoa(eui64_t e) {
48*10465441SEvalZero     static char buf[20];
49*10465441SEvalZero 
50*10465441SEvalZero     sprintf(buf, "%02x%02x:%02x%02x:%02x%02x:%02x%02x",
51*10465441SEvalZero 	     e.e8[0], e.e8[1], e.e8[2], e.e8[3],
52*10465441SEvalZero 	     e.e8[4], e.e8[5], e.e8[6], e.e8[7]);
53*10465441SEvalZero     return buf;
54*10465441SEvalZero }
55*10465441SEvalZero 
56*10465441SEvalZero #endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */
57