xref: /third_party/lwip/src/netif/ppp/eui64.c (revision 195972f6)
1195972f6Sopenharmony_ci/*
2195972f6Sopenharmony_ci * eui64.c - EUI64 routines for IPv6CP.
3195972f6Sopenharmony_ci *
4195972f6Sopenharmony_ci * Copyright (c) 1999 Tommi Komulainen.  All rights reserved.
5195972f6Sopenharmony_ci *
6195972f6Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
7195972f6Sopenharmony_ci * modification, are permitted provided that the following conditions
8195972f6Sopenharmony_ci * are met:
9195972f6Sopenharmony_ci *
10195972f6Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
11195972f6Sopenharmony_ci *    notice, this list of conditions and the following disclaimer.
12195972f6Sopenharmony_ci *
13195972f6Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright
14195972f6Sopenharmony_ci *    notice, this list of conditions and the following disclaimer in
15195972f6Sopenharmony_ci *    the documentation and/or other materials provided with the
16195972f6Sopenharmony_ci *    distribution.
17195972f6Sopenharmony_ci *
18195972f6Sopenharmony_ci * 3. The name(s) of the authors of this software must not be used to
19195972f6Sopenharmony_ci *    endorse or promote products derived from this software without
20195972f6Sopenharmony_ci *    prior written permission.
21195972f6Sopenharmony_ci *
22195972f6Sopenharmony_ci * 4. Redistributions of any form whatsoever must retain the following
23195972f6Sopenharmony_ci *    acknowledgment:
24195972f6Sopenharmony_ci *    "This product includes software developed by Tommi Komulainen
25195972f6Sopenharmony_ci *     <Tommi.Komulainen@iki.fi>".
26195972f6Sopenharmony_ci *
27195972f6Sopenharmony_ci * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
28195972f6Sopenharmony_ci * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
29195972f6Sopenharmony_ci * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
30195972f6Sopenharmony_ci * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
31195972f6Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
32195972f6Sopenharmony_ci * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
33195972f6Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
34195972f6Sopenharmony_ci *
35195972f6Sopenharmony_ci * $Id: eui64.c,v 1.6 2002/12/04 23:03:32 paulus Exp $
36195972f6Sopenharmony_ci */
37195972f6Sopenharmony_ci
38195972f6Sopenharmony_ci#include "netif/ppp/ppp_opts.h"
39195972f6Sopenharmony_ci#if PPP_SUPPORT && PPP_IPV6_SUPPORT  /* don't build if not configured for use in lwipopts.h */
40195972f6Sopenharmony_ci
41195972f6Sopenharmony_ci#include "netif/ppp/ppp_impl.h"
42195972f6Sopenharmony_ci#include "netif/ppp/eui64.h"
43195972f6Sopenharmony_ci
44195972f6Sopenharmony_ci/*
45195972f6Sopenharmony_ci * eui64_ntoa - Make an ascii representation of an interface identifier
46195972f6Sopenharmony_ci */
47195972f6Sopenharmony_cichar *eui64_ntoa(eui64_t e) {
48195972f6Sopenharmony_ci    static char buf[20];
49195972f6Sopenharmony_ci
50195972f6Sopenharmony_ci    sprintf(buf, "%02x%02x:%02x%02x:%02x%02x:%02x%02x",
51195972f6Sopenharmony_ci	     e.e8[0], e.e8[1], e.e8[2], e.e8[3],
52195972f6Sopenharmony_ci	     e.e8[4], e.e8[5], e.e8[6], e.e8[7]);
53195972f6Sopenharmony_ci    return buf;
54195972f6Sopenharmony_ci}
55195972f6Sopenharmony_ci
56195972f6Sopenharmony_ci#endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */
57