Hoa Nguyen has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/33254 )

Change subject: base: Tag API methods in inet.hh
......................................................................

base: Tag API methods in inet.hh

Change-Id: Id53ab873c7de9de7ccb99ff8434827aeec676c30
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33254
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/base/inet.hh
1 file changed, 148 insertions(+), 0 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, but someone else must approve
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/base/inet.hh b/src/base/inet.hh
index 43523a1..8aa4475 100644
--- a/src/base/inet.hh
+++ b/src/base/inet.hh
@@ -75,18 +75,36 @@
     void parse(const std::string &addr);

   public:
+    /**
+     * @ingroup api_inet
+     * @{
+     */
     EthAddr();
     EthAddr(const uint8_t ea[ETH_ADDR_LEN]);
     EthAddr(const eth_addr &ea);
     EthAddr(const std::string &addr);
     const EthAddr &operator=(const eth_addr &ea);
     const EthAddr &operator=(const std::string &addr);
+    /** @} */ // end of api_inet

+    /**
+     * @ingroup api_inet
+     */
     int size() const { return sizeof(eth_addr); }

+
+    /**
+     * @ingroup api_inet
+     * @{
+     */
     const uint8_t *bytes() const { return &data[0]; }
     uint8_t *bytes() { return &data[0]; }
+    /** @} */ // end of api_inet

+    /**
+     * @ingroup api_inet
+     * @{
+     */
     const uint8_t *addr() const { return &data[0]; }
     bool unicast() const { return !(data[0] & 0x01); }
     bool multicast() const { return !unicast() && !broadcast(); }
@@ -99,9 +117,16 @@

         return isBroadcast;
     }
+    /** @} */ // end of api_inet

+    /**
+     * @ingroup api_inet
+     */
     std::string string() const;

+    /**
+     * @ingroup api_inet
+     */
     operator uint64_t() const
     {
         uint64_t reg = 0;
@@ -116,8 +141,13 @@

 };

+/**
+ * @ingroup api_inet
+ * @{
+ */
 std::ostream &operator<<(std::ostream &stream, const EthAddr &ea);
 bool operator==(const EthAddr &left, const EthAddr &right);
+/** @} */ // end of api_inet

 struct EthHdr : public eth_hdr
 {
@@ -161,8 +191,13 @@
     EthPacketPtr p;

   public:
+    /**
+     * @ingroup api_inet
+     * @{
+     */
     EthPtr() {}
     EthPtr(const EthPacketPtr &ptr) : p(ptr) { }
+    /** @} */ // end of api_inet

     EthHdr *operator->() { return (EthHdr *)p->data; }
     EthHdr &operator*() { return *(EthHdr *)p->data; }
@@ -172,14 +207,22 @@
     const EthHdr &operator*() const { return *(const EthHdr *)p->data; }
     operator const EthHdr *() const { return (const EthHdr *)p->data; }

+    /**
+     * @ingroup api_inet
+     */
const EthPtr &operator=(const EthPacketPtr &ptr) { p = ptr; return *this; }

+    /**
+     * @ingroup api_inet
+     * @{
+     */
     const EthPacketPtr packet() const { return p; }
     EthPacketPtr packet() { return p; }
     bool operator!() const { return !p; }
     operator bool() const { return (p != nullptr); }
     int off() const { return 0; }
     int pstart() const { return off() + ((const EthHdr*)p->data)->size(); }
+    /** @} */ // end of api_inet
 };

 /*
@@ -191,18 +234,34 @@
     uint32_t _ip;

   public:
+    /**
+     * @ingroup api_inet
+     * @{
+     */
     IpAddress() : _ip(0)
     {}
     IpAddress(const uint32_t __ip) : _ip(__ip)
     {}
+    /** @} */ // end of api_net

+    /**
+     * @ingroup api_inet
+     */
     uint32_t ip() const { return _ip; }

+    /**
+     * @ingroup api_inet
+     */
     std::string string() const;
 };

+/**
+ * @ingroup api_inet
+ * @{
+ */
 std::ostream &operator<<(std::ostream &stream, const IpAddress &ia);
 bool operator==(const IpAddress &left, const IpAddress &right);
+/** @} */ // end of api_inet

 struct IpNetmask : public IpAddress
 {
@@ -216,13 +275,21 @@
         IpAddress(__ip), _netmask(__netmask)
     {}

+    /**
+     * @ingroup api_inet
+     */
     uint8_t netmask() const { return _netmask; }

     std::string string() const;
 };

+/**
+ * @ingroup api_inet
+ * @{
+ */
 std::ostream &operator<<(std::ostream &stream, const IpNetmask &in);
 bool operator==(const IpNetmask &left, const IpNetmask &right);
+/** @} */ // end of api_inet

 struct IpWithPort : public IpAddress
 {
@@ -236,13 +303,21 @@
         IpAddress(__ip), _port(__port)
     {}

+    /**
+     * @ingroup api_inet
+     */
     uint8_t port() const { return _port; }

     std::string string() const;
 };

+/**
+ * @ingroup api_inet
+ * @{
+ */
 std::ostream &operator<<(std::ostream &stream, const IpWithPort &iwp);
 bool operator==(const IpWithPort &left, const IpWithPort &right);
+/** @} */ // end of api_inet

 struct IpOpt;
 struct IpHdr : public ip_hdr
@@ -296,34 +371,52 @@
     }

   public:
+    /**
+     * @ingroup api_inet
+     * @{
+     */
     IpPtr() : p(0), eth_hdr_vlan(false) {}
IpPtr(const EthPacketPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr); }
     IpPtr(const EthPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr.p); }
     IpPtr(const IpPtr &ptr) : p(ptr.p), eth_hdr_vlan(ptr.eth_hdr_vlan) { }
+    /** @} */ // end of api_inet

     IpHdr *get() { return (IpHdr *)(p->data + sizeof(eth_hdr) +
                                    ((eth_hdr_vlan) ? 4 : 0)); }
     IpHdr *operator->() { return get(); }
     IpHdr &operator*() { return *get(); }

+    /**
+     * @ingroup api_inet
+     * @{
+     */
     const IpHdr *get() const
     { return (const IpHdr *)(p->data + sizeof(eth_hdr) +
                             ((eth_hdr_vlan) ? 4 : 0)); }
     const IpHdr *operator->() const { return get(); }
     const IpHdr &operator*() const { return *get(); }
+    /** @} */ // end of api_inet

const IpPtr &operator=(const EthPacketPtr &ptr) { set(ptr); return *this; }
     const IpPtr &operator=(const EthPtr &ptr) { set(ptr.p); return *this; }
     const IpPtr &operator=(const IpPtr &ptr) { p = ptr.p; return *this; }

+    /**
+     * @ingroup api_inet
+     * @{
+     */
     const EthPacketPtr packet() const { return p; }
     EthPacketPtr packet() { return p; }
     bool operator!() const { return !p; }
     operator bool() const { return (p != nullptr); }
int off() const { return (sizeof(eth_hdr) + ((eth_hdr_vlan) ? 4 : 0)); }
     int pstart() const { return (off() + get()->size()); }
+    /** @} */ // end of api_inet
 };

+/**
+ * @ingroup api_inet
+ */
 uint16_t cksum(const IpPtr &ptr);

 struct IpOpt : public ip_opt
@@ -408,10 +501,15 @@
     }

   public:
+    /**
+     * @ingroup api_inet
+     * @{
+     */
     Ip6Ptr() : p(0), eth_hdr_vlan(false) {}
Ip6Ptr(const EthPacketPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr); }
     Ip6Ptr(const EthPtr &ptr) : p(0), eth_hdr_vlan(false) { set(ptr.p); }
Ip6Ptr(const Ip6Ptr &ptr) : p(ptr.p), eth_hdr_vlan(ptr.eth_hdr_vlan) { }
+    /** @} */ // end of api_inet

     Ip6Hdr *get() { return (Ip6Hdr *)(p->data + sizeof(eth_hdr)
                                       + ((eth_hdr_vlan) ? 4 : 0)); }
@@ -424,19 +522,29 @@
     const Ip6Hdr *operator->() const { return get(); }
     const Ip6Hdr &operator*() const { return *get(); }

+    /**
+     * @ingroup api_inet
+     * @{
+     */
     const Ip6Ptr &operator=(const EthPacketPtr &ptr)
     { set(ptr); return *this; }
     const Ip6Ptr &operator=(const EthPtr &ptr)
     { set(ptr.p); return *this; }
     const Ip6Ptr &operator=(const Ip6Ptr &ptr)
     { p = ptr.p; return *this; }
+    /** @} */ // end of api_inet

+    /**
+     * @ingroup api_inet
+     * @{
+     */
     const EthPacketPtr packet() const { return p; }
     EthPacketPtr packet() { return p; }
     bool operator!() const { return !p; }
     operator bool() const { return (p != nullptr); }
     int off() const { return sizeof(eth_hdr) + ((eth_hdr_vlan) ? 4 : 0); }
     int pstart() const { return off() + get()->size(); }
+    /** @} */ // end of api_inet
 };

 // Dnet supplied ipv6 opt header is incomplete and
@@ -549,10 +657,15 @@
     }

   public:
+    /**
+     * @ingroup api_inet
+     * @{
+     */
     TcpPtr() : p(0), _off(0) {}
     TcpPtr(const IpPtr &ptr) : p(0), _off(0) { set(ptr); }
     TcpPtr(const Ip6Ptr &ptr) : p(0), _off(0) { set(ptr); }
     TcpPtr(const TcpPtr &ptr) : p(ptr.p), _off(ptr._off) {}
+    /** @} */ // end of api_inet

     TcpHdr *get() { return (TcpHdr *)(p->data + _off); }
     TcpHdr *operator->() { return get(); }
@@ -562,19 +675,32 @@
     const TcpHdr *operator->() const { return get(); }
     const TcpHdr &operator*() const { return *get(); }

+    /**
+     * @ingroup api_inet
+     * @{
+     */
     const TcpPtr &operator=(const IpPtr &i)
     { set(i); return *this; }
     const TcpPtr &operator=(const TcpPtr &t)
     { set(t.p, t._off); return *this; }
+    /** @} */ // end of api_inet

+    /**
+     * @ingroup api_inet
+     * @{
+     */
     const EthPacketPtr packet() const { return p; }
     EthPacketPtr packet() { return p; }
     bool operator!() const { return !p; }
     operator bool() const { return (p != nullptr); }
     int off() const { return _off; }
     int pstart() const { return off() + get()->size(); }
+    /** @} */ // end of api_inet
 };

+/**
+ * @ingroup api_inet
+ */
 uint16_t cksum(const TcpPtr &ptr);

 struct TcpOpt : public tcp_opt
@@ -645,10 +771,14 @@
     }

   public:
+    /**
+     * @ingroup api_inet
+     */
     UdpPtr() : p(0), _off(0) {}
     UdpPtr(const IpPtr &ptr) : p(0), _off(0) { set(ptr); }
     UdpPtr(const Ip6Ptr &ptr) : p(0), _off(0) { set(ptr); }
     UdpPtr(const UdpPtr &ptr) : p(ptr.p), _off(ptr._off) {}
+    /** @} */ // end of api_inet

     UdpHdr *get() { return (UdpHdr *)(p->data + _off); }
     UdpHdr *operator->() { return get(); }
@@ -658,22 +788,40 @@
     const UdpHdr *operator->() const { return get(); }
     const UdpHdr &operator*() const { return *get(); }

+    /**
+     * @ingroup api_inet
+     * @{
+     */
     const UdpPtr &operator=(const IpPtr &i) { set(i); return *this; }
     const UdpPtr &operator=(const UdpPtr &t)
     { set(t.p, t._off); return *this; }
+    /** @} */ // end of api_inet

+    /**
+     * @ingroup api_inet
+     * @{
+     */
     const EthPacketPtr packet() const { return p; }
     EthPacketPtr packet() { return p; }
     bool operator!() const { return !p; }
     operator bool() const { return (p != nullptr); }
     int off() const { return _off; }
     int pstart() const { return off() + get()->size(); }
+    /** @} */ // end of api_inet
 };

+/**
+ * @ingroup api_inet
+ * @{
+ */
 uint16_t __tu_cksum6(const Ip6Ptr &ip6);
 uint16_t __tu_cksum(const IpPtr &ip);
 uint16_t cksum(const UdpPtr &ptr);
+/** @} */ // end of api_inet

+/**
+ * @ingroup api_inet
+ */
 int hsplit(const EthPacketPtr &ptr);

 } // namespace Net

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33254
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id53ab873c7de9de7ccb99ff8434827aeec676c30
Gerrit-Change-Number: 33254
Gerrit-PatchSet: 2
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to