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