63 std::memset(
data, 0, ETH_ADDR_LEN);
68 for (
int i = 0;
i < ETH_ADDR_LEN; ++
i)
74 for (
int i = 0;
i < ETH_ADDR_LEN; ++
i)
102 int bytes[ETH_ADDR_LEN == 6 ? ETH_ADDR_LEN : -1];
103 if (sscanf(
addr.c_str(),
"%x:%x:%x:%x:%x:%x", &
bytes[0], &
bytes[1],
105 std::memset(
data, 0xff, ETH_ADDR_LEN);
109 for (
int i = 0;
i < ETH_ADDR_LEN; ++
i) {
111 std::memset(
data, 0xff, ETH_ADDR_LEN);
122 std::stringstream stream;
130 return !std::memcmp(left.
bytes(), right.
bytes(), ETH_ADDR_LEN);
136 const uint8_t *
a =
ea.addr();
137 ccprintf(stream,
"%x:%x:%x:%x:%x:%x",
a[0],
a[1],
a[2],
a[3],
a[4],
a[5]);
144 std::stringstream stream;
152 return left.
ip() == right.
ip();
158 uint32_t
ip =
ia.ip();
160 (uint8_t)(
ip >> 24), (uint8_t)(
ip >> 16),
161 (uint8_t)(
ip >> 8), (uint8_t)(
ip >> 0));
168 std::stringstream stream;
176 return (left.
ip() == right.
ip()) &&
190 std::stringstream stream;
198 return (left.
ip() == right.
ip()) && (left.
port() == right.
port());
212 return ip_cksum_carry(
sum);
218 int tcplen =
ip->len() -
ip->hlen();
219 int sum = ip_cksum_add(
ip->payload(), tcplen, 0);
220 sum = ip_cksum_add(&
ip->ip_src, 8,
sum);
221 sum += htons(
ip->ip_p + tcplen);
222 return ip_cksum_carry(
sum);
228 int tcplen =
ip6->plen() -
ip6->extensionLength();
229 int sum = ip_cksum_add(
ip6->payload(), tcplen, 0);
231 sum += htons(
ip6->proto() + tcplen);
232 return ip_cksum_carry(
sum);
243 panic(
"Unrecognized IP packet format");
257 panic(
"Unrecognized IP packet format");
267 const uint8_t *
data =
bytes() +
sizeof(
struct ip_hdr);
268 int all =
hlen() -
sizeof(
struct ip_hdr);
287 ip6Extension(uint8_t nxt)
289 return nxt == IP_PROTO_HOPOPTS || nxt == IP_PROTO_ROUTING ||
290 nxt == IP_PROTO_FRAGMENT || nxt == IP_PROTO_AH ||
291 nxt == IP_PROTO_ESP || nxt == IP_PROTO_DSTOPTS;
302 const uint8_t *
data =
bytes() + IP6_HDR_LEN;
303 uint8_t
nxt = ip6_nxt;
307 while (ip6Extension(
nxt)) {
325 const uint8_t *
data =
bytes() + IP6_HDR_LEN;
326 uint8_t
nxt = ip6_nxt;
330 while (ip6Extension(
nxt)) {
332 if (
nxt == ext_type) {
341 return (
const Ip6Opt*)opt;
351 const uint8_t *
data =
bytes() + IP6_HDR_LEN;
352 uint8_t
nxt = ip6_nxt;
355 while (ip6Extension(
nxt)) {
370 const uint8_t *
data =
bytes() +
sizeof(
struct tcp_hdr);
371 int all =
off() -
sizeof(
struct tcp_hdr);
394 split_point =
ip.pstart();
398 split_point =
tcp.pstart();
402 split_point = udp.
pstart();
404 split_point =
ip6.pstart();
408 split_point =
tcp.pstart();
411 split_point = udp.
pstart();
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
uint16_t cksum(const IpPtr &ptr)
uint16_t __tu_cksum6(const Ip6Ptr &ip6)
int hsplit(const EthPacketPtr &ptr)
const EthPacketPtr packet() const
uint16_t __tu_cksum(const IpPtr &ip)
std::string string() const
bool operator==(const EthAddr &left, const EthAddr &right)
const uint8_t * addr() const
std::string string() const
std::ostream & operator<<(std::ostream &stream, const EthAddr &ea)
const EthAddr & operator=(const eth_addr &ea)
const uint8_t * bytes() const
#define panic(...)
This implements a cprintf based panic() function.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
void ccprintf(cp::Print &print)
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
std::shared_ptr< EthPacketData > EthPacketPtr
void parse(const std::string &addr)
const Ip6Opt * getExt(uint8_t ext) const
int extensionLength() const
const uint8_t * bytes() const
const uint8_t * bytes() const
bool options(std::vector< const IpOpt * > &vec) const
std::string string() const
std::string string() const
const uint8_t * bytes() const
bool options(std::vector< const TcpOpt * > &vec) const