MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / CaclulateChecksum

Function CaclulateChecksum

Kernel/include/net/net.h:134–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132 };
133
134 static inline BigEndianUInt16 CaclulateChecksum(void* data, size_t size){
135 uint16_t* ptr = (uint16_t*)data;
136 size_t count = sizeof(IPv4Header);
137 uint32_t checksum = 0;
138
139 while(count >= 2){
140 checksum += *ptr++;
141 count -= 2;
142 }
143
144 checksum = (checksum & 0xFFFF) + (checksum >> 16);
145 checksum += checksum >> 16;
146
147 BigEndianUInt16 ret;
148 ret = ~checksum;
149 return ret;
150 }
151
152 void InitializeDrivers();
153 void InitializeConnections();

Callers 2

SendIPv4Function · 0.85
SendUDPFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected