inet.hh (10251:878f2f30b12d) inet.hh (10469:b16b7dc83139)
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

--- 168 unchanged lines hidden (view full) ---

177 const EthHdr &operator*() const { return *(const EthHdr *)p->data; }
178 operator const EthHdr *() const { return (const EthHdr *)p->data; }
179
180 const EthPtr &operator=(const EthPacketPtr &ptr) { p = ptr; return *this; }
181
182 const EthPacketPtr packet() const { return p; }
183 EthPacketPtr packet() { return p; }
184 bool operator!() const { return !p; }
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

--- 168 unchanged lines hidden (view full) ---

177 const EthHdr &operator*() const { return *(const EthHdr *)p->data; }
178 operator const EthHdr *() const { return (const EthHdr *)p->data; }
179
180 const EthPtr &operator=(const EthPacketPtr &ptr) { p = ptr; return *this; }
181
182 const EthPacketPtr packet() const { return p; }
183 EthPacketPtr packet() { return p; }
184 bool operator!() const { return !p; }
185 operator bool() const { return p; }
185 operator bool() const { return (p != nullptr); }
186 int off() const { return 0; }
187 int pstart() const { return off() + ((const EthHdr*)p->data)->size(); }
188};
189
190/*
191 * IP Stuff
192 */
193struct IpAddress

--- 125 unchanged lines hidden (view full) ---

319
320 const IpPtr &operator=(const EthPacketPtr &ptr) { set(ptr); return *this; }
321 const IpPtr &operator=(const EthPtr &ptr) { set(ptr.p); return *this; }
322 const IpPtr &operator=(const IpPtr &ptr) { p = ptr.p; return *this; }
323
324 const EthPacketPtr packet() const { return p; }
325 EthPacketPtr packet() { return p; }
326 bool operator!() const { return !p; }
186 int off() const { return 0; }
187 int pstart() const { return off() + ((const EthHdr*)p->data)->size(); }
188};
189
190/*
191 * IP Stuff
192 */
193struct IpAddress

--- 125 unchanged lines hidden (view full) ---

319
320 const IpPtr &operator=(const EthPacketPtr &ptr) { set(ptr); return *this; }
321 const IpPtr &operator=(const EthPtr &ptr) { set(ptr.p); return *this; }
322 const IpPtr &operator=(const IpPtr &ptr) { p = ptr.p; return *this; }
323
324 const EthPacketPtr packet() const { return p; }
325 EthPacketPtr packet() { return p; }
326 bool operator!() const { return !p; }
327 operator bool() const { return p; }
327 operator bool() const { return (p != nullptr); }
328 int off() const { return (sizeof(eth_hdr) + ((eth_hdr_vlan) ? 4 : 0)); }
329 int pstart() const { return (off() + get()->size()); }
330};
331
332uint16_t cksum(const IpPtr &ptr);
333
334struct IpOpt : public ip_opt
335{

--- 99 unchanged lines hidden (view full) ---

435 const Ip6Ptr &operator=(const EthPtr &ptr)
436 { set(ptr.p); return *this; }
437 const Ip6Ptr &operator=(const Ip6Ptr &ptr)
438 { p = ptr.p; return *this; }
439
440 const EthPacketPtr packet() const { return p; }
441 EthPacketPtr packet() { return p; }
442 bool operator!() const { return !p; }
328 int off() const { return (sizeof(eth_hdr) + ((eth_hdr_vlan) ? 4 : 0)); }
329 int pstart() const { return (off() + get()->size()); }
330};
331
332uint16_t cksum(const IpPtr &ptr);
333
334struct IpOpt : public ip_opt
335{

--- 99 unchanged lines hidden (view full) ---

435 const Ip6Ptr &operator=(const EthPtr &ptr)
436 { set(ptr.p); return *this; }
437 const Ip6Ptr &operator=(const Ip6Ptr &ptr)
438 { p = ptr.p; return *this; }
439
440 const EthPacketPtr packet() const { return p; }
441 EthPacketPtr packet() { return p; }
442 bool operator!() const { return !p; }
443 operator bool() const { return p; }
443 operator bool() const { return (p != nullptr); }
444 int off() const { return sizeof(eth_hdr) + ((eth_hdr_vlan) ? 4 : 0); }
445 int pstart() const { return off() + get()->size(); }
446};
447
448// Dnet supplied ipv6 opt header is incomplete and
449// newer NIC card filters expect a more robust
450// ipv6 header option declaration.
451struct ip6_opt_fragment {

--- 119 unchanged lines hidden (view full) ---

571 const TcpPtr &operator=(const IpPtr &i)
572 { set(i); return *this; }
573 const TcpPtr &operator=(const TcpPtr &t)
574 { set(t.p, t._off); return *this; }
575
576 const EthPacketPtr packet() const { return p; }
577 EthPacketPtr packet() { return p; }
578 bool operator!() const { return !p; }
444 int off() const { return sizeof(eth_hdr) + ((eth_hdr_vlan) ? 4 : 0); }
445 int pstart() const { return off() + get()->size(); }
446};
447
448// Dnet supplied ipv6 opt header is incomplete and
449// newer NIC card filters expect a more robust
450// ipv6 header option declaration.
451struct ip6_opt_fragment {

--- 119 unchanged lines hidden (view full) ---

571 const TcpPtr &operator=(const IpPtr &i)
572 { set(i); return *this; }
573 const TcpPtr &operator=(const TcpPtr &t)
574 { set(t.p, t._off); return *this; }
575
576 const EthPacketPtr packet() const { return p; }
577 EthPacketPtr packet() { return p; }
578 bool operator!() const { return !p; }
579 operator bool() const { return p; }
579 operator bool() const { return (p != nullptr); }
580 int off() const { return _off; }
581 int pstart() const { return off() + get()->size(); }
582};
583
584uint16_t cksum(const TcpPtr &ptr);
585
586struct TcpOpt : public tcp_opt
587{

--- 78 unchanged lines hidden (view full) ---

666
667 const UdpPtr &operator=(const IpPtr &i) { set(i); return *this; }
668 const UdpPtr &operator=(const UdpPtr &t)
669 { set(t.p, t._off); return *this; }
670
671 const EthPacketPtr packet() const { return p; }
672 EthPacketPtr packet() { return p; }
673 bool operator!() const { return !p; }
580 int off() const { return _off; }
581 int pstart() const { return off() + get()->size(); }
582};
583
584uint16_t cksum(const TcpPtr &ptr);
585
586struct TcpOpt : public tcp_opt
587{

--- 78 unchanged lines hidden (view full) ---

666
667 const UdpPtr &operator=(const IpPtr &i) { set(i); return *this; }
668 const UdpPtr &operator=(const UdpPtr &t)
669 { set(t.p, t._off); return *this; }
670
671 const EthPacketPtr packet() const { return p; }
672 EthPacketPtr packet() { return p; }
673 bool operator!() const { return !p; }
674 operator bool() const { return p; }
674 operator bool() const { return (p != nullptr); }
675 int off() const { return _off; }
676 int pstart() const { return off() + get()->size(); }
677};
678
679uint16_t __tu_cksum6(const Ip6Ptr &ip6);
680uint16_t __tu_cksum(const IpPtr &ip);
681uint16_t cksum(const UdpPtr &ptr);
682
683int hsplit(const EthPacketPtr &ptr);
684
685} // namespace Net
686
687#endif // __BASE_INET_HH__
675 int off() const { return _off; }
676 int pstart() const { return off() + get()->size(); }
677};
678
679uint16_t __tu_cksum6(const Ip6Ptr &ip6);
680uint16_t __tu_cksum(const IpPtr &ip);
681uint16_t cksum(const UdpPtr &ptr);
682
683int hsplit(const EthPacketPtr &ptr);
684
685} // namespace Net
686
687#endif // __BASE_INET_HH__