X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/b9b03aadb219d06fbad9d110e508db93e45461af..c1fa2306181924ebd8b36b0e3910b7904143beb8:/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c index 1f571c3e9..4338d3ea8 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c @@ -38,11 +38,11 @@ #include "UDP.h" /** Processes a UDP packet inside an Ethernet frame, and writes the appropriate response - * to the output Ethernet frame if a subprotocol handler has created a response packet. + * to the output Ethernet frame if a sub-protocol handler has created a response packet. * - * \param IPHeaderInStart Pointer to the start of the incoming packet's IP header - * \param UDPHeaderInStart Pointer to the start of the incoming packet's UDP header - * \param UDPHeaderOutStart Pointer to the start of the outgoing packet's UDP header + * \param[in] IPHeaderInStart Pointer to the start of the incoming packet's IP header + * \param[in] UDPHeaderInStart Pointer to the start of the incoming packet's UDP header + * \param[out] UDPHeaderOutStart Pointer to the start of the outgoing packet's UDP header * * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise */ @@ -55,12 +55,13 @@ int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart, void* UDPHeaderInStart, void DecodeUDPHeader(UDPHeaderInStart); - /* Check to see if the UDP packet is a DHCP packet */ - if (SwapEndian_16(UDPHeaderIN->DestinationPort) == UDP_PORT_DHCP_REQUEST) + switch (SwapEndian_16(UDPHeaderIN->DestinationPort)) { - RetSize = DHCP_ProcessDHCPPacket(IPHeaderInStart, - &((uint8_t*)UDPHeaderInStart)[sizeof(UDP_Header_t)], - &((uint8_t*)UDPHeaderOutStart)[sizeof(UDP_Header_t)]); + case UDP_PORT_DHCP_REQUEST: + RetSize = DHCP_ProcessDHCPPacket(IPHeaderInStart, + &((uint8_t*)UDPHeaderInStart)[sizeof(UDP_Header_t)], + &((uint8_t*)UDPHeaderOutStart)[sizeof(UDP_Header_t)]); + break; } /* Check to see if the protocol processing routine has filled out a response */