Changes in uspace/lib/inet/src/addr.c [edeee9f:ec7902d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/inet/src/addr.c
redeee9f rec7902d 1 1 /* 2 * Copyright (c) 20 21Jiri Svoboda2 * Copyright (c) 2013 Jiri Svoboda 3 3 * Copyright (c) 2013 Martin Decky 4 4 * All rights reserved. … … 28 28 */ 29 29 30 /** @addtogroup lib inet30 /** @addtogroup libc 31 31 * @{ 32 32 */ … … 37 37 #include <errno.h> 38 38 #include <inet/addr.h> 39 #include <inet/eth_addr.h>40 39 #include <stdio.h> 41 40 #include <stddef.h> … … 55 54 const addr32_t addr32_broadcast_all_hosts = 0xffffffff; 56 55 57 static eth_addr_t inet_eth_addr_solicited_node = 58 ETH_ADDR_INITIALIZER(0x33, 0x33, 0xff, 0, 0, 0); 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 }; 59 63 60 64 static const inet_addr_t inet_addr_any_addr = { … … 68 72 }; 69 73 74 void addr48(const addr48_t src, addr48_t dst) 75 { 76 memcpy(dst, src, 6); 77 } 78 70 79 void addr128(const addr128_t src, addr128_t dst) 71 80 { 72 81 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; 73 91 } 74 92 … … 88 106 * 89 107 */ 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); 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); 98 112 } 99 113
Note:
See TracChangeset
for help on using the changeset viewer.