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

Function SendUDP

Kernel/src/net/interface.cpp:144–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142 }
143
144 int SendUDP(void* data, size_t length, IPv4Address& destination, BigEndianUInt16 sourcePort, BigEndianUInt16 destinationPort){
145 uint8_t buffer[1600];
146
147 if(length > 1518){
148 return -EMSGSIZE;
149 }
150
151 UDPHeader* header = (UDPHeader*)buffer;
152 header->destPort = destinationPort;
153 header->srcPort = sourcePort;
154 header->length = sizeof(UDPHeader) + length;
155 header->checksum = 0;
156 header->checksum = CaclulateChecksum(header, sizeof(UDPHeader));
157
158 memcpy(header->data, data, length);
159
160 return SendIPv4(header, header->length, destination, IPv4ProtocolUDP);
161 }
162}

Callers 1

SendToMethod · 0.85

Calls 3

CaclulateChecksumFunction · 0.85
memcpyFunction · 0.85
SendIPv4Function · 0.85

Tested by

no test coverage detected