Add svn:eol-style property to source files, so that the line endings are correctly...
[pub/USBasp.git] / Demos / Device / LowLevel / RNDISEthernet / Lib / ICMP.c
index 6de8ba8..02a401f 100644 (file)
@@ -1,79 +1,79 @@
-/*\r
-             LUFA Library\r
-     Copyright (C) Dean Camera, 2010.\r
-              \r
-  dean [at] fourwalledcubicle [dot] com\r
-      www.fourwalledcubicle.com\r
-*/\r
-\r
-/*\r
-  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-\r
-  Permission to use, copy, modify, distribute, and sell this \r
-  software and its documentation for any purpose is hereby granted\r
-  without fee, provided that the above copyright notice appear in \r
-  all copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting \r
-  documentation, and that the name of the author not be used in \r
-  advertising or publicity pertaining to distribution of the \r
-  software without specific, written prior permission.\r
-\r
-  The author disclaim all warranties with regard to this\r
-  software, including all implied warranties of merchantability\r
-  and fitness.  In no event shall the author be liable for any\r
-  special, indirect or consequential damages or any damages\r
-  whatsoever resulting from loss of use, data or profits, whether\r
-  in an action of contract, negligence or other tortious action,\r
-  arising out of or in connection with the use or performance of\r
-  this software.\r
-*/\r
-\r
-/** \file\r
- *\r
- *  Internet Control Message Protocol (ICMP) packet handling routines. This protocol handles\r
- *  Echo requests from the host, to indicate a successful network connection between the host\r
- *  and the virtual server.\r
- */\r
\r
-#include "ICMP.h"\r
-\r
-/** Processes an ICMP packet inside an Ethernet frame, and writes the appropriate response\r
- *  to the output Ethernet frame if the host is issuing a ICMP ECHO request.\r
- *\r
- *  \param[in] InDataStart    Pointer to the start of the incoming packet's ICMP header\r
- *  \param[out] OutDataStart  Pointer to the start of the outgoing packet's ICMP header\r
- *\r
- *  \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise\r
- */\r
-int16_t ICMP_ProcessICMPPacket(void* InDataStart, void* OutDataStart)\r
-{\r
-       ICMP_Header_t* ICMPHeaderIN  = (ICMP_Header_t*)InDataStart;\r
-       ICMP_Header_t* ICMPHeaderOUT = (ICMP_Header_t*)OutDataStart;\r
-\r
-       DecodeICMPHeader(InDataStart);\r
-\r
-       /* Determine if the ICMP packet is an echo request (ping) */\r
-       if (ICMPHeaderIN->Type == ICMP_TYPE_ECHOREQUEST)\r
-       {\r
-               /* Fill out the ICMP response packet */\r
-               ICMPHeaderOUT->Type     = ICMP_TYPE_ECHOREPLY;\r
-               ICMPHeaderOUT->Code     = 0;\r
-               ICMPHeaderOUT->Checksum = 0;\r
-               ICMPHeaderOUT->Id       = ICMPHeaderIN->Id;\r
-               ICMPHeaderOUT->Sequence = ICMPHeaderIN->Sequence;\r
-               \r
-               uint16_t DataSize = FrameIN.FrameLength - ((((uint16_t)InDataStart + sizeof(ICMP_Header_t)) - (uint16_t)FrameIN.FrameData));\r
-               \r
-               /* Copy the remaining payload to the response - echo requests should echo back any sent data */\r
-               memcpy(&((uint8_t*)OutDataStart)[sizeof(ICMP_Header_t)],\r
-                      &((uint8_t*)InDataStart)[sizeof(ICMP_Header_t)],\r
-                          DataSize);\r
-\r
-               ICMPHeaderOUT->Checksum = Ethernet_Checksum16(ICMPHeaderOUT, (DataSize + sizeof(ICMP_Header_t)));\r
-\r
-               /* Return the size of the response so far */\r
-               return (DataSize + sizeof(ICMP_Header_t));\r
-       }\r
-       \r
-       return NO_RESPONSE;\r
-}\r
+/*
+             LUFA Library
+     Copyright (C) Dean Camera, 2010.
+              
+  dean [at] fourwalledcubicle [dot] com
+      www.fourwalledcubicle.com
+*/
+
+/*
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+  Permission to use, copy, modify, distribute, and sell this 
+  software and its documentation for any purpose is hereby granted
+  without fee, provided that the above copyright notice appear in 
+  all copies and that both that the copyright notice and this
+  permission notice and warranty disclaimer appear in supporting 
+  documentation, and that the name of the author not be used in 
+  advertising or publicity pertaining to distribution of the 
+  software without specific, written prior permission.
+
+  The author disclaim all warranties with regard to this
+  software, including all implied warranties of merchantability
+  and fitness.  In no event shall the author be liable for any
+  special, indirect or consequential damages or any damages
+  whatsoever resulting from loss of use, data or profits, whether
+  in an action of contract, negligence or other tortious action,
+  arising out of or in connection with the use or performance of
+  this software.
+*/
+
+/** \file
+ *
+ *  Internet Control Message Protocol (ICMP) packet handling routines. This protocol handles
+ *  Echo requests from the host, to indicate a successful network connection between the host
+ *  and the virtual server.
+ */
+#include "ICMP.h"
+
+/** Processes an ICMP packet inside an Ethernet frame, and writes the appropriate response
+ *  to the output Ethernet frame if the host is issuing a ICMP ECHO request.
+ *
+ *  \param[in] InDataStart    Pointer to the start of the incoming packet's ICMP header
+ *  \param[out] OutDataStart  Pointer to the start of the outgoing packet's ICMP header
+ *
+ *  \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise
+ */
+int16_t ICMP_ProcessICMPPacket(void* InDataStart, void* OutDataStart)
+{
+       ICMP_Header_t* ICMPHeaderIN  = (ICMP_Header_t*)InDataStart;
+       ICMP_Header_t* ICMPHeaderOUT = (ICMP_Header_t*)OutDataStart;
+
+       DecodeICMPHeader(InDataStart);
+
+       /* Determine if the ICMP packet is an echo request (ping) */
+       if (ICMPHeaderIN->Type == ICMP_TYPE_ECHOREQUEST)
+       {
+               /* Fill out the ICMP response packet */
+               ICMPHeaderOUT->Type     = ICMP_TYPE_ECHOREPLY;
+               ICMPHeaderOUT->Code     = 0;
+               ICMPHeaderOUT->Checksum = 0;
+               ICMPHeaderOUT->Id       = ICMPHeaderIN->Id;
+               ICMPHeaderOUT->Sequence = ICMPHeaderIN->Sequence;
+               
+               uint16_t DataSize = FrameIN.FrameLength - ((((uint16_t)InDataStart + sizeof(ICMP_Header_t)) - (uint16_t)FrameIN.FrameData));
+               
+               /* Copy the remaining payload to the response - echo requests should echo back any sent data */
+               memcpy(&((uint8_t*)OutDataStart)[sizeof(ICMP_Header_t)],
+                      &((uint8_t*)InDataStart)[sizeof(ICMP_Header_t)],
+                          DataSize);
+
+               ICMPHeaderOUT->Checksum = Ethernet_Checksum16(ICMPHeaderOUT, (DataSize + sizeof(ICMP_Header_t)));
+
+               /* Return the size of the response so far */
+               return (DataSize + sizeof(ICMP_Header_t));
+       }
+       
+       return NO_RESPONSE;
+}