blob: 3897f6364cee9cda09fbdbf911044cbfaf79148f [file] [log] [blame]
Steve Raasch92638f92003-10-07 10:41:54 -04001/*
Geoffrey Blakefb049642013-10-31 13:41:13 -05002 * 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 *
Steve Reinhardtad8b9632005-06-05 05:16:00 -040014 * Copyright (c) 2002-2005 The Regents of The University of Michigan
Gabe Black7f6ca092010-11-23 17:08:41 -050015 * Copyright (c) 2010 Advanced Micro Devices, Inc.
Steve Raasch92638f92003-10-07 10:41:54 -040016 * 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
Nathan Binkerta58b8342004-09-20 10:43:53 -040042#ifndef __BASE_INET_HH__
43#define __BASE_INET_HH__
44
Nathan Binkerta7fd7722004-10-23 16:18:44 -040045#include <iosfwd>
Nathan Binkerta58b8342004-09-20 10:43:53 -040046#include <string>
Nathan Binkerta7fd7722004-10-23 16:18:44 -040047#include <utility>
48#include <vector>
49
Daniel R. Carvalho9b675eb2021-05-13 12:02:34 -030050#include "base/compiler.hh"
Nathan Binkerteef3a2e2009-05-17 14:34:50 -070051#include "base/types.hh"
Andreas Sandberg23c961a2015-12-10 10:35:18 +000052#include "dev/net/etherpkt.hh"
Nathan Binkerta58b8342004-09-20 10:43:53 -040053#include "dnet/os.h"
Nathan Binkerta58b8342004-09-20 10:43:53 -040054#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"
Nathan Binkerta58b8342004-09-20 10:43:53 -040062#include "dnet/intf.h"
63#include "dnet/route.h"
64#include "dnet/fw.h"
Nathan Binkerta58b8342004-09-20 10:43:53 -040065#include "dnet/blob.h"
66#include "dnet/rand.h"
Steve Raasch92638f92003-10-07 10:41:54 -040067
Daniel R. Carvalho974a47d2021-05-09 12:32:07 -030068namespace gem5
69{
70
Daniel R. Carvalho06fb0752021-05-06 15:50:55 -030071GEM5_DEPRECATED_NAMESPACE(Net, networking);
72namespace networking
73{
Steve Raasch92638f92003-10-07 10:41:54 -040074
Nathan Binkerta7fd7722004-10-23 16:18:44 -040075/*
76 * Ethernet Stuff
77 */
78struct EthAddr : protected eth_addr
79{
80 protected:
81 void parse(const std::string &addr);
Nathan Binkerta58b8342004-09-20 10:43:53 -040082
Nathan Binkerta7fd7722004-10-23 16:18:44 -040083 public:
Hoa Nguyen197deeb2020-08-23 21:41:21 -070084 /**
85 * @ingroup api_inet
86 * @{
87 */
Nathan Binkerta7fd7722004-10-23 16:18:44 -040088 EthAddr();
89 EthAddr(const uint8_t ea[ETH_ADDR_LEN]);
90 EthAddr(const eth_addr &ea);
91 EthAddr(const std::string &addr);
92 const EthAddr &operator=(const eth_addr &ea);
93 const EthAddr &operator=(const std::string &addr);
Hoa Nguyen197deeb2020-08-23 21:41:21 -070094 /** @} */ // end of api_inet
Nathan Binkert1d023452004-09-21 01:41:55 -040095
Hoa Nguyen197deeb2020-08-23 21:41:21 -070096 /**
97 * @ingroup api_inet
98 */
Nathan Binkerta7fd7722004-10-23 16:18:44 -040099 int size() const { return sizeof(eth_addr); }
100
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700101
102 /**
103 * @ingroup api_inet
104 * @{
105 */
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400106 const uint8_t *bytes() const { return &data[0]; }
107 uint8_t *bytes() { return &data[0]; }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700108 /** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400109
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700110 /**
111 * @ingroup api_inet
112 * @{
113 */
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400114 const uint8_t *addr() const { return &data[0]; }
Anthony Gutierrez3956ec02014-07-02 13:19:13 -0400115 bool unicast() const { return !(data[0] & 0x01); }
116 bool multicast() const { return !unicast() && !broadcast(); }
117 bool broadcast() const
118 {
119 bool isBroadcast = true;
120 for (int i = 0; i < ETH_ADDR_LEN; ++i) {
121 isBroadcast = isBroadcast && data[i] == 0xff;
122 }
123
124 return isBroadcast;
125 }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700126 /** @} */ // end of api_inet
Anthony Gutierrez3956ec02014-07-02 13:19:13 -0400127
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700128 /**
129 * @ingroup api_inet
130 */
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400131 std::string string() const;
Nathan Binkertb64619d2004-11-10 18:49:55 -0500132
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700133 /**
134 * @ingroup api_inet
135 */
Nathan Binkertb64619d2004-11-10 18:49:55 -0500136 operator uint64_t() const
137 {
138 uint64_t reg = 0;
139 reg |= ((uint64_t)data[0]) << 40;
140 reg |= ((uint64_t)data[1]) << 32;
141 reg |= ((uint64_t)data[2]) << 24;
142 reg |= ((uint64_t)data[3]) << 16;
143 reg |= ((uint64_t)data[4]) << 8;
144 reg |= ((uint64_t)data[5]) << 0;
145 return reg;
146 }
147
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400148};
149
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700150/**
151 * @ingroup api_inet
152 * @{
153 */
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400154std::ostream &operator<<(std::ostream &stream, const EthAddr &ea);
155bool operator==(const EthAddr &left, const EthAddr &right);
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700156/** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400157
158struct EthHdr : public eth_hdr
Nathan Binkerta58b8342004-09-20 10:43:53 -0400159{
Geoffrey Blakefb049642013-10-31 13:41:13 -0500160 bool isVlan() const { return (ntohs(eth_type) == ETH_TYPE_8021Q); }
161 uint16_t type() const {
162 if (!isVlan())
163 return ntohs(eth_type);
164 else
165 // L3 type is now 16 bytes into the hdr with 802.1Q
166 // instead of 12. dnet/eth.h only supports 802.1
167 return ntohs(*((uint16_t*)(((uint8_t *)this) + 16)));
168 }
169 uint16_t vlanId() const {
170 if (isVlan())
171 return ntohs(*((uint16_t*)(((uint8_t *)this) + 14)));
172 else
173 return 0x0000;
174 }
175
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400176 const EthAddr &src() const { return *(EthAddr *)&eth_src; }
177 const EthAddr &dst() const { return *(EthAddr *)&eth_dst; }
Nathan Binkert1d023452004-09-21 01:41:55 -0400178
Geoffrey Blakefb049642013-10-31 13:41:13 -0500179 int size() const {
180 if (!isVlan())
181 return sizeof(eth_hdr);
182 else
183 return (sizeof(eth_hdr)+4);
184 }
Nathan Binkert1d023452004-09-21 01:41:55 -0400185
Nathan Binkert1d023452004-09-21 01:41:55 -0400186 const uint8_t *bytes() const { return (const uint8_t *)this; }
187 const uint8_t *payload() const { return bytes() + size(); }
188 uint8_t *bytes() { return (uint8_t *)this; }
189 uint8_t *payload() { return bytes() + size(); }
Nathan Binkerta58b8342004-09-20 10:43:53 -0400190};
191
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400192class EthPtr
193{
194 protected:
195 friend class IpPtr;
Geoffrey Blakefb049642013-10-31 13:41:13 -0500196 friend class Ip6Ptr;
Ali Saidi8f8d0952006-04-24 19:31:50 -0400197 EthPacketPtr p;
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400198
199 public:
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700200 /**
201 * @ingroup api_inet
202 * @{
203 */
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400204 EthPtr() {}
Ali Saidi8f8d0952006-04-24 19:31:50 -0400205 EthPtr(const EthPacketPtr &ptr) : p(ptr) { }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700206 /** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400207
208 EthHdr *operator->() { return (EthHdr *)p->data; }
209 EthHdr &operator*() { return *(EthHdr *)p->data; }
210 operator EthHdr *() { return (EthHdr *)p->data; }
211
212 const EthHdr *operator->() const { return (const EthHdr *)p->data; }
213 const EthHdr &operator*() const { return *(const EthHdr *)p->data; }
214 operator const EthHdr *() const { return (const EthHdr *)p->data; }
215
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700216 /**
217 * @ingroup api_inet
218 */
Ali Saidi8f8d0952006-04-24 19:31:50 -0400219 const EthPtr &operator=(const EthPacketPtr &ptr) { p = ptr; return *this; }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400220
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700221 /**
222 * @ingroup api_inet
223 * @{
224 */
Ali Saidi8f8d0952006-04-24 19:31:50 -0400225 const EthPacketPtr packet() const { return p; }
226 EthPacketPtr packet() { return p; }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400227 bool operator!() const { return !p; }
Andreas Hanssonad3f75d2014-10-16 05:49:46 -0400228 operator bool() const { return (p != nullptr); }
Ali Saidi11ac0c72009-01-06 10:36:56 -0500229 int off() const { return 0; }
230 int pstart() const { return off() + ((const EthHdr*)p->data)->size(); }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700231 /** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400232};
233
234/*
235 * IP Stuff
236 */
Gabe Blackb3de4852010-11-23 15:54:43 -0500237struct IpAddress
238{
239 protected:
240 uint32_t _ip;
241
242 public:
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700243 /**
244 * @ingroup api_inet
245 * @{
246 */
Gabe Blackb3de4852010-11-23 15:54:43 -0500247 IpAddress() : _ip(0)
248 {}
249 IpAddress(const uint32_t __ip) : _ip(__ip)
250 {}
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700251 /** @} */ // end of api_net
Gabe Blackb3de4852010-11-23 15:54:43 -0500252
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700253 /**
254 * @ingroup api_inet
255 */
Gabe Blackb3de4852010-11-23 15:54:43 -0500256 uint32_t ip() const { return _ip; }
257
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700258 /**
259 * @ingroup api_inet
260 */
Gabe Blackb3de4852010-11-23 15:54:43 -0500261 std::string string() const;
262};
263
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700264/**
265 * @ingroup api_inet
266 * @{
267 */
Gabe Blackb3de4852010-11-23 15:54:43 -0500268std::ostream &operator<<(std::ostream &stream, const IpAddress &ia);
269bool operator==(const IpAddress &left, const IpAddress &right);
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700270/** @} */ // end of api_inet
Gabe Blackb3de4852010-11-23 15:54:43 -0500271
272struct IpNetmask : public IpAddress
273{
274 protected:
275 uint8_t _netmask;
276
277 public:
278 IpNetmask() : IpAddress(), _netmask(0)
279 {}
280 IpNetmask(const uint32_t __ip, const uint8_t __netmask) :
281 IpAddress(__ip), _netmask(__netmask)
282 {}
283
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700284 /**
285 * @ingroup api_inet
286 */
Gabe Blackb3de4852010-11-23 15:54:43 -0500287 uint8_t netmask() const { return _netmask; }
288
289 std::string string() const;
290};
291
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700292/**
293 * @ingroup api_inet
294 * @{
295 */
Gabe Blackb3de4852010-11-23 15:54:43 -0500296std::ostream &operator<<(std::ostream &stream, const IpNetmask &in);
297bool operator==(const IpNetmask &left, const IpNetmask &right);
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700298/** @} */ // end of api_inet
Gabe Blackb3de4852010-11-23 15:54:43 -0500299
300struct IpWithPort : public IpAddress
301{
302 protected:
303 uint16_t _port;
304
305 public:
306 IpWithPort() : IpAddress(), _port(0)
307 {}
308 IpWithPort(const uint32_t __ip, const uint16_t __port) :
309 IpAddress(__ip), _port(__port)
310 {}
311
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700312 /**
313 * @ingroup api_inet
314 */
Gabe Blackb3de4852010-11-23 15:54:43 -0500315 uint8_t port() const { return _port; }
316
317 std::string string() const;
318};
319
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700320/**
321 * @ingroup api_inet
322 * @{
323 */
Gabe Blackb3de4852010-11-23 15:54:43 -0500324std::ostream &operator<<(std::ostream &stream, const IpWithPort &iwp);
325bool operator==(const IpWithPort &left, const IpWithPort &right);
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700326/** @} */ // end of api_inet
Gabe Blackb3de4852010-11-23 15:54:43 -0500327
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400328struct IpOpt;
329struct IpHdr : public ip_hdr
Nathan Binkerta58b8342004-09-20 10:43:53 -0400330{
331 uint8_t version() const { return ip_v; }
Nathan Binkerteaf66f42004-10-01 19:48:33 -0400332 uint8_t hlen() const { return ip_hl * 4; }
Nathan Binkerta58b8342004-09-20 10:43:53 -0400333 uint8_t tos() const { return ip_tos; }
334 uint16_t len() const { return ntohs(ip_len); }
335 uint16_t id() const { return ntohs(ip_id); }
336 uint16_t frag_flags() const { return ntohs(ip_off) >> 13; }
337 uint16_t frag_off() const { return ntohs(ip_off) & 0x1fff; }
338 uint8_t ttl() const { return ip_ttl; }
339 uint8_t proto() const { return ip_p; }
Nathan Binkerteaf66f42004-10-01 19:48:33 -0400340 uint16_t sum() const { return ip_sum; }
Nathan Binkerta58b8342004-09-20 10:43:53 -0400341 uint32_t src() const { return ntohl(ip_src); }
342 uint32_t dst() const { return ntohl(ip_dst); }
343
Nathan Binkerteaf66f42004-10-01 19:48:33 -0400344 void sum(uint16_t sum) { ip_sum = sum; }
Ali Saidiaab595a2008-12-05 13:58:21 -0500345 void id(uint16_t _id) { ip_id = htons(_id); }
346 void len(uint16_t _len) { ip_len = htons(_len); }
347
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400348 bool options(std::vector<const IpOpt *> &vec) const;
Nathan Binkert1d023452004-09-21 01:41:55 -0400349
350 int size() const { return hlen(); }
351 const uint8_t *bytes() const { return (const uint8_t *)this; }
352 const uint8_t *payload() const { return bytes() + size(); }
353 uint8_t *bytes() { return (uint8_t *)this; }
354 uint8_t *payload() { return bytes() + size(); }
Nathan Binkerta58b8342004-09-20 10:43:53 -0400355};
356
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400357class IpPtr
358{
359 protected:
360 friend class TcpPtr;
361 friend class UdpPtr;
Ali Saidi8f8d0952006-04-24 19:31:50 -0400362 EthPacketPtr p;
Geoffrey Blakefb049642013-10-31 13:41:13 -0500363 bool eth_hdr_vlan;
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400364
Ali Saidi8f8d0952006-04-24 19:31:50 -0400365 void set(const EthPacketPtr &ptr)
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400366 {
Nathan Binkert87d03d02008-06-17 22:14:12 -0700367 p = 0;
Geoffrey Blakefb049642013-10-31 13:41:13 -0500368 eth_hdr_vlan = false;
Nathan Binkert87d03d02008-06-17 22:14:12 -0700369
370 if (ptr) {
371 EthHdr *eth = (EthHdr *)ptr->data;
372 if (eth->type() == ETH_TYPE_IP)
373 p = ptr;
Geoffrey Blakefb049642013-10-31 13:41:13 -0500374 if (eth->isVlan())
375 eth_hdr_vlan = true;
Nathan Binkert87d03d02008-06-17 22:14:12 -0700376 }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400377 }
378
379 public:
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700380 /**
381 * @ingroup api_inet
382 * @{
383 */
Geoffrey Blakefb049642013-10-31 13:41:13 -0500384 IpPtr() : p(0), eth_hdr_vlan(false) {}
385 IpPtr(const EthPacketPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr); }
386 IpPtr(const EthPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr.p); }
387 IpPtr(const IpPtr &ptr) : p(ptr.p), eth_hdr_vlan(ptr.eth_hdr_vlan) { }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700388 /** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400389
Geoffrey Blakefb049642013-10-31 13:41:13 -0500390 IpHdr *get() { return (IpHdr *)(p->data + sizeof(eth_hdr) +
391 ((eth_hdr_vlan) ? 4 : 0)); }
Nathan Binkert87d03d02008-06-17 22:14:12 -0700392 IpHdr *operator->() { return get(); }
393 IpHdr &operator*() { return *get(); }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400394
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700395 /**
396 * @ingroup api_inet
397 * @{
398 */
Nathan Binkert87d03d02008-06-17 22:14:12 -0700399 const IpHdr *get() const
Geoffrey Blakefb049642013-10-31 13:41:13 -0500400 { return (const IpHdr *)(p->data + sizeof(eth_hdr) +
401 ((eth_hdr_vlan) ? 4 : 0)); }
Nathan Binkert87d03d02008-06-17 22:14:12 -0700402 const IpHdr *operator->() const { return get(); }
403 const IpHdr &operator*() const { return *get(); }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700404 /** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400405
Ali Saidi8f8d0952006-04-24 19:31:50 -0400406 const IpPtr &operator=(const EthPacketPtr &ptr) { set(ptr); return *this; }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400407 const IpPtr &operator=(const EthPtr &ptr) { set(ptr.p); return *this; }
408 const IpPtr &operator=(const IpPtr &ptr) { p = ptr.p; return *this; }
409
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700410 /**
411 * @ingroup api_inet
412 * @{
413 */
Ali Saidi8f8d0952006-04-24 19:31:50 -0400414 const EthPacketPtr packet() const { return p; }
415 EthPacketPtr packet() { return p; }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400416 bool operator!() const { return !p; }
Andreas Hanssonad3f75d2014-10-16 05:49:46 -0400417 operator bool() const { return (p != nullptr); }
Geoffrey Blakefb049642013-10-31 13:41:13 -0500418 int off() const { return (sizeof(eth_hdr) + ((eth_hdr_vlan) ? 4 : 0)); }
419 int pstart() const { return (off() + get()->size()); }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700420 /** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400421};
422
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700423/**
424 * @ingroup api_inet
425 */
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400426uint16_t cksum(const IpPtr &ptr);
427
428struct IpOpt : public ip_opt
429{
430 uint8_t type() const { return opt_type; }
431 uint8_t typeNumber() const { return IP_OPT_NUMBER(opt_type); }
432 uint8_t typeClass() const { return IP_OPT_CLASS(opt_type); }
433 uint8_t typeCopied() const { return IP_OPT_COPIED(opt_type); }
434 uint8_t len() const { return IP_OPT_TYPEONLY(type()) ? 1 : opt_len; }
435
436 bool isNumber(int num) const { return typeNumber() == IP_OPT_NUMBER(num); }
437 bool isClass(int cls) const { return typeClass() == IP_OPT_CLASS(cls); }
438 bool isCopied(int cpy) const { return typeCopied() == IP_OPT_COPIED(cpy); }
439
440 const uint8_t *data() const { return opt_data.data8; }
441 void sec(ip_opt_data_sec &sec) const;
442 void lsrr(ip_opt_data_rr &rr) const;
443 void ssrr(ip_opt_data_rr &rr) const;
444 void ts(ip_opt_data_ts &ts) const;
445 uint16_t satid() const { return ntohs(opt_data.satid); }
446 uint16_t mtup() const { return ntohs(opt_data.mtu); }
447 uint16_t mtur() const { return ntohs(opt_data.mtu); }
448 void tr(ip_opt_data_tr &tr) const;
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400449 uint16_t rtralt() const { return ntohs(opt_data.rtralt); }
450 void sdb(std::vector<uint32_t> &vec) const;
451};
452
453/*
Geoffrey Blakefb049642013-10-31 13:41:13 -0500454 * Ip6 Classes
455 */
456struct Ip6Opt;
457struct Ip6Hdr : public ip6_hdr
458{
459 uint8_t version() const { return ip6_vfc; }
460 uint32_t flow() const { return ntohl(ip6_flow); }
461 uint16_t plen() const { return ntohs(ip6_plen); }
462 uint16_t hlen() const { return IP6_HDR_LEN; }
463 uint8_t nxt() const { return ip6_nxt; }
464 uint8_t hlim() const { return ip6_hlim; }
465
466 const uint8_t* src() const { return ip6_src.data; }
467 const uint8_t* dst() const { return ip6_dst.data; }
468
469 int extensionLength() const;
470 const Ip6Opt* getExt(uint8_t ext) const;
471 const Ip6Opt* fragmentExt() const { return getExt(IP_PROTO_FRAGMENT); }
472 const Ip6Opt* rtTypeExt() const { return getExt(IP_PROTO_ROUTING); }
473 const Ip6Opt* dstOptExt() const { return getExt(IP_PROTO_DSTOPTS); }
474 uint8_t proto() const;
475
476 void plen(uint16_t _plen) { ip6_plen = htons(_plen); }
477
478 int size() const { return IP6_HDR_LEN + extensionLength(); }
479 const uint8_t *bytes() const { return (const uint8_t *)this; }
480 const uint8_t *payload() const { return bytes() + IP6_HDR_LEN
481 + extensionLength(); }
482 uint8_t *bytes() { return (uint8_t *)this; }
483 uint8_t *payload() { return bytes() + IP6_HDR_LEN
484 + extensionLength(); }
485};
486
487class Ip6Ptr
488{
489 protected:
490 friend class TcpPtr;
491 friend class UdpPtr;
492 EthPacketPtr p;
493 bool eth_hdr_vlan;
494
495 void set(const EthPacketPtr &ptr)
496 {
497 p = 0;
498 eth_hdr_vlan = false;
499
500 if (ptr) {
501 EthHdr *eth = (EthHdr *)ptr->data;
502 if (eth->type() == ETH_TYPE_IPV6)
503 p = ptr;
504 if (eth->isVlan())
505 eth_hdr_vlan = true;
506 }
507 }
508
509 public:
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700510 /**
511 * @ingroup api_inet
512 * @{
513 */
Geoffrey Blakefb049642013-10-31 13:41:13 -0500514 Ip6Ptr() : p(0), eth_hdr_vlan(false) {}
515 Ip6Ptr(const EthPacketPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr); }
516 Ip6Ptr(const EthPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr.p); }
517 Ip6Ptr(const Ip6Ptr &ptr) : p(ptr.p), eth_hdr_vlan(ptr.eth_hdr_vlan) { }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700518 /** @} */ // end of api_inet
Geoffrey Blakefb049642013-10-31 13:41:13 -0500519
520 Ip6Hdr *get() { return (Ip6Hdr *)(p->data + sizeof(eth_hdr)
521 + ((eth_hdr_vlan) ? 4 : 0)); }
522 Ip6Hdr *operator->() { return get(); }
523 Ip6Hdr &operator*() { return *get(); }
524
525 const Ip6Hdr *get() const
526 { return (const Ip6Hdr *)(p->data + sizeof(eth_hdr)
527 + ((eth_hdr_vlan) ? 4 : 0)); }
528 const Ip6Hdr *operator->() const { return get(); }
529 const Ip6Hdr &operator*() const { return *get(); }
530
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700531 /**
532 * @ingroup api_inet
533 * @{
534 */
Geoffrey Blakefb049642013-10-31 13:41:13 -0500535 const Ip6Ptr &operator=(const EthPacketPtr &ptr)
536 { set(ptr); return *this; }
537 const Ip6Ptr &operator=(const EthPtr &ptr)
538 { set(ptr.p); return *this; }
539 const Ip6Ptr &operator=(const Ip6Ptr &ptr)
540 { p = ptr.p; return *this; }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700541 /** @} */ // end of api_inet
Geoffrey Blakefb049642013-10-31 13:41:13 -0500542
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700543 /**
544 * @ingroup api_inet
545 * @{
546 */
Geoffrey Blakefb049642013-10-31 13:41:13 -0500547 const EthPacketPtr packet() const { return p; }
548 EthPacketPtr packet() { return p; }
549 bool operator!() const { return !p; }
Andreas Hanssonad3f75d2014-10-16 05:49:46 -0400550 operator bool() const { return (p != nullptr); }
Geoffrey Blakefb049642013-10-31 13:41:13 -0500551 int off() const { return sizeof(eth_hdr) + ((eth_hdr_vlan) ? 4 : 0); }
552 int pstart() const { return off() + get()->size(); }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700553 /** @} */ // end of api_inet
Geoffrey Blakefb049642013-10-31 13:41:13 -0500554};
555
556// Dnet supplied ipv6 opt header is incomplete and
557// newer NIC card filters expect a more robust
558// ipv6 header option declaration.
Daniel R. Carvalho2922f762021-01-09 12:28:03 -0300559struct ip6_opt_fragment
560{
Geoffrey Blakefb049642013-10-31 13:41:13 -0500561 uint16_t offlg;
562 uint32_t ident;
563};
564
Daniel R. Carvalho2922f762021-01-09 12:28:03 -0300565struct ip6_opt_routing_type2
566{
Geoffrey Blakefb049642013-10-31 13:41:13 -0500567 uint8_t type;
568 uint8_t segleft;
569 uint32_t reserved;
570 ip6_addr_t addr;
571};
572
Gabe Blackce6b5e72021-05-08 20:35:12 -0700573struct GEM5_PACKED ip6_opt_dstopts
Daniel R. Carvalho2922f762021-01-09 12:28:03 -0300574{
Geoffrey Blakefb049642013-10-31 13:41:13 -0500575 uint8_t type;
576 uint8_t length;
577 ip6_addr_t addr;
Gabe Black463cb282020-10-14 00:38:42 -0700578};
Geoffrey Blakefb049642013-10-31 13:41:13 -0500579
Gabe Blackce6b5e72021-05-08 20:35:12 -0700580struct GEM5_PACKED ip6_opt_hdr
Geoffrey Blakefb049642013-10-31 13:41:13 -0500581{
582 uint8_t ext_nxt;
583 uint8_t ext_len;
Daniel R. Carvalho5c8983f2021-03-23 13:29:40 -0300584 union
585 {
Geoffrey Blakefb049642013-10-31 13:41:13 -0500586 struct ip6_opt_fragment fragment;
587 struct ip6_opt_routing_type2 rtType2;
588 struct ip6_opt_dstopts dstOpts;
589 } ext_data;
Gabe Black463cb282020-10-14 00:38:42 -0700590};
Geoffrey Blakefb049642013-10-31 13:41:13 -0500591
592struct Ip6Opt : public ip6_opt_hdr
593{
594 uint8_t nxt() const { return ext_nxt; }
595 uint8_t extlen() const { return ext_len; }
596 uint8_t len() const { return extlen() + 8; }
597
598 // Supporting the types of header extensions likely to be encountered:
599 // fragment, routing type 2 and dstopts.
600
601 // Routing type 2
602 uint8_t rtType2Type() const { return ext_data.rtType2.type; }
603 uint8_t rtType2SegLft() const { return ext_data.rtType2.segleft; }
604 const uint8_t* rtType2Addr() const { return ext_data.rtType2.addr.data; }
605
606 // Fragment
607 uint16_t fragmentOfflg() const { return ntohs(ext_data.fragment.offlg); }
608 uint32_t fragmentIdent() const { return ntohl(ext_data.fragment.ident); }
609
610 // Dst Options/Home Address Option
611 uint8_t dstOptType() const { return ext_data.dstOpts.type; }
612 uint8_t dstOptLength() const { return ext_data.dstOpts.length; }
613 const uint8_t* dstOptAddr() const { return ext_data.dstOpts.addr.data; }
614};
615
616
617/*
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400618 * TCP Stuff
619 */
620struct TcpOpt;
621struct TcpHdr : public tcp_hdr
Nathan Binkerta58b8342004-09-20 10:43:53 -0400622{
623 uint16_t sport() const { return ntohs(th_sport); }
624 uint16_t dport() const { return ntohs(th_dport); }
625 uint32_t seq() const { return ntohl(th_seq); }
626 uint32_t ack() const { return ntohl(th_ack); }
Geoffrey Blakefb049642013-10-31 13:41:13 -0500627 uint8_t off() const { return th_off*4; }
Nathan Binkerta58b8342004-09-20 10:43:53 -0400628 uint8_t flags() const { return th_flags & 0x3f; }
629 uint16_t win() const { return ntohs(th_win); }
Nathan Binkerteaf66f42004-10-01 19:48:33 -0400630 uint16_t sum() const { return th_sum; }
Nathan Binkerta58b8342004-09-20 10:43:53 -0400631 uint16_t urp() const { return ntohs(th_urp); }
632
Nathan Binkerteaf66f42004-10-01 19:48:33 -0400633 void sum(uint16_t sum) { th_sum = sum; }
Ali Saidiaab595a2008-12-05 13:58:21 -0500634 void seq(uint32_t _seq) { th_seq = htonl(_seq); }
Steve Reinhardtdc8018a2016-02-06 17:21:18 -0800635 void flags(uint8_t _flags) { th_flags = _flags; }
Nathan Binkerta58b8342004-09-20 10:43:53 -0400636
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400637 bool options(std::vector<const TcpOpt *> &vec) const;
638
Nathan Binkert1d023452004-09-21 01:41:55 -0400639 int size() const { return off(); }
640 const uint8_t *bytes() const { return (const uint8_t *)this; }
641 const uint8_t *payload() const { return bytes() + size(); }
642 uint8_t *bytes() { return (uint8_t *)this; }
643 uint8_t *payload() { return bytes() + size(); }
Nathan Binkerta58b8342004-09-20 10:43:53 -0400644};
645
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400646class TcpPtr
647{
648 protected:
Ali Saidi8f8d0952006-04-24 19:31:50 -0400649 EthPacketPtr p;
Ali Saidi11ac0c72009-01-06 10:36:56 -0500650 int _off;
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400651
Ali Saidi11ac0c72009-01-06 10:36:56 -0500652 void set(const EthPacketPtr &ptr, int offset) { p = ptr; _off = offset; }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400653 void set(const IpPtr &ptr)
654 {
Nathan Binkert87d03d02008-06-17 22:14:12 -0700655 if (ptr && ptr->proto() == IP_PROTO_TCP)
Geoffrey Blakefb049642013-10-31 13:41:13 -0500656 set(ptr.p, ptr.pstart());
657 else
658 set(0, 0);
659 }
660 void set(const Ip6Ptr &ptr)
661 {
662 if (ptr && ptr->proto() == IP_PROTO_TCP)
663 set(ptr.p, ptr.pstart());
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400664 else
665 set(0, 0);
666 }
667
668 public:
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700669 /**
670 * @ingroup api_inet
671 * @{
672 */
Ali Saidi11ac0c72009-01-06 10:36:56 -0500673 TcpPtr() : p(0), _off(0) {}
674 TcpPtr(const IpPtr &ptr) : p(0), _off(0) { set(ptr); }
Geoffrey Blakefb049642013-10-31 13:41:13 -0500675 TcpPtr(const Ip6Ptr &ptr) : p(0), _off(0) { set(ptr); }
Ali Saidi11ac0c72009-01-06 10:36:56 -0500676 TcpPtr(const TcpPtr &ptr) : p(ptr.p), _off(ptr._off) {}
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700677 /** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400678
Ali Saidi11ac0c72009-01-06 10:36:56 -0500679 TcpHdr *get() { return (TcpHdr *)(p->data + _off); }
Nathan Binkert87d03d02008-06-17 22:14:12 -0700680 TcpHdr *operator->() { return get(); }
681 TcpHdr &operator*() { return *get(); }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400682
Ali Saidi11ac0c72009-01-06 10:36:56 -0500683 const TcpHdr *get() const { return (const TcpHdr *)(p->data + _off); }
Nathan Binkert87d03d02008-06-17 22:14:12 -0700684 const TcpHdr *operator->() const { return get(); }
685 const TcpHdr &operator*() const { return *get(); }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400686
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700687 /**
688 * @ingroup api_inet
689 * @{
690 */
Geoffrey Blakefb049642013-10-31 13:41:13 -0500691 const TcpPtr &operator=(const IpPtr &i)
692 { set(i); return *this; }
693 const TcpPtr &operator=(const TcpPtr &t)
694 { set(t.p, t._off); return *this; }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700695 /** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400696
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700697 /**
698 * @ingroup api_inet
699 * @{
700 */
Ali Saidi8f8d0952006-04-24 19:31:50 -0400701 const EthPacketPtr packet() const { return p; }
702 EthPacketPtr packet() { return p; }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400703 bool operator!() const { return !p; }
Andreas Hanssonad3f75d2014-10-16 05:49:46 -0400704 operator bool() const { return (p != nullptr); }
Ali Saidi11ac0c72009-01-06 10:36:56 -0500705 int off() const { return _off; }
706 int pstart() const { return off() + get()->size(); }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700707 /** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400708};
709
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700710/**
711 * @ingroup api_inet
712 */
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400713uint16_t cksum(const TcpPtr &ptr);
714
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400715struct TcpOpt : public tcp_opt
716{
717 uint8_t type() const { return opt_type; }
718 uint8_t len() const { return TCP_OPT_TYPEONLY(type()) ? 1 : opt_len; }
719
720 bool isopt(int opt) const { return type() == opt; }
721
722 const uint8_t *data() const { return opt_data.data8; }
723
724 uint16_t mss() const { return ntohs(opt_data.mss); }
725 uint8_t wscale() const { return opt_data.wscale; }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400726 uint32_t echo() const { return ntohl(opt_data.echo); }
727 uint32_t tsval() const { return ntohl(opt_data.timestamp[0]); }
728 uint32_t tsecr() const { return ntohl(opt_data.timestamp[1]); }
729 uint32_t cc() const { return ntohl(opt_data.cc); }
730 uint8_t cksum() const{ return opt_data.cksum; }
731 const uint8_t *md5() const { return opt_data.md5; }
732
733 int size() const { return len(); }
734 const uint8_t *bytes() const { return (const uint8_t *)this; }
735 const uint8_t *payload() const { return bytes() + size(); }
736 uint8_t *bytes() { return (uint8_t *)this; }
737 uint8_t *payload() { return bytes() + size(); }
738};
739
740/*
741 * UDP Stuff
742 */
743struct UdpHdr : public udp_hdr
Nathan Binkerta58b8342004-09-20 10:43:53 -0400744{
745 uint16_t sport() const { return ntohs(uh_sport); }
746 uint16_t dport() const { return ntohs(uh_dport); }
747 uint16_t len() const { return ntohs(uh_ulen); }
Nathan Binkertf7323ae2004-11-15 15:40:35 -0500748 uint16_t sum() const { return uh_sum; }
Nathan Binkerta58b8342004-09-20 10:43:53 -0400749
Nathan Binkertf7323ae2004-11-15 15:40:35 -0500750 void sum(uint16_t sum) { uh_sum = sum; }
Ali Saidiaab595a2008-12-05 13:58:21 -0500751 void len(uint16_t _len) { uh_ulen = htons(_len); }
Nathan Binkerta58b8342004-09-20 10:43:53 -0400752
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400753 int size() const { return sizeof(udp_hdr); }
Nathan Binkert1d023452004-09-21 01:41:55 -0400754 const uint8_t *bytes() const { return (const uint8_t *)this; }
755 const uint8_t *payload() const { return bytes() + size(); }
756 uint8_t *bytes() { return (uint8_t *)this; }
757 uint8_t *payload() { return bytes() + size(); }
Nathan Binkerta58b8342004-09-20 10:43:53 -0400758};
759
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400760class UdpPtr
761{
762 protected:
Ali Saidi8f8d0952006-04-24 19:31:50 -0400763 EthPacketPtr p;
Ali Saidi11ac0c72009-01-06 10:36:56 -0500764 int _off;
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400765
Ali Saidi11ac0c72009-01-06 10:36:56 -0500766 void set(const EthPacketPtr &ptr, int offset) { p = ptr; _off = offset; }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400767 void set(const IpPtr &ptr)
768 {
Nathan Binkert87d03d02008-06-17 22:14:12 -0700769 if (ptr && ptr->proto() == IP_PROTO_UDP)
Geoffrey Blakefb049642013-10-31 13:41:13 -0500770 set(ptr.p, ptr.pstart());
771 else
772 set(0, 0);
773 }
774 void set(const Ip6Ptr &ptr)
775 {
776 if (ptr && ptr->proto() == IP_PROTO_UDP)
777 set(ptr.p, ptr.pstart());
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400778 else
779 set(0, 0);
780 }
781
782 public:
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700783 /**
784 * @ingroup api_inet
785 */
Ali Saidi11ac0c72009-01-06 10:36:56 -0500786 UdpPtr() : p(0), _off(0) {}
787 UdpPtr(const IpPtr &ptr) : p(0), _off(0) { set(ptr); }
Geoffrey Blakefb049642013-10-31 13:41:13 -0500788 UdpPtr(const Ip6Ptr &ptr) : p(0), _off(0) { set(ptr); }
Ali Saidi11ac0c72009-01-06 10:36:56 -0500789 UdpPtr(const UdpPtr &ptr) : p(ptr.p), _off(ptr._off) {}
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700790 /** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400791
Ali Saidi11ac0c72009-01-06 10:36:56 -0500792 UdpHdr *get() { return (UdpHdr *)(p->data + _off); }
Nathan Binkert87d03d02008-06-17 22:14:12 -0700793 UdpHdr *operator->() { return get(); }
794 UdpHdr &operator*() { return *get(); }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400795
Ali Saidi11ac0c72009-01-06 10:36:56 -0500796 const UdpHdr *get() const { return (const UdpHdr *)(p->data + _off); }
Nathan Binkert87d03d02008-06-17 22:14:12 -0700797 const UdpHdr *operator->() const { return get(); }
798 const UdpHdr &operator*() const { return *get(); }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400799
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700800 /**
801 * @ingroup api_inet
802 * @{
803 */
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400804 const UdpPtr &operator=(const IpPtr &i) { set(i); return *this; }
Geoffrey Blakefb049642013-10-31 13:41:13 -0500805 const UdpPtr &operator=(const UdpPtr &t)
806 { set(t.p, t._off); return *this; }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700807 /** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400808
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700809 /**
810 * @ingroup api_inet
811 * @{
812 */
Ali Saidi8f8d0952006-04-24 19:31:50 -0400813 const EthPacketPtr packet() const { return p; }
814 EthPacketPtr packet() { return p; }
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400815 bool operator!() const { return !p; }
Andreas Hanssonad3f75d2014-10-16 05:49:46 -0400816 operator bool() const { return (p != nullptr); }
Ali Saidi11ac0c72009-01-06 10:36:56 -0500817 int off() const { return _off; }
818 int pstart() const { return off() + get()->size(); }
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700819 /** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400820};
821
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700822/**
823 * @ingroup api_inet
824 * @{
825 */
Geoffrey Blakefb049642013-10-31 13:41:13 -0500826uint16_t __tu_cksum6(const Ip6Ptr &ip6);
Andreas Hansson319443d2013-02-19 05:56:07 -0500827uint16_t __tu_cksum(const IpPtr &ip);
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400828uint16_t cksum(const UdpPtr &ptr);
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700829/** @} */ // end of api_inet
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400830
Hoa Nguyen197deeb2020-08-23 21:41:21 -0700831/**
832 * @ingroup api_inet
833 */
Ali Saidi11ac0c72009-01-06 10:36:56 -0500834int hsplit(const EthPacketPtr &ptr);
835
Daniel R. Carvalho06fb0752021-05-06 15:50:55 -0300836} // namespace networking
Daniel R. Carvalho974a47d2021-05-09 12:32:07 -0300837} // namespace gem5
Nathan Binkerta7fd7722004-10-23 16:18:44 -0400838
Nathan Binkerta58b8342004-09-20 10:43:53 -0400839#endif // __BASE_INET_HH__