gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
inet.hh
Go to the documentation of this file.
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
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2002-2005 The Regents of The University of Michigan
15  * Copyright (c) 2010 Advanced Micro Devices, Inc.
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 
42 #ifndef __BASE_INET_HH__
43 #define __BASE_INET_HH__
44 
45 #include <iosfwd>
46 #include <string>
47 #include <utility>
48 #include <vector>
49 
50 #include "base/compiler.hh"
51 #include "base/types.hh"
52 #include "dev/net/etherpkt.hh"
53 #include "dnet/os.h"
54 #include "dnet/eth.h"
55 #include "dnet/ip.h"
56 #include "dnet/ip6.h"
57 #include "dnet/addr.h"
58 #include "dnet/arp.h"
59 #include "dnet/icmp.h"
60 #include "dnet/tcp.h"
61 #include "dnet/udp.h"
62 #include "dnet/intf.h"
63 #include "dnet/route.h"
64 #include "dnet/fw.h"
65 #include "dnet/blob.h"
66 #include "dnet/rand.h"
67 
68 namespace gem5
69 {
70 
71 namespace networking
72 {
73 
74 /*
75  * Ethernet Stuff
76  */
77 struct EthAddr : protected eth_addr
78 {
79  protected:
80  void parse(const std::string &addr);
81 
82  public:
87  EthAddr();
88  EthAddr(const uint8_t ea[ETH_ADDR_LEN]);
89  EthAddr(const eth_addr &ea);
90  EthAddr(const std::string &addr);
91  const EthAddr &operator=(const eth_addr &ea);
92  const EthAddr &operator=(const std::string &addr); // end of api_inet
94 
98  int size() const { return sizeof(eth_addr); }
99 
100 
105  const uint8_t *bytes() const { return &data[0]; }
106  uint8_t *bytes() { return &data[0]; } // end of api_inet
108 
113  const uint8_t *addr() const { return &data[0]; }
114  bool unicast() const { return !(data[0] & 0x01); }
115  bool multicast() const { return !unicast() && !broadcast(); }
116  bool broadcast() const
117  {
118  bool isBroadcast = true;
119  for (int i = 0; i < ETH_ADDR_LEN; ++i) {
120  isBroadcast = isBroadcast && data[i] == 0xff;
121  }
122 
123  return isBroadcast;
124  } // end of api_inet
126 
130  std::string string() const;
131 
135  operator uint64_t() const
136  {
137  uint64_t reg = 0;
138  reg |= ((uint64_t)data[0]) << 40;
139  reg |= ((uint64_t)data[1]) << 32;
140  reg |= ((uint64_t)data[2]) << 24;
141  reg |= ((uint64_t)data[3]) << 16;
142  reg |= ((uint64_t)data[4]) << 8;
143  reg |= ((uint64_t)data[5]) << 0;
144  return reg;
145  }
146 
147 };
148 
153 std::ostream &operator<<(std::ostream &stream, const EthAddr &ea);
154 bool operator==(const EthAddr &left, const EthAddr &right); // end of api_inet
156 
157 struct EthHdr : public eth_hdr
158 {
159  bool isVlan() const { return (ntohs(eth_type) == ETH_TYPE_8021Q); }
160  uint16_t type() const {
161  if (!isVlan())
162  return ntohs(eth_type);
163  else
164  // L3 type is now 16 bytes into the hdr with 802.1Q
165  // instead of 12. dnet/eth.h only supports 802.1
166  return ntohs(*((uint16_t*)(((uint8_t *)this) + 16)));
167  }
168  uint16_t vlanId() const {
169  if (isVlan())
170  return ntohs(*((uint16_t*)(((uint8_t *)this) + 14)));
171  else
172  return 0x0000;
173  }
174 
175  const EthAddr &src() const { return *(EthAddr *)&eth_src; }
176  const EthAddr &dst() const { return *(EthAddr *)&eth_dst; }
177 
178  int size() const {
179  if (!isVlan())
180  return sizeof(eth_hdr);
181  else
182  return (sizeof(eth_hdr)+4);
183  }
184 
185  const uint8_t *bytes() const { return (const uint8_t *)this; }
186  const uint8_t *payload() const { return bytes() + size(); }
187  uint8_t *bytes() { return (uint8_t *)this; }
188  uint8_t *payload() { return bytes() + size(); }
189 };
190 
191 class EthPtr
192 {
193  protected:
194  friend class IpPtr;
195  friend class Ip6Ptr;
197 
198  public:
203  EthPtr() {}
204  EthPtr(const EthPacketPtr &ptr) : p(ptr) { } // end of api_inet
206 
207  EthHdr *operator->() { return (EthHdr *)p->data; }
208  EthHdr &operator*() { return *(EthHdr *)p->data; }
209  operator EthHdr *() { return (EthHdr *)p->data; }
210 
211  const EthHdr *operator->() const { return (const EthHdr *)p->data; }
212  const EthHdr &operator*() const { return *(const EthHdr *)p->data; }
213  operator const EthHdr *() const { return (const EthHdr *)p->data; }
214 
218  const EthPtr &operator=(const EthPacketPtr &ptr) { p = ptr; return *this; }
219 
224  const EthPacketPtr packet() const { return p; }
225  EthPacketPtr packet() { return p; }
226  bool operator!() const { return !p; }
227  operator bool() const { return (p != nullptr); }
228  int off() const { return 0; }
229  int pstart() const { return off() + ((const EthHdr*)p->data)->size(); } // end of api_inet
231 };
232 
233 /*
234  * IP Stuff
235  */
236 struct IpAddress
237 {
238  protected:
239  uint32_t _ip;
240 
241  public:
246  IpAddress() : _ip(0)
247  {}
248  IpAddress(const uint32_t __ip) : _ip(__ip)
249  {} // end of api_net
251 
255  uint32_t ip() const { return _ip; }
256 
260  std::string string() const;
261 };
262 
267 std::ostream &operator<<(std::ostream &stream, const IpAddress &ia);
268 bool operator==(const IpAddress &left, const IpAddress &right); // end of api_inet
270 
271 struct IpNetmask : public IpAddress
272 {
273  protected:
274  uint8_t _netmask;
275 
276  public:
278  {}
279  IpNetmask(const uint32_t __ip, const uint8_t __netmask) :
280  IpAddress(__ip), _netmask(__netmask)
281  {}
282 
286  uint8_t netmask() const { return _netmask; }
287 
288  std::string string() const;
289 };
290 
295 std::ostream &operator<<(std::ostream &stream, const IpNetmask &in);
296 bool operator==(const IpNetmask &left, const IpNetmask &right); // end of api_inet
298 
299 struct IpWithPort : public IpAddress
300 {
301  protected:
302  uint16_t _port;
303 
304  public:
306  {}
307  IpWithPort(const uint32_t __ip, const uint16_t __port) :
308  IpAddress(__ip), _port(__port)
309  {}
310 
314  uint8_t port() const { return _port; }
315 
316  std::string string() const;
317 };
318 
323 std::ostream &operator<<(std::ostream &stream, const IpWithPort &iwp);
324 bool operator==(const IpWithPort &left, const IpWithPort &right); // end of api_inet
326 
327 struct IpOpt;
328 struct IpHdr : public ip_hdr
329 {
330  uint8_t version() const { return ip_v; }
331  uint8_t hlen() const { return ip_hl * 4; }
332  uint8_t tos() const { return ip_tos; }
333  uint16_t len() const { return ntohs(ip_len); }
334  uint16_t id() const { return ntohs(ip_id); }
335  uint16_t frag_flags() const { return ntohs(ip_off) >> 13; }
336  uint16_t frag_off() const { return ntohs(ip_off) & 0x1fff; }
337  uint8_t ttl() const { return ip_ttl; }
338  uint8_t proto() const { return ip_p; }
339  uint16_t sum() const { return ip_sum; }
340  uint32_t src() const { return ntohl(ip_src); }
341  uint32_t dst() const { return ntohl(ip_dst); }
342 
343  void sum(uint16_t sum) { ip_sum = sum; }
344  void id(uint16_t _id) { ip_id = htons(_id); }
345  void len(uint16_t _len) { ip_len = htons(_len); }
346 
348 
349  int size() const { return hlen(); }
350  const uint8_t *bytes() const { return (const uint8_t *)this; }
351  const uint8_t *payload() const { return bytes() + size(); }
352  uint8_t *bytes() { return (uint8_t *)this; }
353  uint8_t *payload() { return bytes() + size(); }
354 };
355 
356 class IpPtr
357 {
358  protected:
359  friend class TcpPtr;
360  friend class UdpPtr;
363 
364  void set(const EthPacketPtr &ptr)
365  {
366  p = 0;
367  eth_hdr_vlan = false;
368 
369  if (ptr) {
370  EthHdr *eth = (EthHdr *)ptr->data;
371  if (eth->type() == ETH_TYPE_IP)
372  p = ptr;
373  if (eth->isVlan())
374  eth_hdr_vlan = true;
375  }
376  }
377 
378  public:
383  IpPtr() : p(0), eth_hdr_vlan(false) {}
384  IpPtr(const EthPacketPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr); }
385  IpPtr(const EthPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr.p); }
386  IpPtr(const IpPtr &ptr) : p(ptr.p), eth_hdr_vlan(ptr.eth_hdr_vlan) { } // end of api_inet
388 
389  IpHdr *get() { return (IpHdr *)(p->data + sizeof(eth_hdr) +
390  ((eth_hdr_vlan) ? 4 : 0)); }
391  IpHdr *operator->() { return get(); }
392  IpHdr &operator*() { return *get(); }
393 
398  const IpHdr *get() const
399  { return (const IpHdr *)(p->data + sizeof(eth_hdr) +
400  ((eth_hdr_vlan) ? 4 : 0)); }
401  const IpHdr *operator->() const { return get(); }
402  const IpHdr &operator*() const { return *get(); } // end of api_inet
404 
405  const IpPtr &operator=(const EthPacketPtr &ptr) { set(ptr); return *this; }
406  const IpPtr &operator=(const EthPtr &ptr) { set(ptr.p); return *this; }
407  const IpPtr &operator=(const IpPtr &ptr) { p = ptr.p; return *this; }
408 
413  const EthPacketPtr packet() const { return p; }
414  EthPacketPtr packet() { return p; }
415  bool operator!() const { return !p; }
416  operator bool() const { return (p != nullptr); }
417  int off() const { return (sizeof(eth_hdr) + ((eth_hdr_vlan) ? 4 : 0)); }
418  int pstart() const { return (off() + get()->size()); } // end of api_inet
420 };
421 
425 uint16_t cksum(const IpPtr &ptr);
426 
427 struct IpOpt : public ip_opt
428 {
429  uint8_t type() const { return opt_type; }
430  uint8_t typeNumber() const { return IP_OPT_NUMBER(opt_type); }
431  uint8_t typeClass() const { return IP_OPT_CLASS(opt_type); }
432  uint8_t typeCopied() const { return IP_OPT_COPIED(opt_type); }
433  uint8_t len() const { return IP_OPT_TYPEONLY(type()) ? 1 : opt_len; }
434 
435  bool isNumber(int num) const { return typeNumber() == IP_OPT_NUMBER(num); }
436  bool isClass(int cls) const { return typeClass() == IP_OPT_CLASS(cls); }
437  bool isCopied(int cpy) const { return typeCopied() == IP_OPT_COPIED(cpy); }
438 
439  const uint8_t *data() const { return opt_data.data8; }
440  void sec(ip_opt_data_sec &sec) const;
441  void lsrr(ip_opt_data_rr &rr) const;
442  void ssrr(ip_opt_data_rr &rr) const;
443  void ts(ip_opt_data_ts &ts) const;
444  uint16_t satid() const { return ntohs(opt_data.satid); }
445  uint16_t mtup() const { return ntohs(opt_data.mtu); }
446  uint16_t mtur() const { return ntohs(opt_data.mtu); }
447  void tr(ip_opt_data_tr &tr) const;
448  uint16_t rtralt() const { return ntohs(opt_data.rtralt); }
449  void sdb(std::vector<uint32_t> &vec) const;
450 };
451 
452 /*
453  * Ip6 Classes
454  */
455 struct Ip6Opt;
456 struct Ip6Hdr : public ip6_hdr
457 {
458  uint8_t version() const { return ip6_vfc; }
459  uint32_t flow() const { return ntohl(ip6_flow); }
460  uint16_t plen() const { return ntohs(ip6_plen); }
461  uint16_t hlen() const { return IP6_HDR_LEN; }
462  uint8_t nxt() const { return ip6_nxt; }
463  uint8_t hlim() const { return ip6_hlim; }
464 
465  const uint8_t* src() const { return ip6_src.data; }
466  const uint8_t* dst() const { return ip6_dst.data; }
467 
468  int extensionLength() const;
469  const Ip6Opt* getExt(uint8_t ext) const;
470  const Ip6Opt* fragmentExt() const { return getExt(IP_PROTO_FRAGMENT); }
471  const Ip6Opt* rtTypeExt() const { return getExt(IP_PROTO_ROUTING); }
472  const Ip6Opt* dstOptExt() const { return getExt(IP_PROTO_DSTOPTS); }
473  uint8_t proto() const;
474 
475  void plen(uint16_t _plen) { ip6_plen = htons(_plen); }
476 
477  int size() const { return IP6_HDR_LEN + extensionLength(); }
478  const uint8_t *bytes() const { return (const uint8_t *)this; }
479  const uint8_t *payload() const { return bytes() + IP6_HDR_LEN
480  + extensionLength(); }
481  uint8_t *bytes() { return (uint8_t *)this; }
482  uint8_t *payload() { return bytes() + IP6_HDR_LEN
483  + extensionLength(); }
484 };
485 
486 class Ip6Ptr
487 {
488  protected:
489  friend class TcpPtr;
490  friend class UdpPtr;
493 
494  void set(const EthPacketPtr &ptr)
495  {
496  p = 0;
497  eth_hdr_vlan = false;
498 
499  if (ptr) {
500  EthHdr *eth = (EthHdr *)ptr->data;
501  if (eth->type() == ETH_TYPE_IPV6)
502  p = ptr;
503  if (eth->isVlan())
504  eth_hdr_vlan = true;
505  }
506  }
507 
508  public:
513  Ip6Ptr() : p(0), eth_hdr_vlan(false) {}
514  Ip6Ptr(const EthPacketPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr); }
515  Ip6Ptr(const EthPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr.p); }
516  Ip6Ptr(const Ip6Ptr &ptr) : p(ptr.p), eth_hdr_vlan(ptr.eth_hdr_vlan) { } // end of api_inet
518 
519  Ip6Hdr *get() { return (Ip6Hdr *)(p->data + sizeof(eth_hdr)
520  + ((eth_hdr_vlan) ? 4 : 0)); }
521  Ip6Hdr *operator->() { return get(); }
522  Ip6Hdr &operator*() { return *get(); }
523 
524  const Ip6Hdr *get() const
525  { return (const Ip6Hdr *)(p->data + sizeof(eth_hdr)
526  + ((eth_hdr_vlan) ? 4 : 0)); }
527  const Ip6Hdr *operator->() const { return get(); }
528  const Ip6Hdr &operator*() const { return *get(); }
529 
534  const Ip6Ptr &operator=(const EthPacketPtr &ptr)
535  { set(ptr); return *this; }
536  const Ip6Ptr &operator=(const EthPtr &ptr)
537  { set(ptr.p); return *this; }
538  const Ip6Ptr &operator=(const Ip6Ptr &ptr)
539  { p = ptr.p; return *this; } // end of api_inet
541 
546  const EthPacketPtr packet() const { return p; }
547  EthPacketPtr packet() { return p; }
548  bool operator!() const { return !p; }
549  operator bool() const { return (p != nullptr); }
550  int off() const { return sizeof(eth_hdr) + ((eth_hdr_vlan) ? 4 : 0); }
551  int pstart() const { return off() + get()->size(); } // end of api_inet
553 };
554 
555 // Dnet supplied ipv6 opt header is incomplete and
556 // newer NIC card filters expect a more robust
557 // ipv6 header option declaration.
559 {
560  uint16_t offlg;
561  uint32_t ident;
562 };
563 
565 {
566  uint8_t type;
567  uint8_t segleft;
568  uint32_t reserved;
569  ip6_addr_t addr;
570 };
571 
573 {
574  uint8_t type;
575  uint8_t length;
576  ip6_addr_t addr;
577 };
578 
580 {
581  uint8_t ext_nxt;
582  uint8_t ext_len;
583  union
584  {
586  struct ip6_opt_routing_type2 rtType2;
587  struct ip6_opt_dstopts dstOpts;
588  } ext_data;
589 };
590 
591 struct Ip6Opt : public ip6_opt_hdr
592 {
593  uint8_t nxt() const { return ext_nxt; }
594  uint8_t extlen() const { return ext_len; }
595  uint8_t len() const { return extlen() + 8; }
596 
597  // Supporting the types of header extensions likely to be encountered:
598  // fragment, routing type 2 and dstopts.
599 
600  // Routing type 2
601  uint8_t rtType2Type() const { return ext_data.rtType2.type; }
602  uint8_t rtType2SegLft() const { return ext_data.rtType2.segleft; }
603  const uint8_t* rtType2Addr() const { return ext_data.rtType2.addr.data; }
604 
605  // Fragment
606  uint16_t fragmentOfflg() const { return ntohs(ext_data.fragment.offlg); }
607  uint32_t fragmentIdent() const { return ntohl(ext_data.fragment.ident); }
608 
609  // Dst Options/Home Address Option
610  uint8_t dstOptType() const { return ext_data.dstOpts.type; }
611  uint8_t dstOptLength() const { return ext_data.dstOpts.length; }
612  const uint8_t* dstOptAddr() const { return ext_data.dstOpts.addr.data; }
613 };
614 
615 
616 /*
617  * TCP Stuff
618  */
619 struct TcpOpt;
620 struct TcpHdr : public tcp_hdr
621 {
622  uint16_t sport() const { return ntohs(th_sport); }
623  uint16_t dport() const { return ntohs(th_dport); }
624  uint32_t seq() const { return ntohl(th_seq); }
625  uint32_t ack() const { return ntohl(th_ack); }
626  uint8_t off() const { return th_off*4; }
627  uint8_t flags() const { return th_flags & 0x3f; }
628  uint16_t win() const { return ntohs(th_win); }
629  uint16_t sum() const { return th_sum; }
630  uint16_t urp() const { return ntohs(th_urp); }
631 
632  void sum(uint16_t sum) { th_sum = sum; }
633  void seq(uint32_t _seq) { th_seq = htonl(_seq); }
634  void flags(uint8_t _flags) { th_flags = _flags; }
635 
637 
638  int size() const { return off(); }
639  const uint8_t *bytes() const { return (const uint8_t *)this; }
640  const uint8_t *payload() const { return bytes() + size(); }
641  uint8_t *bytes() { return (uint8_t *)this; }
642  uint8_t *payload() { return bytes() + size(); }
643 };
644 
645 class TcpPtr
646 {
647  protected:
649  int _off;
650 
651  void set(const EthPacketPtr &ptr, int offset) { p = ptr; _off = offset; }
652  void set(const IpPtr &ptr)
653  {
654  if (ptr && ptr->proto() == IP_PROTO_TCP)
655  set(ptr.p, ptr.pstart());
656  else
657  set(0, 0);
658  }
659  void set(const Ip6Ptr &ptr)
660  {
661  if (ptr && ptr->proto() == IP_PROTO_TCP)
662  set(ptr.p, ptr.pstart());
663  else
664  set(0, 0);
665  }
666 
667  public:
672  TcpPtr() : p(0), _off(0) {}
673  TcpPtr(const IpPtr &ptr) : p(0), _off(0) { set(ptr); }
674  TcpPtr(const Ip6Ptr &ptr) : p(0), _off(0) { set(ptr); }
675  TcpPtr(const TcpPtr &ptr) : p(ptr.p), _off(ptr._off) {} // end of api_inet
677 
678  TcpHdr *get() { return (TcpHdr *)(p->data + _off); }
679  TcpHdr *operator->() { return get(); }
680  TcpHdr &operator*() { return *get(); }
681 
682  const TcpHdr *get() const { return (const TcpHdr *)(p->data + _off); }
683  const TcpHdr *operator->() const { return get(); }
684  const TcpHdr &operator*() const { return *get(); }
685 
690  const TcpPtr &operator=(const IpPtr &i)
691  { set(i); return *this; }
692  const TcpPtr &operator=(const TcpPtr &t)
693  { set(t.p, t._off); return *this; } // end of api_inet
695 
700  const EthPacketPtr packet() const { return p; }
701  EthPacketPtr packet() { return p; }
702  bool operator!() const { return !p; }
703  operator bool() const { return (p != nullptr); }
704  int off() const { return _off; }
705  int pstart() const { return off() + get()->size(); } // end of api_inet
707 };
708 
712 uint16_t cksum(const TcpPtr &ptr);
713 
714 struct TcpOpt : public tcp_opt
715 {
716  uint8_t type() const { return opt_type; }
717  uint8_t len() const { return TCP_OPT_TYPEONLY(type()) ? 1 : opt_len; }
718 
719  bool isopt(int opt) const { return type() == opt; }
720 
721  const uint8_t *data() const { return opt_data.data8; }
722 
723  uint16_t mss() const { return ntohs(opt_data.mss); }
724  uint8_t wscale() const { return opt_data.wscale; }
725  uint32_t echo() const { return ntohl(opt_data.echo); }
726  uint32_t tsval() const { return ntohl(opt_data.timestamp[0]); }
727  uint32_t tsecr() const { return ntohl(opt_data.timestamp[1]); }
728  uint32_t cc() const { return ntohl(opt_data.cc); }
729  uint8_t cksum() const{ return opt_data.cksum; }
730  const uint8_t *md5() const { return opt_data.md5; }
731 
732  int size() const { return len(); }
733  const uint8_t *bytes() const { return (const uint8_t *)this; }
734  const uint8_t *payload() const { return bytes() + size(); }
735  uint8_t *bytes() { return (uint8_t *)this; }
736  uint8_t *payload() { return bytes() + size(); }
737 };
738 
739 /*
740  * UDP Stuff
741  */
742 struct UdpHdr : public udp_hdr
743 {
744  uint16_t sport() const { return ntohs(uh_sport); }
745  uint16_t dport() const { return ntohs(uh_dport); }
746  uint16_t len() const { return ntohs(uh_ulen); }
747  uint16_t sum() const { return uh_sum; }
748 
749  void sum(uint16_t sum) { uh_sum = sum; }
750  void len(uint16_t _len) { uh_ulen = htons(_len); }
751 
752  int size() const { return sizeof(udp_hdr); }
753  const uint8_t *bytes() const { return (const uint8_t *)this; }
754  const uint8_t *payload() const { return bytes() + size(); }
755  uint8_t *bytes() { return (uint8_t *)this; }
756  uint8_t *payload() { return bytes() + size(); }
757 };
758 
759 class UdpPtr
760 {
761  protected:
763  int _off;
764 
765  void set(const EthPacketPtr &ptr, int offset) { p = ptr; _off = offset; }
766  void set(const IpPtr &ptr)
767  {
768  if (ptr && ptr->proto() == IP_PROTO_UDP)
769  set(ptr.p, ptr.pstart());
770  else
771  set(0, 0);
772  }
773  void set(const Ip6Ptr &ptr)
774  {
775  if (ptr && ptr->proto() == IP_PROTO_UDP)
776  set(ptr.p, ptr.pstart());
777  else
778  set(0, 0);
779  }
780 
781  public:
785  UdpPtr() : p(0), _off(0) {}
786  UdpPtr(const IpPtr &ptr) : p(0), _off(0) { set(ptr); }
787  UdpPtr(const Ip6Ptr &ptr) : p(0), _off(0) { set(ptr); }
788  UdpPtr(const UdpPtr &ptr) : p(ptr.p), _off(ptr._off) {} // end of api_inet
790 
791  UdpHdr *get() { return (UdpHdr *)(p->data + _off); }
792  UdpHdr *operator->() { return get(); }
793  UdpHdr &operator*() { return *get(); }
794 
795  const UdpHdr *get() const { return (const UdpHdr *)(p->data + _off); }
796  const UdpHdr *operator->() const { return get(); }
797  const UdpHdr &operator*() const { return *get(); }
798 
803  const UdpPtr &operator=(const IpPtr &i) { set(i); return *this; }
804  const UdpPtr &operator=(const UdpPtr &t)
805  { set(t.p, t._off); return *this; } // end of api_inet
807 
812  const EthPacketPtr packet() const { return p; }
813  EthPacketPtr packet() { return p; }
814  bool operator!() const { return !p; }
815  operator bool() const { return (p != nullptr); }
816  int off() const { return _off; }
817  int pstart() const { return off() + get()->size(); } // end of api_inet
819 };
820 
825 uint16_t __tu_cksum6(const Ip6Ptr &ip6);
826 uint16_t __tu_cksum(const IpPtr &ip);
827 uint16_t cksum(const UdpPtr &ptr); // end of api_inet
829 
833 int hsplit(const EthPacketPtr &ptr);
834 
835 } // namespace networking
836 } // namespace gem5
837 
838 #endif // __BASE_INET_HH__
gem5::networking::EthHdr::type
uint16_t type() const
Definition: inet.hh:160
gem5::networking::Ip6Hdr::dstOptExt
const Ip6Opt * dstOptExt() const
Definition: inet.hh:472
gem5::networking::IpHdr::bytes
const uint8_t * bytes() const
Definition: inet.hh:350
gem5::MipsISA::ip6
Bitfield< 14 > ip6
Definition: pra_constants.hh:190
gem5::networking::TcpOpt::echo
uint32_t echo() const
Definition: inet.hh:725
gem5::networking::IpAddress
Definition: inet.hh:236
gem5::networking::Ip6Ptr::set
void set(const EthPacketPtr &ptr)
Definition: inet.hh:494
gem5::networking::TcpHdr::dport
uint16_t dport() const
Definition: inet.hh:623
gem5::networking::IpHdr::id
void id(uint16_t _id)
Definition: inet.hh:344
gem5::networking::TcpPtr::p
EthPacketPtr p
Definition: inet.hh:648
gem5::networking::TcpOpt::cc
uint32_t cc() const
Definition: inet.hh:728
gem5::networking::Ip6Opt::extlen
uint8_t extlen() const
Definition: inet.hh:594
gem5::networking::UdpHdr::sum
void sum(uint16_t sum)
Definition: inet.hh:749
gem5::networking::IpOpt::satid
uint16_t satid() const
Definition: inet.hh:444
gem5::networking::TcpHdr
Definition: inet.hh:620
gem5::networking::UdpPtr::operator->
const UdpHdr * operator->() const
Definition: inet.hh:796
gem5::networking::IpPtr::operator*
IpHdr & operator*()
Definition: inet.hh:392
gem5::networking::UdpPtr::off
int off() const
Definition: inet.hh:816
gem5::networking::TcpPtr::packet
EthPacketPtr packet()
Definition: inet.hh:701
gem5::networking::ip6_opt_dstopts::type
uint8_t type
Definition: inet.hh:574
gem5::GEM5_PACKED
PM4 packets.
Definition: pm4_defines.hh:77
gem5::networking::TcpPtr::TcpPtr
TcpPtr(const IpPtr &ptr)
Definition: inet.hh:673
gem5::networking::UdpPtr::get
UdpHdr * get()
Definition: inet.hh:791
gem5::networking::TcpHdr::sum
void sum(uint16_t sum)
Definition: inet.hh:632
gem5::networking::Ip6Opt::rtType2Type
uint8_t rtType2Type() const
Definition: inet.hh:601
gem5::networking::TcpOpt::mss
uint16_t mss() const
Definition: inet.hh:723
gem5::networking::TcpOpt
Definition: inet.hh:714
gem5::networking::IpPtr::operator!
bool operator!() const
Definition: inet.hh:415
gem5::networking::UdpHdr::size
int size() const
Definition: inet.hh:752
gem5::networking::IpOpt::ts
void ts(ip_opt_data_ts &ts) const
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::networking::UdpPtr::_off
int _off
Definition: inet.hh:763
gem5::networking::Ip6Hdr::extensionLength
int extensionLength() const
Definition: inet.cc:299
gem5::networking::Ip6Opt::fragmentOfflg
uint16_t fragmentOfflg() const
Definition: inet.hh:606
gem5::networking::EthAddr::string
std::string string() const
Definition: inet.cc:119
gem5::networking::operator<<
std::ostream & operator<<(std::ostream &stream, const EthAddr &ea)
Definition: inet.cc:133
gem5::networking::IpHdr::proto
uint8_t proto() const
Definition: inet.hh:338
gem5::networking::IpAddress::IpAddress
IpAddress(const uint32_t __ip)
Definition: inet.hh:248
gem5::networking::IpWithPort::_port
uint16_t _port
Definition: inet.hh:302
gem5::networking::IpHdr::len
uint16_t len() const
Definition: inet.hh:333
gem5::networking::IpOpt::tr
void tr(ip_opt_data_tr &tr) const
gem5::networking::EthPtr::operator*
const EthHdr & operator*() const
Definition: inet.hh:212
gem5::networking::Ip6Hdr::version
uint8_t version() const
Definition: inet.hh:458
gem5::networking::IpHdr::src
uint32_t src() const
Definition: inet.hh:340
gem5::networking::TcpHdr::seq
uint32_t seq() const
Definition: inet.hh:624
gem5::networking::IpHdr::payload
uint8_t * payload()
Definition: inet.hh:353
gem5::networking::TcpOpt::tsval
uint32_t tsval() const
Definition: inet.hh:726
gem5::networking::cksum
uint16_t cksum(const IpPtr &ptr)
Definition: inet.cc:208
gem5::networking::Ip6Hdr::payload
uint8_t * payload()
Definition: inet.hh:482
gem5::networking::TcpHdr::ack
uint32_t ack() const
Definition: inet.hh:625
gem5::networking::Ip6Hdr::proto
uint8_t proto() const
Definition: inet.cc:348
gem5::networking::EthHdr::isVlan
bool isVlan() const
Definition: inet.hh:159
gem5::networking::Ip6Hdr::getExt
const Ip6Opt * getExt(uint8_t ext) const
Definition: inet.cc:322
gem5::networking::hsplit
int hsplit(const EthPacketPtr &ptr)
Definition: inet.cc:386
gem5::networking::ip6_opt_dstopts
Definition: inet.hh:572
gem5::networking::EthAddr::unicast
bool unicast() const
Definition: inet.hh:114
gem5::networking::IpHdr::frag_flags
uint16_t frag_flags() const
Definition: inet.hh:335
gem5::networking::ip6_opt_fragment::offlg
uint16_t offlg
Definition: inet.hh:560
gem5::networking::IpOpt::typeNumber
uint8_t typeNumber() const
Definition: inet.hh:430
gem5::networking::Ip6Ptr::operator->
Ip6Hdr * operator->()
Definition: inet.hh:521
gem5::networking::IpPtr::eth_hdr_vlan
bool eth_hdr_vlan
Definition: inet.hh:362
gem5::networking::UdpPtr::operator*
const UdpHdr & operator*() const
Definition: inet.hh:797
gem5::networking::UdpHdr
Definition: inet.hh:742
gem5::networking::Ip6Ptr::get
Ip6Hdr * get()
Definition: inet.hh:519
gem5::networking::IpPtr::operator=
const IpPtr & operator=(const IpPtr &ptr)
Definition: inet.hh:407
gem5::networking::EthHdr
Definition: inet.hh:157
gem5::networking::TcpHdr::sum
uint16_t sum() const
Definition: inet.hh:629
gem5::networking::Ip6Ptr
Definition: inet.hh:486
gem5::networking::IpOpt::lsrr
void lsrr(ip_opt_data_rr &rr) const
gem5::networking::ip6_opt_routing_type2
Definition: inet.hh:564
gem5::networking::EthPtr::pstart
int pstart() const
Definition: inet.hh:229
gem5::networking::UdpPtr::operator=
const UdpPtr & operator=(const IpPtr &i)
Definition: inet.hh:803
gem5::networking::IpHdr::options
bool options(std::vector< const IpOpt * > &vec) const
Definition: inet.cc:262
gem5::networking::EthHdr::bytes
const uint8_t * bytes() const
Definition: inet.hh:185
gem5::networking::Ip6Opt::dstOptType
uint8_t dstOptType() const
Definition: inet.hh:610
gem5::networking::TcpPtr::get
TcpHdr * get()
Definition: inet.hh:678
gem5::networking::UdpPtr::packet
const EthPacketPtr packet() const
Definition: inet.hh:812
gem5::networking::IpNetmask
Definition: inet.hh:271
gem5::networking::IpHdr::version
uint8_t version() const
Definition: inet.hh:330
gem5::networking::IpHdr::ttl
uint8_t ttl() const
Definition: inet.hh:337
gem5::networking::TcpPtr::operator*
const TcpHdr & operator*() const
Definition: inet.hh:684
gem5::networking::IpWithPort
Definition: inet.hh:299
gem5::networking::Ip6Ptr::operator->
const Ip6Hdr * operator->() const
Definition: inet.hh:527
gem5::ArmISA::ea
Bitfield< 3 > ea
Definition: misc_types.hh:385
std::vector
STL vector class.
Definition: stl.hh:37
gem5::networking::Ip6Hdr::flow
uint32_t flow() const
Definition: inet.hh:459
gem5::networking::Ip6Ptr::operator*
const Ip6Hdr & operator*() const
Definition: inet.hh:528
gem5::networking::Ip6Ptr::operator=
const Ip6Ptr & operator=(const EthPtr &ptr)
Definition: inet.hh:536
gem5::networking::TcpPtr::set
void set(const Ip6Ptr &ptr)
Definition: inet.hh:659
gem5::networking::Ip6Ptr::Ip6Ptr
Ip6Ptr()
Definition: inet.hh:513
gem5::networking::Ip6Ptr::eth_hdr_vlan
bool eth_hdr_vlan
Definition: inet.hh:492
gem5::networking::UdpHdr::bytes
uint8_t * bytes()
Definition: inet.hh:755
gem5::networking::TcpOpt::payload
uint8_t * payload()
Definition: inet.hh:736
gem5::networking::EthHdr::dst
const EthAddr & dst() const
Definition: inet.hh:176
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:67
gem5::networking::EthAddr::size
int size() const
Definition: inet.hh:98
gem5::networking::TcpPtr::off
int off() const
Definition: inet.hh:704
gem5::networking::operator==
bool operator==(const EthAddr &left, const EthAddr &right)
Definition: inet.cc:127
gem5::networking::TcpOpt::type
uint8_t type() const
Definition: inet.hh:716
gem5::networking::UdpPtr::set
void set(const Ip6Ptr &ptr)
Definition: inet.hh:773
gem5::networking::IpPtr::IpPtr
IpPtr(const EthPtr &ptr)
Definition: inet.hh:385
gem5::networking::Ip6Ptr::off
int off() const
Definition: inet.hh:550
gem5::networking::TcpOpt::len
uint8_t len() const
Definition: inet.hh:717
gem5::networking::TcpPtr::packet
const EthPacketPtr packet() const
Definition: inet.hh:700
gem5::networking::IpOpt::mtup
uint16_t mtup() const
Definition: inet.hh:445
gem5::networking::TcpOpt::size
int size() const
Definition: inet.hh:732
gem5::networking::IpPtr::get
IpHdr * get()
Definition: inet.hh:389
gem5::networking::TcpOpt::bytes
const uint8_t * bytes() const
Definition: inet.hh:733
gem5::networking::IpPtr::set
void set(const EthPacketPtr &ptr)
Definition: inet.hh:364
gem5::networking::EthPtr::p
EthPacketPtr p
Definition: inet.hh:196
gem5::networking::IpOpt::typeCopied
uint8_t typeCopied() const
Definition: inet.hh:432
gem5::VegaISA::fragment
Bitfield< 11, 7 > fragment
Definition: pagetable.hh:58
gem5::networking::Ip6Hdr::payload
const uint8_t * payload() const
Definition: inet.hh:479
gem5::MipsISA::ia
Bitfield< 18, 16 > ia
Definition: pra_constants.hh:237
gem5::networking::EthAddr::multicast
bool multicast() const
Definition: inet.hh:115
gem5::networking::Ip6Hdr::src
const uint8_t * src() const
Definition: inet.hh:465
gem5::networking::EthAddr::parse
void parse(const std::string &addr)
Definition: inet.cc:97
gem5::networking::Ip6Ptr::p
EthPacketPtr p
Definition: inet.hh:491
gem5::networking::IpHdr::sum
void sum(uint16_t sum)
Definition: inet.hh:343
gem5::networking::IpOpt::sec
void sec(ip_opt_data_sec &sec) const
gem5::networking::UdpPtr::get
const UdpHdr * get() const
Definition: inet.hh:795
gem5::networking::TcpHdr::options
bool options(std::vector< const TcpOpt * > &vec) const
Definition: inet.cc:365
gem5::networking::IpOpt::isCopied
bool isCopied(int cpy) const
Definition: inet.hh:437
gem5::networking::IpOpt
Definition: inet.hh:427
gem5::networking::UdpPtr::operator=
const UdpPtr & operator=(const UdpPtr &t)
Definition: inet.hh:804
gem5::networking::UdpPtr::pstart
int pstart() const
Definition: inet.hh:817
gem5::networking::Ip6Ptr::operator!
bool operator!() const
Definition: inet.hh:548
gem5::networking::TcpOpt::cksum
uint8_t cksum() const
Definition: inet.hh:729
gem5::networking::TcpPtr::_off
int _off
Definition: inet.hh:649
gem5::networking::EthHdr::vlanId
uint16_t vlanId() const
Definition: inet.hh:168
gem5::networking::IpNetmask::netmask
uint8_t netmask() const
Definition: inet.hh:286
gem5::networking::IpPtr::operator->
const IpHdr * operator->() const
Definition: inet.hh:401
gem5::networking::UdpPtr::UdpPtr
UdpPtr(const IpPtr &ptr)
Definition: inet.hh:786
gem5::networking::IpNetmask::IpNetmask
IpNetmask(const uint32_t __ip, const uint8_t __netmask)
Definition: inet.hh:279
gem5::networking::TcpOpt::md5
const uint8_t * md5() const
Definition: inet.hh:730
gem5::VegaISA::t
Bitfield< 51 > t
Definition: pagetable.hh:56
gem5::networking::IpNetmask::string
std::string string() const
Definition: inet.cc:165
gem5::networking::EthHdr::bytes
uint8_t * bytes()
Definition: inet.hh:187
gem5::networking::TcpOpt::payload
const uint8_t * payload() const
Definition: inet.hh:734
gem5::EthPacketPtr
std::shared_ptr< EthPacketData > EthPacketPtr
Definition: etherpkt.hh:90
gem5::networking::EthAddr::EthAddr
EthAddr()
Definition: inet.cc:60
gem5::networking::TcpPtr::operator=
const TcpPtr & operator=(const IpPtr &i)
Definition: inet.hh:690
gem5::networking::Ip6Hdr::rtTypeExt
const Ip6Opt * rtTypeExt() const
Definition: inet.hh:471
gem5::networking::IpHdr::payload
const uint8_t * payload() const
Definition: inet.hh:351
gem5::networking::IpOpt::len
uint8_t len() const
Definition: inet.hh:433
gem5::networking::IpPtr::operator*
const IpHdr & operator*() const
Definition: inet.hh:402
gem5::networking::__tu_cksum6
uint16_t __tu_cksum6(const Ip6Ptr &ip6)
Definition: inet.cc:225
gem5::networking::IpPtr::operator=
const IpPtr & operator=(const EthPacketPtr &ptr)
Definition: inet.hh:405
gem5::networking::IpPtr
Definition: inet.hh:356
gem5::networking::UdpPtr::UdpPtr
UdpPtr(const Ip6Ptr &ptr)
Definition: inet.hh:787
gem5::networking::IpHdr::frag_off
uint16_t frag_off() const
Definition: inet.hh:336
gem5::networking::Ip6Hdr::bytes
const uint8_t * bytes() const
Definition: inet.hh:478
gem5::networking::EthAddr
Definition: inet.hh:77
gem5::networking::UdpPtr::operator!
bool operator!() const
Definition: inet.hh:814
gem5::networking::EthAddr::broadcast
bool broadcast() const
Definition: inet.hh:116
gem5::networking::ip6_opt_hdr::ext_len
uint8_t ext_len
Definition: inet.hh:582
gem5::networking::TcpHdr::payload
uint8_t * payload()
Definition: inet.hh:642
gem5::networking::Ip6Opt::fragmentIdent
uint32_t fragmentIdent() const
Definition: inet.hh:607
gem5::networking::TcpPtr::TcpPtr
TcpPtr()
Definition: inet.hh:672
gem5::networking::EthHdr::payload
const uint8_t * payload() const
Definition: inet.hh:186
gem5::networking::ip6_opt_routing_type2::segleft
uint8_t segleft
Definition: inet.hh:567
gem5::networking::UdpPtr::UdpPtr
UdpPtr(const UdpPtr &ptr)
Definition: inet.hh:788
gem5::networking::IpPtr::get
const IpHdr * get() const
Definition: inet.hh:398
gem5::networking::EthPtr::operator*
EthHdr & operator*()
Definition: inet.hh:208
gem5::networking::EthPtr::packet
EthPacketPtr packet()
Definition: inet.hh:225
gem5::networking::ip6_opt_hdr::ext_nxt
uint8_t ext_nxt
Definition: inet.hh:581
gem5::networking::EthHdr::payload
uint8_t * payload()
Definition: inet.hh:188
gem5::networking::TcpPtr::TcpPtr
TcpPtr(const TcpPtr &ptr)
Definition: inet.hh:675
gem5::networking::IpHdr
Definition: inet.hh:328
gem5::networking::IpNetmask::_netmask
uint8_t _netmask
Definition: inet.hh:274
gem5::networking::TcpHdr::flags
void flags(uint8_t _flags)
Definition: inet.hh:634
gem5::networking::UdpPtr::p
EthPacketPtr p
Definition: inet.hh:762
gem5::networking::Ip6Ptr::operator*
Ip6Hdr & operator*()
Definition: inet.hh:522
gem5::networking::EthPtr::operator!
bool operator!() const
Definition: inet.hh:226
gem5::ArmISA::offset
Bitfield< 23, 0 > offset
Definition: types.hh:144
gem5::networking::EthAddr::operator=
const EthAddr & operator=(const eth_addr &ea)
Definition: inet.cc:83
gem5::networking::IpPtr::IpPtr
IpPtr(const IpPtr &ptr)
Definition: inet.hh:386
gem5::networking::UdpPtr::set
void set(const EthPacketPtr &ptr, int offset)
Definition: inet.hh:765
gem5::networking::IpOpt::data
const uint8_t * data() const
Definition: inet.hh:439
compiler.hh
gem5::networking::TcpOpt::wscale
uint8_t wscale() const
Definition: inet.hh:724
gem5::networking::IpAddress::_ip
uint32_t _ip
Definition: inet.hh:239
gem5::networking::Ip6Ptr::Ip6Ptr
Ip6Ptr(const Ip6Ptr &ptr)
Definition: inet.hh:516
gem5::networking::EthPtr::operator->
const EthHdr * operator->() const
Definition: inet.hh:211
gem5::networking::IpNetmask::IpNetmask
IpNetmask()
Definition: inet.hh:277
gem5::networking::Ip6Opt::dstOptAddr
const uint8_t * dstOptAddr() const
Definition: inet.hh:612
gem5::networking::IpPtr::operator->
IpHdr * operator->()
Definition: inet.hh:391
gem5::ArmISA::ext
Bitfield< 12 > ext
Definition: misc_types.hh:485
gem5::networking::Ip6Ptr::operator=
const Ip6Ptr & operator=(const EthPacketPtr &ptr)
Definition: inet.hh:534
gem5::networking::Ip6Opt::rtType2Addr
const uint8_t * rtType2Addr() const
Definition: inet.hh:603
gem5::networking::UdpPtr::operator*
UdpHdr & operator*()
Definition: inet.hh:793
gem5::networking::UdpHdr::len
uint16_t len() const
Definition: inet.hh:746
gem5::networking::TcpOpt::isopt
bool isopt(int opt) const
Definition: inet.hh:719
gem5::networking::IpHdr::len
void len(uint16_t _len)
Definition: inet.hh:345
gem5::networking::TcpHdr::sport
uint16_t sport() const
Definition: inet.hh:622
gem5::networking::TcpHdr::bytes
uint8_t * bytes()
Definition: inet.hh:641
gem5::networking::EthPtr::off
int off() const
Definition: inet.hh:228
gem5::networking::EthPtr::operator=
const EthPtr & operator=(const EthPacketPtr &ptr)
Definition: inet.hh:218
gem5::networking::IpPtr::operator=
const IpPtr & operator=(const EthPtr &ptr)
Definition: inet.hh:406
gem5::networking::ip6_opt_dstopts::addr
ip6_addr_t addr
Definition: inet.hh:576
gem5::igbreg::txd_op::ip
bool ip(TxDesc *d)
Definition: i8254xGBe_defs.hh:330
gem5::networking::IpOpt::mtur
uint16_t mtur() const
Definition: inet.hh:446
gem5::networking::UdpHdr::dport
uint16_t dport() const
Definition: inet.hh:745
gem5::networking::TcpHdr::urp
uint16_t urp() const
Definition: inet.hh:630
gem5::networking::Ip6Hdr::hlen
uint16_t hlen() const
Definition: inet.hh:461
gem5::networking::EthPtr::EthPtr
EthPtr()
Definition: inet.hh:203
gem5::networking::TcpHdr::win
uint16_t win() const
Definition: inet.hh:628
gem5::networking::UdpHdr::payload
uint8_t * payload()
Definition: inet.hh:756
gem5::networking::Ip6Ptr::packet
const EthPacketPtr packet() const
Definition: inet.hh:546
gem5::networking::Ip6Hdr::size
int size() const
Definition: inet.hh:477
gem5::networking::Ip6Opt::dstOptLength
uint8_t dstOptLength() const
Definition: inet.hh:611
gem5::ArmISA::rr
Bitfield< 14 > rr
Definition: misc_types.hh:425
gem5::networking::Ip6Hdr::fragmentExt
const Ip6Opt * fragmentExt() const
Definition: inet.hh:470
gem5::networking::IpOpt::isNumber
bool isNumber(int num) const
Definition: inet.hh:435
gem5::networking::ip6_opt_routing_type2::type
uint8_t type
Definition: inet.hh:566
gem5::networking::Ip6Ptr::get
const Ip6Hdr * get() const
Definition: inet.hh:524
gem5::X86ISA::reg
Bitfield< 5, 3 > reg
Definition: types.hh:92
gem5::networking::UdpPtr::UdpPtr
UdpPtr()
Definition: inet.hh:785
gem5::networking::IpWithPort::string
std::string string() const
Definition: inet.cc:187
gem5::networking::IpPtr::packet
EthPacketPtr packet()
Definition: inet.hh:414
gem5::networking::IpWithPort::IpWithPort
IpWithPort()
Definition: inet.hh:305
gem5::networking::TcpHdr::off
uint8_t off() const
Definition: inet.hh:626
gem5::networking::TcpPtr::operator!
bool operator!() const
Definition: inet.hh:702
gem5::networking::IpPtr::IpPtr
IpPtr(const EthPacketPtr &ptr)
Definition: inet.hh:384
gem5::networking::IpPtr::IpPtr
IpPtr()
Definition: inet.hh:383
gem5::networking::Ip6Opt::nxt
uint8_t nxt() const
Definition: inet.hh:593
gem5::networking::Ip6Opt::rtType2SegLft
uint8_t rtType2SegLft() const
Definition: inet.hh:602
gem5::networking::IpOpt::ssrr
void ssrr(ip_opt_data_rr &rr) const
gem5::networking::IpHdr::tos
uint8_t tos() const
Definition: inet.hh:332
gem5::networking::IpOpt::isClass
bool isClass(int cls) const
Definition: inet.hh:436
gem5::networking::Ip6Hdr::hlim
uint8_t hlim() const
Definition: inet.hh:463
gem5::networking::IpAddress::IpAddress
IpAddress()
Definition: inet.hh:246
gem5::networking::EthAddr::bytes
const uint8_t * bytes() const
Definition: inet.hh:105
gem5::networking::UdpPtr::packet
EthPacketPtr packet()
Definition: inet.hh:813
types.hh
gem5::networking::TcpPtr::operator->
const TcpHdr * operator->() const
Definition: inet.hh:683
gem5::networking::IpOpt::rtralt
uint16_t rtralt() const
Definition: inet.hh:448
gem5::networking::UdpPtr::operator->
UdpHdr * operator->()
Definition: inet.hh:792
gem5::networking::UdpHdr::bytes
const uint8_t * bytes() const
Definition: inet.hh:753
gem5::PowerISA::vec
Bitfield< 25 > vec
Definition: misc.hh:113
gem5::networking::TcpPtr::get
const TcpHdr * get() const
Definition: inet.hh:682
gem5::networking::EthPtr::packet
const EthPacketPtr packet() const
Definition: inet.hh:224
gem5::networking::TcpHdr::flags
uint8_t flags() const
Definition: inet.hh:627
gem5::networking::Ip6Hdr
Definition: inet.hh:456
gem5::networking::EthPtr::operator->
EthHdr * operator->()
Definition: inet.hh:207
gem5::networking::EthAddr::bytes
uint8_t * bytes()
Definition: inet.hh:106
gem5::networking::ip6_opt_fragment
Definition: inet.hh:558
gem5::networking::__tu_cksum
uint16_t __tu_cksum(const IpPtr &ip)
Definition: inet.cc:215
gem5::networking::TcpPtr::pstart
int pstart() const
Definition: inet.hh:705
gem5::networking::TcpPtr::set
void set(const IpPtr &ptr)
Definition: inet.hh:652
gem5::networking::IpHdr::dst
uint32_t dst() const
Definition: inet.hh:341
gem5::networking::TcpPtr::operator*
TcpHdr & operator*()
Definition: inet.hh:680
gem5::networking::TcpHdr::payload
const uint8_t * payload() const
Definition: inet.hh:640
gem5::networking::IpPtr::pstart
int pstart() const
Definition: inet.hh:418
gem5::networking::Ip6Opt::len
uint8_t len() const
Definition: inet.hh:595
gem5::networking::TcpPtr::TcpPtr
TcpPtr(const Ip6Ptr &ptr)
Definition: inet.hh:674
gem5::networking::Ip6Hdr::bytes
uint8_t * bytes()
Definition: inet.hh:481
gem5::networking::IpHdr::sum
uint16_t sum() const
Definition: inet.hh:339
gem5::networking::UdpHdr::len
void len(uint16_t _len)
Definition: inet.hh:750
etherpkt.hh
gem5::networking::IpAddress::string
std::string string() const
Definition: inet.cc:141
gem5::networking::IpHdr::hlen
uint8_t hlen() const
Definition: inet.hh:331
gem5::networking::EthPtr
Definition: inet.hh:191
gem5::networking::Ip6Hdr::dst
const uint8_t * dst() const
Definition: inet.hh:466
gem5::networking::UdpHdr::sum
uint16_t sum() const
Definition: inet.hh:747
gem5::networking::TcpPtr::operator=
const TcpPtr & operator=(const TcpPtr &t)
Definition: inet.hh:692
gem5::networking::TcpHdr::bytes
const uint8_t * bytes() const
Definition: inet.hh:639
gem5::networking::Ip6Hdr::plen
void plen(uint16_t _plen)
Definition: inet.hh:475
gem5::networking::IpPtr::packet
const EthPacketPtr packet() const
Definition: inet.hh:413
gem5::networking::TcpHdr::size
int size() const
Definition: inet.hh:638
gem5::networking::EthHdr::size
int size() const
Definition: inet.hh:178
gem5::networking::Ip6Ptr::operator=
const Ip6Ptr & operator=(const Ip6Ptr &ptr)
Definition: inet.hh:538
gem5::networking::EthAddr::addr
const uint8_t * addr() const
Definition: inet.hh:113
gem5::networking::TcpOpt::data
const uint8_t * data() const
Definition: inet.hh:721
gem5::networking::IpWithPort::port
uint8_t port() const
Definition: inet.hh:314
gem5::networking::IpPtr::off
int off() const
Definition: inet.hh:417
gem5::networking::UdpHdr::sport
uint16_t sport() const
Definition: inet.hh:744
gem5::networking::ip6_opt_dstopts::length
uint8_t length
Definition: inet.hh:575
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::networking::ip6_opt_fragment::ident
uint32_t ident
Definition: inet.hh:561
gem5::networking::EthHdr::src
const EthAddr & src() const
Definition: inet.hh:175
gem5::networking::Ip6Ptr::pstart
int pstart() const
Definition: inet.hh:551
gem5::networking::Ip6Hdr::plen
uint16_t plen() const
Definition: inet.hh:460
gem5::networking::TcpOpt::bytes
uint8_t * bytes()
Definition: inet.hh:735
gem5::networking::IpHdr::id
uint16_t id() const
Definition: inet.hh:334
gem5::networking::TcpPtr::operator->
TcpHdr * operator->()
Definition: inet.hh:679
gem5::networking::Ip6Ptr::Ip6Ptr
Ip6Ptr(const EthPacketPtr &ptr)
Definition: inet.hh:514
gem5::networking::IpPtr::p
EthPacketPtr p
Definition: inet.hh:361
gem5::networking::EthPtr::EthPtr
EthPtr(const EthPacketPtr &ptr)
Definition: inet.hh:204
gem5::networking::TcpOpt::tsecr
uint32_t tsecr() const
Definition: inet.hh:727
gem5::networking::UdpPtr
Definition: inet.hh:759
gem5::networking::ip6_opt_hdr
Definition: inet.hh:579
gem5::networking::IpWithPort::IpWithPort
IpWithPort(const uint32_t __ip, const uint16_t __port)
Definition: inet.hh:307
gem5::networking::ip6_opt_routing_type2::addr
ip6_addr_t addr
Definition: inet.hh:569
gem5::networking::ip6_opt_routing_type2::reserved
uint32_t reserved
Definition: inet.hh:568
gem5::networking::Ip6Ptr::Ip6Ptr
Ip6Ptr(const EthPtr &ptr)
Definition: inet.hh:515
gem5::networking::IpHdr::size
int size() const
Definition: inet.hh:349
gem5::networking::IpOpt::type
uint8_t type() const
Definition: inet.hh:429
gem5::networking::TcpPtr::set
void set(const EthPacketPtr &ptr, int offset)
Definition: inet.hh:651
gem5::networking::Ip6Hdr::nxt
uint8_t nxt() const
Definition: inet.hh:462
gem5::networking::UdpPtr::set
void set(const IpPtr &ptr)
Definition: inet.hh:766
gem5::networking::IpOpt::sdb
void sdb(std::vector< uint32_t > &vec) const
gem5::networking::TcpPtr
Definition: inet.hh:645
gem5::networking::IpAddress::ip
uint32_t ip() const
Definition: inet.hh:255
gem5::networking::Ip6Ptr::packet
EthPacketPtr packet()
Definition: inet.hh:547
gem5::networking::UdpHdr::payload
const uint8_t * payload() const
Definition: inet.hh:754
gem5::networking::TcpHdr::seq
void seq(uint32_t _seq)
Definition: inet.hh:633
gem5::networking::IpOpt::typeClass
uint8_t typeClass() const
Definition: inet.hh:431
gem5::networking::IpHdr::bytes
uint8_t * bytes()
Definition: inet.hh:352
gem5::networking::ip6_opt_hdr::ext_data
union gem5::networking::ip6_opt_hdr::@36 ext_data
gem5::networking::Ip6Opt
Definition: inet.hh:591

Generated on Sun Jul 30 2023 01:56:51 for gem5 by doxygen 1.8.17