Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: njh/EtherCard
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7f420218afa0e468286b26bc2424b6c62ff01a0a
Choose a base ref
..
head repository: njh/EtherCard
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7b2837f4b31b0acca95c79d1df41793f1e765645
Choose a head ref
Showing with 8 additions and 8 deletions.
  1. +8 −8 src/EtherUtil.h
16 changes: 8 additions & 8 deletions src/EtherUtil.h
Original file line number Diff line number Diff line change
@@ -9,43 +9,43 @@

#define gPB ether.buffer

static inline EthHeader &ethernet_header()
inline EthHeader &ethernet_header()
{
uint8_t *iter = gPB; // avoid strict aliasing warning
return *(EthHeader *)iter;
}

static inline uint8_t *ethernet_payload()
inline uint8_t *ethernet_payload()
{
return (uint8_t *)&ethernet_header() + sizeof(EthHeader);
}

static inline ArpHeader &arp_header()
inline ArpHeader &arp_header()
{
return *(ArpHeader *)ethernet_payload();
}

static inline IpHeader &ip_header()
inline IpHeader &ip_header()
{
return *(IpHeader *)ethernet_payload();
}

static inline uint8_t *ip_payload()
inline uint8_t *ip_payload()
{
return (uint8_t *)&ip_header() + sizeof(IpHeader);
}

static inline uint8_t *tcp_header()
inline uint8_t *tcp_header()
{
return (uint8_t *)ip_payload();
}

static inline UdpHeader &udp_header()
inline UdpHeader &udp_header()
{
return *(UdpHeader *)ip_payload();
}

static inline uint8_t *udp_payload()
inline uint8_t *udp_payload()
{
return (uint8_t *)&udp_header() + sizeof(UdpHeader);
}