Changes in uspace/lib/inet/src/addr.c [ec7902d:edeee9f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/inet/src/addr.c
rec7902d redeee9f 1 1 /* 2 * Copyright (c) 20 13Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * Copyright (c) 2013 Martin Decky 4 4 * All rights reserved. … … 28 28 */ 29 29 30 /** @addtogroup lib c30 /** @addtogroup libinet 31 31 * @{ 32 32 */ … … 37 37 #include <errno.h> 38 38 #include <inet/addr.h> 39 #include <inet/eth_addr.h> 39 40 #include <stdio.h> 40 41 #include <stddef.h> … … 54 55 const addr32_t addr32_broadcast_all_hosts = 0xffffffff; 55 56 56 const addr48_t addr48_broadcast = { 57 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 58 }; 59 60 static const addr48_t inet_addr48_solicited_node = { 61 0x33, 0x33, 0xff, 0, 0, 0 62 }; 57 static eth_addr_t inet_eth_addr_solicited_node = 58 ETH_ADDR_INITIALIZER(0x33, 0x33, 0xff, 0, 0, 0); 63 59 64 60 static const inet_addr_t inet_addr_any_addr = { … … 72 68 }; 73 69 74 void addr48(const addr48_t src, addr48_t dst)75 {76 memcpy(dst, src, 6);77 }78 79 70 void addr128(const addr128_t src, addr128_t dst) 80 71 { 81 72 memcpy(dst, src, 16); 82 }83 84 /** Compare addr48.85 *86 * @return Non-zero if equal, zero if not equal.87 */88 int addr48_compare(const addr48_t a, const addr48_t b)89 {90 return memcmp(a, b, 6) == 0;91 73 } 92 74 … … 106 88 * 107 89 */ 108 void addr48_solicited_node(const addr128_t ip, addr48_t mac) 109 { 110 memcpy(mac, inet_addr48_solicited_node, 3); 111 memcpy(mac + 3, ip + 13, 3); 90 void eth_addr_solicited_node(const addr128_t ip, eth_addr_t *mac) 91 { 92 uint8_t b[6]; 93 mac->a = inet_eth_addr_solicited_node.a; 94 95 eth_addr_encode(&inet_eth_addr_solicited_node, b); 96 memcpy(&b[3], ip + 13, 3); 97 eth_addr_decode(b, mac); 112 98 } 113 99
Note:
See TracChangeset
for help on using the changeset viewer.