gem5  v20.1.0.0
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/types.hh"
51 #include "dev/net/etherpkt.hh"
52 #include "dnet/os.h"
53 #include "dnet/eth.h"
54 #include "dnet/ip.h"
55 #include "dnet/ip6.h"
56 #include "dnet/addr.h"
57 #include "dnet/arp.h"
58 #include "dnet/icmp.h"
59 #include "dnet/tcp.h"
60 #include "dnet/udp.h"
61 #include "dnet/intf.h"
62 #include "dnet/route.h"
63 #include "dnet/fw.h"
64 #include "dnet/blob.h"
65 #include "dnet/rand.h"
66 
67 namespace Net {
68 
69 /*
70  * Ethernet Stuff
71  */
72 struct EthAddr : protected eth_addr
73 {
74  protected:
75  void parse(const std::string &addr);
76 
77  public:
82  EthAddr();
83  EthAddr(const uint8_t ea[ETH_ADDR_LEN]);
84  EthAddr(const eth_addr &ea);
85  EthAddr(const std::string &addr);
86  const EthAddr &operator=(const eth_addr &ea);
87  const EthAddr &operator=(const std::string &addr); // end of api_inet
89 
93  int size() const { return sizeof(eth_addr); }
94 
95 
100  const uint8_t *bytes() const { return &data[0]; }
101  uint8_t *bytes() { return &data[0]; } // end of api_inet
103 
108  const uint8_t *addr() const { return &data[0]; }
109  bool unicast() const { return !(data[0] & 0x01); }
110  bool multicast() const { return !unicast() && !broadcast(); }
111  bool broadcast() const
112  {
113  bool isBroadcast = true;
114  for (int i = 0; i < ETH_ADDR_LEN; ++i) {
115  isBroadcast = isBroadcast && data[i] == 0xff;
116  }
117 
118  return isBroadcast;
119  } // end of api_inet
121 
125  std::string string() const;
126 
130  operator uint64_t() const
131  {
132  uint64_t reg = 0;
133  reg |= ((uint64_t)data[0]) << 40;
134  reg |= ((uint64_t)data[1]) << 32;
135  reg |= ((uint64_t)data[2]) << 24;
136  reg |= ((uint64_t)data[3]) << 16;
137  reg |= ((uint64_t)data[4]) << 8;
138  reg |= ((uint64_t)data[5]) << 0;
139  return reg;
140  }
141 
142 };
143 
148 std::ostream &operator<<(std::ostream &stream, const EthAddr &ea);
149 bool operator==(const EthAddr &left, const EthAddr &right); // end of api_inet
151 
152 struct EthHdr : public eth_hdr
153 {
154  bool isVlan() const { return (ntohs(eth_type) == ETH_TYPE_8021Q); }
155  uint16_t type() const {
156  if (!isVlan())
157  return ntohs(eth_type);
158  else
159  // L3 type is now 16 bytes into the hdr with 802.1Q
160  // instead of 12. dnet/eth.h only supports 802.1
161  return ntohs(*((uint16_t*)(((uint8_t *)this) + 16)));
162  }
163  uint16_t vlanId() const {
164  if (isVlan())
165  return ntohs(*((uint16_t*)(((uint8_t *)this) + 14)));
166  else
167  return 0x0000;
168  }
169 
170  const EthAddr &src() const { return *(EthAddr *)&eth_src; }
171  const EthAddr &dst() const { return *(EthAddr *)&eth_dst; }
172 
173  int size() const {
174  if (!isVlan())
175  return sizeof(eth_hdr);
176  else
177  return (sizeof(eth_hdr)+4);
178  }
179 
180  const uint8_t *bytes() const { return (const uint8_t *)this; }
181  const uint8_t *payload() const { return bytes() + size(); }
182  uint8_t *bytes() { return (uint8_t *)this; }
183  uint8_t *payload() { return bytes() + size(); }
184 };
185 
186 class EthPtr
187 {
188  protected:
189  friend class IpPtr;
190  friend class Ip6Ptr;
192 
193  public:
198  EthPtr() {}
199  EthPtr(const EthPacketPtr &ptr) : p(ptr) { } // end of api_inet
201 
202  EthHdr *operator->() { return (EthHdr *)p->data; }
203  EthHdr &operator*() { return *(EthHdr *)p->data; }
204  operator EthHdr *() { return (EthHdr *)p->data; }
205 
206  const EthHdr *operator->() const { return (const EthHdr *)p->data; }
207  const EthHdr &operator*() const { return *(const EthHdr *)p->data; }
208  operator const EthHdr *() const { return (const EthHdr *)p->data; }
209 
213  const EthPtr &operator=(const EthPacketPtr &ptr) { p = ptr; return *this; }
214 
219  const EthPacketPtr packet() const { return p; }
220  EthPacketPtr packet() { return p; }
221  bool operator!() const { return !p; }
222  operator bool() const { return (p != nullptr); }
223  int off() const { return 0; }
224  int pstart() const { return off() + ((const EthHdr*)p->data)->size(); } // end of api_inet
226 };
227 
228 /*
229  * IP Stuff
230  */
231 struct IpAddress
232 {
233  protected:
234  uint32_t _ip;
235 
236  public:
241  IpAddress() : _ip(0)
242  {}
243  IpAddress(const uint32_t __ip) : _ip(__ip)
244  {} // end of api_net
246 
250  uint32_t ip() const { return _ip; }
251 
255  std::string string() const;
256 };
257 
262 std::ostream &operator<<(std::ostream &stream, const IpAddress &ia);
263 bool operator==(const IpAddress &left, const IpAddress &right); // end of api_inet
265 
266 struct IpNetmask : public IpAddress
267 {
268  protected:
269  uint8_t _netmask;
270 
271  public:
273  {}
274  IpNetmask(const uint32_t __ip, const uint8_t __netmask) :
275  IpAddress(__ip), _netmask(__netmask)
276  {}
277 
281  uint8_t netmask() const { return _netmask; }
282 
283  std::string string() const;
284 };
285 
290 std::ostream &operator<<(std::ostream &stream, const IpNetmask &in);
291 bool operator==(const IpNetmask &left, const IpNetmask &right); // end of api_inet
293 
294 struct IpWithPort : public IpAddress
295 {
296  protected:
297  uint16_t _port;
298 
299  public:
301  {}
302  IpWithPort(const uint32_t __ip, const uint16_t __port) :
303  IpAddress(__ip), _port(__port)
304  {}
305 
309  uint8_t port() const { return _port; }
310 
311  std::string string() const;
312 };
313 
318 std::ostream &operator<<(std::ostream &stream, const IpWithPort &iwp);
319 bool operator==(const IpWithPort &left, const IpWithPort &right); // end of api_inet
321 
322 struct IpOpt;
323 struct IpHdr : public ip_hdr
324 {
325  uint8_t version() const { return ip_v; }
326  uint8_t hlen() const { return ip_hl * 4; }
327  uint8_t tos() const { return ip_tos; }
328  uint16_t len() const { return ntohs(ip_len); }
329  uint16_t id() const { return ntohs(ip_id); }
330  uint16_t frag_flags() const { return ntohs(ip_off) >> 13; }
331  uint16_t frag_off() const { return ntohs(ip_off) & 0x1fff; }
332  uint8_t ttl() const { return ip_ttl; }
333  uint8_t proto() const { return ip_p; }
334  uint16_t sum() const { return ip_sum; }
335  uint32_t src() const { return ntohl(ip_src); }
336  uint32_t dst() const { return ntohl(ip_dst); }
337 
338  void sum(uint16_t sum) { ip_sum = sum; }
339  void id(uint16_t _id) { ip_id = htons(_id); }
340  void len(uint16_t _len) { ip_len = htons(_len); }
341 
342  bool options(std::vector<const IpOpt *> &vec) const;
343 
344  int size() const { return hlen(); }
345  const uint8_t *bytes() const { return (const uint8_t *)this; }
346  const uint8_t *payload() const { return bytes() + size(); }
347  uint8_t *bytes() { return (uint8_t *)this; }
348  uint8_t *payload() { return bytes() + size(); }
349 };
350 
351 class IpPtr
352 {
353  protected:
354  friend class TcpPtr;
355  friend class UdpPtr;
358 
359  void set(const EthPacketPtr &ptr)
360  {
361  p = 0;
362  eth_hdr_vlan = false;
363 
364  if (ptr) {
365  EthHdr *eth = (EthHdr *)ptr->data;
366  if (eth->type() == ETH_TYPE_IP)
367  p = ptr;
368  if (eth->isVlan())
369  eth_hdr_vlan = true;
370  }
371  }
372 
373  public:
378  IpPtr() : p(0), eth_hdr_vlan(false) {}
379  IpPtr(const EthPacketPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr); }
380  IpPtr(const EthPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr.p); }
381  IpPtr(const IpPtr &ptr) : p(ptr.p), eth_hdr_vlan(ptr.eth_hdr_vlan) { } // end of api_inet
383 
384  IpHdr *get() { return (IpHdr *)(p->data + sizeof(eth_hdr) +
385  ((eth_hdr_vlan) ? 4 : 0)); }
386  IpHdr *operator->() { return get(); }
387  IpHdr &operator*() { return *get(); }
388 
393  const IpHdr *get() const
394  { return (const IpHdr *)(p->data + sizeof(eth_hdr) +
395  ((eth_hdr_vlan) ? 4 : 0)); }
396  const IpHdr *operator->() const { return get(); }
397  const IpHdr &operator*() const { return *get(); } // end of api_inet
399 
400  const IpPtr &operator=(const EthPacketPtr &ptr) { set(ptr); return *this; }
401  const IpPtr &operator=(const EthPtr &ptr) { set(ptr.p); return *this; }
402  const IpPtr &operator=(const IpPtr &ptr) { p = ptr.p; return *this; }
403 
408  const EthPacketPtr packet() const { return p; }
409  EthPacketPtr packet() { return p; }
410  bool operator!() const { return !p; }
411  operator bool() const { return (p != nullptr); }
412  int off() const { return (sizeof(eth_hdr) + ((eth_hdr_vlan) ? 4 : 0)); }
413  int pstart() const { return (off() + get()->size()); } // end of api_inet
415 };
416 
420 uint16_t cksum(const IpPtr &ptr);
421 
422 struct IpOpt : public ip_opt
423 {
424  uint8_t type() const { return opt_type; }
425  uint8_t typeNumber() const { return IP_OPT_NUMBER(opt_type); }
426  uint8_t typeClass() const { return IP_OPT_CLASS(opt_type); }
427  uint8_t typeCopied() const { return IP_OPT_COPIED(opt_type); }
428  uint8_t len() const { return IP_OPT_TYPEONLY(type()) ? 1 : opt_len; }
429 
430  bool isNumber(int num) const { return typeNumber() == IP_OPT_NUMBER(num); }
431  bool isClass(int cls) const { return typeClass() == IP_OPT_CLASS(cls); }
432  bool isCopied(int cpy) const { return typeCopied() == IP_OPT_COPIED(cpy); }
433 
434  const uint8_t *data() const { return opt_data.data8; }
435  void sec(ip_opt_data_sec &sec) const;
436  void lsrr(ip_opt_data_rr &rr) const;
437  void ssrr(ip_opt_data_rr &rr) const;
438  void ts(ip_opt_data_ts &ts) const;
439  uint16_t satid() const { return ntohs(opt_data.satid); }
440  uint16_t mtup() const { return ntohs(opt_data.mtu); }
441  uint16_t mtur() const { return ntohs(opt_data.mtu); }
442  void tr(ip_opt_data_tr &tr) const;
443  uint16_t rtralt() const { return ntohs(opt_data.rtralt); }
444  void sdb(std::vector<uint32_t> &vec) const;
445 };
446 
447 /*
448  * Ip6 Classes
449  */
450 struct Ip6Opt;
451 struct Ip6Hdr : public ip6_hdr
452 {
453  uint8_t version() const { return ip6_vfc; }
454  uint32_t flow() const { return ntohl(ip6_flow); }
455  uint16_t plen() const { return ntohs(ip6_plen); }
456  uint16_t hlen() const { return IP6_HDR_LEN; }
457  uint8_t nxt() const { return ip6_nxt; }
458  uint8_t hlim() const { return ip6_hlim; }
459 
460  const uint8_t* src() const { return ip6_src.data; }
461  const uint8_t* dst() const { return ip6_dst.data; }
462 
463  int extensionLength() const;
464  const Ip6Opt* getExt(uint8_t ext) const;
465  const Ip6Opt* fragmentExt() const { return getExt(IP_PROTO_FRAGMENT); }
466  const Ip6Opt* rtTypeExt() const { return getExt(IP_PROTO_ROUTING); }
467  const Ip6Opt* dstOptExt() const { return getExt(IP_PROTO_DSTOPTS); }
468  uint8_t proto() const;
469 
470  void plen(uint16_t _plen) { ip6_plen = htons(_plen); }
471 
472  int size() const { return IP6_HDR_LEN + extensionLength(); }
473  const uint8_t *bytes() const { return (const uint8_t *)this; }
474  const uint8_t *payload() const { return bytes() + IP6_HDR_LEN
475  + extensionLength(); }
476  uint8_t *bytes() { return (uint8_t *)this; }
477  uint8_t *payload() { return bytes() + IP6_HDR_LEN
478  + extensionLength(); }
479 };
480 
481 class Ip6Ptr
482 {
483  protected:
484  friend class TcpPtr;
485  friend class UdpPtr;
488 
489  void set(const EthPacketPtr &ptr)
490  {
491  p = 0;
492  eth_hdr_vlan = false;
493 
494  if (ptr) {
495  EthHdr *eth = (EthHdr *)ptr->data;
496  if (eth->type() == ETH_TYPE_IPV6)
497  p = ptr;
498  if (eth->isVlan())
499  eth_hdr_vlan = true;
500  }
501  }
502 
503  public:
508  Ip6Ptr() : p(0), eth_hdr_vlan(false) {}
509  Ip6Ptr(const EthPacketPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr); }
510  Ip6Ptr(const EthPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr.p); }
511  Ip6Ptr(const Ip6Ptr &ptr) : p(ptr.p), eth_hdr_vlan(ptr.eth_hdr_vlan) { } // end of api_inet
513 
514  Ip6Hdr *get() { return (Ip6Hdr *)(p->data + sizeof(eth_hdr)
515  + ((eth_hdr_vlan) ? 4 : 0)); }
516  Ip6Hdr *operator->() { return get(); }
517  Ip6Hdr &operator*() { return *get(); }
518 
519  const Ip6Hdr *get() const
520  { return (const Ip6Hdr *)(p->data + sizeof(eth_hdr)
521  + ((eth_hdr_vlan) ? 4 : 0)); }
522  const Ip6Hdr *operator->() const { return get(); }
523  const Ip6Hdr &operator*() const { return *get(); }
524 
529  const Ip6Ptr &operator=(const EthPacketPtr &ptr)
530  { set(ptr); return *this; }
531  const Ip6Ptr &operator=(const EthPtr &ptr)
532  { set(ptr.p); return *this; }
533  const Ip6Ptr &operator=(const Ip6Ptr &ptr)
534  { p = ptr.p; return *this; } // end of api_inet
536 
541  const EthPacketPtr packet() const { return p; }
542  EthPacketPtr packet() { return p; }
543  bool operator!() const { return !p; }
544  operator bool() const { return (p != nullptr); }
545  int off() const { return sizeof(eth_hdr) + ((eth_hdr_vlan) ? 4 : 0); }
546  int pstart() const { return off() + get()->size(); } // end of api_inet
548 };
549 
550 // Dnet supplied ipv6 opt header is incomplete and
551 // newer NIC card filters expect a more robust
552 // ipv6 header option declaration.
554  uint16_t offlg;
555  uint32_t ident;
556 };
557 
559  uint8_t type;
560  uint8_t segleft;
561  uint32_t reserved;
562  ip6_addr_t addr;
563 };
564 
565 #define HOME_ADDRESS_OPTION 0xC9
567  uint8_t type;
568  uint8_t length;
569  ip6_addr_t addr;
570 } __attribute__((packed));
571 
573 {
574  uint8_t ext_nxt;
575  uint8_t ext_len;
576  union {
580  } ext_data;
581 } __attribute__((packed));
582 
583 struct Ip6Opt : public ip6_opt_hdr
584 {
585  uint8_t nxt() const { return ext_nxt; }
586  uint8_t extlen() const { return ext_len; }
587  uint8_t len() const { return extlen() + 8; }
588 
589  // Supporting the types of header extensions likely to be encountered:
590  // fragment, routing type 2 and dstopts.
591 
592  // Routing type 2
593  uint8_t rtType2Type() const { return ext_data.rtType2.type; }
594  uint8_t rtType2SegLft() const { return ext_data.rtType2.segleft; }
595  const uint8_t* rtType2Addr() const { return ext_data.rtType2.addr.data; }
596 
597  // Fragment
598  uint16_t fragmentOfflg() const { return ntohs(ext_data.fragment.offlg); }
599  uint32_t fragmentIdent() const { return ntohl(ext_data.fragment.ident); }
600 
601  // Dst Options/Home Address Option
602  uint8_t dstOptType() const { return ext_data.dstOpts.type; }
603  uint8_t dstOptLength() const { return ext_data.dstOpts.length; }
604  const uint8_t* dstOptAddr() const { return ext_data.dstOpts.addr.data; }
605 };
606 
607 
608 /*
609  * TCP Stuff
610  */
611 struct TcpOpt;
612 struct TcpHdr : public tcp_hdr
613 {
614  uint16_t sport() const { return ntohs(th_sport); }
615  uint16_t dport() const { return ntohs(th_dport); }
616  uint32_t seq() const { return ntohl(th_seq); }
617  uint32_t ack() const { return ntohl(th_ack); }
618  uint8_t off() const { return th_off*4; }
619  uint8_t flags() const { return th_flags & 0x3f; }
620  uint16_t win() const { return ntohs(th_win); }
621  uint16_t sum() const { return th_sum; }
622  uint16_t urp() const { return ntohs(th_urp); }
623 
624  void sum(uint16_t sum) { th_sum = sum; }
625  void seq(uint32_t _seq) { th_seq = htonl(_seq); }
626  void flags(uint8_t _flags) { th_flags = _flags; }
627 
628  bool options(std::vector<const TcpOpt *> &vec) const;
629 
630  int size() const { return off(); }
631  const uint8_t *bytes() const { return (const uint8_t *)this; }
632  const uint8_t *payload() const { return bytes() + size(); }
633  uint8_t *bytes() { return (uint8_t *)this; }
634  uint8_t *payload() { return bytes() + size(); }
635 };
636 
637 class TcpPtr
638 {
639  protected:
641  int _off;
642 
643  void set(const EthPacketPtr &ptr, int offset) { p = ptr; _off = offset; }
644  void set(const IpPtr &ptr)
645  {
646  if (ptr && ptr->proto() == IP_PROTO_TCP)
647  set(ptr.p, ptr.pstart());
648  else
649  set(0, 0);
650  }
651  void set(const Ip6Ptr &ptr)
652  {
653  if (ptr && ptr->proto() == IP_PROTO_TCP)
654  set(ptr.p, ptr.pstart());
655  else
656  set(0, 0);
657  }
658 
659  public:
664  TcpPtr() : p(0), _off(0) {}
665  TcpPtr(const IpPtr &ptr) : p(0), _off(0) { set(ptr); }
666  TcpPtr(const Ip6Ptr &ptr) : p(0), _off(0) { set(ptr); }
667  TcpPtr(const TcpPtr &ptr) : p(ptr.p), _off(ptr._off) {} // end of api_inet
669 
670  TcpHdr *get() { return (TcpHdr *)(p->data + _off); }
671  TcpHdr *operator->() { return get(); }
672  TcpHdr &operator*() { return *get(); }
673 
674  const TcpHdr *get() const { return (const TcpHdr *)(p->data + _off); }
675  const TcpHdr *operator->() const { return get(); }
676  const TcpHdr &operator*() const { return *get(); }
677 
682  const TcpPtr &operator=(const IpPtr &i)
683  { set(i); return *this; }
684  const TcpPtr &operator=(const TcpPtr &t)
685  { set(t.p, t._off); return *this; } // end of api_inet
687 
692  const EthPacketPtr packet() const { return p; }
693  EthPacketPtr packet() { return p; }
694  bool operator!() const { return !p; }
695  operator bool() const { return (p != nullptr); }
696  int off() const { return _off; }
697  int pstart() const { return off() + get()->size(); } // end of api_inet
699 };
700 
704 uint16_t cksum(const TcpPtr &ptr);
705 
706 struct TcpOpt : public tcp_opt
707 {
708  uint8_t type() const { return opt_type; }
709  uint8_t len() const { return TCP_OPT_TYPEONLY(type()) ? 1 : opt_len; }
710 
711  bool isopt(int opt) const { return type() == opt; }
712 
713  const uint8_t *data() const { return opt_data.data8; }
714 
715  uint16_t mss() const { return ntohs(opt_data.mss); }
716  uint8_t wscale() const { return opt_data.wscale; }
717  uint32_t echo() const { return ntohl(opt_data.echo); }
718  uint32_t tsval() const { return ntohl(opt_data.timestamp[0]); }
719  uint32_t tsecr() const { return ntohl(opt_data.timestamp[1]); }
720  uint32_t cc() const { return ntohl(opt_data.cc); }
721  uint8_t cksum() const{ return opt_data.cksum; }
722  const uint8_t *md5() const { return opt_data.md5; }
723 
724  int size() const { return len(); }
725  const uint8_t *bytes() const { return (const uint8_t *)this; }
726  const uint8_t *payload() const { return bytes() + size(); }
727  uint8_t *bytes() { return (uint8_t *)this; }
728  uint8_t *payload() { return bytes() + size(); }
729 };
730 
731 /*
732  * UDP Stuff
733  */
734 struct UdpHdr : public udp_hdr
735 {
736  uint16_t sport() const { return ntohs(uh_sport); }
737  uint16_t dport() const { return ntohs(uh_dport); }
738  uint16_t len() const { return ntohs(uh_ulen); }
739  uint16_t sum() const { return uh_sum; }
740 
741  void sum(uint16_t sum) { uh_sum = sum; }
742  void len(uint16_t _len) { uh_ulen = htons(_len); }
743 
744  int size() const { return sizeof(udp_hdr); }
745  const uint8_t *bytes() const { return (const uint8_t *)this; }
746  const uint8_t *payload() const { return bytes() + size(); }
747  uint8_t *bytes() { return (uint8_t *)this; }
748  uint8_t *payload() { return bytes() + size(); }
749 };
750 
751 class UdpPtr
752 {
753  protected:
755  int _off;
756 
757  void set(const EthPacketPtr &ptr, int offset) { p = ptr; _off = offset; }
758  void set(const IpPtr &ptr)
759  {
760  if (ptr && ptr->proto() == IP_PROTO_UDP)
761  set(ptr.p, ptr.pstart());
762  else
763  set(0, 0);
764  }
765  void set(const Ip6Ptr &ptr)
766  {
767  if (ptr && ptr->proto() == IP_PROTO_UDP)
768  set(ptr.p, ptr.pstart());
769  else
770  set(0, 0);
771  }
772 
773  public:
777  UdpPtr() : p(0), _off(0) {}
778  UdpPtr(const IpPtr &ptr) : p(0), _off(0) { set(ptr); }
779  UdpPtr(const Ip6Ptr &ptr) : p(0), _off(0) { set(ptr); }
780  UdpPtr(const UdpPtr &ptr) : p(ptr.p), _off(ptr._off) {} // end of api_inet
782 
783  UdpHdr *get() { return (UdpHdr *)(p->data + _off); }
784  UdpHdr *operator->() { return get(); }
785  UdpHdr &operator*() { return *get(); }
786 
787  const UdpHdr *get() const { return (const UdpHdr *)(p->data + _off); }
788  const UdpHdr *operator->() const { return get(); }
789  const UdpHdr &operator*() const { return *get(); }
790 
795  const UdpPtr &operator=(const IpPtr &i) { set(i); return *this; }
796  const UdpPtr &operator=(const UdpPtr &t)
797  { set(t.p, t._off); return *this; } // end of api_inet
799 
804  const EthPacketPtr packet() const { return p; }
805  EthPacketPtr packet() { return p; }
806  bool operator!() const { return !p; }
807  operator bool() const { return (p != nullptr); }
808  int off() const { return _off; }
809  int pstart() const { return off() + get()->size(); } // end of api_inet
811 };
812 
817 uint16_t __tu_cksum6(const Ip6Ptr &ip6);
818 uint16_t __tu_cksum(const IpPtr &ip);
819 uint16_t cksum(const UdpPtr &ptr); // end of api_inet
821 
825 int hsplit(const EthPacketPtr &ptr);
826 
827 } // namespace Net
828 
829 #endif // __BASE_INET_HH__
Net::IpNetmask
Definition: inet.hh:266
Net::TcpPtr::operator!
bool operator!() const
Definition: inet.hh:694
Net::TcpHdr::sum
uint16_t sum() const
Definition: inet.hh:621
Net::Ip6Ptr::operator*
Ip6Hdr & operator*()
Definition: inet.hh:517
Net::Ip6Ptr::operator->
const Ip6Hdr * operator->() const
Definition: inet.hh:522
Net::EthHdr::vlanId
uint16_t vlanId() const
Definition: inet.hh:163
Net::IpOpt::rtralt
uint16_t rtralt() const
Definition: inet.hh:443
Net::Ip6Hdr::plen
uint16_t plen() const
Definition: inet.hh:455
Net::TcpHdr::payload
uint8_t * payload()
Definition: inet.hh:634
Net::IpHdr::payload
uint8_t * payload()
Definition: inet.hh:348
Net::Ip6Hdr::extensionLength
int extensionLength() const
Definition: inet.cc:289
Net::UdpPtr::off
int off() const
Definition: inet.hh:808
Net::IpPtr::get
const IpHdr * get() const
Definition: inet.hh:393
Net::IpHdr::options
bool options(std::vector< const IpOpt * > &vec) const
Definition: inet.cc:258
Net::TcpHdr::options
bool options(std::vector< const TcpOpt * > &vec) const
Definition: inet.cc:355
Net::UdpPtr::operator->
UdpHdr * operator->()
Definition: inet.hh:784
Net::IpHdr::tos
uint8_t tos() const
Definition: inet.hh:327
Net::TcpHdr::size
int size() const
Definition: inet.hh:630
Net::EthAddr::EthAddr
EthAddr()
Definition: inet.cc:56
Net::TcpHdr::dport
uint16_t dport() const
Definition: inet.hh:615
Net::UdpHdr::payload
uint8_t * payload()
Definition: inet.hh:748
ArmISA::rr
Bitfield< 14 > rr
Definition: miscregs_types.hh:364
Net::UdpPtr::get
const UdpHdr * get() const
Definition: inet.hh:787
data
const char data[]
Definition: circlebuf.test.cc:42
Net::TcpPtr::off
int off() const
Definition: inet.hh:696
Net::operator==
bool operator==(const EthAddr &left, const EthAddr &right)
Definition: inet.cc:123
Net::TcpOpt::tsecr
uint32_t tsecr() const
Definition: inet.hh:719
Net::Ip6Hdr::payload
uint8_t * payload()
Definition: inet.hh:477
Net::ip6_opt_routing_type2::segleft
uint8_t segleft
Definition: inet.hh:560
Net::EthAddr::bytes
const uint8_t * bytes() const
Definition: inet.hh:100
Net::IpPtr::packet
EthPacketPtr packet()
Definition: inet.hh:409
Net::IpHdr::bytes
const uint8_t * bytes() const
Definition: inet.hh:345
Net::TcpPtr::_off
int _off
Definition: inet.hh:641
Net::UdpHdr::size
int size() const
Definition: inet.hh:744
Net::TcpPtr::set
void set(const EthPacketPtr &ptr, int offset)
Definition: inet.hh:643
Net::Ip6Hdr::getExt
const Ip6Opt * getExt(uint8_t ext) const
Definition: inet.cc:312
Net::TcpPtr::set
void set(const IpPtr &ptr)
Definition: inet.hh:644
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
Net::Ip6Ptr::operator=
const Ip6Ptr & operator=(const EthPacketPtr &ptr)
Definition: inet.hh:529
Net::TcpPtr::get
const TcpHdr * get() const
Definition: inet.hh:674
Net::EthPtr::operator->
const EthHdr * operator->() const
Definition: inet.hh:206
Net::UdpHdr
Definition: inet.hh:734
Net::Ip6Opt::fragmentOfflg
uint16_t fragmentOfflg() const
Definition: inet.hh:598
Net::TcpPtr::operator->
const TcpHdr * operator->() const
Definition: inet.hh:675
Net::Ip6Ptr::operator->
Ip6Hdr * operator->()
Definition: inet.hh:516
Net::Ip6Hdr::proto
uint8_t proto() const
Definition: inet.cc:338
Net::ip6_opt_dstopts::type
uint8_t type
Definition: inet.hh:567
Net::UdpPtr::operator!
bool operator!() const
Definition: inet.hh:806
Net::IpPtr::operator=
const IpPtr & operator=(const EthPtr &ptr)
Definition: inet.hh:401
Net::TcpPtr::set
void set(const Ip6Ptr &ptr)
Definition: inet.hh:651
Net::EthPtr::off
int off() const
Definition: inet.hh:223
Net::TcpHdr::sum
void sum(uint16_t sum)
Definition: inet.hh:624
Net::Ip6Hdr::fragmentExt
const Ip6Opt * fragmentExt() const
Definition: inet.hh:465
Net::Ip6Ptr::operator*
const Ip6Hdr & operator*() const
Definition: inet.hh:523
Net::TcpOpt::bytes
const uint8_t * bytes() const
Definition: inet.hh:725
Net::ip6_opt_dstopts::length
uint8_t length
Definition: inet.hh:568
Net::EthHdr::bytes
uint8_t * bytes()
Definition: inet.hh:182
Net::IpAddress
Definition: inet.hh:231
Net::EthAddr
Definition: inet.hh:72
Net::IpAddress::IpAddress
IpAddress(const uint32_t __ip)
Definition: inet.hh:243
Net::EthPtr::operator*
EthHdr & operator*()
Definition: inet.hh:203
Net::TcpPtr
Definition: inet.hh:637
Net::TcpHdr
Definition: inet.hh:612
Net::ip6_opt_hdr::rtType2
struct ip6_opt_routing_type2 rtType2
Definition: inet.hh:578
Net::Ip6Opt::rtType2Type
uint8_t rtType2Type() const
Definition: inet.hh:593
Net::TcpOpt::mss
uint16_t mss() const
Definition: inet.hh:715
Net::IpOpt::tr
void tr(ip_opt_data_tr &tr) const
Net::TcpPtr::packet
const EthPacketPtr packet() const
Definition: inet.hh:692
Net::IpHdr::src
uint32_t src() const
Definition: inet.hh:335
Net::IpPtr::packet
const EthPacketPtr packet() const
Definition: inet.hh:408
Net::Ip6Opt::dstOptType
uint8_t dstOptType() const
Definition: inet.hh:602
Net::IpOpt::ssrr
void ssrr(ip_opt_data_rr &rr) const
Net::Ip6Hdr::bytes
const uint8_t * bytes() const
Definition: inet.hh:473
Net::ip6_opt_hdr
Definition: inet.hh:572
Net::IpHdr::frag_off
uint16_t frag_off() const
Definition: inet.hh:331
Net::EthPtr::packet
EthPacketPtr packet()
Definition: inet.hh:220
Net::Ip6Ptr::get
const Ip6Hdr * get() const
Definition: inet.hh:519
Net::TcpPtr::TcpPtr
TcpPtr()
Definition: inet.hh:664
Net::TcpOpt::size
int size() const
Definition: inet.hh:724
Net::IpPtr::IpPtr
IpPtr(const IpPtr &ptr)
Definition: inet.hh:381
Net::UdpPtr
Definition: inet.hh:751
Net::UdpHdr::sum
void sum(uint16_t sum)
Definition: inet.hh:741
Net::Ip6Opt::dstOptAddr
const uint8_t * dstOptAddr() const
Definition: inet.hh:604
Net::EthHdr::payload
const uint8_t * payload() const
Definition: inet.hh:181
Net::TcpPtr::operator*
TcpHdr & operator*()
Definition: inet.hh:672
Net::ip6_opt_fragment::offlg
uint16_t offlg
Definition: inet.hh:554
Net::TcpPtr::pstart
int pstart() const
Definition: inet.hh:697
Net::UdpPtr::operator=
const UdpPtr & operator=(const IpPtr &i)
Definition: inet.hh:795
Net::IpAddress::ip
uint32_t ip() const
Definition: inet.hh:250
Net::IpNetmask::IpNetmask
IpNetmask(const uint32_t __ip, const uint8_t __netmask)
Definition: inet.hh:274
Net::TcpOpt::tsval
uint32_t tsval() const
Definition: inet.hh:718
Net::Ip6Ptr::Ip6Ptr
Ip6Ptr(const Ip6Ptr &ptr)
Definition: inet.hh:511
Net::UdpPtr::UdpPtr
UdpPtr()
Definition: inet.hh:777
Net::IpPtr::get
IpHdr * get()
Definition: inet.hh:384
Net::TcpOpt::payload
uint8_t * payload()
Definition: inet.hh:728
std::vector
STL vector class.
Definition: stl.hh:37
Net::TcpPtr::operator*
const TcpHdr & operator*() const
Definition: inet.hh:676
Net::IpOpt::isClass
bool isClass(int cls) const
Definition: inet.hh:431
Net::IpOpt::sec
void sec(ip_opt_data_sec &sec) const
Net::IpHdr::len
void len(uint16_t _len)
Definition: inet.hh:340
Net::Ip6Hdr::rtTypeExt
const Ip6Opt * rtTypeExt() const
Definition: inet.hh:466
Net::Ip6Hdr::bytes
uint8_t * bytes()
Definition: inet.hh:476
Net::IpOpt::typeClass
uint8_t typeClass() const
Definition: inet.hh:426
Net::IpHdr::hlen
uint8_t hlen() const
Definition: inet.hh:326
Net::IpHdr::size
int size() const
Definition: inet.hh:344
X86ISA::reg
Bitfield< 5, 3 > reg
Definition: types.hh:87
Net::IpPtr::IpPtr
IpPtr()
Definition: inet.hh:378
Net::IpOpt::ts
void ts(ip_opt_data_ts &ts) const
Net::TcpHdr::flags
void flags(uint8_t _flags)
Definition: inet.hh:626
Net::EthHdr
Definition: inet.hh:152
Net::Ip6Hdr::hlen
uint16_t hlen() const
Definition: inet.hh:456
Net::EthPtr::operator!
bool operator!() const
Definition: inet.hh:221
Net::EthPtr::pstart
int pstart() const
Definition: inet.hh:224
Net::UdpPtr::set
void set(const IpPtr &ptr)
Definition: inet.hh:758
Net::ip6_opt_hdr::ext_nxt
uint8_t ext_nxt
Definition: inet.hh:574
Net::EthPtr::packet
const EthPacketPtr packet() const
Definition: inet.hh:219
Net::IpPtr::eth_hdr_vlan
bool eth_hdr_vlan
Definition: inet.hh:357
Net::IpOpt::typeNumber
uint8_t typeNumber() const
Definition: inet.hh:425
Net::Ip6Ptr::operator!
bool operator!() const
Definition: inet.hh:543
Net::ip6_opt_dstopts::addr
ip6_addr_t addr
Definition: inet.hh:569
Net::UdpHdr::sum
uint16_t sum() const
Definition: inet.hh:739
Net::UdpPtr::operator->
const UdpHdr * operator->() const
Definition: inet.hh:788
Net
Definition: inet.cc:54
Net::IpHdr::version
uint8_t version() const
Definition: inet.hh:325
Net::TcpPtr::TcpPtr
TcpPtr(const IpPtr &ptr)
Definition: inet.hh:665
Net::TcpOpt::type
uint8_t type() const
Definition: inet.hh:708
Net::Ip6Ptr::set
void set(const EthPacketPtr &ptr)
Definition: inet.hh:489
Net::EthHdr::dst
const EthAddr & dst() const
Definition: inet.hh:171
Net::IpHdr::frag_flags
uint16_t frag_flags() const
Definition: inet.hh:330
Net::EthHdr::src
const EthAddr & src() const
Definition: inet.hh:170
Net::IpOpt::type
uint8_t type() const
Definition: inet.hh:424
Net::EthHdr::isVlan
bool isVlan() const
Definition: inet.hh:154
Net::IpOpt::len
uint8_t len() const
Definition: inet.hh:428
Net::Ip6Hdr::flow
uint32_t flow() const
Definition: inet.hh:454
Net::Ip6Ptr::packet
EthPacketPtr packet()
Definition: inet.hh:542
Net::IpPtr::operator*
IpHdr & operator*()
Definition: inet.hh:387
Net::TcpHdr::flags
uint8_t flags() const
Definition: inet.hh:619
Net::ip6_opt_routing_type2::reserved
uint32_t reserved
Definition: inet.hh:561
Net::EthAddr::addr
const uint8_t * addr() const
Definition: inet.hh:108
Net::TcpOpt::cksum
uint8_t cksum() const
Definition: inet.hh:721
Net::EthHdr::type
uint16_t type() const
Definition: inet.hh:155
Net::TcpOpt::len
uint8_t len() const
Definition: inet.hh:709
Net::Ip6Hdr::src
const uint8_t * src() const
Definition: inet.hh:460
Net::EthAddr::broadcast
bool broadcast() const
Definition: inet.hh:111
Net::UdpPtr::packet
EthPacketPtr packet()
Definition: inet.hh:805
Net::IpOpt::mtup
uint16_t mtup() const
Definition: inet.hh:440
Net::IpPtr::IpPtr
IpPtr(const EthPtr &ptr)
Definition: inet.hh:380
Net::IpHdr::payload
const uint8_t * payload() const
Definition: inet.hh:346
Net::Ip6Ptr::Ip6Ptr
Ip6Ptr()
Definition: inet.hh:508
Net::UdpPtr::UdpPtr
UdpPtr(const UdpPtr &ptr)
Definition: inet.hh:780
Net::EthPtr::EthPtr
EthPtr()
Definition: inet.hh:198
Net::UdpHdr::bytes
const uint8_t * bytes() const
Definition: inet.hh:745
Net::Ip6Hdr::dstOptExt
const Ip6Opt * dstOptExt() const
Definition: inet.hh:467
Net::UdpPtr::set
void set(const EthPacketPtr &ptr, int offset)
Definition: inet.hh:757
Net::IpWithPort::IpWithPort
IpWithPort()
Definition: inet.hh:300
Net::IpPtr
Definition: inet.hh:351
MipsISA::ia
Bitfield< 18, 16 > ia
Definition: pra_constants.hh:234
Net::IpWithPort
Definition: inet.hh:294
Net::Ip6Hdr
Definition: inet.hh:451
Net::Ip6Opt::nxt
uint8_t nxt() const
Definition: inet.hh:585
Net::IpNetmask::_netmask
uint8_t _netmask
Definition: inet.hh:269
Net::__tu_cksum6
uint16_t __tu_cksum6(const Ip6Ptr &ip6)
Definition: inet.cc:221
Net::TcpHdr::seq
uint32_t seq() const
Definition: inet.hh:616
Net::IpHdr::ttl
uint8_t ttl() const
Definition: inet.hh:332
Net::TcpOpt::wscale
uint8_t wscale() const
Definition: inet.hh:716
Net::Ip6Hdr::version
uint8_t version() const
Definition: inet.hh:453
Net::TcpHdr::urp
uint16_t urp() const
Definition: inet.hh:622
Net::IpPtr::p
EthPacketPtr p
Definition: inet.hh:356
ArmISA::ext
Bitfield< 12 > ext
Definition: miscregs_types.hh:422
Net::TcpPtr::p
EthPacketPtr p
Definition: inet.hh:640
Net::UdpPtr::_off
int _off
Definition: inet.hh:755
Net::Ip6Opt::fragmentIdent
uint32_t fragmentIdent() const
Definition: inet.hh:599
Net::ip6_opt_fragment::ident
uint32_t ident
Definition: inet.hh:555
Net::Ip6Ptr::eth_hdr_vlan
bool eth_hdr_vlan
Definition: inet.hh:487
Net::Ip6Hdr::plen
void plen(uint16_t _plen)
Definition: inet.hh:470
Net::ip6_opt_hdr::ext_data
union Net::ip6_opt_hdr::@26 ext_data
Net::IpOpt::sdb
void sdb(std::vector< uint32_t > &vec) const
Net::IpPtr::operator=
const IpPtr & operator=(const EthPacketPtr &ptr)
Definition: inet.hh:400
Net::IpHdr
Definition: inet.hh:323
Net::IpPtr::set
void set(const EthPacketPtr &ptr)
Definition: inet.hh:359
Net::EthHdr::payload
uint8_t * payload()
Definition: inet.hh:183
Net::IpOpt::mtur
uint16_t mtur() const
Definition: inet.hh:441
Net::Ip6Ptr::operator=
const Ip6Ptr & operator=(const EthPtr &ptr)
Definition: inet.hh:531
Net::Ip6Opt::rtType2SegLft
uint8_t rtType2SegLft() const
Definition: inet.hh:594
Net::IpWithPort::port
uint8_t port() const
Definition: inet.hh:309
Net::TcpOpt::bytes
uint8_t * bytes()
Definition: inet.hh:727
Net::IpOpt::typeCopied
uint8_t typeCopied() const
Definition: inet.hh:427
Net::__tu_cksum
uint16_t __tu_cksum(const IpPtr &ip)
Definition: inet.cc:211
Net::TcpHdr::win
uint16_t win() const
Definition: inet.hh:620
Net::TcpOpt::payload
const uint8_t * payload() const
Definition: inet.hh:726
Net::IpOpt::isCopied
bool isCopied(int cpy) const
Definition: inet.hh:432
Net::ip6_opt_routing_type2
Definition: inet.hh:558
Net::EthAddr::operator=
const EthAddr & operator=(const eth_addr &ea)
Definition: inet.cc:79
Net::cksum
uint16_t cksum(const IpPtr &ptr)
Definition: inet.cc:204
Net::TcpPtr::operator=
const TcpPtr & operator=(const TcpPtr &t)
Definition: inet.hh:684
Net::Ip6Hdr::dst
const uint8_t * dst() const
Definition: inet.hh:461
Net::TcpHdr::sport
uint16_t sport() const
Definition: inet.hh:614
Net::UdpPtr::operator=
const UdpPtr & operator=(const UdpPtr &t)
Definition: inet.hh:796
Net::Ip6Ptr::operator=
const Ip6Ptr & operator=(const Ip6Ptr &ptr)
Definition: inet.hh:533
Net::TcpHdr::ack
uint32_t ack() const
Definition: inet.hh:617
Net::IpPtr::pstart
int pstart() const
Definition: inet.hh:413
Net::UdpHdr::payload
const uint8_t * payload() const
Definition: inet.hh:746
Net::UdpHdr::len
void len(uint16_t _len)
Definition: inet.hh:742
Net::ip6_opt_routing_type2::addr
ip6_addr_t addr
Definition: inet.hh:562
Net::EthPtr::operator->
EthHdr * operator->()
Definition: inet.hh:202
Net::TcpPtr::TcpPtr
TcpPtr(const TcpPtr &ptr)
Definition: inet.hh:667
Net::TcpOpt::md5
const uint8_t * md5() const
Definition: inet.hh:722
Net::Ip6Ptr::Ip6Ptr
Ip6Ptr(const EthPacketPtr &ptr)
Definition: inet.hh:509
Net::IpHdr::id
uint16_t id() const
Definition: inet.hh:329
Net::IpNetmask::IpNetmask
IpNetmask()
Definition: inet.hh:272
Net::Ip6Ptr::get
Ip6Hdr * get()
Definition: inet.hh:514
Net::Ip6Ptr::Ip6Ptr
Ip6Ptr(const EthPtr &ptr)
Definition: inet.hh:510
Net::Ip6Ptr::pstart
int pstart() const
Definition: inet.hh:546
Net::IpPtr::operator!
bool operator!() const
Definition: inet.hh:410
Net::TcpOpt::cc
uint32_t cc() const
Definition: inet.hh:720
Net::ip6_opt_hdr::dstOpts
struct ip6_opt_dstopts dstOpts
Definition: inet.hh:579
Net::TcpPtr::operator=
const TcpPtr & operator=(const IpPtr &i)
Definition: inet.hh:682
Net::EthPtr::EthPtr
EthPtr(const EthPacketPtr &ptr)
Definition: inet.hh:199
EthPacketPtr
std::shared_ptr< EthPacketData > EthPacketPtr
Definition: etherpkt.hh:87
Net::IpAddress::string
std::string string() const
Definition: inet.cc:137
Net::EthAddr::size
int size() const
Definition: inet.hh:93
Net::TcpPtr::get
TcpHdr * get()
Definition: inet.hh:670
Net::EthPtr::p
EthPacketPtr p
Definition: inet.hh:191
Net::EthAddr::multicast
bool multicast() const
Definition: inet.hh:110
Net::IpHdr::id
void id(uint16_t _id)
Definition: inet.hh:339
Net::ip6_opt_hdr::ext_len
uint8_t ext_len
Definition: inet.hh:575
Net::IpNetmask::string
std::string string() const
Definition: inet.cc:161
Net::Ip6Opt
Definition: inet.hh:583
Net::IpHdr::sum
void sum(uint16_t sum)
Definition: inet.hh:338
Net::TcpPtr::packet
EthPacketPtr packet()
Definition: inet.hh:693
Net::UdpPtr::operator*
UdpHdr & operator*()
Definition: inet.hh:785
Net::IpPtr::operator=
const IpPtr & operator=(const IpPtr &ptr)
Definition: inet.hh:402
Net::IpOpt::satid
uint16_t satid() const
Definition: inet.hh:439
Net::IpPtr::operator->
IpHdr * operator->()
Definition: inet.hh:386
Net::IpWithPort::_port
uint16_t _port
Definition: inet.hh:297
types.hh
ArmISA::t
Bitfield< 5 > t
Definition: miscregs_types.hh:67
Net::IpPtr::operator->
const IpHdr * operator->() const
Definition: inet.hh:396
Net::IpWithPort::string
std::string string() const
Definition: inet.cc:183
Net::UdpPtr::get
UdpHdr * get()
Definition: inet.hh:783
Net::UdpPtr::UdpPtr
UdpPtr(const IpPtr &ptr)
Definition: inet.hh:778
Net::UdpPtr::p
EthPacketPtr p
Definition: inet.hh:754
Net::UdpPtr::operator*
const UdpHdr & operator*() const
Definition: inet.hh:789
Net::TcpPtr::TcpPtr
TcpPtr(const Ip6Ptr &ptr)
Definition: inet.hh:666
Net::IpHdr::sum
uint16_t sum() const
Definition: inet.hh:334
Net::Ip6Ptr
Definition: inet.hh:481
iGbReg::TxdOp::ip
bool ip(TxDesc *d)
Definition: i8254xGBe_defs.hh:261
Net::UdpPtr::set
void set(const Ip6Ptr &ptr)
Definition: inet.hh:765
Net::EthPtr::operator=
const EthPtr & operator=(const EthPacketPtr &ptr)
Definition: inet.hh:213
Net::Ip6Hdr::nxt
uint8_t nxt() const
Definition: inet.hh:457
Net::EthAddr::bytes
uint8_t * bytes()
Definition: inet.hh:101
Net::EthAddr::string
std::string string() const
Definition: inet.cc:115
Net::IpPtr::IpPtr
IpPtr(const EthPacketPtr &ptr)
Definition: inet.hh:379
Net::IpPtr::operator*
const IpHdr & operator*() const
Definition: inet.hh:397
Net::Ip6Opt::dstOptLength
uint8_t dstOptLength() const
Definition: inet.hh:603
etherpkt.hh
Net::EthPtr::operator*
const EthHdr & operator*() const
Definition: inet.hh:207
ArmISA::ea
Bitfield< 3 > ea
Definition: miscregs_types.hh:325
Net::Ip6Hdr::hlim
uint8_t hlim() const
Definition: inet.hh:458
Net::UdpPtr::packet
const EthPacketPtr packet() const
Definition: inet.hh:804
Net::Ip6Opt::rtType2Addr
const uint8_t * rtType2Addr() const
Definition: inet.hh:595
Net::IpOpt::lsrr
void lsrr(ip_opt_data_rr &rr) const
Net::IpHdr::proto
uint8_t proto() const
Definition: inet.hh:333
Net::IpHdr::bytes
uint8_t * bytes()
Definition: inet.hh:347
Net::ip6_opt_hdr::fragment
struct ip6_opt_fragment fragment
Definition: inet.hh:577
Net::Ip6Ptr::off
int off() const
Definition: inet.hh:545
Net::UdpHdr::sport
uint16_t sport() const
Definition: inet.hh:736
Net::EthAddr::unicast
bool unicast() const
Definition: inet.hh:109
Net::TcpOpt::isopt
bool isopt(int opt) const
Definition: inet.hh:711
Net::EthHdr::size
int size() const
Definition: inet.hh:173
Net::ip6_opt_fragment
Definition: inet.hh:553
Net::IpAddress::IpAddress
IpAddress()
Definition: inet.hh:241
Net::Ip6Opt::extlen
uint8_t extlen() const
Definition: inet.hh:586
Net::TcpHdr::bytes
const uint8_t * bytes() const
Definition: inet.hh:631
Net::Ip6Ptr::p
EthPacketPtr p
Definition: inet.hh:486
Net::hsplit
int hsplit(const EthPacketPtr &ptr)
Definition: inet.cc:376
Net::Ip6Hdr::payload
const uint8_t * payload() const
Definition: inet.hh:474
Net::ip6_opt_routing_type2::type
uint8_t type
Definition: inet.hh:559
Net::EthPtr
Definition: inet.hh:186
Net::IpOpt::data
const uint8_t * data() const
Definition: inet.hh:434
Net::UdpPtr::UdpPtr
UdpPtr(const Ip6Ptr &ptr)
Definition: inet.hh:779
Net::EthAddr::parse
void parse(const std::string &addr)
Definition: inet.cc:93
Net::IpHdr::len
uint16_t len() const
Definition: inet.hh:328
Net::Ip6Hdr::size
int size() const
Definition: inet.hh:472
Net::TcpOpt::data
const uint8_t * data() const
Definition: inet.hh:713
Net::UdpHdr::len
uint16_t len() const
Definition: inet.hh:738
Net::TcpHdr::off
uint8_t off() const
Definition: inet.hh:618
MipsISA::ip6
Bitfield< 14 > ip6
Definition: pra_constants.hh:187
Net::TcpPtr::operator->
TcpHdr * operator->()
Definition: inet.hh:671
Net::ip6_opt_dstopts
Definition: inet.hh:566
Net::IpHdr::dst
uint32_t dst() const
Definition: inet.hh:336
Net::UdpHdr::bytes
uint8_t * bytes()
Definition: inet.hh:747
Net::IpPtr::off
int off() const
Definition: inet.hh:412
Net::TcpOpt
Definition: inet.hh:706
Net::IpAddress::_ip
uint32_t _ip
Definition: inet.hh:234
Net::IpOpt::isNumber
bool isNumber(int num) const
Definition: inet.hh:430
Net::Ip6Ptr::packet
const EthPacketPtr packet() const
Definition: inet.hh:541
Net::IpNetmask::netmask
uint8_t netmask() const
Definition: inet.hh:281
Net::__attribute__
Net::Ip6Opt __attribute__
Net::TcpHdr::bytes
uint8_t * bytes()
Definition: inet.hh:633
Net::EthHdr::bytes
const uint8_t * bytes() const
Definition: inet.hh:180
Net::TcpOpt::echo
uint32_t echo() const
Definition: inet.hh:717
Net::UdpPtr::pstart
int pstart() const
Definition: inet.hh:809
Net::IpWithPort::IpWithPort
IpWithPort(const uint32_t __ip, const uint16_t __port)
Definition: inet.hh:302
Net::Ip6Opt::len
uint8_t len() const
Definition: inet.hh:587
Net::TcpHdr::payload
const uint8_t * payload() const
Definition: inet.hh:632
Net::operator<<
ostream & operator<<(ostream &stream, const EthAddr &ea)
Definition: inet.cc:129
Net::UdpHdr::dport
uint16_t dport() const
Definition: inet.hh:737
ArmISA::offset
Bitfield< 23, 0 > offset
Definition: types.hh:153
Net::TcpHdr::seq
void seq(uint32_t _seq)
Definition: inet.hh:625

Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17