inet.hh (9955:5d8722ab804b) | inet.hh (10251:878f2f30b12d) |
---|---|
1/* 2 * Copyright (c) 2013 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 79 unchanged lines hidden (view full) --- 88 const EthAddr &operator=(const std::string &addr); 89 90 int size() const { return sizeof(eth_addr); } 91 92 const uint8_t *bytes() const { return &data[0]; } 93 uint8_t *bytes() { return &data[0]; } 94 95 const uint8_t *addr() const { return &data[0]; } | 1/* 2 * Copyright (c) 2013 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 79 unchanged lines hidden (view full) --- 88 const EthAddr &operator=(const std::string &addr); 89 90 int size() const { return sizeof(eth_addr); } 91 92 const uint8_t *bytes() const { return &data[0]; } 93 uint8_t *bytes() { return &data[0]; } 94 95 const uint8_t *addr() const { return &data[0]; } |
96 bool unicast() const { return data[0] == 0x00; } 97 bool multicast() const { return data[0] == 0x01; } 98 bool broadcast() const { return data[0] == 0xff; } | 96 bool unicast() const { return !(data[0] & 0x01); } 97 bool multicast() const { return !unicast() && !broadcast(); } 98 bool broadcast() const 99 { 100 bool isBroadcast = true; 101 for (int i = 0; i < ETH_ADDR_LEN; ++i) { 102 isBroadcast = isBroadcast && data[i] == 0xff; 103 } 104 105 return isBroadcast; 106 } 107 |
99 std::string string() const; 100 101 operator uint64_t() const 102 { 103 uint64_t reg = 0; 104 reg |= ((uint64_t)data[0]) << 40; 105 reg |= ((uint64_t)data[1]) << 32; 106 reg |= ((uint64_t)data[2]) << 24; --- 572 unchanged lines hidden --- | 108 std::string string() const; 109 110 operator uint64_t() const 111 { 112 uint64_t reg = 0; 113 reg |= ((uint64_t)data[0]) << 40; 114 reg |= ((uint64_t)data[1]) << 32; 115 reg |= ((uint64_t)data[2]) << 24; --- 572 unchanged lines hidden --- |