aboutsummaryrefslogtreecommitdiff
path: root/lib/lufa/Demos/Device/LowLevel/RNDISEthernet
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-07-07 11:55:23 -0400
committerJack Humbert <jack.humb@gmail.com>2017-07-07 11:55:23 -0400
commit8655d4f4948b2deef7844503c8d690f23ac1a062 (patch)
treeb2c6effc9d6cd5b5b43933a1e53b8bf17e9e82cf /lib/lufa/Demos/Device/LowLevel/RNDISEthernet
parent1896c76a2928c96f9ab7947bec2ef8dd37623cff (diff)
parent60b30c036397cb5627fa374bb930794b225daa29 (diff)
downloadqmk_firmware-8655d4f4948b2deef7844503c8d690f23ac1a062.tar.gz
qmk_firmware-8655d4f4948b2deef7844503c8d690f23ac1a062.zip
Merge commit '60b30c036397cb5627fa374bb930794b225daa29' as 'lib/lufa'
Diffstat (limited to 'lib/lufa/Demos/Device/LowLevel/RNDISEthernet')
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/AppConfig.h60
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/LUFAConfig.h126
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c244
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h112
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/LUFA RNDIS.inf59
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c87
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h78
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c129
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h131
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c136
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h111
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h88
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c81
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h82
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c113
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h92
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c276
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h60
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c394
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h67
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c631
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h260
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c84
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h73
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c203
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h57
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c294
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h87
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt146
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/asf.xml86
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/doxyfile2395
-rw-r--r--lib/lufa/Demos/Device/LowLevel/RNDISEthernet/makefile44
32 files changed, 6886 insertions, 0 deletions
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/AppConfig.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/AppConfig.h
new file mode 100644
index 000000000..0e4d1780a
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/AppConfig.h
@@ -0,0 +1,60 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 * \brief Application Configuration Header File
33 *
34 * This is a header file which is be used to configure some of
35 * the application's compile time options, as an alternative to
36 * specifying the compile time constants supplied through a
37 * makefile or build system.
38 *
39 * For information on what each token does, refer to the
40 * \ref Sec_Options section of the application documentation.
41 */
42
43#ifndef _APP_CONFIG_H_
44#define _APP_CONFIG_H_
45
46 #define CLIENT_IP_ADDRESS { 10, 0, 0, 1}
47 #define SERVER_IP_ADDRESS { 10, 0, 0, 2}
48
49 #define ADAPTER_MAC_ADDRESS {0x02, 0x00, 0x02, 0x00, 0x02, 0x00}
50 #define SERVER_MAC_ADDRESS {0x00, 0x01, 0x00, 0x01, 0x00, 0x01}
51
52 #define NO_DECODE_ETHERNET
53 #define NO_DECODE_ARP
54 #define NO_DECODE_IP
55 #define NO_DECODE_ICMP
56 #define NO_DECODE_TCP
57 #define NO_DECODE_UDP
58 #define NO_DECODE_DHCP
59
60#endif
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/LUFAConfig.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/LUFAConfig.h
new file mode 100644
index 000000000..cc828a108
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/LUFAConfig.h
@@ -0,0 +1,126 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 * \brief LUFA Library Configuration Header File
33 *
34 * This header file is used to configure LUFA's compile time options,
35 * as an alternative to the compile time constants supplied through
36 * a makefile.
37 *
38 * For information on what each token does, refer to the LUFA
39 * manual section "Summary of Compile Tokens".
40 */
41
42#ifndef _LUFA_CONFIG_H_
43#define _LUFA_CONFIG_H_
44
45 #if (ARCH == ARCH_AVR8)
46
47 /* Non-USB Related Configuration Tokens: */
48// #define DISABLE_TERMINAL_CODES
49
50 /* USB Class Driver Related Tokens: */
51// #define HID_HOST_BOOT_PROTOCOL_ONLY
52// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
53// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
54// #define HID_MAX_COLLECTIONS {Insert Value Here}
55// #define HID_MAX_REPORTITEMS {Insert Value Here}
56// #define HID_MAX_REPORT_IDS {Insert Value Here}
57// #define NO_CLASS_DRIVER_AUTOFLUSH
58
59 /* General USB Driver Related Tokens: */
60// #define ORDERED_EP_CONFIG
61 #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)
62 #define USB_DEVICE_ONLY
63// #define USB_HOST_ONLY
64// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
65// #define NO_LIMITED_CONTROLLER_CONNECT
66// #define NO_SOF_EVENTS
67
68 /* USB Device Mode Driver Related Tokens: */
69// #define USE_RAM_DESCRIPTORS
70 #define USE_FLASH_DESCRIPTORS
71// #define USE_EEPROM_DESCRIPTORS
72// #define NO_INTERNAL_SERIAL
73 #define FIXED_CONTROL_ENDPOINT_SIZE 8
74// #define DEVICE_STATE_AS_GPIOR {Insert Value Here}
75 #define FIXED_NUM_CONFIGURATIONS 1
76// #define CONTROL_ONLY_DEVICE
77// #define INTERRUPT_CONTROL_ENDPOINT
78// #define NO_DEVICE_REMOTE_WAKEUP
79// #define NO_DEVICE_SELF_POWER
80
81 /* USB Host Mode Driver Related Tokens: */
82// #define HOST_STATE_AS_GPIOR {Insert Value Here}
83// #define USB_HOST_TIMEOUT_MS {Insert Value Here}
84// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here}
85// #define NO_AUTO_VBUS_MANAGEMENT
86// #define INVERTED_VBUS_ENABLE_LINE
87
88 #elif (ARCH == ARCH_XMEGA)
89
90 /* Non-USB Related Configuration Tokens: */
91// #define DISABLE_TERMINAL_CODES
92
93 /* USB Class Driver Related Tokens: */
94// #define HID_HOST_BOOT_PROTOCOL_ONLY
95// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
96// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
97// #define HID_MAX_COLLECTIONS {Insert Value Here}
98// #define HID_MAX_REPORTITEMS {Insert Value Here}
99// #define HID_MAX_REPORT_IDS {Insert Value Here}
100// #define NO_CLASS_DRIVER_AUTOFLUSH
101
102 /* General USB Driver Related Tokens: */
103 #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
104// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
105// #define NO_LIMITED_CONTROLLER_CONNECT
106// #define NO_SOF_EVENTS
107
108 /* USB Device Mode Driver Related Tokens: */
109// #define USE_RAM_DESCRIPTORS
110 #define USE_FLASH_DESCRIPTORS
111// #define USE_EEPROM_DESCRIPTORS
112// #define NO_INTERNAL_SERIAL
113 #define FIXED_CONTROL_ENDPOINT_SIZE 8
114// #define DEVICE_STATE_AS_GPIOR {Insert Value Here}
115 #define FIXED_NUM_CONFIGURATIONS 1
116// #define CONTROL_ONLY_DEVICE
117 #define MAX_ENDPOINT_INDEX 3
118// #define NO_DEVICE_REMOTE_WAKEUP
119// #define NO_DEVICE_SELF_POWER
120
121 #else
122
123 #error Unsupported architecture for this LUFA configuration file.
124
125 #endif
126#endif
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c
new file mode 100644
index 000000000..e42b31860
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c
@@ -0,0 +1,244 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
34 * computer-readable structures which the host requests upon device enumeration, to determine
35 * the device's capabilities and functions.
36 */
37
38#include "Descriptors.h"
39
40/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
41 * device characteristics, including the supported USB version, control endpoint size and the
42 * number of device configurations. The descriptor is read out by the USB host when the enumeration
43 * process begins.
44 */
45const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
46{
47 .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
48
49 .USBSpecification = VERSION_BCD(1,1,0),
50 .Class = CDC_CSCP_CDCClass,
51 .SubClass = CDC_CSCP_NoSpecificSubclass,
52 .Protocol = CDC_CSCP_NoSpecificProtocol,
53
54 .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
55
56 .VendorID = 0x03EB,
57 .ProductID = 0x204C,
58 .ReleaseNumber = VERSION_BCD(0,0,1),
59
60 .ManufacturerStrIndex = STRING_ID_Manufacturer,
61 .ProductStrIndex = STRING_ID_Product,
62 .SerialNumStrIndex = NO_DESCRIPTOR,
63
64 .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
65};
66
67/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
68 * of the device in one of its supported configurations, including information about any device interfaces
69 * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
70 * a configuration so that the host may correctly communicate with the USB device.
71 */
72const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
73{
74 .Config =
75 {
76 .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
77
78 .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
79 .TotalInterfaces = 2,
80
81 .ConfigurationNumber = 1,
82 .ConfigurationStrIndex = NO_DESCRIPTOR,
83
84 .ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),
85
86 .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
87 },
88
89 .CDC_CCI_Interface =
90 {
91 .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
92
93 .InterfaceNumber = INTERFACE_ID_CDC_CCI,
94 .AlternateSetting = 0,
95
96 .TotalEndpoints = 1,
97
98 .Class = CDC_CSCP_CDCClass,
99 .SubClass = CDC_CSCP_ACMSubclass,
100 .Protocol = CDC_CSCP_VendorSpecificProtocol,
101
102 .InterfaceStrIndex = NO_DESCRIPTOR
103 },
104
105 .CDC_Functional_Header =
106 {
107 .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
108 .Subtype = CDC_DSUBTYPE_CSInterface_Header,
109
110 .CDCSpecification = VERSION_BCD(1,1,0),
111 },
112
113 .CDC_Functional_ACM =
114 {
115 .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
116 .Subtype = CDC_DSUBTYPE_CSInterface_ACM,
117
118 .Capabilities = 0x00,
119 },
120
121 .CDC_Functional_Union =
122 {
123 .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
124 .Subtype = CDC_DSUBTYPE_CSInterface_Union,
125
126 .MasterInterfaceNumber = INTERFACE_ID_CDC_CCI,
127 .SlaveInterfaceNumber = INTERFACE_ID_CDC_DCI,
128 },
129
130 .CDC_NotificationEndpoint =
131 {
132 .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
133
134 .EndpointAddress = CDC_NOTIFICATION_EPADDR,
135 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
136 .EndpointSize = CDC_NOTIFICATION_EPSIZE,
137 .PollingIntervalMS = 0xFF
138 },
139
140 .CDC_DCI_Interface =
141 {
142 .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
143
144 .InterfaceNumber = INTERFACE_ID_CDC_DCI,
145 .AlternateSetting = 0,
146
147 .TotalEndpoints = 2,
148
149 .Class = CDC_CSCP_CDCDataClass,
150 .SubClass = CDC_CSCP_NoDataSubclass,
151 .Protocol = CDC_CSCP_NoDataProtocol,
152
153 .InterfaceStrIndex = NO_DESCRIPTOR
154 },
155
156 .RNDIS_DataOutEndpoint =
157 {
158 .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
159
160 .EndpointAddress = CDC_RX_EPADDR,
161 .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
162 .EndpointSize = CDC_TXRX_EPSIZE,
163 .PollingIntervalMS = 0x05
164 },
165
166 .RNDIS_DataInEndpoint =
167 {
168 .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
169
170 .EndpointAddress = CDC_TX_EPADDR,
171 .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
172 .EndpointSize = CDC_TXRX_EPSIZE,
173 .PollingIntervalMS = 0x05
174 }
175};
176
177/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
178 * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
179 * via the language ID table available at USB.org what languages the device supports for its string descriptors.
180 */
181const USB_Descriptor_String_t PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG);
182
183/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
184 * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
185 * Descriptor.
186 */
187const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera");
188
189/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
190 * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
191 * Descriptor.
192 */
193const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"LUFA RNDIS CDC Demo");
194
195/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
196 * documentation) by the application code so that the address and size of a requested descriptor can be given
197 * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
198 * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
199 * USB host.
200 */
201uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
202 const uint16_t wIndex,
203 const void** const DescriptorAddress)
204{
205 const uint8_t DescriptorType = (wValue >> 8);
206 const uint8_t DescriptorNumber = (wValue & 0xFF);
207
208 const void* Address = NULL;
209 uint16_t Size = NO_DESCRIPTOR;
210
211 switch (DescriptorType)
212 {
213 case DTYPE_Device:
214 Address = &DeviceDescriptor;
215 Size = sizeof(USB_Descriptor_Device_t);
216 break;
217 case DTYPE_Configuration:
218 Address = &ConfigurationDescriptor;
219 Size = sizeof(USB_Descriptor_Configuration_t);
220 break;
221 case DTYPE_String:
222 switch (DescriptorNumber)
223 {
224 case STRING_ID_Language:
225 Address = &LanguageString;
226 Size = pgm_read_byte(&LanguageString.Header.Size);
227 break;
228 case STRING_ID_Manufacturer:
229 Address = &ManufacturerString;
230 Size = pgm_read_byte(&ManufacturerString.Header.Size);
231 break;
232 case STRING_ID_Product:
233 Address = &ProductString;
234 Size = pgm_read_byte(&ProductString.Header.Size);
235 break;
236 }
237
238 break;
239 }
240
241 *DescriptorAddress = Address;
242 return Size;
243}
244
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h
new file mode 100644
index 000000000..84c336f16
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h
@@ -0,0 +1,112 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Header file for Descriptors.c.
34 */
35
36#ifndef _DESCRIPTORS_H_
37#define _DESCRIPTORS_H_
38
39 /* Includes: */
40 #include <LUFA/Drivers/USB/USB.h>
41
42 #include <avr/pgmspace.h>
43
44 #include "Config/AppConfig.h"
45
46 /* Macros: */
47 /** Endpoint address of the CDC device-to-host data IN endpoint. */
48 #define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 1)
49
50 /** Endpoint address of the CDC host-to-device data OUT endpoint. */
51 #define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 2)
52
53 /** Endpoint address of the CDC device-to-host notification IN endpoint. */
54 #define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 3)
55
56 /** Size in bytes of the CDC data IN and OUT endpoints. */
57 #define CDC_TXRX_EPSIZE 64
58
59 /** Size in bytes of the CDC device-to-host notification IN endpoint. */
60 #define CDC_NOTIFICATION_EPSIZE 8
61
62 /* Type Defines: */
63 /** Type define for the device configuration descriptor structure. This must be defined in the
64 * application code, as the configuration descriptor contains several sub-descriptors which
65 * vary between devices, and which describe the device's usage to the host.
66 */
67 typedef struct
68 {
69 USB_Descriptor_Configuration_Header_t Config;
70
71 // RNDIS CDC Control Interface
72 USB_Descriptor_Interface_t CDC_CCI_Interface;
73 USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
74 USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
75 USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
76 USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
77
78 // RNDIS CDC Data Interface
79 USB_Descriptor_Interface_t CDC_DCI_Interface;
80 USB_Descriptor_Endpoint_t RNDIS_DataOutEndpoint;
81 USB_Descriptor_Endpoint_t RNDIS_DataInEndpoint;
82 } USB_Descriptor_Configuration_t;
83
84 /** Enum for the device interface descriptor IDs within the device. Each interface descriptor
85 * should have a unique ID index associated with it, which can be used to refer to the
86 * interface from other descriptors.
87 */
88 enum InterfaceDescriptors_t
89 {
90 INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */
91 INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */
92 };
93
94 /** Enum for the device string descriptor IDs within the device. Each string descriptor should
95 * have a unique ID index associated with it, which can be used to refer to the string from
96 * other descriptors.
97 */
98 enum StringDescriptors_t
99 {
100 STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */
101 STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
102 STRING_ID_Product = 2, /**< Product string ID */
103 };
104
105 /* Function Prototypes: */
106 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
107 const uint16_t wIndex,
108 const void** const DescriptorAddress)
109 ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
110
111#endif
112
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/LUFA RNDIS.inf b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/LUFA RNDIS.inf
new file mode 100644
index 000000000..f34e55f99
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/LUFA RNDIS.inf
@@ -0,0 +1,59 @@
1; Windows LUFA RNDIS Setup File
2; Copyright (c) 2000 Microsoft Corporation
3
4[DefaultInstall]
5CopyINF="LUFA RNDIS.inf"
6
7[Version]
8Signature="$Windows NT$"
9Class=Net
10ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318}
11Provider=%MFGNAME%
12DriverVer=7/1/2012,10.0.0.0
13
14[Manufacturer]
15%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64
16
17[ControlFlags]
18ExcludeFromSelect=*
19
20[DriverInstall]
21Characteristics=0x84 ; NCF_PHYSICAL + NCF_HAS_UI
22BusType=15
23include=netrndis.inf
24needs=Usb_Rndis.ndi
25AddReg=Rndis_AddReg_Vista
26
27[DriverInstall.Services]
28include=netrndis.inf
29needs=Usb_Rndis.ndi.Services
30
31;------------------------------------------------------------------------------
32; Vendor and Product ID Definitions
33;------------------------------------------------------------------------------
34; When developing your USB device, the VID and PID used in the PC side
35; application program and the firmware on the microcontroller must match.
36; Modify the below line to use your VID and PID. Use the format as shown below.
37; Note: One INF file can be used for multiple devices with different VID and PIDs.
38; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
39;------------------------------------------------------------------------------
40[DeviceList]
41%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204C
42
43[DeviceList.NTx86]
44%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204C
45
46[DeviceList.NTamd64]
47%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204C
48
49[DeviceList.NTia64]
50%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204C
51
52;------------------------------------------------------------------------------
53; String Definitions
54;------------------------------------------------------------------------------
55;Modify these strings to customize your device
56;------------------------------------------------------------------------------
57[Strings]
58MFGNAME="http://www.lufa-lib.org"
59DESCRIPTION="LUFA USB RNDIS Demo"
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c
new file mode 100644
index 000000000..24008705c
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c
@@ -0,0 +1,87 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Address Resolution Protocol (ARP) packet handling routines. This protocol handles the
34 * conversion of physical MAC addresses to protocol IP addresses between the host and the
35 * device.
36 */
37
38#include "ARP.h"
39
40/** Processes an ARP packet inside an Ethernet frame, and writes the appropriate response
41 * to the output Ethernet frame if the host is requesting the IP or MAC address of the
42 * virtual server device on the network.
43 *
44 * \param[in] InDataStart Pointer to the start of the incoming packet's ARP header
45 * \param[out] OutDataStart Pointer to the start of the outgoing packet's ARP header
46 *
47 * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise
48 */
49int16_t ARP_ProcessARPPacket(void* InDataStart,
50 void* OutDataStart)
51{
52 DecodeARPHeader(InDataStart);
53
54 ARP_Header_t* ARPHeaderIN = (ARP_Header_t*)InDataStart;
55 ARP_Header_t* ARPHeaderOUT = (ARP_Header_t*)OutDataStart;
56
57 /* Ensure that the ARP request is a IPv4 request packet */
58 if ((SwapEndian_16(ARPHeaderIN->ProtocolType) == ETHERTYPE_IPV4) &&
59 (SwapEndian_16(ARPHeaderIN->Operation) == ARP_OPERATION_REQUEST))
60 {
61 /* If the ARP packet is requesting the MAC or IP of the virtual webserver, return the response */
62 if (IP_COMPARE(&ARPHeaderIN->TPA, &ServerIPAddress) ||
63 MAC_COMPARE(&ARPHeaderIN->THA, &ServerMACAddress))
64 {
65 /* Fill out the ARP response header */
66 ARPHeaderOUT->HardwareType = ARPHeaderIN->HardwareType;
67 ARPHeaderOUT->ProtocolType = ARPHeaderIN->ProtocolType;
68 ARPHeaderOUT->HLEN = ARPHeaderIN->HLEN;
69 ARPHeaderOUT->PLEN = ARPHeaderIN->PLEN;
70 ARPHeaderOUT->Operation = SwapEndian_16(ARP_OPERATION_REPLY);
71
72 /* Copy over the sender MAC/IP to the target fields for the response */
73 ARPHeaderOUT->THA = ARPHeaderIN->SHA;
74 ARPHeaderOUT->TPA = ARPHeaderIN->SPA;
75
76 /* Copy over the new sender MAC/IP - MAC and IP addresses of the virtual webserver */
77 ARPHeaderOUT->SHA = ServerMACAddress;
78 ARPHeaderOUT->SPA = ServerIPAddress;
79
80 /* Return the size of the response so far */
81 return sizeof(ARP_Header_t);
82 }
83 }
84
85 return NO_RESPONSE;
86}
87
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h
new file mode 100644
index 000000000..c809cbf44
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h
@@ -0,0 +1,78 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Header file for ARP.c.
34 */
35
36#ifndef _ARP_H_
37#define _ARP_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <string.h>
42
43 #include <LUFA/Drivers/USB/USB.h>
44
45 #include "EthernetProtocols.h"
46 #include "Ethernet.h"
47 #include "ProtocolDecoders.h"
48
49 /* Macros: */
50 /** ARP header operation constant, indicating a request from a host for an address translation. */
51 #define ARP_OPERATION_REQUEST 1
52
53 /** ARP header operation constant, indicating a reply from a host giving an address translation. */
54 #define ARP_OPERATION_REPLY 2
55
56 /* Type Defines: */
57 /** Type define for an ARP packet inside an Ethernet frame. */
58 typedef struct
59 {
60 uint16_t HardwareType; /**< Hardware type constant, indicating the hardware used */
61 uint16_t ProtocolType; /**< Protocol being resolved, usually ETHERTYPE_IPV4 */
62
63 uint8_t HLEN; /**< Length in bytes of the source/destination hardware addresses */
64 uint8_t PLEN; /**< Length in bytes of the source/destination protocol addresses */
65 uint16_t Operation; /**< Type of operation, either ARP_OPERATION_REQUEST or ARP_OPERATION_REPLY */
66
67 MAC_Address_t SHA; /**< Sender's hardware address */
68 IP_Address_t SPA; /**< Sender's protocol address */
69 MAC_Address_t THA; /**< Target's hardware address */
70 IP_Address_t TPA; /**< Target's protocol address */
71 } ARP_Header_t;
72
73 /* Function Prototypes: */
74 int16_t ARP_ProcessARPPacket(void* InDataStart,
75 void* OutDataStart);
76
77#endif
78
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c
new file mode 100644
index 000000000..6f7b40af6
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c
@@ -0,0 +1,129 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Dynamic Host Configuration Protocol (DHCP) packet handling routines. This protocol
34 * handles the automatic IP negotiation to the host, so that the host will use the provided
35 * IP address given to it by the device.
36 */
37
38#include "DHCP.h"
39
40/** Processes a DHCP packet inside an Ethernet frame, and writes the appropriate response
41 * to the output Ethernet frame if the host is requesting or accepting an IP address.
42 *
43 * \param[in] IPHeaderInStart Pointer to the start of the incoming packet's IP header
44 * \param[in] DHCPHeaderInStart Pointer to the start of the incoming packet's DHCP header
45 * \param[out] DHCPHeaderOutStart Pointer to the start of the outgoing packet's DHCP header
46 *
47 * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise
48 */
49int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
50 void* DHCPHeaderInStart,
51 void* DHCPHeaderOutStart)
52{
53 IP_Header_t* IPHeaderIN = (IP_Header_t*)IPHeaderInStart;
54 DHCP_Header_t* DHCPHeaderIN = (DHCP_Header_t*)DHCPHeaderInStart;
55 DHCP_Header_t* DHCPHeaderOUT = (DHCP_Header_t*)DHCPHeaderOutStart;
56
57 uint8_t* DHCPOptionsINStart = (uint8_t*)(DHCPHeaderInStart + sizeof(DHCP_Header_t));
58 uint8_t* DHCPOptionsOUTStart = (uint8_t*)(DHCPHeaderOutStart + sizeof(DHCP_Header_t));
59
60 DecodeDHCPHeader(DHCPHeaderInStart);
61
62 /* Zero out the response DHCP packet, as much of it is legacy and left at 0 */
63 memset(DHCPHeaderOUT, 0, sizeof(DHCP_Header_t));
64
65 /* Fill out the response DHCP packet */
66 DHCPHeaderOUT->HardwareType = DHCPHeaderIN->HardwareType;
67 DHCPHeaderOUT->Operation = DHCP_OP_BOOTREPLY;
68 DHCPHeaderOUT->HardwareAddressLength = DHCPHeaderIN->HardwareAddressLength;
69 DHCPHeaderOUT->Hops = 0;
70 DHCPHeaderOUT->TransactionID = DHCPHeaderIN->TransactionID;
71 DHCPHeaderOUT->ElapsedSeconds = 0;
72 DHCPHeaderOUT->Flags = DHCPHeaderIN->Flags;
73 DHCPHeaderOUT->YourIP = ClientIPAddress;
74 memmove(&DHCPHeaderOUT->ClientHardwareAddress, &DHCPHeaderIN->ClientHardwareAddress, sizeof(MAC_Address_t));
75 DHCPHeaderOUT->Cookie = SwapEndian_32(DHCP_MAGIC_COOKIE);
76
77 /* Alter the incoming IP packet header so that the corrected IP source and destinations are used - this means that
78 when the response IP header is generated, it will use the corrected addresses and not the null/broatcast addresses */
79 IPHeaderIN->SourceAddress = ClientIPAddress;
80 IPHeaderIN->DestinationAddress = ServerIPAddress;
81
82 /* Process the incoming DHCP packet options */
83 while (DHCPOptionsINStart[0] != DHCP_OPTION_END)
84 {
85 /* Find the Message Type DHCP option, to determine the type of DHCP packet */
86 if (DHCPOptionsINStart[0] == DHCP_OPTION_MESSAGETYPE)
87 {
88 if ((DHCPOptionsINStart[2] == DHCP_MESSAGETYPE_DISCOVER) || (DHCPOptionsINStart[2] == DHCP_MESSAGETYPE_REQUEST))
89 {
90 /* Fill out the response DHCP packet options for a DHCP OFFER or ACK response */
91
92 *(DHCPOptionsOUTStart++) = DHCP_OPTION_MESSAGETYPE;
93 *(DHCPOptionsOUTStart++) = 1;
94 *(DHCPOptionsOUTStart++) = (DHCPOptionsINStart[2] == DHCP_MESSAGETYPE_DISCOVER) ? DHCP_MESSAGETYPE_OFFER
95 : DHCP_MESSAGETYPE_ACK;
96
97 *(DHCPOptionsOUTStart++) = DHCP_OPTION_SUBNETMASK;
98 *(DHCPOptionsOUTStart++) = sizeof(IP_Address_t);
99 *(DHCPOptionsOUTStart++) = 0xFF;
100 *(DHCPOptionsOUTStart++) = 0xFF;
101 *(DHCPOptionsOUTStart++) = 0xFF;
102 *(DHCPOptionsOUTStart++) = 0x00;
103
104 *(DHCPOptionsOUTStart++) = DHCP_OPTION_LEASETIME;
105 *(DHCPOptionsOUTStart++) = sizeof(uint32_t);
106 /* Lease Time 86400s (ONE_DAY) */
107 *(DHCPOptionsOUTStart++) = 0x00;
108 *(DHCPOptionsOUTStart++) = 0x01;
109 *(DHCPOptionsOUTStart++) = 0x51;
110 *(DHCPOptionsOUTStart++) = 0x80;
111
112 *(DHCPOptionsOUTStart++) = DHCP_OPTION_DHCPSERVER;
113 *(DHCPOptionsOUTStart++) = sizeof(IP_Address_t);
114 memcpy(DHCPOptionsOUTStart, &ServerIPAddress, sizeof(IP_Address_t));
115 DHCPOptionsOUTStart += sizeof(IP_Address_t);
116
117 *(DHCPOptionsOUTStart++) = DHCP_OPTION_END;
118
119 return (sizeof(DHCP_Header_t) + 18 + sizeof(IP_Address_t));
120 }
121 }
122
123 /* Go to the next DHCP option - skip one byte if option is a padding byte, else skip the complete option's size */
124 DHCPOptionsINStart += ((DHCPOptionsINStart[0] == DHCP_OPTION_PAD) ? 1 : (DHCPOptionsINStart[1] + 2));
125 }
126
127 return NO_RESPONSE;
128}
129
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h
new file mode 100644
index 000000000..5ef78469e
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h
@@ -0,0 +1,131 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Header file for DHCP.c.
34 */
35
36#ifndef _DHCP_H_
37#define _DHCP_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <string.h>
42
43 #include "EthernetProtocols.h"
44 #include "Ethernet.h"
45 #include "ProtocolDecoders.h"
46
47 /* Macros: */
48 /** DHCP operation constant, indicating a request from a host to a DHCP server. */
49 #define DHCP_OP_BOOTREQUEST 0x01
50
51 /** DHCP operation constant, indicating a reply from a DHCP server to a host. */
52 #define DHCP_OP_BOOTREPLY 0x02
53
54 /** Hardware type constant, indicating Ethernet as a carrier. */
55 #define DHCP_HTYPE_ETHERNET 0x01
56
57 /** Magic boot protocol "cookie", inserted into all BOOTP packets (BOOTP is the carrier of DHCP). */
58 #define DHCP_MAGIC_COOKIE 0x63825363
59
60 /** DHCP option list entry header, indicating that a subnet mask will follow. */
61 #define DHCP_OPTION_SUBNETMASK 1
62
63 /** DHCP option list entry header, indicating that the Lease Time will follow. */
64 #define DHCP_OPTION_LEASETIME 51
65
66 /** DHCP option list entry header, indicating that the DHCP message type constant will follow. */
67 #define DHCP_OPTION_MESSAGETYPE 53
68
69 /** DHCP option list entry header, indicating that the IP address of the DHCP server will follow. */
70 #define DHCP_OPTION_DHCPSERVER 54
71
72 /** DHCP option list entry header, used to pad out option data. */
73 #define DHCP_OPTION_PAD 0
74
75 /** DHCP option list entry header, indicating the end of option data. */
76 #define DHCP_OPTION_END 255
77
78 /** Message type constant, used in the DHCP option data field, requesting that a DHCP server offer an IP address. */
79 #define DHCP_MESSAGETYPE_DISCOVER 1
80
81 /** Message type constant, used in the DHCP option data field, indicating that a DHCP server is offering an IP address. */
82 #define DHCP_MESSAGETYPE_OFFER 2
83
84 /** Message type constant, used in the DHCP option data field, requesting that a DHCP server lease a given IP address. */
85 #define DHCP_MESSAGETYPE_REQUEST 3
86
87 /** Message type constant, used in the DHCP option data field, declining an offered DHCP server IP address lease. */
88 #define DHCP_MESSAGETYPE_DECLINE 4
89
90 /** Message type constant, used in the DHCP option data field, ACKing a host IP lease request. */
91 #define DHCP_MESSAGETYPE_ACK 5
92
93 /** Message type constant, used in the DHCP option data field, NACKing a host IP lease request. */
94 #define DHCP_MESSAGETYPE_NACK 6
95
96 /** Message type constant, used in the DHCP option data field, indicating that a host is releasing a leased IP address. */
97 #define DHCP_MESSAGETYPE_RELEASE 7
98
99 /* Type Defines: */
100 /** Type define for a DHCP packet inside an Ethernet frame. */
101 typedef struct
102 {
103 uint8_t Operation; /**< DHCP operation, either DHCP_OP_BOOTREQUEST or DHCP_OP_BOOTREPLY */
104 uint8_t HardwareType; /**< Hardware carrier type constant */
105 uint8_t HardwareAddressLength; /**< Length in bytes of a hardware (MAC) address on the network */
106 uint8_t Hops; /**< Number of hops required to reach the server, unused */
107
108 uint32_t TransactionID; /**< Unique ID of the DHCP packet, for positive matching between sent and received packets */
109
110 uint16_t ElapsedSeconds; /**< Elapsed seconds since the request was made */
111 uint16_t Flags; /**< BOOTP packet flags */
112
113 IP_Address_t ClientIP; /**< Client IP address, if already leased an IP */
114 IP_Address_t YourIP; /**< Client IP address */
115 IP_Address_t NextServerIP; /**< Legacy BOOTP protocol field, unused for DHCP */
116 IP_Address_t RelayAgentIP; /**< Legacy BOOTP protocol field, unused for DHCP */
117
118 uint8_t ClientHardwareAddress[16]; /**< Hardware (MAC) address of the client making a request to the DHCP server */
119 uint8_t ServerHostnameString[64]; /**< Legacy BOOTP protocol field, unused for DHCP */
120 uint8_t BootFileName[128]; /**< Legacy BOOTP protocol field, unused for DHCP */
121
122 uint32_t Cookie; /**< Magic BOOTP protocol cookie to indicate a valid packet */
123 } DHCP_Header_t;
124
125 /* Function Prototypes: */
126 int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
127 void* DHCPHeaderInStart,
128 void* DHCPHeaderOutStart);
129
130#endif
131
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c
new file mode 100644
index 000000000..a48de2c71
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c
@@ -0,0 +1,136 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Ethernet frame packet handling routines. This protocol handles the processing of raw Ethernet
34 * frames sent and received, deferring the processing of sub-packet protocols to the appropriate
35 * protocol handlers, such as DHCP or ARP.
36 */
37
38#include "Ethernet.h"
39
40/** Ethernet Frame buffer structure, to hold the incoming Ethernet frame from the host. */
41Ethernet_Frame_Info_t FrameIN;
42
43/** Ethernet Frame buffer structure, to hold the outgoing Ethernet frame to the host. */
44Ethernet_Frame_Info_t FrameOUT;
45
46/** Constant for convenience when checking against or setting a MAC address to the virtual server MAC address. */
47const MAC_Address_t ServerMACAddress = {SERVER_MAC_ADDRESS};
48
49/** Constant for convenience when checking against or setting an IP address to the virtual server IP address. */
50const IP_Address_t ServerIPAddress = {SERVER_IP_ADDRESS};
51
52/** Constant for convenience when checking against or setting a MAC address to the broadcast MAC address. */
53const MAC_Address_t BroadcastMACAddress = {BROADCAST_MAC_ADDRESS};
54
55/** Constant for convenience when checking against or setting a IP address to the broadcast IP address. */
56const IP_Address_t BroadcastIPAddress = {BROADCAST_IP_ADDRESS};
57
58/** Constant for convenience when checking against or setting an IP address to the client (host) IP address. */
59const IP_Address_t ClientIPAddress = {CLIENT_IP_ADDRESS};
60
61
62/** Processes an incoming Ethernet frame, and writes the appropriate response to the output Ethernet
63 * frame buffer if the sub protocol handlers create a valid response.
64 */
65void Ethernet_ProcessPacket(void)
66{
67 DecodeEthernetFrameHeader(FrameIN.FrameData);
68
69 /* Cast the incoming Ethernet frame to the Ethernet header type */
70 Ethernet_Frame_Header_t* FrameINHeader = (Ethernet_Frame_Header_t*)&FrameIN.FrameData;
71 Ethernet_Frame_Header_t* FrameOUTHeader = (Ethernet_Frame_Header_t*)&FrameOUT.FrameData;
72
73 int16_t RetSize = NO_RESPONSE;
74
75 /* Ensure frame is addressed to either all (broadcast) or the virtual webserver, and is a type II frame */
76 if ((MAC_COMPARE(&FrameINHeader->Destination, &ServerMACAddress) ||
77 MAC_COMPARE(&FrameINHeader->Destination, &BroadcastMACAddress)) &&
78 (SwapEndian_16(FrameIN.FrameLength) > ETHERNET_VER2_MINSIZE))
79 {
80 /* Process the packet depending on its protocol */
81 switch (SwapEndian_16(FrameINHeader->EtherType))
82 {
83 case ETHERTYPE_ARP:
84 RetSize = ARP_ProcessARPPacket(&FrameIN.FrameData[sizeof(Ethernet_Frame_Header_t)],
85 &FrameOUT.FrameData[sizeof(Ethernet_Frame_Header_t)]);
86 break;
87 case ETHERTYPE_IPV4:
88 RetSize = IP_ProcessIPPacket(&FrameIN.FrameData[sizeof(Ethernet_Frame_Header_t)],
89 &FrameOUT.FrameData[sizeof(Ethernet_Frame_Header_t)]);
90 break;
91 }
92
93 /* Protocol processing routine has filled a response, complete the ethernet frame header */
94 if (RetSize > 0)
95 {
96 /* Fill out the response Ethernet frame header */
97 FrameOUTHeader->Source = ServerMACAddress;
98 FrameOUTHeader->Destination = FrameINHeader->Source;
99 FrameOUTHeader->EtherType = FrameINHeader->EtherType;
100
101 /* Set the response length in the buffer and indicate that a response is ready to be sent */
102 FrameOUT.FrameLength = (sizeof(Ethernet_Frame_Header_t) + RetSize);
103 }
104 }
105
106 /* Check if the packet was processed */
107 if (RetSize != NO_PROCESS)
108 {
109 /* Clear the frame buffer */
110 FrameIN.FrameLength = 0;
111 }
112}
113
114/** Calculates the appropriate ethernet checksum, consisting of the addition of the one's
115 * compliment of each word, complimented.
116 *
117 * \param[in] Data Pointer to the packet buffer data whose checksum must be calculated
118 * \param[in] Bytes Number of bytes in the data buffer to process
119 *
120 * \return A 16-bit Ethernet checksum value
121 */
122uint16_t Ethernet_Checksum16(void* Data,
123 uint16_t Bytes)
124{
125 uint16_t* Words = (uint16_t*)Data;
126 uint32_t Checksum = 0;
127
128 for (uint16_t CurrWord = 0; CurrWord < (Bytes >> 1); CurrWord++)
129 Checksum += Words[CurrWord];
130
131 while (Checksum & 0xFFFF0000)
132 Checksum = ((Checksum & 0xFFFF) + (Checksum >> 16));
133
134 return ~Checksum;
135}
136
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h
new file mode 100644
index 000000000..8eaf64080
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h
@@ -0,0 +1,111 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Header file for Ethernet.c.
34 */
35
36#ifndef _ETHERNET_H_
37#define _ETHERNET_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <string.h>
42
43 #include "Config/AppConfig.h"
44
45 #include "EthernetProtocols.h"
46 #include "ProtocolDecoders.h"
47 #include "ICMP.h"
48 #include "TCP.h"
49 #include "UDP.h"
50 #include "DHCP.h"
51 #include "ARP.h"
52 #include "IP.h"
53
54 /* Macros: */
55 /** Physical MAC address of the network broadcast address. */
56 #define BROADCAST_MAC_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
57
58 /** Performs a comparison between two MAC addresses, indicating if they are identical.
59 *
60 * \param[in] MAC1 First MAC address
61 * \param[in] MAC2 Second MAC address
62 *
63 * \return True if the addresses match, \c false otherwise
64 */
65 #define MAC_COMPARE(MAC1, MAC2) (memcmp(MAC1, MAC2, sizeof(MAC_Address_t)) == 0)
66
67 /** Maximum size of an incoming or outgoing Ethernet frame in bytes. */
68 #define ETHERNET_FRAME_SIZE_MAX 1500
69
70 /** Minimum size of an Ethernet packet in bytes, to conform to the Ethernet V2 packet standard. */
71 #define ETHERNET_VER2_MINSIZE 0x0600
72
73 /** Return value for all sub protocol handling routines, indicating that no response packet has been generated. */
74 #define NO_RESPONSE 0
75
76 /** Return value for all sub protocol handling routines, indicating that the packet has not yet been handled. */
77 #define NO_PROCESS -1
78
79 /* Type Defines: */
80 /** Type define for an Ethernet frame buffer data and information structure. */
81 typedef struct
82 {
83 uint8_t FrameData[ETHERNET_FRAME_SIZE_MAX]; /**< Ethernet frame contents. */
84 uint16_t FrameLength; /**< Length in bytes of the Ethernet frame stored in the buffer. */
85 } Ethernet_Frame_Info_t;
86
87 /** Type define for an Ethernet frame header. */
88 typedef struct
89 {
90 MAC_Address_t Destination; /**< Physical MAC address of the packet recipient */
91 MAC_Address_t Source; /**< Physics MAC address of the packet source */
92 uint16_t EtherType; /**< Ethernet packet sub-protocol type, for Ethernet V2 packets */
93 } Ethernet_Frame_Header_t;
94
95 /* External Variables: */
96 extern Ethernet_Frame_Info_t FrameIN;
97 extern Ethernet_Frame_Info_t FrameOUT;
98
99 extern const MAC_Address_t ServerMACAddress;
100 extern const IP_Address_t ServerIPAddress;
101 extern const MAC_Address_t BroadcastMACAddress;
102 extern const IP_Address_t BroadcastIPAddress;
103 extern const IP_Address_t ClientIPAddress;
104
105 /* Function Prototypes: */
106 void Ethernet_ProcessPacket(void);
107 uint16_t Ethernet_Checksum16(void* Data,
108 uint16_t Bytes);
109
110#endif
111
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h
new file mode 100644
index 000000000..ca738cd0d
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h
@@ -0,0 +1,88 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * General Ethernet protocol constants and type defines, for use by
34 * all network protocol portions of the TCP/IP stack.
35 */
36
37#ifndef _ETHERNET_PROTOCOLS_H_
38#define _ETHERNET_PROTOCOLS_H_
39
40 /* Macros: */
41 #define ETHERTYPE_IPV4 0x0800
42 #define ETHERTYPE_ARP 0x0806
43 #define ETHERTYPE_RARP 0x8035
44 #define ETHERTYPE_APPLETALK 0x809b
45 #define ETHERTYPE_APPLETALKARP 0x80f3
46 #define ETHERTYPE_IEEE8021Q 0x8100
47 #define ETHERTYPE_NOVELLIPX 0x8137
48 #define ETHERTYPE_NOVELL 0x8138
49 #define ETHERTYPE_IPV6 0x86DD
50 #define ETHERTYPE_COBRANET 0x8819
51 #define ETHERTYPE_PROVIDERBRIDGING 0x88a8
52 #define ETHERTYPE_MPLSUNICAST 0x8847
53 #define ETHERTYPE_MPLSMULTICAST 0x8848
54 #define ETHERTYPE_PPPoEDISCOVERY 0x8863
55 #define ETHERTYPE_PPPoESESSION 0x8864
56 #define ETHERTYPE_EAPOVERLAN 0x888E
57 #define ETHERTYPE_HYPERSCSI 0x889A
58 #define ETHERTYPE_ATAOVERETHERNET 0x88A2
59 #define ETHERTYPE_ETHERCAT 0x88A4
60 #define ETHERTYPE_SERCOSIII 0x88CD
61 #define ETHERTYPE_CESoE 0x88D8
62 #define ETHERTYPE_MACSECURITY 0x88E5
63 #define ETHERTYPE_FIBRECHANNEL 0x8906
64 #define ETHERTYPE_QINQ 0x9100
65 #define ETHERTYPE_VLLT 0xCAFE
66
67 #define PROTOCOL_ICMP 1
68 #define PROTOCOL_IGMP 2
69 #define PROTOCOL_TCP 6
70 #define PROTOCOL_UDP 17
71 #define PROTOCOL_OSPF 89
72 #define PROTOCOL_SCTP 132
73
74 /* Type Defines: */
75 /** Type define for a physical MAC address of a device on a network. */
76 typedef struct
77 {
78 uint8_t Octets[6]; /**< Individual bytes of a MAC address */
79 } RNDIS_MAC_Address_t;
80
81 /** Type define for a protocol IP address of a device on a network. */
82 typedef struct
83 {
84 uint8_t Octets[4]; /**< Individual bytes of an IP address */
85 } IP_Address_t;
86
87#endif
88
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c
new file mode 100644
index 000000000..b144c4c51
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c
@@ -0,0 +1,81 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Internet Control Message Protocol (ICMP) packet handling routines. This protocol handles
34 * Echo requests from the host, to indicate a successful network connection between the host
35 * and the virtual server.
36 */
37
38#include "ICMP.h"
39
40/** Processes an ICMP packet inside an Ethernet frame, and writes the appropriate response
41 * to the output Ethernet frame if the host is issuing a ICMP ECHO request.
42 *
43 * \param[in] InDataStart Pointer to the start of the incoming packet's ICMP header
44 * \param[out] OutDataStart Pointer to the start of the outgoing packet's ICMP header
45 *
46 * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise
47 */
48int16_t ICMP_ProcessICMPPacket(void* InDataStart,
49 void* OutDataStart)
50{
51 ICMP_Header_t* ICMPHeaderIN = (ICMP_Header_t*)InDataStart;
52 ICMP_Header_t* ICMPHeaderOUT = (ICMP_Header_t*)OutDataStart;
53
54 DecodeICMPHeader(InDataStart);
55
56 /* Determine if the ICMP packet is an echo request (ping) */
57 if (ICMPHeaderIN->Type == ICMP_TYPE_ECHOREQUEST)
58 {
59 /* Fill out the ICMP response packet */
60 ICMPHeaderOUT->Type = ICMP_TYPE_ECHOREPLY;
61 ICMPHeaderOUT->Code = 0;
62 ICMPHeaderOUT->Checksum = 0;
63 ICMPHeaderOUT->Id = ICMPHeaderIN->Id;
64 ICMPHeaderOUT->Sequence = ICMPHeaderIN->Sequence;
65
66 intptr_t DataSize = FrameIN.FrameLength - ((((intptr_t)InDataStart + sizeof(ICMP_Header_t)) - (intptr_t)FrameIN.FrameData));
67
68 /* Copy the remaining payload to the response - echo requests should echo back any sent data */
69 memmove(&((uint8_t*)OutDataStart)[sizeof(ICMP_Header_t)],
70 &((uint8_t*)InDataStart)[sizeof(ICMP_Header_t)],
71 DataSize);
72
73 ICMPHeaderOUT->Checksum = Ethernet_Checksum16(ICMPHeaderOUT, (DataSize + sizeof(ICMP_Header_t)));
74
75 /* Return the size of the response so far */
76 return (DataSize + sizeof(ICMP_Header_t));
77 }
78
79 return NO_RESPONSE;
80}
81
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h
new file mode 100644
index 000000000..e8039da3e
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h
@@ -0,0 +1,82 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Header file for ICMP.c.
34 */
35
36#ifndef _ICMP_H_
37#define _ICMP_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <string.h>
42
43 #include "EthernetProtocols.h"
44 #include "Ethernet.h"
45 #include "ProtocolDecoders.h"
46
47 /* Macros: */
48 /** ICMP message type constant, indicating an ICMP ECHO Reply message. */
49 #define ICMP_TYPE_ECHOREPLY 0
50
51 /** ICMP message type constant, indicating a packet destination is unreachable. */
52 #define ICMP_TYPE_DESTINATIONUNREACHABLE 3
53
54 /** ICMP message type constant, indicating an ICMP Source Quench message. */
55 #define ICMP_TYPE_SOURCEQUENCH 4
56
57 /** ICMP message type constant, indicating an ICMP Redirect message. */
58 #define ICMP_TYPE_REDIRECTMESSAGE 5
59
60 /** ICMP message type constant, indicating an ICMP ECHO Request message. */
61 #define ICMP_TYPE_ECHOREQUEST 8
62
63 /** ICMP message type constant, indicating an ICMP Time Exceeded message. */
64 #define ICMP_TYPE_TIMEEXCEEDED 11
65
66 /* Type Defines: */
67 /** Type define for an ICMP message header. */
68 typedef struct
69 {
70 uint8_t Type; /**< ICMP message type, an \c ICMP_TYPE_* constant */
71 uint8_t Code; /**< ICMP message code, indicating the message value */
72 uint16_t Checksum; /**< Ethernet checksum of the ICMP message */
73 uint16_t Id; /**< Id of the ICMP message */
74 uint16_t Sequence; /**< Sequence number of the ICMP message, to link together message responses */
75 } ICMP_Header_t;
76
77 /* Function Prototypes: */
78 int16_t ICMP_ProcessICMPPacket(void* InDataStart,
79 void* OutDataStart);
80
81#endif
82
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c
new file mode 100644
index 000000000..dfa583b85
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c
@@ -0,0 +1,113 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Internet Protocol (IP) packet handling routines. This protocol handles IP packets from the
34 * host which typically encapsulate other protocols such as ICMP, UDP and TCP.
35 */
36
37#include "IP.h"
38
39/** Processes an IP packet inside an Ethernet frame, and writes the appropriate response
40 * to the output Ethernet frame if one is created by a sub-protocol handler.
41 *
42 * \param[in] InDataStart Pointer to the start of the incoming packet's IP header
43 * \param[out] OutDataStart Pointer to the start of the outgoing packet's IP header
44 *
45 * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE if no
46 * response was generated, NO_PROCESS if the packet processing was deferred until the
47 * next Ethernet packet handler iteration
48 */
49int16_t IP_ProcessIPPacket(void* InDataStart,
50 void* OutDataStart)
51{
52 DecodeIPHeader(InDataStart);
53
54 IP_Header_t* IPHeaderIN = (IP_Header_t*)InDataStart;
55 IP_Header_t* IPHeaderOUT = (IP_Header_t*)OutDataStart;
56
57 /* Header length is specified in number of longs in the packet header, convert to bytes */
58 uint16_t HeaderLengthBytes = (IPHeaderIN->HeaderLength * sizeof(uint32_t));
59
60 int16_t RetSize = NO_RESPONSE;
61
62 /* Check to ensure the IP packet is addressed to the virtual webserver's IP or the broadcast IP address */
63 if (!(IP_COMPARE(&IPHeaderIN->DestinationAddress, &ServerIPAddress)) &&
64 !(IP_COMPARE(&IPHeaderIN->DestinationAddress, &BroadcastIPAddress)))
65 {
66 return NO_RESPONSE;
67 }
68
69 /* Pass off the IP payload to the appropriate protocol processing routine */
70 switch (IPHeaderIN->Protocol)
71 {
72 case PROTOCOL_ICMP:
73 RetSize = ICMP_ProcessICMPPacket(&((uint8_t*)InDataStart)[HeaderLengthBytes],
74 &((uint8_t*)OutDataStart)[sizeof(IP_Header_t)]);
75 break;
76 case PROTOCOL_TCP:
77 RetSize = TCP_ProcessTCPPacket(InDataStart,
78 &((uint8_t*)InDataStart)[HeaderLengthBytes],
79 &((uint8_t*)OutDataStart)[sizeof(IP_Header_t)]);
80 break;
81 case PROTOCOL_UDP:
82 RetSize = UDP_ProcessUDPPacket(InDataStart,
83 &((uint8_t*)InDataStart)[HeaderLengthBytes],
84 &((uint8_t*)OutDataStart)[sizeof(IP_Header_t)]);
85 break;
86 }
87
88 /* Check to see if the protocol processing routine has filled out a response */
89 if (RetSize > 0)
90 {
91 /* Fill out the response IP packet header */
92 IPHeaderOUT->TotalLength = SwapEndian_16(sizeof(IP_Header_t) + RetSize);
93 IPHeaderOUT->TypeOfService = 0;
94 IPHeaderOUT->HeaderLength = (sizeof(IP_Header_t) / sizeof(uint32_t));
95 IPHeaderOUT->Version = 4;
96 IPHeaderOUT->Flags = 0;
97 IPHeaderOUT->FragmentOffset = 0;
98 IPHeaderOUT->Identification = 0;
99 IPHeaderOUT->HeaderChecksum = 0;
100 IPHeaderOUT->Protocol = IPHeaderIN->Protocol;
101 IPHeaderOUT->TTL = DEFAULT_TTL;
102 IPHeaderOUT->SourceAddress = IPHeaderIN->DestinationAddress;
103 IPHeaderOUT->DestinationAddress = IPHeaderIN->SourceAddress;
104
105 IPHeaderOUT->HeaderChecksum = Ethernet_Checksum16(IPHeaderOUT, sizeof(IP_Header_t));
106
107 /* Return the size of the response so far */
108 return (sizeof(IP_Header_t) + RetSize);
109 }
110
111 return RetSize;
112}
113
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h
new file mode 100644
index 000000000..48f2c9086
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h
@@ -0,0 +1,92 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Header file for IP.c.
34 */
35
36#ifndef _IP_H_
37#define _IP_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <string.h>
42
43 #include "EthernetProtocols.h"
44 #include "Ethernet.h"
45 #include "ProtocolDecoders.h"
46 #include "Config/AppConfig.h"
47
48 /* Macros: */
49 /** Protocol IP address of the broadcast address. */
50 #define BROADCAST_IP_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF}
51
52 /** Default Time To Live (TTL) value for sent packets, indicating the maximum allowable hops until their destination
53 * is reached.
54 */
55 #define DEFAULT_TTL 128
56
57 /** Performs a comparison between two IP addresses, indicating if they are identical.
58 *
59 * \param[in] IP1 First IP address
60 * \param[in] IP2 Second IP address
61 *
62 * \return True if the addresses match, \c false otherwise
63 */
64 #define IP_COMPARE(IP1, IP2) (memcmp(IP1, IP2, sizeof(IP_Address_t)) == 0)
65
66 /* Type Defines: */
67 /** Type define of an IP packet header. */
68 typedef struct
69 {
70 unsigned HeaderLength : 4; /**< Total length of the packet header, in 4-byte blocks */
71 unsigned Version : 4; /**< IP protocol version */
72 uint8_t TypeOfService; /**< Special service type identifier, indicating delay/throughput/reliability levels */
73 uint16_t TotalLength; /**< Total length of the IP packet, in bytes */
74
75 uint16_t Identification; /**< Identification value for identifying fragmented packets */
76 unsigned FragmentOffset : 13; /**< Offset of this IP fragment */
77 unsigned Flags : 3; /**< Fragment flags, to indicate if a packet is fragmented */
78
79 uint8_t TTL; /**< Maximum allowable number of hops to reach the packet destination */
80 uint8_t Protocol; /**< Encapsulated protocol type */
81 uint16_t HeaderChecksum; /**< Ethernet checksum of the IP header */
82
83 IP_Address_t SourceAddress; /**< Source protocol IP address of the packet */
84 IP_Address_t DestinationAddress; /**< Destination protocol IP address of the packet */
85 } IP_Header_t;
86
87 /* Function Prototypes: */
88 int16_t IP_ProcessIPPacket(void* InDataStart,
89 void* OutDataStart);
90
91#endif
92
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c
new file mode 100644
index 000000000..90d678bf4
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c
@@ -0,0 +1,276 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/* Protocol decoders for Ethernet, TCP, IP, ICMP and ARP. Each of these routines
32 accepts a header to the appropriate protocol and prints out pertinent information
33 on the packet through the serial port.
34
35 To disable printing of a specific protocol, define the token NO_DECODE_{Protocol}
36 in the project makefile, and pass it to the compiler using the -D switch.
37*/
38
39/** \file
40 *
41 * Protocol decoding routines, for the plain-text decoding of Ethernet frames for debugging purposes.
42 * Enabled protocol decoders will print incoming Ethernet frame contents through the USART in a human
43 * readable format.
44 *
45 * Note that the USART is a slow transmission medium, and will slow down packet processing considerably.
46 * Packet decoding routines can be disabled by defining NO_DECODE_{Protocol Name} in the project makefile
47 * and passing it to the compiler via the -D switch.
48 */
49
50#include "ProtocolDecoders.h"
51
52/** Decodes an Ethernet frame header and prints its contents to through the USART in a human readable format.
53 *
54 * \param[in] InDataStart Pointer to the start of an Ethernet frame header
55 */
56void DecodeEthernetFrameHeader(void* InDataStart)
57{
58 #if !defined(NO_DECODE_ETHERNET)
59 Ethernet_Frame_Header_t* FrameHeader = (Ethernet_Frame_Header_t*)InDataStart;
60
61 printf_P(PSTR("\r\n"));
62
63 printf_P(PSTR(" ETHERNET\r\n"));
64
65 if (!(MAC_COMPARE(&FrameHeader->Destination, &ServerMACAddress)) &&
66 !(MAC_COMPARE(&FrameHeader->Destination, &BroadcastMACAddress)))
67 {
68 printf_P(PSTR(" + NOT ADDRESSED TO DEVICE\r\n"));
69 return;
70 }
71
72 printf_P(PSTR(" + MAC Source : %02X:%02X:%02X:%02X:%02X:%02X\r\n"), FrameHeader->Source.Octets[0],
73 FrameHeader->Source.Octets[1],
74 FrameHeader->Source.Octets[2],
75 FrameHeader->Source.Octets[3],
76 FrameHeader->Source.Octets[4],
77 FrameHeader->Source.Octets[5]);
78
79 printf_P(PSTR(" + MAC Dest: %02X:%02X:%02X:%02X:%02X:%02X\r\n"), FrameHeader->Destination.Octets[0],
80 FrameHeader->Destination.Octets[1],
81 FrameHeader->Destination.Octets[2],
82 FrameHeader->Destination.Octets[3],
83 FrameHeader->Destination.Octets[4],
84 FrameHeader->Destination.Octets[5]);
85
86 printf_P(PSTR(" + Protocol: 0x%04x\r\n"), SwapEndian_16(FrameHeader->EtherType));
87 #endif
88}
89
90/** Decodes an ARP header and prints its contents to through the USART in a human readable format.
91 *
92 * \param[in] InDataStart Pointer to the start of an ARP packet header
93 */
94void DecodeARPHeader(void* InDataStart)
95{
96 #if !defined(NO_DECODE_ARP)
97 ARP_Header_t* ARPHeader = (ARP_Header_t*)InDataStart;
98
99 printf_P(PSTR(" \\\r\n ARP\r\n"));
100
101 if (!(IP_COMPARE(&ARPHeader->TPA, &ServerIPAddress)) &&
102 !(MAC_COMPARE(&ARPHeader->THA, &ServerMACAddress)))
103 {
104 printf_P(PSTR(" + NOT ADDRESSED TO DEVICE\r\n"));
105 return;
106 }
107
108 printf_P(PSTR(" + Protocol: %x\r\n"), SwapEndian_16(ARPHeader->ProtocolType));
109 printf_P(PSTR(" + Operation: %u\r\n"), SwapEndian_16(ARPHeader->Operation));
110
111 if (SwapEndian_16(ARPHeader->ProtocolType) == ETHERTYPE_IPV4)
112 {
113 printf_P(PSTR(" + SHA MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n"), ARPHeader->SHA.Octets[0],
114 ARPHeader->SHA.Octets[1],
115 ARPHeader->SHA.Octets[2],
116 ARPHeader->SHA.Octets[3],
117 ARPHeader->SHA.Octets[4],
118 ARPHeader->SHA.Octets[5]);
119
120 printf_P(PSTR(" + SPA IP: %u.%u.%u.%u\r\n"), ARPHeader->SPA.Octets[0],
121 ARPHeader->SPA.Octets[1],
122 ARPHeader->SPA.Octets[2],
123 ARPHeader->SPA.Octets[3]);
124
125 printf_P(PSTR(" + THA MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n"), ARPHeader->THA.Octets[0],
126 ARPHeader->THA.Octets[1],
127 ARPHeader->THA.Octets[2],
128 ARPHeader->THA.Octets[3],
129 ARPHeader->THA.Octets[4],
130 ARPHeader->THA.Octets[5]);
131
132 printf_P(PSTR(" + TPA IP: %u.%u.%u.%u\r\n"), ARPHeader->TPA.Octets[0],
133 ARPHeader->TPA.Octets[1],
134 ARPHeader->TPA.Octets[2],
135 ARPHeader->TPA.Octets[3]);
136 }
137 #endif
138}
139
140/** Decodes an IP header and prints its contents to through the USART in a human readable format.
141 *
142 * \param[in] InDataStart Pointer to the start of an IP packet header
143 */
144void DecodeIPHeader(void* InDataStart)
145{
146 #if !defined(NO_DECODE_IP)
147 IP_Header_t* IPHeader = (IP_Header_t*)InDataStart;
148
149 uint16_t HeaderLengthBytes = (IPHeader->HeaderLength * sizeof(uint32_t));
150
151 printf_P(PSTR(" \\\r\n IP\r\n"));
152
153 if (!(IP_COMPARE(&IPHeader->DestinationAddress, &ServerIPAddress)))
154 {
155 printf_P(PSTR(" + NOT ADDRESSED TO DEVICE\r\n"));
156 return;
157 }
158
159 printf_P(PSTR(" + Header Length: %u Bytes\r\n"), HeaderLengthBytes);
160 printf_P(PSTR(" + Packet Version: %u\r\n"), IPHeader->Version);
161 printf_P(PSTR(" + Total Length: %u\r\n"), SwapEndian_16(IPHeader->TotalLength));
162
163 printf_P(PSTR(" + Protocol: %u\r\n"), IPHeader->Protocol);
164 printf_P(PSTR(" + TTL: %u\r\n"), IPHeader->TTL);
165
166 printf_P(PSTR(" + IP Src: %u.%u.%u.%u\r\n"), IPHeader->SourceAddress.Octets[0],
167 IPHeader->SourceAddress.Octets[1],
168 IPHeader->SourceAddress.Octets[2],
169 IPHeader->SourceAddress.Octets[3]);
170
171 printf_P(PSTR(" + IP Dst: %u.%u.%u.%u\r\n"), IPHeader->DestinationAddress.Octets[0],
172 IPHeader->DestinationAddress.Octets[1],
173 IPHeader->DestinationAddress.Octets[2],
174 IPHeader->DestinationAddress.Octets[3]);
175 #endif
176}
177
178/** Decodes an ICMP header and prints its contents to through the USART in a human readable format.
179 *
180 * \param[in] InDataStart Pointer to the start of an ICMP packet header
181 */
182void DecodeICMPHeader(void* InDataStart)
183{
184 #if !defined(NO_DECODE_ICMP)
185 ICMP_Header_t* ICMPHeader = (ICMP_Header_t*)InDataStart;
186
187 printf_P(PSTR(" \\\r\n ICMP\r\n"));
188
189 printf_P(PSTR(" + Type: %u\r\n"), ICMPHeader->Type);
190 printf_P(PSTR(" + Code: %u\r\n"), ICMPHeader->Code);
191 #endif
192}
193
194/** Decodes a TCP header and prints its contents to through the USART in a human readable format.
195 *
196 * \param[in] InDataStart Pointer to the start of a TCP packet header
197 */
198void DecodeTCPHeader(void* InDataStart)
199{
200 #if !defined(NO_DECODE_TCP)
201 TCP_Header_t* TCPHeader = (TCP_Header_t*)InDataStart;
202
203 uint16_t HeaderLengthBytes = (TCPHeader->DataOffset * sizeof(uint32_t));
204
205 printf_P(PSTR(" \\\r\n TCP\r\n"));
206
207 printf_P(PSTR(" + Header Length: %u Bytes\r\n"), HeaderLengthBytes);
208
209 printf_P(PSTR(" + Source Port: %u\r\n"), SwapEndian_16(TCPHeader->SourcePort));
210 printf_P(PSTR(" + Destination Port: %u\r\n"), SwapEndian_16(TCPHeader->DestinationPort));
211
212 printf_P(PSTR(" + Sequence Number: %lu\r\n"), SwapEndian_32(TCPHeader->SequenceNumber));
213 printf_P(PSTR(" + Acknowledgment Number: %lu\r\n"), SwapEndian_32(TCPHeader->AcknowledgmentNumber));
214
215 printf_P(PSTR(" + Flags: 0x%02X\r\n"), TCPHeader->Flags);
216
217 if (TCP_GetPortState(TCPHeader->DestinationPort) == TCP_Port_Closed)
218 printf_P(PSTR(" + NOT LISTENING ON DESTINATION PORT\r\n"));
219 #endif
220}
221
222/** Decodes an UDP header and prints its contents to through the USART in a human readable format.
223 *
224 * \param[in] InDataStart Pointer to the start of a UDP packet header
225 */
226void DecodeUDPHeader(void* InDataStart)
227{
228 #if !defined(NO_DECODE_UDP)
229 UDP_Header_t* UDPHeader = (UDP_Header_t*)InDataStart;
230
231 printf_P(PSTR(" \\\r\n UDP\r\n"));
232
233 printf_P(PSTR(" + Source Port: %u\r\n"), SwapEndian_16(UDPHeader->SourcePort));
234 printf_P(PSTR(" + Destination Port: %u\r\n"), SwapEndian_16(UDPHeader->DestinationPort));
235
236 printf_P(PSTR(" + Data Length: %d\r\n"), SwapEndian_16(UDPHeader->Length));
237 #endif
238}
239
240/** Decodes an DHCP header and prints its contents to through the USART in a human readable format.
241 *
242 * \param[in] InDataStart Pointer to the start of a DHCP packet header
243 */
244void DecodeDHCPHeader(void* InDataStart)
245{
246 #if !defined(NO_DECODE_DHCP)
247 uint8_t* DHCPOptions = ((uint8_t*)InDataStart + sizeof(DHCP_Header_t));
248
249 printf_P(PSTR(" \\\r\n DHCP\r\n"));
250
251 while (DHCPOptions[0] != DHCP_OPTION_END)
252 {
253 if (DHCPOptions[0] == DHCP_OPTION_MESSAGETYPE)
254 {
255 switch (DHCPOptions[2])
256 {
257 case DHCP_MESSAGETYPE_DISCOVER:
258 printf_P(PSTR(" + DISCOVER\r\n"));
259 break;
260 case DHCP_MESSAGETYPE_REQUEST:
261 printf_P(PSTR(" + REQUEST\r\n"));
262 break;
263 case DHCP_MESSAGETYPE_RELEASE:
264 printf_P(PSTR(" + RELEASE\r\n"));
265 break;
266 case DHCP_MESSAGETYPE_DECLINE:
267 printf_P(PSTR(" + DECLINE\r\n"));
268 break;
269 }
270 }
271
272 DHCPOptions += ((DHCPOptions[0] == DHCP_OPTION_PAD) ? 1 : (DHCPOptions[1] + 2));
273 }
274 #endif
275}
276
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h
new file mode 100644
index 000000000..77a50f02f
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h
@@ -0,0 +1,60 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Header file for ProtocolDecoders.c.
34 */
35
36#ifndef _PROTOCOL_DECODERS_H_
37#define _PROTOCOL_DECODERS_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <avr/pgmspace.h>
42 #include <stdio.h>
43
44 #include <LUFA/Drivers/Peripheral/Serial.h>
45
46 #include "EthernetProtocols.h"
47 #include "Ethernet.h"
48 #include "Config/AppConfig.h"
49
50 /* Function Prototypes: */
51 void DecodeEthernetFrameHeader(void* InDataStart);
52 void DecodeARPHeader(void* InDataStart);
53 void DecodeIPHeader(void* InDataStart);
54 void DecodeICMPHeader(void* InDataStart);
55 void DecodeTCPHeader(void* InDataStart);
56 void DecodeUDPHeader(void* InDataStart);
57 void DecodeDHCPHeader(void* InDataStart);
58
59#endif
60
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c
new file mode 100644
index 000000000..00052ed39
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c
@@ -0,0 +1,394 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * RNDIS command handler functions. This handles RNDIS commands according to
34 * the Microsoft RNDIS specification, creating a USB Ethernet network adapter.
35 */
36
37#define INCLUDE_FROM_RNDIS_C
38#include "RNDIS.h"
39
40/** Physical MAC address of the network adapter, which becomes the MAC address of the host for packets sent to the adapter. */
41static const MAC_Address_t PROGMEM AdapterMACAddress = {ADAPTER_MAC_ADDRESS};
42
43/** Vendor description of the adapter. This is overridden by the INF file required to install the appropriate RNDIS drivers for
44 * the device, but may still be used by the OS in some circumstances.
45 */
46static const char PROGMEM AdapterVendorDescription[] = "LUFA RNDIS Adapter";
47
48/** List of RNDIS OID commands supported by this adapter. */
49static const uint32_t PROGMEM AdapterSupportedOIDList[] =
50 {
51 OID_GEN_SUPPORTED_LIST,
52 OID_GEN_PHYSICAL_MEDIUM,
53 OID_GEN_HARDWARE_STATUS,
54 OID_GEN_MEDIA_SUPPORTED,
55 OID_GEN_MEDIA_IN_USE,
56 OID_GEN_MAXIMUM_FRAME_SIZE,
57 OID_GEN_MAXIMUM_TOTAL_SIZE,
58 OID_GEN_LINK_SPEED,
59 OID_GEN_TRANSMIT_BLOCK_SIZE,
60 OID_GEN_RECEIVE_BLOCK_SIZE,
61 OID_GEN_VENDOR_ID,
62 OID_GEN_VENDOR_DESCRIPTION,
63 OID_GEN_CURRENT_PACKET_FILTER,
64 OID_GEN_MAXIMUM_TOTAL_SIZE,
65 OID_GEN_MEDIA_CONNECT_STATUS,
66 OID_GEN_XMIT_OK,
67 OID_GEN_RCV_OK,
68 OID_GEN_XMIT_ERROR,
69 OID_GEN_RCV_ERROR,
70 OID_GEN_RCV_NO_BUFFER,
71 OID_802_3_PERMANENT_ADDRESS,
72 OID_802_3_CURRENT_ADDRESS,
73 OID_802_3_MULTICAST_LIST,
74 OID_802_3_MAXIMUM_LIST_SIZE,
75 OID_802_3_RCV_ERROR_ALIGNMENT,
76 OID_802_3_XMIT_ONE_COLLISION,
77 OID_802_3_XMIT_MORE_COLLISIONS,
78 };
79
80/** Buffer for RNDIS messages (as distinct from Ethernet frames sent through the adapter. This must be big enough to hold the entire
81 * Supported OID list, plus the response header. The buffer is half-duplex, and is written to as it is read to save on SRAM - for this
82 * reason, care must be taken when constructing RNDIS responses that unread data is not overwritten when writing in responses.
83 */
84uint8_t RNDISMessageBuffer[sizeof(AdapterSupportedOIDList) + sizeof(RNDIS_Query_Complete_t)];
85
86/** Pointer to the RNDIS message header at the top of the RNDIS message buffer, for convenience. */
87RNDIS_Message_Header_t* MessageHeader = (RNDIS_Message_Header_t*)&RNDISMessageBuffer;
88
89/** Indicates if a RNDIS message response is ready to be sent back to the host. */
90bool ResponseReady = false;
91
92/** Current RNDIS adapter state, a value from the \c RNDIS_States_t enum. */
93uint8_t CurrRNDISState = RNDIS_Uninitialized;
94
95/** Current Ethernet packet filter mask. This is non-zero when the adapter is initialized, or zero when disabled. */
96uint32_t CurrPacketFilter = 0;
97
98
99/** Processes the RNDIS message received by the host and stored in the RNDISMessageBuffer global buffer. If a response is
100 * created, the ResponseReady global is updated so that the response is written back to the host upon request.
101 */
102void ProcessRNDISControlMessage(void)
103{
104 /* Note: Only a single buffer is used for both the received message and its response to save SRAM. Because of
105 this, response bytes should be filled in order so that they do not clobber unread data in the buffer. */
106
107 switch (MessageHeader->MessageType)
108 {
109 case REMOTE_NDIS_INITIALIZE_MSG:
110 /* Initialize the adapter - return information about the supported RNDIS version and buffer sizes */
111
112 ResponseReady = true;
113
114 RNDIS_Initialize_Message_t* INITIALIZE_Message = (RNDIS_Initialize_Message_t*)&RNDISMessageBuffer;
115 RNDIS_Initialize_Complete_t* INITIALIZE_Response = (RNDIS_Initialize_Complete_t*)&RNDISMessageBuffer;
116
117 INITIALIZE_Response->MessageType = REMOTE_NDIS_INITIALIZE_CMPLT;
118 INITIALIZE_Response->MessageLength = sizeof(RNDIS_Initialize_Complete_t);
119 INITIALIZE_Response->RequestId = INITIALIZE_Message->RequestId;
120 INITIALIZE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
121
122 INITIALIZE_Response->MajorVersion = REMOTE_NDIS_VERSION_MAJOR;
123 INITIALIZE_Response->MinorVersion = REMOTE_NDIS_VERSION_MINOR;
124 INITIALIZE_Response->DeviceFlags = REMOTE_NDIS_DF_CONNECTIONLESS;
125 INITIALIZE_Response->Medium = REMOTE_NDIS_MEDIUM_802_3;
126 INITIALIZE_Response->MaxPacketsPerTransfer = 1;
127 INITIALIZE_Response->MaxTransferSize = (sizeof(RNDIS_Packet_Message_t) + ETHERNET_FRAME_SIZE_MAX);
128 INITIALIZE_Response->PacketAlignmentFactor = 0;
129 INITIALIZE_Response->AFListOffset = 0;
130 INITIALIZE_Response->AFListSize = 0;
131
132 CurrRNDISState = RNDIS_Initialized;
133
134 break;
135 case REMOTE_NDIS_HALT_MSG:
136 /* Halt the adapter, reset the adapter state - note that no response should be returned when completed */
137
138 ResponseReady = false;
139 MessageHeader->MessageLength = 0;
140
141 CurrRNDISState = RNDIS_Uninitialized;
142
143 break;
144 case REMOTE_NDIS_QUERY_MSG:
145 /* Request for information about a parameter about the adapter, specified as an OID token */
146
147 ResponseReady = true;
148
149 RNDIS_Query_Message_t* QUERY_Message = (RNDIS_Query_Message_t*)&RNDISMessageBuffer;
150 RNDIS_Query_Complete_t* QUERY_Response = (RNDIS_Query_Complete_t*)&RNDISMessageBuffer;
151 uint32_t Query_Oid = QUERY_Message->Oid;
152
153 void* QueryData = &RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) +
154 QUERY_Message->InformationBufferOffset];
155 void* ResponseData = &RNDISMessageBuffer[sizeof(RNDIS_Query_Complete_t)];
156 uint16_t ResponseSize;
157
158 QUERY_Response->MessageType = REMOTE_NDIS_QUERY_CMPLT;
159 QUERY_Response->MessageLength = sizeof(RNDIS_Query_Complete_t);
160
161 if (ProcessNDISQuery(Query_Oid, QueryData, QUERY_Message->InformationBufferLength,
162 ResponseData, &ResponseSize))
163 {
164 QUERY_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
165 QUERY_Response->MessageLength += ResponseSize;
166
167 QUERY_Response->InformationBufferLength = ResponseSize;
168 QUERY_Response->InformationBufferOffset = (sizeof(RNDIS_Query_Complete_t) - sizeof(RNDIS_Message_Header_t));
169 }
170 else
171 {
172 QUERY_Response->Status = REMOTE_NDIS_STATUS_NOT_SUPPORTED;
173
174 QUERY_Response->InformationBufferLength = 0;
175 QUERY_Response->InformationBufferOffset = 0;
176 }
177
178 break;
179 case REMOTE_NDIS_SET_MSG:
180 /* Request to set a parameter of the adapter, specified as an OID token */
181
182 ResponseReady = true;
183
184 RNDIS_Set_Message_t* SET_Message = (RNDIS_Set_Message_t*)&RNDISMessageBuffer;
185 RNDIS_Set_Complete_t* SET_Response = (RNDIS_Set_Complete_t*)&RNDISMessageBuffer;
186 uint32_t SET_Oid = SET_Message->Oid;
187
188 SET_Response->MessageType = REMOTE_NDIS_SET_CMPLT;
189 SET_Response->MessageLength = sizeof(RNDIS_Set_Complete_t);
190 SET_Response->RequestId = SET_Message->RequestId;
191
192 void* SetData = &RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) +
193 SET_Message->InformationBufferOffset];
194
195 if (ProcessNDISSet(SET_Oid, SetData, SET_Message->InformationBufferLength))
196 SET_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
197 else
198 SET_Response->Status = REMOTE_NDIS_STATUS_NOT_SUPPORTED;
199
200 break;
201 case REMOTE_NDIS_RESET_MSG:
202 /* Soft reset the adapter */
203
204 ResponseReady = true;
205
206 RNDIS_Reset_Complete_t* RESET_Response = (RNDIS_Reset_Complete_t*)&RNDISMessageBuffer;
207
208 RESET_Response->MessageType = REMOTE_NDIS_RESET_CMPLT;
209 RESET_Response->MessageLength = sizeof(RNDIS_Reset_Complete_t);
210 RESET_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
211 RESET_Response->AddressingReset = 0;
212
213 break;
214 case REMOTE_NDIS_KEEPALIVE_MSG:
215 /* Keep alive message sent to the adapter every 5 seconds when idle to ensure it is still responding */
216
217 ResponseReady = true;
218
219 RNDIS_KeepAlive_Message_t* KEEPALIVE_Message = (RNDIS_KeepAlive_Message_t*)&RNDISMessageBuffer;
220 RNDIS_KeepAlive_Complete_t* KEEPALIVE_Response = (RNDIS_KeepAlive_Complete_t*)&RNDISMessageBuffer;
221
222 KEEPALIVE_Response->MessageType = REMOTE_NDIS_KEEPALIVE_CMPLT;
223 KEEPALIVE_Response->MessageLength = sizeof(RNDIS_KeepAlive_Complete_t);
224 KEEPALIVE_Response->RequestId = KEEPALIVE_Message->RequestId;
225 KEEPALIVE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
226
227 break;
228 }
229}
230
231/** Processes RNDIS query commands, retrieving information from the adapter and reporting it back to the host. The requested
232 * parameter is given as an OID value.
233 *
234 * \param[in] OId OId value of the parameter being queried
235 * \param[in] QueryData Pointer to any extra query data being sent by the host to the device inside the RNDIS message buffer
236 * \param[in] QuerySize Size in bytes of the extra query data being sent by the host
237 * \param[out] ResponseData Pointer to the start of the query response inside the RNDIS message buffer
238 * \param[out] ResponseSize Pointer to the size in bytes of the response data being sent to the host
239 *
240 * \return Boolean \c true if the query was handled, \c false otherwise
241 */
242static bool ProcessNDISQuery(const uint32_t OId, void* QueryData, uint16_t QuerySize,
243 void* ResponseData, uint16_t* ResponseSize)
244{
245 /* Handler for REMOTE_NDIS_QUERY_MSG messages */
246
247 switch (OId)
248 {
249 case OID_GEN_SUPPORTED_LIST:
250 *ResponseSize = sizeof(AdapterSupportedOIDList);
251
252 /* Copy the list of supported NDIS OID tokens to the response buffer */
253 memcpy_P(ResponseData, AdapterSupportedOIDList, sizeof(AdapterSupportedOIDList));
254
255 return true;
256 case OID_GEN_PHYSICAL_MEDIUM:
257 *ResponseSize = sizeof(uint32_t);
258
259 /* Indicate that the device is a true ethernet link */
260 *((uint32_t*)ResponseData) = 0;
261
262 return true;
263 case OID_GEN_HARDWARE_STATUS:
264 *ResponseSize = sizeof(uint32_t);
265
266 /* Always indicate hardware ready */
267 *((uint32_t*)ResponseData) = NDIS_HardwareStatus_Ready;
268
269 return true;
270 case OID_GEN_MEDIA_SUPPORTED:
271 case OID_GEN_MEDIA_IN_USE:
272 *ResponseSize = sizeof(uint32_t);
273
274 /* Indicate 802.3 (Ethernet) supported by the adapter */
275 *((uint32_t*)ResponseData) = REMOTE_NDIS_MEDIUM_802_3;
276
277 return true;
278 case OID_GEN_VENDOR_ID:
279 *ResponseSize = sizeof(uint32_t);
280
281 /* Vendor ID 0x0xFFFFFF is reserved for vendors who have not purchased a NDIS VID */
282 *((uint32_t*)ResponseData) = 0x00FFFFFF;
283
284 return true;
285 case OID_GEN_MAXIMUM_FRAME_SIZE:
286 case OID_GEN_TRANSMIT_BLOCK_SIZE:
287 case OID_GEN_RECEIVE_BLOCK_SIZE:
288 *ResponseSize = sizeof(uint32_t);
289
290 /* Indicate that the maximum frame size is the size of the ethernet frame buffer */
291 *((uint32_t*)ResponseData) = ETHERNET_FRAME_SIZE_MAX;
292
293 return true;
294 case OID_GEN_VENDOR_DESCRIPTION:
295 *ResponseSize = sizeof(AdapterVendorDescription);
296
297 /* Copy vendor description string to the response buffer */
298 memcpy_P(ResponseData, AdapterVendorDescription, sizeof(AdapterVendorDescription));
299
300 return true;
301 case OID_GEN_MEDIA_CONNECT_STATUS:
302 *ResponseSize = sizeof(uint32_t);
303
304 /* Always indicate that the adapter is connected to a network */
305 *((uint32_t*)ResponseData) = REMOTE_NDIS_MEDIA_STATE_CONNECTED;
306
307 return true;
308 case OID_GEN_LINK_SPEED:
309 *ResponseSize = sizeof(uint32_t);
310
311 /* Indicate 10Mb/s link speed */
312 *((uint32_t*)ResponseData) = 100000;
313
314 return true;
315 case OID_802_3_PERMANENT_ADDRESS:
316 case OID_802_3_CURRENT_ADDRESS:
317 *ResponseSize = sizeof(MAC_Address_t);
318
319 /* Copy over the fixed adapter MAC to the response buffer */
320 memcpy_P(ResponseData, &AdapterMACAddress, sizeof(MAC_Address_t));
321
322 return true;
323 case OID_802_3_MAXIMUM_LIST_SIZE:
324 *ResponseSize = sizeof(uint32_t);
325
326 /* Indicate only one multicast address supported */
327 *((uint32_t*)ResponseData) = 1;
328
329 return true;
330 case OID_GEN_CURRENT_PACKET_FILTER:
331 *ResponseSize = sizeof(uint32_t);
332
333 /* Indicate the current packet filter mask */
334 *((uint32_t*)ResponseData) = CurrPacketFilter;
335
336 return true;
337 case OID_GEN_XMIT_OK:
338 case OID_GEN_RCV_OK:
339 case OID_GEN_XMIT_ERROR:
340 case OID_GEN_RCV_ERROR:
341 case OID_GEN_RCV_NO_BUFFER:
342 case OID_802_3_RCV_ERROR_ALIGNMENT:
343 case OID_802_3_XMIT_ONE_COLLISION:
344 case OID_802_3_XMIT_MORE_COLLISIONS:
345 *ResponseSize = sizeof(uint32_t);
346
347 /* Unused statistic OIDs - always return 0 for each */
348 *((uint32_t*)ResponseData) = 0;
349
350 return true;
351 case OID_GEN_MAXIMUM_TOTAL_SIZE:
352 *ResponseSize = sizeof(uint32_t);
353
354 /* Indicate maximum overall buffer (Ethernet frame and RNDIS header) the adapter can handle */
355 *((uint32_t*)ResponseData) = (sizeof(RNDISMessageBuffer) + ETHERNET_FRAME_SIZE_MAX);
356
357 return true;
358 default:
359 return false;
360 }
361}
362
363/** Processes RNDIS set commands, setting adapter parameters to values given by the host. The requested parameter is given
364 * as an OID value.
365 *
366 * \param[in] OId OId value of the parameter being set
367 * \param[in] SetData Pointer to the parameter value in the RNDIS message buffer
368 * \param[in] SetSize Size in bytes of the parameter value being sent by the host
369 *
370 * \return Boolean \c true if the set was handled, \c false otherwise
371 */
372static bool ProcessNDISSet(uint32_t OId, void* SetData, uint16_t SetSize)
373{
374 /* Handler for REMOTE_NDIS_SET_MSG messages */
375
376 switch (OId)
377 {
378 case OID_GEN_CURRENT_PACKET_FILTER:
379 /* Save the packet filter mask in case the host queries it again later */
380 CurrPacketFilter = *((uint32_t*)SetData);
381
382 /* Set the RNDIS state to initialized if the packet filter is non-zero */
383 CurrRNDISState = ((CurrPacketFilter) ? RNDIS_Data_Initialized : RNDIS_Initialized);
384
385 return true;
386 case OID_802_3_MULTICAST_LIST:
387 /* Do nothing - throw away the value from the host as it is unused */
388
389 return true;
390 default:
391 return false;
392 }
393}
394
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h
new file mode 100644
index 000000000..bea97f79d
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h
@@ -0,0 +1,67 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Header file for RNDIS.c.
34 */
35
36#ifndef _RNDIS_H_
37#define _RNDIS_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <stdbool.h>
42
43 #include "../RNDISEthernet.h"
44 #include "Ethernet.h"
45
46 /* External Variables: */
47 extern uint8_t RNDISMessageBuffer[];
48 extern RNDIS_Message_Header_t* MessageHeader;
49 extern bool ResponseReady;
50 extern uint8_t CurrRNDISState;
51
52 /* Function Prototypes: */
53 void ProcessRNDISControlMessage(void);
54
55 #if defined(INCLUDE_FROM_RNDIS_C)
56 static bool ProcessNDISQuery(const uint32_t OId,
57 void* QueryData,
58 uint16_t QuerySize,
59 void* ResponseData,
60 uint16_t* ResponseSize);
61 static bool ProcessNDISSet(const uint32_t OId,
62 void* SetData,
63 uint16_t SetSize);
64 #endif
65
66#endif
67
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c
new file mode 100644
index 000000000..a6f1f6adf
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c
@@ -0,0 +1,631 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Transmission Control Protocol (TCP) packet handling routines. This protocol handles the reliable in-order transmission
34 * and reception of packets to and from devices on a network, to "ports" on the device. It is used in situations where data
35 * delivery must be reliable and correct, e.g. HTTP, TELNET and most other non-streaming protocols.
36 */
37
38#define INCLUDE_FROM_TCP_C
39#include "TCP.h"
40
41/** Port state table array. This contains the current status of TCP ports in the device. To save on space, only open ports are
42 * stored - closed ports may be overwritten at any time, and the system will assume any ports not present in the array are closed. This
43 * allows for MAX_OPEN_TCP_PORTS to be less than the number of ports used by the application if desired.
44 */
45TCP_PortState_t PortStateTable[MAX_OPEN_TCP_PORTS];
46
47/** Connection state table array. This contains the current status of TCP connections in the device. To save on space, only active
48 * (non-closed) connections are stored - closed connections may be overwritten at any time, and the system will assume any connections
49 * not present in the array are closed.
50 */
51TCP_ConnectionState_t ConnectionStateTable[MAX_TCP_CONNECTIONS];
52
53
54/** Task to handle the calling of each registered application's callback function, to process and generate TCP packets at the application
55 * level. If an application produces a response, this task constructs the appropriate Ethernet frame and places it into the Ethernet OUT
56 * buffer for later transmission.
57 */
58void TCP_Task(void)
59{
60 /* Run each application in sequence, to process incoming and generate outgoing packets */
61 for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
62 {
63 /* Find the corresponding port entry in the port table */
64 for (uint8_t PTableEntry = 0; PTableEntry < MAX_OPEN_TCP_PORTS; PTableEntry++)
65 {
66 /* Run the application handler for the port */
67 if ((PortStateTable[PTableEntry].Port == ConnectionStateTable[CSTableEntry].Port) &&
68 (PortStateTable[PTableEntry].State == TCP_Port_Open))
69 {
70 PortStateTable[PTableEntry].ApplicationHandler(&ConnectionStateTable[CSTableEntry],
71 &ConnectionStateTable[CSTableEntry].Info.Buffer);
72 }
73 }
74 }
75
76 /* Bail out early if there is already a frame waiting to be sent in the Ethernet OUT buffer */
77 if (FrameOUT.FrameLength)
78 return;
79
80 /* Send response packets from each application as the TCP packet buffers are filled by the applications */
81 for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
82 {
83 /* For each completely received packet, pass it along to the listening application */
84 if ((ConnectionStateTable[CSTableEntry].Info.Buffer.Direction == TCP_PACKETDIR_OUT) &&
85 (ConnectionStateTable[CSTableEntry].Info.Buffer.Ready))
86 {
87 Ethernet_Frame_Header_t* FrameOUTHeader = (Ethernet_Frame_Header_t*)&FrameOUT.FrameData;
88 IP_Header_t* IPHeaderOUT = (IP_Header_t*)&FrameOUT.FrameData[sizeof(Ethernet_Frame_Header_t)];
89 TCP_Header_t* TCPHeaderOUT = (TCP_Header_t*)&FrameOUT.FrameData[sizeof(Ethernet_Frame_Header_t) +
90 sizeof(IP_Header_t)];
91 void* TCPDataOUT = &FrameOUT.FrameData[sizeof(Ethernet_Frame_Header_t) +
92 sizeof(IP_Header_t) +
93 sizeof(TCP_Header_t)];
94
95 uint16_t PacketSize = ConnectionStateTable[CSTableEntry].Info.Buffer.Length;
96
97 /* Fill out the TCP data */
98 TCPHeaderOUT->SourcePort = ConnectionStateTable[CSTableEntry].Port;
99 TCPHeaderOUT->DestinationPort = ConnectionStateTable[CSTableEntry].RemotePort;
100 TCPHeaderOUT->SequenceNumber = SwapEndian_32(ConnectionStateTable[CSTableEntry].Info.SequenceNumberOut);
101 TCPHeaderOUT->AcknowledgmentNumber = SwapEndian_32(ConnectionStateTable[CSTableEntry].Info.SequenceNumberIn);
102 TCPHeaderOUT->DataOffset = (sizeof(TCP_Header_t) / sizeof(uint32_t));
103 TCPHeaderOUT->WindowSize = SwapEndian_16(TCP_WINDOW_SIZE);
104
105 TCPHeaderOUT->Flags = TCP_FLAG_ACK;
106 TCPHeaderOUT->UrgentPointer = 0;
107 TCPHeaderOUT->Checksum = 0;
108 TCPHeaderOUT->Reserved = 0;
109
110 memcpy(TCPDataOUT, ConnectionStateTable[CSTableEntry].Info.Buffer.Data, PacketSize);
111
112 ConnectionStateTable[CSTableEntry].Info.SequenceNumberOut += PacketSize;
113
114 TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, &ServerIPAddress,
115 &ConnectionStateTable[CSTableEntry].RemoteAddress,
116 (sizeof(TCP_Header_t) + PacketSize));
117
118 PacketSize += sizeof(TCP_Header_t);
119
120 /* Fill out the response IP header */
121 IPHeaderOUT->TotalLength = SwapEndian_16(sizeof(IP_Header_t) + PacketSize);
122 IPHeaderOUT->TypeOfService = 0;
123 IPHeaderOUT->HeaderLength = (sizeof(IP_Header_t) / sizeof(uint32_t));
124 IPHeaderOUT->Version = 4;
125 IPHeaderOUT->Flags = 0;
126 IPHeaderOUT->FragmentOffset = 0;
127 IPHeaderOUT->Identification = 0;
128 IPHeaderOUT->HeaderChecksum = 0;
129 IPHeaderOUT->Protocol = PROTOCOL_TCP;
130 IPHeaderOUT->TTL = DEFAULT_TTL;
131 IPHeaderOUT->SourceAddress = ServerIPAddress;
132 IPHeaderOUT->DestinationAddress = ConnectionStateTable[CSTableEntry].RemoteAddress;
133
134 IPHeaderOUT->HeaderChecksum = Ethernet_Checksum16(IPHeaderOUT, sizeof(IP_Header_t));
135
136 PacketSize += sizeof(IP_Header_t);
137
138 /* Fill out the response Ethernet frame header */
139 FrameOUTHeader->Source = ServerMACAddress;
140 FrameOUTHeader->Destination = (MAC_Address_t){{0x02, 0x00, 0x02, 0x00, 0x02, 0x00}};
141 FrameOUTHeader->EtherType = SwapEndian_16(ETHERTYPE_IPV4);
142
143 PacketSize += sizeof(Ethernet_Frame_Header_t);
144
145 /* Set the response length in the buffer and indicate that a response is ready to be sent */
146 FrameOUT.FrameLength = PacketSize;
147
148 ConnectionStateTable[CSTableEntry].Info.Buffer.Ready = false;
149
150 break;
151 }
152 }
153}
154
155/** Initializes the TCP protocol handler, clearing the port and connection state tables. This must be called before TCP packets are
156 * processed.
157 */
158void TCP_Init(void)
159{
160 /* Initialize the port state table with all CLOSED entries */
161 for (uint8_t PTableEntry = 0; PTableEntry < MAX_OPEN_TCP_PORTS; PTableEntry++)
162 PortStateTable[PTableEntry].State = TCP_Port_Closed;
163
164 /* Initialize the connection table with all CLOSED entries */
165 for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
166 ConnectionStateTable[CSTableEntry].State = TCP_Connection_Closed;
167}
168
169/** Sets the state and callback handler of the given port, specified in big endian to the given state.
170 *
171 * \param[in] Port Port whose state and callback function to set, specified in big endian
172 * \param[in] State New state of the port, a value from the \ref TCP_PortStates_t enum
173 * \param[in] Handler Application callback handler for the port
174 *
175 * \return Boolean \c true if the port state was set, \c false otherwise (no more space in the port state table)
176 */
177bool TCP_SetPortState(const uint16_t Port,
178 const uint8_t State,
179 void (*Handler)(TCP_ConnectionState_t*, TCP_ConnectionBuffer_t*))
180{
181 /* Note, Port number should be specified in BIG endian to simplify network code */
182
183 /* Check to see if the port entry is already in the port state table */
184 for (uint8_t PTableEntry = 0; PTableEntry < MAX_OPEN_TCP_PORTS; PTableEntry++)
185 {
186 /* Find existing entry for the port in the table, update it if found */
187 if (PortStateTable[PTableEntry].Port == Port)
188 {
189 PortStateTable[PTableEntry].State = State;
190 PortStateTable[PTableEntry].ApplicationHandler = Handler;
191 return true;
192 }
193 }
194
195 /* Check if trying to open the port -- if so we need to find an unused (closed) entry and replace it */
196 if (State == TCP_Port_Open)
197 {
198 for (uint8_t PTableEntry = 0; PTableEntry < MAX_OPEN_TCP_PORTS; PTableEntry++)
199 {
200 /* Find a closed port entry in the table, change it to the given port and state */
201 if (PortStateTable[PTableEntry].State == TCP_Port_Closed)
202 {
203 PortStateTable[PTableEntry].Port = Port;
204 PortStateTable[PTableEntry].State = State;
205 PortStateTable[PTableEntry].ApplicationHandler = Handler;
206 return true;
207 }
208 }
209
210 /* Port not in table and no room to add it, return failure */
211 return false;
212 }
213 else
214 {
215 /* Port not in table but trying to close it, so operation successful */
216 return true;
217 }
218}
219
220/** Retrieves the current state of a given TCP port, specified in big endian.
221 *
222 * \param[in] Port TCP port whose state is to be retrieved, given in big-endian
223 *
224 * \return A value from the \ref TCP_PortStates_t enum
225 */
226uint8_t TCP_GetPortState(const uint16_t Port)
227{
228 /* Note, Port number should be specified in BIG endian to simplify network code */
229
230 for (uint8_t PTableEntry = 0; PTableEntry < MAX_OPEN_TCP_PORTS; PTableEntry++)
231 {
232 /* Find existing entry for the port in the table, return the port status if found */
233 if (PortStateTable[PTableEntry].Port == Port)
234 return PortStateTable[PTableEntry].State;
235 }
236
237 /* Port not in table, assume closed */
238 return TCP_Port_Closed;
239}
240
241/** Sets the connection state of the given port, remote address and remote port to the given TCP connection state. If the
242 * connection exists in the connection state table it is updated, otherwise it is created if possible.
243 *
244 * \param[in] Port TCP port of the connection on the device, specified in big endian
245 * \param[in] RemoteAddress Remote protocol IP address of the connected device
246 * \param[in] RemotePort TCP port of the remote device in the connection, specified in big endian
247 * \param[in] State TCP connection state, a value from the \ref TCP_ConnectionStates_t enum
248 *
249 * \return Boolean \c true if the connection was updated or created, \c false otherwise (no more space in the connection state table)
250 */
251bool TCP_SetConnectionState(const uint16_t Port,
252 const IP_Address_t* RemoteAddress,
253 const uint16_t RemotePort,
254 const uint8_t State)
255{
256 /* Note, Port number should be specified in BIG endian to simplify network code */
257
258 for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
259 {
260 /* Find port entry in the table */
261 if ((ConnectionStateTable[CSTableEntry].Port == Port) &&
262 IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, RemoteAddress) &&
263 ConnectionStateTable[CSTableEntry].RemotePort == RemotePort)
264 {
265 ConnectionStateTable[CSTableEntry].State = State;
266 return true;
267 }
268 }
269
270 for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
271 {
272 /* Find empty entry in the table */
273 if (ConnectionStateTable[CSTableEntry].State == TCP_Connection_Closed)
274 {
275 ConnectionStateTable[CSTableEntry].Port = Port;
276 ConnectionStateTable[CSTableEntry].RemoteAddress = *RemoteAddress;
277 ConnectionStateTable[CSTableEntry].RemotePort = RemotePort;
278 ConnectionStateTable[CSTableEntry].State = State;
279 return true;
280 }
281 }
282
283 return false;
284}
285
286/** Retrieves the current state of a given TCP connection to a host.
287 *
288 * \param[in] Port TCP port on the device in the connection, specified in big endian
289 * \param[in] RemoteAddress Remote protocol IP address of the connected host
290 * \param[in] RemotePort Remote TCP port of the connected host, specified in big endian
291 *
292 * \return A value from the \ref TCP_ConnectionStates_t enum
293 */
294uint8_t TCP_GetConnectionState(const uint16_t Port,
295 const IP_Address_t* RemoteAddress,
296 const uint16_t RemotePort)
297{
298 /* Note, Port number should be specified in BIG endian to simplify network code */
299
300 for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
301 {
302 /* Find port entry in the table */
303 if ((ConnectionStateTable[CSTableEntry].Port == Port) &&
304 IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, RemoteAddress) &&
305 ConnectionStateTable[CSTableEntry].RemotePort == RemotePort)
306
307 {
308 return ConnectionStateTable[CSTableEntry].State;
309 }
310 }
311
312 return TCP_Connection_Closed;
313}
314
315/** Retrieves the connection info structure of a given connection to a host.
316 *
317 * \param[in] Port TCP port on the device in the connection, specified in big endian
318 * \param[in] RemoteAddress Remote protocol IP address of the connected host
319 * \param[in] RemotePort Remote TCP port of the connected host, specified in big endian
320 *
321 * \return ConnectionInfo structure of the connection if found, NULL otherwise
322 */
323TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port,
324 const IP_Address_t* RemoteAddress,
325 const uint16_t RemotePort)
326{
327 /* Note, Port number should be specified in BIG endian to simplify network code */
328
329 for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
330 {
331 /* Find port entry in the table */
332 if ((ConnectionStateTable[CSTableEntry].Port == Port) &&
333 IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, RemoteAddress) &&
334 ConnectionStateTable[CSTableEntry].RemotePort == RemotePort)
335 {
336 return &ConnectionStateTable[CSTableEntry].Info;
337 }
338 }
339
340 return NULL;
341}
342
343/** Processes a TCP packet inside an Ethernet frame, and writes the appropriate response
344 * to the output Ethernet frame if one is created by a application handler.
345 *
346 * \param[in] IPHeaderInStart Pointer to the start of the incoming packet's IP header
347 * \param[in] TCPHeaderInStart Pointer to the start of the incoming packet's TCP header
348 * \param[out] TCPHeaderOutStart Pointer to the start of the outgoing packet's TCP header
349 *
350 * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE if no
351 * response was generated, NO_PROCESS if the packet processing was deferred until the
352 * next Ethernet packet handler iteration
353 */
354int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
355 void* TCPHeaderInStart,
356 void* TCPHeaderOutStart)
357{
358 IP_Header_t* IPHeaderIN = (IP_Header_t*)IPHeaderInStart;
359 TCP_Header_t* TCPHeaderIN = (TCP_Header_t*)TCPHeaderInStart;
360 TCP_Header_t* TCPHeaderOUT = (TCP_Header_t*)TCPHeaderOutStart;
361
362 TCP_ConnectionInfo_t* ConnectionInfo;
363
364 DecodeTCPHeader(TCPHeaderInStart);
365
366 bool PacketResponse = false;
367
368 /* Check if the destination port is open and allows incoming connections */
369 if (TCP_GetPortState(TCPHeaderIN->DestinationPort) == TCP_Port_Open)
370 {
371 /* Detect SYN from host to start a connection */
372 if (TCPHeaderIN->Flags & TCP_FLAG_SYN)
373 TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, TCP_Connection_Listen);
374
375 /* Detect RST from host to abort existing connection */
376 if (TCPHeaderIN->Flags & TCP_FLAG_RST)
377 {
378 if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
379 TCPHeaderIN->SourcePort, TCP_Connection_Closed))
380 {
381 TCPHeaderOUT->Flags = (TCP_FLAG_RST | TCP_FLAG_ACK);
382 PacketResponse = true;
383 }
384 }
385 else
386 {
387 /* Process the incoming TCP packet based on the current connection state for the sender and port */
388 switch (TCP_GetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort))
389 {
390 case TCP_Connection_Listen:
391 if (TCPHeaderIN->Flags == TCP_FLAG_SYN)
392 {
393 /* SYN connection starts a connection with a peer */
394 if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
395 TCPHeaderIN->SourcePort, TCP_Connection_SYNReceived))
396 {
397 TCPHeaderOUT->Flags = (TCP_FLAG_SYN | TCP_FLAG_ACK);
398
399 ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort);
400
401 ConnectionInfo->SequenceNumberIn = (SwapEndian_32(TCPHeaderIN->SequenceNumber) + 1);
402 ConnectionInfo->SequenceNumberOut = 0;
403 ConnectionInfo->Buffer.InUse = false;
404 }
405 else
406 {
407 TCPHeaderOUT->Flags = TCP_FLAG_RST;
408 }
409
410 PacketResponse = true;
411 }
412
413 break;
414 case TCP_Connection_SYNReceived:
415 if (TCPHeaderIN->Flags == TCP_FLAG_ACK)
416 {
417 /* ACK during the connection process completes the connection to a peer */
418
419 TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
420 TCPHeaderIN->SourcePort, TCP_Connection_Established);
421
422 ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
423 TCPHeaderIN->SourcePort);
424
425 ConnectionInfo->SequenceNumberOut++;
426 }
427
428 break;
429 case TCP_Connection_Established:
430 if (TCPHeaderIN->Flags == (TCP_FLAG_FIN | TCP_FLAG_ACK))
431 {
432 /* FIN ACK when connected to a peer starts the finalization process */
433
434 TCPHeaderOUT->Flags = (TCP_FLAG_FIN | TCP_FLAG_ACK);
435 PacketResponse = true;
436
437 TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
438 TCPHeaderIN->SourcePort, TCP_Connection_CloseWait);
439
440 ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
441 TCPHeaderIN->SourcePort);
442
443 ConnectionInfo->SequenceNumberIn++;
444 ConnectionInfo->SequenceNumberOut++;
445 }
446 else if ((TCPHeaderIN->Flags == TCP_FLAG_ACK) || (TCPHeaderIN->Flags == (TCP_FLAG_ACK | TCP_FLAG_PSH)))
447 {
448 ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
449 TCPHeaderIN->SourcePort);
450
451 /* Check if the buffer is currently in use either by a buffered data to send, or receive */
452 if ((ConnectionInfo->Buffer.InUse == false) && (ConnectionInfo->Buffer.Ready == false))
453 {
454 ConnectionInfo->Buffer.Direction = TCP_PACKETDIR_IN;
455 ConnectionInfo->Buffer.InUse = true;
456 ConnectionInfo->Buffer.Length = 0;
457 }
458
459 /* Check if the buffer has been claimed by us to read in data from the peer */
460 if ((ConnectionInfo->Buffer.Direction == TCP_PACKETDIR_IN) &&
461 (ConnectionInfo->Buffer.Length != TCP_WINDOW_SIZE))
462 {
463 uint16_t IPOffset = (IPHeaderIN->HeaderLength * sizeof(uint32_t));
464 uint16_t TCPOffset = (TCPHeaderIN->DataOffset * sizeof(uint32_t));
465 uint16_t DataLength = (SwapEndian_16(IPHeaderIN->TotalLength) - IPOffset - TCPOffset);
466
467 /* Copy the packet data into the buffer */
468 memcpy(&ConnectionInfo->Buffer.Data[ConnectionInfo->Buffer.Length],
469 &((uint8_t*)TCPHeaderInStart)[TCPOffset],
470 DataLength);
471
472 ConnectionInfo->SequenceNumberIn += DataLength;
473 ConnectionInfo->Buffer.Length += DataLength;
474
475 /* Check if the buffer is full or if the PSH flag is set, if so indicate buffer ready */
476 if ((!(TCP_WINDOW_SIZE - ConnectionInfo->Buffer.Length)) || (TCPHeaderIN->Flags & TCP_FLAG_PSH))
477 {
478 ConnectionInfo->Buffer.InUse = false;
479 ConnectionInfo->Buffer.Ready = true;
480
481 TCPHeaderOUT->Flags = TCP_FLAG_ACK;
482 PacketResponse = true;
483 }
484 }
485 else
486 {
487 /* Buffer is currently in use by the application, defer processing of the incoming packet */
488 return NO_PROCESS;
489 }
490 }
491
492 break;
493 case TCP_Connection_Closing:
494 ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
495 TCPHeaderIN->SourcePort);
496
497 TCPHeaderOUT->Flags = (TCP_FLAG_ACK | TCP_FLAG_FIN);
498 PacketResponse = true;
499
500 ConnectionInfo->Buffer.InUse = false;
501
502 TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
503 TCPHeaderIN->SourcePort, TCP_Connection_FINWait1);
504
505 break;
506 case TCP_Connection_FINWait1:
507 if (TCPHeaderIN->Flags == (TCP_FLAG_FIN | TCP_FLAG_ACK))
508 {
509 ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
510 TCPHeaderIN->SourcePort);
511
512 TCPHeaderOUT->Flags = TCP_FLAG_ACK;
513 PacketResponse = true;
514
515 ConnectionInfo->SequenceNumberIn++;
516 ConnectionInfo->SequenceNumberOut++;
517
518 TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
519 TCPHeaderIN->SourcePort, TCP_Connection_Closed);
520 }
521 else if (TCPHeaderIN->Flags == TCP_FLAG_ACK)
522 {
523 TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
524 TCPHeaderIN->SourcePort, TCP_Connection_FINWait2);
525 }
526
527 break;
528 case TCP_Connection_FINWait2:
529 if (TCPHeaderIN->Flags == (TCP_FLAG_FIN | TCP_FLAG_ACK))
530 {
531 ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
532 TCPHeaderIN->SourcePort);
533
534 TCPHeaderOUT->Flags = TCP_FLAG_ACK;
535 PacketResponse = true;
536
537 ConnectionInfo->SequenceNumberIn++;
538 ConnectionInfo->SequenceNumberOut++;
539
540 TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
541 TCPHeaderIN->SourcePort, TCP_Connection_Closed);
542 }
543
544 break;
545 case TCP_Connection_CloseWait:
546 if (TCPHeaderIN->Flags == TCP_FLAG_ACK)
547 {
548 TCP_SetConnectionState(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
549 TCPHeaderIN->SourcePort, TCP_Connection_Closed);
550 }
551
552 break;
553 }
554 }
555 }
556 else
557 {
558 /* Port is not open, indicate via a RST/ACK response to the sender */
559 TCPHeaderOUT->Flags = (TCP_FLAG_RST | TCP_FLAG_ACK);
560 PacketResponse = true;
561 }
562
563 /* Check if we need to respond to the sent packet */
564 if (PacketResponse)
565 {
566 ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, &IPHeaderIN->SourceAddress,
567 TCPHeaderIN->SourcePort);
568
569 TCPHeaderOUT->SourcePort = TCPHeaderIN->DestinationPort;
570 TCPHeaderOUT->DestinationPort = TCPHeaderIN->SourcePort;
571 TCPHeaderOUT->SequenceNumber = SwapEndian_32(ConnectionInfo->SequenceNumberOut);
572 TCPHeaderOUT->AcknowledgmentNumber = SwapEndian_32(ConnectionInfo->SequenceNumberIn);
573 TCPHeaderOUT->DataOffset = (sizeof(TCP_Header_t) / sizeof(uint32_t));
574
575 if (!(ConnectionInfo->Buffer.InUse))
576 TCPHeaderOUT->WindowSize = SwapEndian_16(TCP_WINDOW_SIZE);
577 else
578 TCPHeaderOUT->WindowSize = SwapEndian_16(TCP_WINDOW_SIZE - ConnectionInfo->Buffer.Length);
579
580 TCPHeaderOUT->UrgentPointer = 0;
581 TCPHeaderOUT->Checksum = 0;
582 TCPHeaderOUT->Reserved = 0;
583
584 TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, &IPHeaderIN->DestinationAddress,
585 &IPHeaderIN->SourceAddress, sizeof(TCP_Header_t));
586
587 return sizeof(TCP_Header_t);
588 }
589
590 return NO_RESPONSE;
591}
592
593/** Calculates the appropriate TCP checksum, consisting of the addition of the one's compliment of each word,
594 * complimented.
595 *
596 * \param[in] TCPHeaderOutStart Pointer to the start of the packet's outgoing TCP header
597 * \param[in] SourceAddress Source protocol IP address of the outgoing IP header
598 * \param[in] DestinationAddress Destination protocol IP address of the outgoing IP header
599 * \param[in] TCPOutSize Size in bytes of the TCP data header and payload
600 *
601 * \return A 16-bit TCP checksum value
602 */
603static uint16_t TCP_Checksum16(void* TCPHeaderOutStart,
604 const IP_Address_t* SourceAddress,
605 const IP_Address_t* DestinationAddress,
606 uint16_t TCPOutSize)
607{
608 uint32_t Checksum = 0;
609
610 /* TCP/IP checksums are the addition of the one's compliment of each word including the IP pseudo-header,
611 complimented */
612
613 Checksum += ((uint16_t*)SourceAddress)[0];
614 Checksum += ((uint16_t*)SourceAddress)[1];
615 Checksum += ((uint16_t*)DestinationAddress)[0];
616 Checksum += ((uint16_t*)DestinationAddress)[1];
617 Checksum += SwapEndian_16(PROTOCOL_TCP);
618 Checksum += SwapEndian_16(TCPOutSize);
619
620 for (uint16_t CurrWord = 0; CurrWord < (TCPOutSize >> 1); CurrWord++)
621 Checksum += ((uint16_t*)TCPHeaderOutStart)[CurrWord];
622
623 if (TCPOutSize & 0x01)
624 Checksum += (((uint16_t*)TCPHeaderOutStart)[TCPOutSize >> 1] & 0x00FF);
625
626 while (Checksum & 0xFFFF0000)
627 Checksum = ((Checksum & 0xFFFF) + (Checksum >> 16));
628
629 return ~Checksum;
630}
631
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h
new file mode 100644
index 000000000..ce8a9a2d0
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h
@@ -0,0 +1,260 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Header file for TCP.c.
34 */
35
36#ifndef _TCP_H_
37#define _TCP_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <stdbool.h>
42
43 #include "EthernetProtocols.h"
44 #include "Ethernet.h"
45 #include "ProtocolDecoders.h"
46
47 /* Macros: */
48 /** Maximum number of TCP ports which can be open at the one time. */
49 #define MAX_OPEN_TCP_PORTS 1
50
51 /** Maximum number of TCP connections which can be sustained at the one time. */
52 #define MAX_TCP_CONNECTIONS 3
53
54 /** TCP window size, giving the maximum number of bytes which can be buffered at the one time. */
55 #define TCP_WINDOW_SIZE 512
56
57 /** Port number for HTTP transmissions. */
58 #define TCP_PORT_HTTP SwapEndian_16(80)
59
60 /** Data direction indicator for a TCP application buffer, indicating data from host-to-device. */
61 #define TCP_PACKETDIR_IN false
62
63 /** Data direction indicator for a TCP application buffer, indicating data from device-to-host. */
64 #define TCP_PACKETDIR_OUT true
65
66 /** Congestion Window Reduced TCP flag mask. */
67 #define TCP_FLAG_CWR (1 << 7)
68
69 /** Explicit Congestion Notification TCP flag mask. */
70 #define TCP_FLAG_ECE (1 << 6)
71
72 /** Urgent TCP flag mask. */
73 #define TCP_FLAG_URG (1 << 5)
74
75 /** Data Acknowledge TCP flag mask. */
76 #define TCP_FLAG_ACK (1 << 4)
77
78 /** Data Push TCP flag mask. */
79 #define TCP_FLAG_PSH (1 << 3)
80
81 /** Reset TCP flag mask. */
82 #define TCP_FLAG_RST (1 << 2)
83
84 /** Synchronize TCP flag mask. */
85 #define TCP_FLAG_SYN (1 << 1)
86
87 /** Connection Finalize TCP flag mask. */
88 #define TCP_FLAG_FIN (1 << 0)
89
90 /** Application macro: Determines if the given application buffer contains a packet received from the host
91 *
92 * \param[in] Buffer Application buffer to check
93 *
94 * \return Boolean \c true if the buffer contains a packet from the host, \c false otherwise
95 */
96 #define TCP_APP_HAS_RECEIVED_PACKET(Buffer) (Buffer->Ready && (Buffer->Direction == TCP_PACKETDIR_IN))
97
98 /** Application macro: Indicates if the application buffer is currently locked by the application for device-to-host transfers.
99 *
100 * \param[in] Buffer Application buffer to check
101 *
102 * \return Boolean \c true if the buffer has been captured by the application for device-to-host transmissions, \c false otherwise
103 */
104 #define TCP_APP_HAVE_CAPTURED_BUFFER(Buffer) (!(Buffer->Ready) && Buffer->InUse && \
105 (Buffer->Direction == TCP_PACKETDIR_OUT))
106
107 /** Application macro: Indicates if the application can lock the buffer for multiple continued device-to-host transmissions.
108 *
109 * \param[in] Buffer Application buffer to check
110 *
111 * \return Boolean \c true if the buffer may be captured by the application for device-to-host transmissions, \c false otherwise
112 */
113 #define TCP_APP_CAN_CAPTURE_BUFFER(Buffer) Buffer->InUse
114
115 /** Application macro: Captures the application buffer, locking it for device-to-host transmissions only. This should be
116 * performed when the application needs to transmit several packets worth of data in succession with no interruptions from the host.
117 *
118 * \pre The application must check that the buffer can be locked first using TCP_APP_CAN_CAPTURE_BUFFER().
119 *
120 * \param[in] Buffer Application buffer to lock
121 */
122 #define TCP_APP_CAPTURE_BUFFER(Buffer) do { Buffer->Direction = TCP_PACKETDIR_OUT; Buffer->InUse = true; } while (0)
123
124 /** Application macro: Releases a captured application buffer, allowing for host-to-device packets to be received.
125 *
126 * \param[in] Buffer Application buffer to release
127 */
128 #define TCP_APP_RELEASE_BUFFER(Buffer) do { Buffer->InUse = false; } while (0)
129
130 /** Application macro: Sends the contents of the given application buffer to the host.
131 *
132 * \param[in] Buffer Application buffer to send
133 * \param[in] Len Length of data contained in the buffer
134 */
135 #define TCP_APP_SEND_BUFFER(Buffer, Len) do { Buffer->Direction = TCP_PACKETDIR_OUT; Buffer->Length = Len; Buffer->Ready = true; } while (0)
136
137 /** Application macro: Clears the application buffer, ready for a packet to be written to it.
138 *
139 * \param[in] Buffer Application buffer to clear
140 */
141 #define TCP_APP_CLEAR_BUFFER(Buffer) do { Buffer->Ready = false; Buffer->Length = 0; } while (0)
142
143 /** Application macro: Closes an open connection to a host.
144 *
145 * \param[in] Connection Open TCP connection to close
146 */
147 #define TCP_APP_CLOSECONNECTION(Connection) do { Connection->State = TCP_Connection_Closing; } while (0)
148
149 /* Enums: */
150 /** Enum for possible TCP port states. */
151 enum TCP_PortStates_t
152 {
153 TCP_Port_Closed = 0, /**< TCP port closed, no connections to a host may be made on this port. */
154 TCP_Port_Open = 1, /**< TCP port open, connections to a host may be made on this port. */
155 };
156
157 /** Enum for possible TCP connection states. */
158 enum TCP_ConnectionStates_t
159 {
160 TCP_Connection_Listen = 0, /**< Listening for a connection from a host */
161 TCP_Connection_SYNSent = 1, /**< Unused */
162 TCP_Connection_SYNReceived = 2, /**< SYN received, waiting for ACK */
163 TCP_Connection_Established = 3, /**< Connection established in both directions */
164 TCP_Connection_FINWait1 = 4, /**< Closing, waiting for ACK */
165 TCP_Connection_FINWait2 = 5, /**< Closing, waiting for FIN ACK */
166 TCP_Connection_CloseWait = 6, /**< Closing, waiting for ACK */
167 TCP_Connection_Closing = 7, /**< Unused */
168 TCP_Connection_LastACK = 8, /**< Unused */
169 TCP_Connection_TimeWait = 9, /**< Unused */
170 TCP_Connection_Closed = 10, /**< Connection closed in both directions */
171 };
172
173 /* Type Defines: */
174 /** Type define for a TCP connection buffer structure, including size, data and direction. */
175 typedef struct
176 {
177 uint16_t Length; /**< Length of data in the TCP application buffer */
178 uint8_t Data[TCP_WINDOW_SIZE]; /**< TCP application data buffer */
179 bool Direction; /**< Buffer transmission direction, either TCP_PACKETDIR_IN or TCP_PACKETDIR_OUT */
180 bool Ready; /**< If data from host, indicates buffer ready to be read, otherwise indicates
181 * buffer ready to be sent to the host
182 */
183 bool InUse; /**< Indicates if the buffer is locked to to the current direction, and cannot be changed */
184 } TCP_ConnectionBuffer_t;
185
186 /** Type define for a TCP connection information structure. */
187 typedef struct
188 {
189 uint32_t SequenceNumberIn; /**< Current TCP sequence number for host-to-device */
190 uint32_t SequenceNumberOut; /**< Current TCP sequence number for device-to-host */
191 TCP_ConnectionBuffer_t Buffer; /**< Connection application data buffer */
192 } TCP_ConnectionInfo_t;
193
194 /** Type define for a complete TCP connection state. */
195 typedef struct
196 {
197 uint16_t Port; /**< Connection port number on the device */
198 uint16_t RemotePort; /**< Connection port number on the host */
199 IP_Address_t RemoteAddress; /**< Connection protocol IP address of the host */
200 TCP_ConnectionInfo_t Info; /**< Connection information, including application buffer */
201 uint8_t State; /**< Current connection state, a value from the \ref TCP_ConnectionStates_t enum */
202 } TCP_ConnectionState_t;
203
204 /** Type define for a TCP port state. */
205 typedef struct
206 {
207 uint16_t Port; /**< TCP port number on the device */
208 uint8_t State; /**< Current port state, a value from the \ref TCP_PortStates_t enum */
209 void (*ApplicationHandler) (TCP_ConnectionState_t* ConnectionState,
210 TCP_ConnectionBuffer_t* Buffer); /**< Port application handler */
211 } TCP_PortState_t;
212
213 /** Type define for a TCP packet header. */
214 typedef struct
215 {
216 uint16_t SourcePort; /**< Source port of the TCP packet */
217 uint16_t DestinationPort; /**< Destination port of the TCP packet */
218
219 uint32_t SequenceNumber; /**< Data sequence number of the packet */
220 uint32_t AcknowledgmentNumber; /**< Data acknowledgment number of the packet */
221
222 unsigned Reserved : 4; /**< Reserved, must be all 0 */
223 unsigned DataOffset : 4; /**< Offset of the data from the start of the header, in 4 byte chunks */
224 uint8_t Flags; /**< TCP packet flags */
225 uint16_t WindowSize; /**< Current data window size (bytes remaining in reception buffer) */
226
227 uint16_t Checksum; /**< TCP checksum */
228 uint16_t UrgentPointer; /**< Urgent data pointer */
229 } TCP_Header_t;
230
231 /* Function Prototypes: */
232 void TCP_Init(void);
233 void TCP_Task(void);
234 bool TCP_SetPortState(const uint16_t Port,
235 const uint8_t State,
236 void (*Handler)(TCP_ConnectionState_t*, TCP_ConnectionBuffer_t*));
237 uint8_t TCP_GetPortState(const uint16_t Port);
238 bool TCP_SetConnectionState(const uint16_t Port,
239 const IP_Address_t* RemoteAddress,
240 const uint16_t RemotePort,
241 const uint8_t State);
242 uint8_t TCP_GetConnectionState(const uint16_t Port,
243 const IP_Address_t* RemoteAddress,
244 const uint16_t RemotePort);
245 TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port,
246 const IP_Address_t* RemoteAddress,
247 const uint16_t RemotePort);
248 int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
249 void* TCPHeaderInStart,
250 void* TCPHeaderOutStart);
251
252 #if defined(INCLUDE_FROM_TCP_C)
253 static uint16_t TCP_Checksum16(void* TCPHeaderOutStart,
254 const IP_Address_t* SourceAddress,
255 const IP_Address_t* DestinationAddress,
256 uint16_t TCPOutSize);
257 #endif
258
259#endif
260
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c
new file mode 100644
index 000000000..03c19e00e
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c
@@ -0,0 +1,84 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * User Datagram Protocol (UDP) packet handling routines. This protocol handles high throughput, low
34 * reliability packets which are typically used to encapsulate streaming data.
35 */
36
37#define INCLUDE_FROM_UDP_C
38#include "UDP.h"
39
40/** Processes a UDP packet inside an Ethernet frame, and writes the appropriate response
41 * to the output Ethernet frame if a sub-protocol handler has created a response packet.
42 *
43 * \param[in] IPHeaderInStart Pointer to the start of the incoming packet's IP header
44 * \param[in] UDPHeaderInStart Pointer to the start of the incoming packet's UDP header
45 * \param[out] UDPHeaderOutStart Pointer to the start of the outgoing packet's UDP header
46 *
47 * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise
48 */
49int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
50 void* UDPHeaderInStart,
51 void* UDPHeaderOutStart)
52{
53 UDP_Header_t* UDPHeaderIN = (UDP_Header_t*)UDPHeaderInStart;
54 UDP_Header_t* UDPHeaderOUT = (UDP_Header_t*)UDPHeaderOutStart;
55
56 int16_t RetSize = NO_RESPONSE;
57
58 DecodeUDPHeader(UDPHeaderInStart);
59
60 switch (SwapEndian_16(UDPHeaderIN->DestinationPort))
61 {
62 case UDP_PORT_DHCP_REQUEST:
63 RetSize = DHCP_ProcessDHCPPacket(IPHeaderInStart,
64 &((uint8_t*)UDPHeaderInStart)[sizeof(UDP_Header_t)],
65 &((uint8_t*)UDPHeaderOutStart)[sizeof(UDP_Header_t)]);
66 break;
67 }
68
69 /* Check to see if the protocol processing routine has filled out a response */
70 if (RetSize > 0)
71 {
72 /* Fill out the response UDP packet header */
73 UDPHeaderOUT->SourcePort = UDPHeaderIN->DestinationPort;
74 UDPHeaderOUT->DestinationPort = UDPHeaderIN->SourcePort;
75 UDPHeaderOUT->Checksum = 0;
76 UDPHeaderOUT->Length = SwapEndian_16(sizeof(UDP_Header_t) + RetSize);
77
78 /* Return the size of the response so far */
79 return (sizeof(UDP_Header_t) + RetSize);
80 }
81
82 return NO_RESPONSE;
83}
84
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h
new file mode 100644
index 000000000..d008cb8ed
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h
@@ -0,0 +1,73 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Header file for UDP.c.
34 */
35
36#ifndef _UDP_H_
37#define _UDP_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41
42 #include "EthernetProtocols.h"
43 #include "Ethernet.h"
44 #include "ProtocolDecoders.h"
45 #include "DHCP.h"
46
47 /* Macros: */
48 /** Source UDP port for a DHCP request. */
49 #define UDP_PORT_DHCP_REQUEST 67
50
51 /** Destination UDP port for a DHCP reply. */
52 #define UDP_PORT_DHCP_REPLY 68
53
54 /** Source UDP port for a DNS request/response. */
55 #define UDP_PORT_DNS 53
56
57 /* Type Defines: */
58 /** Type define for a UDP packet header. */
59 typedef struct
60 {
61 uint16_t SourcePort; /**< Packet source port */
62 uint16_t DestinationPort; /**< Packet destination port */
63 uint16_t Length; /**< Total packet length, in bytes */
64 uint16_t Checksum; /**< Optional UDP packet checksum */
65 } UDP_Header_t;
66
67 /* Function Prototypes: */
68 int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
69 void* UDPHeaderInStart,
70 void* UDPHeaderOutStart);
71
72#endif
73
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c
new file mode 100644
index 000000000..e0d9e3647
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c
@@ -0,0 +1,203 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Simple webserver application for demonstrating the RNDIS demo and TCP/IP stack. This
34 * application will serve up a static HTTP webpage when requested by the host.
35 */
36
37#include "Webserver.h"
38
39/** HTTP server response header, for transmission before the page contents. This indicates to the host that a page exists at the
40 * given location, and gives extra connection information.
41 */
42const char PROGMEM HTTP200Header[] = "HTTP/1.1 200 OK\r\n"
43 "Server: LUFA RNDIS\r\n"
44 "Content-type: text/html\r\n"
45 "Connection: close\r\n\r\n";
46
47/** HTTP server response header, for transmission before a resource not found error. This indicates to the host that the given
48 * given URL is invalid, and gives extra error information.
49 */
50const char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n"
51 "Server: LUFA RNDIS\r\n"
52 "Connection: close\r\n\r\n";
53
54/** HTTP page to serve to the host when a HTTP request is made. This page is too long for a single response, thus it is automatically
55 * broken up into smaller blocks and sent as a series of packets each time the webserver application callback is run.
56 */
57const char PROGMEM HTTPPage[] =
58 "<html>"
59 " <head>"
60 " <title>"
61 " LUFA Webserver Demo"
62 " </title>"
63 " </head>"
64 " <body>"
65 " <h1>Hello from your USB AVR!</h1>"
66 " <p>"
67 " Hello! Welcome to the LUFA RNDIS Demo Webserver test page, running on your USB AVR via the LUFA library. This demonstrates the HTTP webserver, TCP/IP stack and RNDIS demo all running atop the LUFA USB stack."
68 " <br /><br />"
69 " <small>Project Information: <a href=\"http://www.lufa-lib.org\">http://www.lufa-lib.org</a>.</small>"
70 " <hr />"
71 " <i>LUFA Version: </i>" LUFA_VERSION_STRING
72 " </p>"
73 " </body>"
74 "</html>";
75
76
77/** Initializes the Webserver application, opening the appropriate HTTP port in the TCP handler and registering the application
78 * callback routine for packets sent to the HTTP protocol port.
79 */
80void Webserver_Init(void)
81{
82 /* Open the HTTP port in the TCP protocol so that HTTP connections to the device can be established */
83 TCP_SetPortState(TCP_PORT_HTTP, TCP_Port_Open, Webserver_ApplicationCallback);
84}
85
86/** Indicates if a given request equals the given HTTP command.
87 *
88 * \param[in] RequestHeader HTTP request made by the host
89 * \param[in] Command HTTP command to compare the request to
90 *
91 * \return Boolean \c true if the command matches the request, \c false otherwise
92 */
93static bool IsHTTPCommand(uint8_t* RequestHeader,
94 char* Command)
95{
96 /* Returns true if the non null terminated string in RequestHeader matches the null terminated string Command */
97 return (strncmp((char*)RequestHeader, Command, strlen(Command)) == 0);
98}
99
100/** Application callback routine, executed each time the TCP processing task runs. This callback determines what request
101 * has been made (if any), and serves up appropriate responses.
102 *
103 * \param[in] ConnectionState Pointer to a TCP Connection State structure giving connection information
104 * \param[in,out] Buffer Pointer to the application's send/receive packet buffer
105 */
106void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
107 TCP_ConnectionBuffer_t* const Buffer)
108{
109 char* BufferDataStr = (char*)Buffer->Data;
110 static uint8_t PageBlock = 0;
111
112 /* Check to see if a packet has been received on the HTTP port from a remote host */
113 if (TCP_APP_HAS_RECEIVED_PACKET(Buffer))
114 {
115 if (IsHTTPCommand(Buffer->Data, "GET"))
116 {
117 if (IsHTTPCommand(Buffer->Data, "GET / "))
118 {
119 PageBlock = 0;
120
121 /* Copy the HTTP 200 response header into the packet buffer */
122 strcpy_P(BufferDataStr, HTTP200Header);
123
124 /* Send the buffer contents to the host */
125 TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
126
127 /* Lock the buffer to Device->Host transmissions only while we send the page contents */
128 TCP_APP_CAPTURE_BUFFER(Buffer);
129 }
130 else
131 {
132 /* Copy the HTTP 404 response header into the packet buffer */
133 strcpy_P(BufferDataStr, HTTP404Header);
134
135 /* Send the buffer contents to the host */
136 TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
137
138 /* All data sent, close the connection */
139 TCP_APP_CLOSECONNECTION(ConnectionState);
140 }
141 }
142 else if (IsHTTPCommand(Buffer->Data, "HEAD"))
143 {
144 if (IsHTTPCommand(Buffer->Data, "HEAD / "))
145 {
146 /* Copy the HTTP response header into the packet buffer */
147 strcpy_P(BufferDataStr, HTTP200Header);
148
149 /* Send the buffer contents to the host */
150 TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
151 }
152 else
153 {
154 /* Copy the HTTP response header into the packet buffer */
155 strcpy_P(BufferDataStr, HTTP404Header);
156
157 /* Send the buffer contents to the host */
158 TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
159 }
160
161 /* All data sent, close the connection */
162 TCP_APP_CLOSECONNECTION(ConnectionState);
163 }
164 else if (IsHTTPCommand(Buffer->Data, "TRACE"))
165 {
166 /* Echo the host's query back to the host */
167 TCP_APP_SEND_BUFFER(Buffer, Buffer->Length);
168
169 /* All data sent, close the connection */
170 TCP_APP_CLOSECONNECTION(ConnectionState);
171 }
172 else
173 {
174 /* Unknown request, just clear the buffer (drop the packet) */
175 TCP_APP_CLEAR_BUFFER(Buffer);
176 }
177 }
178 else if (TCP_APP_HAVE_CAPTURED_BUFFER(Buffer))
179 {
180 uint16_t RemLength = strlen_P(&HTTPPage[PageBlock * HTTP_REPLY_BLOCK_SIZE]);
181 uint16_t Length;
182
183 /* Determine the length of the loaded block */
184 Length = MIN(RemLength, HTTP_REPLY_BLOCK_SIZE);
185
186 /* Copy the next buffer sized block of the page to the packet buffer */
187 strncpy_P(BufferDataStr, &HTTPPage[PageBlock * HTTP_REPLY_BLOCK_SIZE], Length);
188
189 /* Send the buffer contents to the host */
190 TCP_APP_SEND_BUFFER(Buffer, Length);
191
192 /* Check to see if the entire page has been sent */
193 if (PageBlock++ == (sizeof(HTTPPage) / HTTP_REPLY_BLOCK_SIZE))
194 {
195 /* Unlock the buffer so that the host can fill it with future packets */
196 TCP_APP_RELEASE_BUFFER(Buffer);
197
198 /* Close the connection to the host */
199 TCP_APP_CLOSECONNECTION(ConnectionState);
200 }
201 }
202}
203
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h
new file mode 100644
index 000000000..a73bd3338
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h
@@ -0,0 +1,57 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Header file for Webserver.c.
34 */
35
36#ifndef _WEBSERVER_H_
37#define _WEBSERVER_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <avr/pgmspace.h>
42
43 #include <LUFA/Version.h>
44
45 #include "TCP.h"
46
47 /* Macros: */
48 /** Maximum size of a HTTP response per transmission */
49 #define HTTP_REPLY_BLOCK_SIZE 128
50
51 /* Function Prototypes: */
52 void Webserver_Init(void);
53 void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
54 TCP_ConnectionBuffer_t* const Buffer);
55
56#endif
57
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c
new file mode 100644
index 000000000..f1dd7a788
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c
@@ -0,0 +1,294 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Main source file for the RNDISEthernet demo. This file contains the main tasks of the demo and
34 * is responsible for the initial application hardware configuration.
35 */
36
37#include "RNDISEthernet.h"
38
39/** Main program entry point. This routine configures the hardware required by the application, then
40 * enters a loop to run the application tasks in sequence.
41 */
42int main(void)
43{
44 SetupHardware();
45
46 /* Webserver Initialization */
47 TCP_Init();
48 Webserver_Init();
49
50 LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
51 GlobalInterruptEnable();
52
53 for (;;)
54 {
55 Ethernet_Task();
56 TCP_Task();
57 RNDIS_Task();
58 USB_USBTask();
59 }
60}
61
62/** Configures the board hardware and chip peripherals for the demo's functionality. */
63void SetupHardware(void)
64{
65#if (ARCH == ARCH_AVR8)
66 /* Disable watchdog if enabled by bootloader/fuses */
67 MCUSR &= ~(1 << WDRF);
68 wdt_disable();
69
70 /* Disable clock division */
71 clock_prescale_set(clock_div_1);
72#elif (ARCH == ARCH_XMEGA)
73 /* Start the PLL to multiply the 2MHz RC oscillator to 32MHz and switch the CPU core to run from it */
74 XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU);
75 XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL);
76
77 /* Start the 32MHz internal RC oscillator and start the DFLL to increase it to 48MHz using the USB SOF as a reference */
78 XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ);
79 XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB);
80
81 PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;
82#endif
83
84 /* Hardware Initialization */
85 LEDs_Init();
86 Serial_Init(9600, false);
87 USB_Init();
88
89 /* Create a stdio stream for the serial port for stdin and stdout */
90 Serial_CreateStream(NULL);
91}
92
93/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and
94 * starts the library USB task to begin the enumeration and USB management process.
95 */
96void EVENT_USB_Device_Connect(void)
97{
98 /* Indicate USB enumerating */
99 LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
100}
101
102/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
103 * the status LEDs and stops all the relevant tasks.
104 */
105void EVENT_USB_Device_Disconnect(void)
106{
107 /* Indicate USB not ready */
108 LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
109}
110
111/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration
112 * of the USB device after enumeration, and configures the RNDIS device endpoints and starts the relevant tasks.
113 */
114void EVENT_USB_Device_ConfigurationChanged(void)
115{
116 bool ConfigSuccess = true;
117
118 /* Setup RNDIS Data Endpoints */
119 ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_TX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
120 ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_RX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
121 ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPADDR, EP_TYPE_INTERRUPT, CDC_NOTIFICATION_EPSIZE, 1);
122
123 /* Indicate endpoint configuration success or failure */
124 LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
125}
126
127/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
128 * the device from the USB host before passing along unhandled control requests to the library for processing
129 * internally.
130 */
131void EVENT_USB_Device_ControlRequest(void)
132{
133 /* Process RNDIS class commands */
134 switch (USB_ControlRequest.bRequest)
135 {
136 case RNDIS_REQ_SendEncapsulatedCommand:
137 if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
138 {
139 Endpoint_ClearSETUP();
140
141 /* Read in the RNDIS message into the message buffer */
142 Endpoint_Read_Control_Stream_LE(RNDISMessageBuffer, USB_ControlRequest.wLength);
143 Endpoint_ClearIN();
144
145 /* Process the RNDIS message */
146 ProcessRNDISControlMessage();
147 }
148
149 break;
150 case RNDIS_REQ_GetEncapsulatedResponse:
151 if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
152 {
153 /* Check if a response to the last message is ready */
154 if (!(MessageHeader->MessageLength))
155 {
156 /* Set the response to a single 0x00 byte to indicate that no response is ready */
157 RNDISMessageBuffer[0] = 0;
158 MessageHeader->MessageLength = 1;
159 }
160
161 Endpoint_ClearSETUP();
162
163 /* Write the message response data to the endpoint */
164 Endpoint_Write_Control_Stream_LE(RNDISMessageBuffer, MessageHeader->MessageLength);
165 Endpoint_ClearOUT();
166
167 /* Reset the message header once again after transmission */
168 MessageHeader->MessageLength = 0;
169 }
170
171 break;
172 }
173}
174
175/** Task to manage the sending and receiving of encapsulated RNDIS data and notifications. This removes the RNDIS
176 * wrapper from received Ethernet frames and places them in the FrameIN global buffer, or adds the RNDIS wrapper
177 * to a frame in the FrameOUT global before sending the buffer contents to the host.
178 */
179void RNDIS_Task(void)
180{
181 /* Select the notification endpoint */
182 Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPADDR);
183
184 /* Check if a message response is ready for the host */
185 if (Endpoint_IsINReady() && ResponseReady)
186 {
187 USB_Request_Header_t Notification = (USB_Request_Header_t)
188 {
189 .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
190 .bRequest = RNDIS_NOTIF_ResponseAvailable,
191 .wValue = 0,
192 .wIndex = 0,
193 .wLength = 0,
194 };
195
196 /* Indicate that a message response is ready for the host */
197 Endpoint_Write_Stream_LE(&Notification, sizeof(Notification), NULL);
198
199 /* Finalize the stream transfer to send the last packet */
200 Endpoint_ClearIN();
201
202 /* Indicate a response is no longer ready */
203 ResponseReady = false;
204 }
205
206 /* Don't process the data endpoints until the system is in the data initialized state, and the buffer is free */
207 if ((CurrRNDISState == RNDIS_Data_Initialized) && !(MessageHeader->MessageLength))
208 {
209 /* Create a new packet header for reading/writing */
210 RNDIS_Packet_Message_t RNDISPacketHeader;
211
212 /* Select the data OUT endpoint */
213 Endpoint_SelectEndpoint(CDC_RX_EPADDR);
214
215 /* Check if the data OUT endpoint contains data, and that the IN buffer is empty */
216 if (Endpoint_IsOUTReceived() && !(FrameIN.FrameLength))
217 {
218 /* Read in the packet message header */
219 Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL);
220
221 /* Stall the request if the data is too large */
222 if (RNDISPacketHeader.DataLength > ETHERNET_FRAME_SIZE_MAX)
223 {
224 Endpoint_StallTransaction();
225 return;
226 }
227
228 /* Read in the Ethernet frame into the buffer */
229 Endpoint_Read_Stream_LE(FrameIN.FrameData, RNDISPacketHeader.DataLength, NULL);
230
231 /* Finalize the stream transfer to send the last packet */
232 Endpoint_ClearOUT();
233
234 /* Store the size of the Ethernet frame */
235 FrameIN.FrameLength = RNDISPacketHeader.DataLength;
236 }
237
238 /* Select the data IN endpoint */
239 Endpoint_SelectEndpoint(CDC_TX_EPADDR);
240
241 /* Check if the data IN endpoint is ready for more data, and that the IN buffer is full */
242 if (Endpoint_IsINReady() && FrameOUT.FrameLength)
243 {
244 /* Clear the packet header with all 0s so that the relevant fields can be filled */
245 memset(&RNDISPacketHeader, 0, sizeof(RNDIS_Packet_Message_t));
246
247 /* Construct the required packet header fields in the buffer */
248 RNDISPacketHeader.MessageType = REMOTE_NDIS_PACKET_MSG;
249 RNDISPacketHeader.MessageLength = (sizeof(RNDIS_Packet_Message_t) + FrameOUT.FrameLength);
250 RNDISPacketHeader.DataOffset = (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));
251 RNDISPacketHeader.DataLength = FrameOUT.FrameLength;
252
253 /* Send the packet header to the host */
254 Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL);
255
256 /* Send the Ethernet frame data to the host */
257 Endpoint_Write_Stream_LE(FrameOUT.FrameData, RNDISPacketHeader.DataLength, NULL);
258
259 /* Finalize the stream transfer to send the last packet */
260 Endpoint_ClearIN();
261
262 /* Indicate Ethernet OUT buffer no longer full */
263 FrameOUT.FrameLength = 0;
264 }
265 }
266}
267
268/** Ethernet frame processing task. This task checks to see if a frame has been received, and if so hands off the processing
269 * of the frame to the Ethernet processing routines.
270 */
271void Ethernet_Task(void)
272{
273 /* Task for Ethernet processing. Incoming ethernet frames are loaded into the FrameIN structure, and
274 outgoing frames should be loaded into the FrameOUT structure. Both structures can only hold a single
275 Ethernet frame at a time, so the FrameInBuffer bool is used to indicate when the buffers contain data. */
276
277 /* Device must be connected and configured for the task to run */
278 if (USB_DeviceState != DEVICE_STATE_Configured)
279 return;
280
281 /* Check if a frame has been written to the IN frame buffer */
282 if (FrameIN.FrameLength)
283 {
284 /* Indicate packet processing started */
285 LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
286
287 /* Process the ethernet frame - replace this with your own Ethernet handler code as desired */
288 Ethernet_ProcessPacket();
289
290 /* Indicate packet processing complete */
291 LEDs_SetAllLEDs(LEDMASK_USB_READY);
292 }
293}
294
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h
new file mode 100644
index 000000000..89858a58b
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h
@@ -0,0 +1,87 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2017.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 *
33 * Header file for RNDISEthernet.c.
34 */
35
36#ifndef _RNDISETHERNET_H_
37#define _RNDISETHERNET_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <avr/wdt.h>
42 #include <avr/power.h>
43 #include <avr/interrupt.h>
44 #include <string.h>
45
46 #include "Descriptors.h"
47
48 #include "Lib/RNDIS.h"
49 #include "Lib/Ethernet.h"
50 #include "Lib/TCP.h"
51 #include "Lib/ARP.h"
52 #include "Lib/Webserver.h"
53 #include "Config/AppConfig.h"
54
55 #include <LUFA/Drivers/USB/USB.h>
56 #include <LUFA/Drivers/Board/LEDs.h>
57 #include <LUFA/Drivers/Peripheral/Serial.h>
58 #include <LUFA/Platform/Platform.h>
59
60 /* Macros: */
61 /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
62 #define LEDMASK_USB_NOTREADY LEDS_LED1
63
64 /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
65 #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
66
67 /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
68 #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
69
70 /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
71 #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
72
73 /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
74 #define LEDMASK_USB_BUSY LEDS_LED2
75
76 /* Function Prototypes: */
77 void SetupHardware(void);
78 void RNDIS_Task(void);
79 void Ethernet_Task(void);
80
81 void EVENT_USB_Device_Connect(void);
82 void EVENT_USB_Device_Disconnect(void);
83 void EVENT_USB_Device_ConfigurationChanged(void);
84 void EVENT_USB_Device_ControlRequest(void);
85
86#endif
87
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt
new file mode 100644
index 000000000..a2c2ac604
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt
@@ -0,0 +1,146 @@
1/** \file
2 *
3 * This file contains special DoxyGen information for the generation of the main page and other special
4 * documentation pages. It is not a project source file.
5 */
6
7/** \mainpage RNDIS Class Ethernet Demo (with Webserver/Telnet)
8 *
9 * \section Sec_Compat Demo Compatibility:
10 *
11 * The following list indicates what microcontrollers are compatible with this demo.
12 *
13 * \li Series 7 USB AVRs (AT90USBxxx7)
14 * \li Series 6 USB AVRs (AT90USBxxx6)
15 * \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
16 * \li Series B XMEGA AVRs (ATXMEGAxxxBx)
17 * \li Series C XMEGA AVRs (ATXMEGAxxxCx)
18 *
19 * \section Sec_Info USB Information:
20 *
21 * The following table gives a rundown of the USB utilization of this demo.
22 *
23 * <table>
24 * <tr>
25 * <td><b>USB Mode:</b></td>
26 * <td>Device</td>
27 * </tr>
28 * <tr>
29 * <td><b>USB Class:</b></td>
30 * <td>Communications Device Class (CDC)</td>
31 * </tr>
32 * <tr>
33 * <td><b>USB Subclass:</b></td>
34 * <td>Remote NDIS (Microsoft Proprietary CDC Class Networking Standard)</td>
35 * </tr>
36 * <tr>
37 * <td><b>Relevant Standards:</b></td>
38 * <td>Microsoft RNDIS Specification</td>
39 * </tr>
40 * <tr>
41 * <td><b>Supported USB Speeds:</b></td>
42 * <td>Full Speed Mode</td>
43 * </tr>
44 * </table>
45 *
46 * \section Sec_Description Project Description:
47 *
48 * Remote Network Driver Interface demonstration application.
49 * This gives a simple reference application for implementing
50 * a CDC RNDIS device acting as a simple network interface for
51 * ethernet packet exchange. RNDIS is a proprietary Microsoft
52 * standard; this demo will only work on Windows 2000 (manually
53 * patched with the Microsoft RNDIS hotfix) and above (with no
54 * manual patches), or on the latest Linux kernels.
55 *
56 * Before running, you will need to install the INF file that
57 * is located in the RNDISEthernet project directory. This will
58 * enable Windows to use its inbuilt RNDIS drivers, negating the
59 * need for special Windows drivers for the device. To install,
60 * right-click the .INF file and choose the Install option. If
61 * Windows 2000 is used, the Microsoft INF file in the hotfix
62 * will need to be altered to use the VID/PID of the demo and
63 * then chosen instead of the LUFA RNDIS INF file when prompted.
64 *
65 * When enumerated, this demo will install as a new network
66 * adapter which ethernet packets can be sent to and received
67 * from. Running on top of the adapter is a very simple TCP/IP
68 * stack with a HTTP webserver and TELNET host which can be
69 * accessed through a web browser at IP address 10.0.0.2:80 or
70 * through a TELNET client at 10.0.0.2:25. This device also supports
71 * ping echos via the ICMP protocol.
72 *
73 * \note The TCP/IP stack in this demo has a number of limitations
74 * and should serve as an example only - it is not fully featured nor
75 * compliant to the TCP/IP specification. For complete projects, it is
76 * recommended that it be replaced with an external open source TCP/IP
77 * stack that is feature complete, such as the uIP stack.
78 *
79 * \section Sec_Options Project Options
80 *
81 * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
82 *
83 * <table>
84 * <tr>
85 * <th><b>Define Name:</b></th>
86 * <th><b>Location:</b></th>
87 * <th><b>Description:</b></th>
88 * </tr>
89 * <tr>
90 * <td>CLIENT_IP_ADDRESS</td>
91 * <td>AppConfig.h</td>
92 * <td>Configures the IP address given to the client (PC) via the DHCP server.</td>
93 * </tr>
94 * <tr>
95 * <td>SERVER_IP_ADDRESS</td>
96 * <td>AppConfig.h</td>
97 * <td>Configures the IP address of the virtual server.</td>
98 * </tr>
99 * <tr>
100 * <td>ADAPTER_MAC_ADDRESS</td>
101 * <td>AppConfig.h</td>
102 * <td>Configures the MAC address of the RNDIS adapter on the host (PC) side.</td>
103 * </tr>
104 * <tr>
105 * <td>SERVER_MAC_ADDRESS</td>
106 * <td>AppConfig.h</td>
107 * <td>Configures the MAC address of the virtual server on the network.</td>
108 * </tr>
109 * <tr>
110 * <td>NO_DECODE_ETHERNET</td>
111 * <td>AppConfig.h</td>
112 * <td>When defined, received Ethernet headers will not be decoded and printed to the device serial port.</td>
113 * </tr>
114 * <tr>
115 * <td>NO_DECODE_ARP</td>
116 * <td>AppConfig.h</td>
117 * <td>When defined, received ARP headers will not be decoded and printed to the device serial port.</td>
118 * </tr>
119 * <tr>
120 * <td>NO_DECODE_IP</td>
121 * <td>AppConfig.h</td>
122 * <td>When defined, received IP headers will not be decoded and printed to the device serial port.</td>
123 * </tr>
124 * <tr>
125 * <td>NO_DECODE_ICMP</td>
126 * <td>AppConfig.h</td>
127 * <td>When defined, received ICMP headers will not be decoded and printed to the device serial port.</td>
128 * </tr>
129 * <tr>
130 * <td>NO_DECODE_TCP</td>
131 * <td>AppConfig.h</td>
132 * <td>When defined, received TCP headers will not be decoded and printed to the device serial port.</td>
133 * </tr>
134 * <tr>
135 * <td>NO_DECODE_UDP</td>
136 * <td>AppConfig.h</td>
137 * <td>When defined, received UDP headers will not be decoded and printed to the device serial port.</td>
138 * </tr>
139 * <tr>
140 * <td>NO_DECODE_DHCP</td>
141 * <td>AppConfig.h</td>
142 * <td>When defined, received DHCP headers will not be decoded and printed to the device serial port.</td>
143 * </tr>
144 * </table>
145 */
146
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/asf.xml b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/asf.xml
new file mode 100644
index 000000000..5bdbf635f
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/asf.xml
@@ -0,0 +1,86 @@
1<asf xmlversion="1.0">
2 <project caption="RNDIS Ethernet Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.rndis.example.avr8">
3 <require idref="lufa.demos.device.lowlevel.rndis"/>
4 <require idref="lufa.boards.dummy.avr8"/>
5 <generator value="as5_8"/>
6
7 <device-support value="at90usb1287"/>
8 <config name="lufa.drivers.board.name" value="none"/>
9
10 <build type="define" name="F_CPU" value="16000000UL"/>
11 <build type="define" name="F_USB" value="16000000UL"/>
12 </project>
13
14 <project caption="RNDIS Ethernet Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.rndis.example.xmega">
15 <require idref="lufa.demos.device.lowlevel.rndis"/>
16 <require idref="lufa.boards.dummy.xmega"/>
17 <generator value="as5_8"/>
18
19 <device-support value="atxmega128a1u"/>
20 <config name="lufa.drivers.board.name" value="none"/>
21
22 <build type="define" name="F_CPU" value="32000000UL"/>
23 <build type="define" name="F_USB" value="48000000UL"/>
24 </project>
25
26 <module type="application" id="lufa.demos.device.lowlevel.rndis" caption="RNDIS Ethernet Device Demo (Low Level APIs)">
27 <info type="description" value="summary">
28 Microsoft RNDIS Ethernet networking device demo, implementing a basic HTTP webserver. This demo uses the Low Level LUFA APIs to manually implement a USB Class for demonstration purposes without using the simpler in-built LUFA Class Driver APIs.
29 </info>
30
31 <info type="gui-flag" value="move-to-root"/>
32
33 <info type="keyword" value="Technology">
34 <keyword value="Low Level APIs"/>
35 <keyword value="USB Device"/>
36 <keyword value="RNDIS Class"/>
37 </info>
38
39 <device-support-alias value="lufa_avr8"/>
40 <device-support-alias value="lufa_xmega"/>
41 <device-support-alias value="lufa_uc3"/>
42
43 <build type="distribute" subtype="user-file" value="doxyfile"/>
44 <build type="distribute" subtype="user-file" value="RNDISEthernet.txt"/>
45 <build type="distribute" subtype="user-file" value="LUFA RNDIS.inf"/>
46
47 <build type="c-source" value="RNDISEthernet.c"/>
48 <build type="c-source" value="Descriptors.c"/>
49 <build type="c-source" value="Lib/ARP.c"/>
50 <build type="c-source" value="Lib/DHCP.c"/>
51 <build type="c-source" value="Lib/Ethernet.c"/>
52 <build type="c-source" value="Lib/ICMP.c"/>
53 <build type="c-source" value="Lib/IP.c"/>
54 <build type="c-source" value="Lib/ProtocolDecoders.c"/>
55 <build type="c-source" value="Lib/RNDIS.c"/>
56 <build type="c-source" value="Lib/TCP.c"/>
57 <build type="c-source" value="Lib/UDP.c"/>
58 <build type="c-source" value="Lib/Webserver.c"/>
59 <build type="header-file" value="RNDISEthernet.h"/>
60 <build type="header-file" value="Descriptors.h"/>
61 <build type="header-file" value="Lib/ARP.h"/>
62 <build type="header-file" value="Lib/DHCP.h"/>
63 <build type="header-file" value="Lib/Ethernet.h"/>
64 <build type="header-file" value="Lib/ICMP.h"/>
65 <build type="header-file" value="Lib/IP.h"/>
66 <build type="header-file" value="Lib/ProtocolDecoders.h"/>
67 <build type="header-file" value="Lib/RNDIS.h"/>
68 <build type="header-file" value="Lib/TCP.h"/>
69 <build type="header-file" value="Lib/UDP.h"/>
70 <build type="header-file" value="Lib/Webserver.h"/>
71 <build type="header-file" value="Lib/EthernetProtocols.h"/>
72
73 <build type="module-config" subtype="path" value="Config"/>
74 <build type="module-config" subtype="required-header-file" value="AppConfig.h"/>
75 <build type="header-file" value="Config/AppConfig.h"/>
76 <build type="header-file" value="Config/LUFAConfig.h"/>
77
78 <require idref="lufa.common"/>
79 <require idref="lufa.platform"/>
80 <require idref="lufa.drivers.usb"/>
81 <require idref="lufa.drivers.board"/>
82 <require idref="lufa.drivers.board.leds"/>
83 <require idref="lufa.drivers.peripheral.usart"/>
84 <require idref="lufa.drivers.misc.ansi"/>
85 </module>
86</asf>
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/doxyfile b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/doxyfile
new file mode 100644
index 000000000..29d07c317
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/doxyfile
@@ -0,0 +1,2395 @@
1# Doxyfile 1.8.9
2
3# This file describes the settings to be used by the documentation system
4# doxygen (www.doxygen.org) for a project.
5#
6# All text after a double hash (##) is considered a comment and is placed in
7# front of the TAG it is preceding.
8#
9# All text after a single hash (#) is considered a comment and will be ignored.
10# The format is:
11# TAG = value [value, ...]
12# For lists, items can also be appended using:
13# TAG += value [value, ...]
14# Values that contain spaces should be placed between quotes (\" \").
15
16#---------------------------------------------------------------------------
17# Project related configuration options
18#---------------------------------------------------------------------------
19
20# This tag specifies the encoding used for all characters in the config file
21# that follow. The default is UTF-8 which is also the encoding used for all text
22# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
23# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
24# for the list of possible encodings.
25# The default value is: UTF-8.
26
27DOXYFILE_ENCODING = UTF-8
28
29# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
30# double-quotes, unless you are using Doxywizard) that should identify the
31# project for which the documentation is generated. This name is used in the
32# title of most generated pages and in a few other places.
33# The default value is: My Project.
34
35PROJECT_NAME = "LUFA Library - RNDIS Ethernet Demo"
36
37# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
38# could be handy for archiving the generated documentation or if some version
39# control system is used.
40
41PROJECT_NUMBER =
42
43# Using the PROJECT_BRIEF tag one can provide an optional one line description
44# for a project that appears at the top of each page and should give viewer a
45# quick idea about the purpose of the project. Keep the description short.
46
47PROJECT_BRIEF =
48
49# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
50# in the documentation. The maximum height of the logo should not exceed 55
51# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
52# the logo to the output directory.
53
54PROJECT_LOGO =
55
56# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
57# into which the generated documentation will be written. If a relative path is
58# entered, it will be relative to the location where doxygen was started. If
59# left blank the current directory will be used.
60
61OUTPUT_DIRECTORY = ./Documentation/
62
63# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
64# directories (in 2 levels) under the output directory of each output format and
65# will distribute the generated files over these directories. Enabling this
66# option can be useful when feeding doxygen a huge amount of source files, where
67# putting all generated files in the same directory would otherwise causes
68# performance problems for the file system.
69# The default value is: NO.
70
71CREATE_SUBDIRS = NO
72
73# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
74# characters to appear in the names of generated files. If set to NO, non-ASCII
75# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
76# U+3044.
77# The default value is: NO.
78
79ALLOW_UNICODE_NAMES = NO
80
81# The OUTPUT_LANGUAGE tag is used to specify the language in which all
82# documentation generated by doxygen is written. Doxygen will use this
83# information to generate all constant output in the proper language.
84# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
85# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
86# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
87# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
88# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
89# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
90# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
91# Ukrainian and Vietnamese.
92# The default value is: English.
93
94OUTPUT_LANGUAGE = English
95
96# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
97# descriptions after the members that are listed in the file and class
98# documentation (similar to Javadoc). Set to NO to disable this.
99# The default value is: YES.
100
101BRIEF_MEMBER_DESC = YES
102
103# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
104# description of a member or function before the detailed description
105#
106# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
107# brief descriptions will be completely suppressed.
108# The default value is: YES.
109
110REPEAT_BRIEF = YES
111
112# This tag implements a quasi-intelligent brief description abbreviator that is
113# used to form the text in various listings. Each string in this list, if found
114# as the leading text of the brief description, will be stripped from the text
115# and the result, after processing the whole list, is used as the annotated
116# text. Otherwise, the brief description is used as-is. If left blank, the
117# following values are used ($name is automatically replaced with the name of
118# the entity):The $name class, The $name widget, The $name file, is, provides,
119# specifies, contains, represents, a, an and the.
120
121ABBREVIATE_BRIEF = "The $name class" \
122 "The $name widget" \
123 "The $name file" \
124 is \
125 provides \
126 specifies \
127 contains \
128 represents \
129 a \
130 an \
131 the
132
133# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
134# doxygen will generate a detailed section even if there is only a brief
135# description.
136# The default value is: NO.
137
138ALWAYS_DETAILED_SEC = NO
139
140# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
141# inherited members of a class in the documentation of that class as if those
142# members were ordinary class members. Constructors, destructors and assignment
143# operators of the base classes will not be shown.
144# The default value is: NO.
145
146INLINE_INHERITED_MEMB = NO
147
148# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
149# before files name in the file list and in the header files. If set to NO the
150# shortest path that makes the file name unique will be used
151# The default value is: YES.
152
153FULL_PATH_NAMES = YES
154
155# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
156# Stripping is only done if one of the specified strings matches the left-hand
157# part of the path. The tag can be used to show relative paths in the file list.
158# If left blank the directory from which doxygen is run is used as the path to
159# strip.
160#
161# Note that you can specify absolute paths here, but also relative paths, which
162# will be relative from the directory where doxygen is started.
163# This tag requires that the tag FULL_PATH_NAMES is set to YES.
164
165STRIP_FROM_PATH =
166
167# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
168# path mentioned in the documentation of a class, which tells the reader which
169# header file to include in order to use a class. If left blank only the name of
170# the header file containing the class definition is used. Otherwise one should
171# specify the list of include paths that are normally passed to the compiler
172# using the -I flag.
173
174STRIP_FROM_INC_PATH =
175
176# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
177# less readable) file names. This can be useful is your file systems doesn't
178# support long names like on DOS, Mac, or CD-ROM.
179# The default value is: NO.
180
181SHORT_NAMES = YES
182
183# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
184# first line (until the first dot) of a Javadoc-style comment as the brief
185# description. If set to NO, the Javadoc-style will behave just like regular Qt-
186# style comments (thus requiring an explicit @brief command for a brief
187# description.)
188# The default value is: NO.
189
190JAVADOC_AUTOBRIEF = NO
191
192# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
193# line (until the first dot) of a Qt-style comment as the brief description. If
194# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
195# requiring an explicit \brief command for a brief description.)
196# The default value is: NO.
197
198QT_AUTOBRIEF = NO
199
200# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
201# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
202# a brief description. This used to be the default behavior. The new default is
203# to treat a multi-line C++ comment block as a detailed description. Set this
204# tag to YES if you prefer the old behavior instead.
205#
206# Note that setting this tag to YES also means that rational rose comments are
207# not recognized any more.
208# The default value is: NO.
209
210MULTILINE_CPP_IS_BRIEF = NO
211
212# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
213# documentation from any documented member that it re-implements.
214# The default value is: YES.
215
216INHERIT_DOCS = YES
217
218# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
219# page for each member. If set to NO, the documentation of a member will be part
220# of the file/class/namespace that contains it.
221# The default value is: NO.
222
223SEPARATE_MEMBER_PAGES = NO
224
225# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
226# uses this value to replace tabs by spaces in code fragments.
227# Minimum value: 1, maximum value: 16, default value: 4.
228
229TAB_SIZE = 4
230
231# This tag can be used to specify a number of aliases that act as commands in
232# the documentation. An alias has the form:
233# name=value
234# For example adding
235# "sideeffect=@par Side Effects:\n"
236# will allow you to put the command \sideeffect (or @sideeffect) in the
237# documentation, which will result in a user-defined paragraph with heading
238# "Side Effects:". You can put \n's in the value part of an alias to insert
239# newlines.
240
241ALIASES =
242
243# This tag can be used to specify a number of word-keyword mappings (TCL only).
244# A mapping has the form "name=value". For example adding "class=itcl::class"
245# will allow you to use the command class in the itcl::class meaning.
246
247TCL_SUBST =
248
249# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
250# only. Doxygen will then generate output that is more tailored for C. For
251# instance, some of the names that are used will be different. The list of all
252# members will be omitted, etc.
253# The default value is: NO.
254
255OPTIMIZE_OUTPUT_FOR_C = YES
256
257# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
258# Python sources only. Doxygen will then generate output that is more tailored
259# for that language. For instance, namespaces will be presented as packages,
260# qualified scopes will look different, etc.
261# The default value is: NO.
262
263OPTIMIZE_OUTPUT_JAVA = NO
264
265# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
266# sources. Doxygen will then generate output that is tailored for Fortran.
267# The default value is: NO.
268
269OPTIMIZE_FOR_FORTRAN = NO
270
271# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
272# sources. Doxygen will then generate output that is tailored for VHDL.
273# The default value is: NO.
274
275OPTIMIZE_OUTPUT_VHDL = NO
276
277# Doxygen selects the parser to use depending on the extension of the files it
278# parses. With this tag you can assign which parser to use for a given
279# extension. Doxygen has a built-in mapping, but you can override or extend it
280# using this tag. The format is ext=language, where ext is a file extension, and
281# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
282# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
283# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
284# Fortran. In the later case the parser tries to guess whether the code is fixed
285# or free formatted code, this is the default for Fortran type files), VHDL. For
286# instance to make doxygen treat .inc files as Fortran files (default is PHP),
287# and .f files as C (default is Fortran), use: inc=Fortran f=C.
288#
289# Note: For files without extension you can use no_extension as a placeholder.
290#
291# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
292# the files are not read by doxygen.
293
294EXTENSION_MAPPING =
295
296# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
297# according to the Markdown format, which allows for more readable
298# documentation. See http://daringfireball.net/projects/markdown/ for details.
299# The output of markdown processing is further processed by doxygen, so you can
300# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
301# case of backward compatibilities issues.
302# The default value is: YES.
303
304MARKDOWN_SUPPORT = NO
305
306# When enabled doxygen tries to link words that correspond to documented
307# classes, or namespaces to their corresponding documentation. Such a link can
308# be prevented in individual cases by putting a % sign in front of the word or
309# globally by setting AUTOLINK_SUPPORT to NO.
310# The default value is: YES.
311
312AUTOLINK_SUPPORT = YES
313
314# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
315# to include (a tag file for) the STL sources as input, then you should set this
316# tag to YES in order to let doxygen match functions declarations and
317# definitions whose arguments contain STL classes (e.g. func(std::string);
318# versus func(std::string) {}). This also make the inheritance and collaboration
319# diagrams that involve STL classes more complete and accurate.
320# The default value is: NO.
321
322BUILTIN_STL_SUPPORT = NO
323
324# If you use Microsoft's C++/CLI language, you should set this option to YES to
325# enable parsing support.
326# The default value is: NO.
327
328CPP_CLI_SUPPORT = NO
329
330# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
331# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
332# will parse them like normal C++ but will assume all classes use public instead
333# of private inheritance when no explicit protection keyword is present.
334# The default value is: NO.
335
336SIP_SUPPORT = NO
337
338# For Microsoft's IDL there are propget and propput attributes to indicate
339# getter and setter methods for a property. Setting this option to YES will make
340# doxygen to replace the get and set methods by a property in the documentation.
341# This will only work if the methods are indeed getting or setting a simple
342# type. If this is not the case, or you want to show the methods anyway, you
343# should set this option to NO.
344# The default value is: YES.
345
346IDL_PROPERTY_SUPPORT = YES
347
348# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
349# tag is set to YES then doxygen will reuse the documentation of the first
350# member in the group (if any) for the other members of the group. By default
351# all members of a group must be documented explicitly.
352# The default value is: NO.
353
354DISTRIBUTE_GROUP_DOC = NO
355
356# Set the SUBGROUPING tag to YES to allow class member groups of the same type
357# (for instance a group of public functions) to be put as a subgroup of that
358# type (e.g. under the Public Functions section). Set it to NO to prevent
359# subgrouping. Alternatively, this can be done per class using the
360# \nosubgrouping command.
361# The default value is: YES.
362
363SUBGROUPING = YES
364
365# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
366# are shown inside the group in which they are included (e.g. using \ingroup)
367# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
368# and RTF).
369#
370# Note that this feature does not work in combination with
371# SEPARATE_MEMBER_PAGES.
372# The default value is: NO.
373
374INLINE_GROUPED_CLASSES = NO
375
376# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
377# with only public data fields or simple typedef fields will be shown inline in
378# the documentation of the scope in which they are defined (i.e. file,
379# namespace, or group documentation), provided this scope is documented. If set
380# to NO, structs, classes, and unions are shown on a separate page (for HTML and
381# Man pages) or section (for LaTeX and RTF).
382# The default value is: NO.
383
384INLINE_SIMPLE_STRUCTS = NO
385
386# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
387# enum is documented as struct, union, or enum with the name of the typedef. So
388# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
389# with name TypeT. When disabled the typedef will appear as a member of a file,
390# namespace, or class. And the struct will be named TypeS. This can typically be
391# useful for C code in case the coding convention dictates that all compound
392# types are typedef'ed and only the typedef is referenced, never the tag name.
393# The default value is: NO.
394
395TYPEDEF_HIDES_STRUCT = NO
396
397# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
398# cache is used to resolve symbols given their name and scope. Since this can be
399# an expensive process and often the same symbol appears multiple times in the
400# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
401# doxygen will become slower. If the cache is too large, memory is wasted. The
402# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
403# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
404# symbols. At the end of a run doxygen will report the cache usage and suggest
405# the optimal cache size from a speed point of view.
406# Minimum value: 0, maximum value: 9, default value: 0.
407
408LOOKUP_CACHE_SIZE = 0
409
410#---------------------------------------------------------------------------
411# Build related configuration options
412#---------------------------------------------------------------------------
413
414# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
415# documentation are documented, even if no documentation was available. Private
416# class members and static file members will be hidden unless the
417# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
418# Note: This will also disable the warnings about undocumented members that are
419# normally produced when WARNINGS is set to YES.
420# The default value is: NO.
421
422EXTRACT_ALL = YES
423
424# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
425# be included in the documentation.
426# The default value is: NO.
427
428EXTRACT_PRIVATE = YES
429
430# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
431# scope will be included in the documentation.
432# The default value is: NO.
433
434EXTRACT_PACKAGE = NO
435
436# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
437# included in the documentation.
438# The default value is: NO.
439
440EXTRACT_STATIC = YES
441
442# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
443# locally in source files will be included in the documentation. If set to NO,
444# only classes defined in header files are included. Does not have any effect
445# for Java sources.
446# The default value is: YES.
447
448EXTRACT_LOCAL_CLASSES = YES
449
450# This flag is only useful for Objective-C code. If set to YES, local methods,
451# which are defined in the implementation section but not in the interface are
452# included in the documentation. If set to NO, only methods in the interface are
453# included.
454# The default value is: NO.
455
456EXTRACT_LOCAL_METHODS = NO
457
458# If this flag is set to YES, the members of anonymous namespaces will be
459# extracted and appear in the documentation as a namespace called
460# 'anonymous_namespace{file}', where file will be replaced with the base name of
461# the file that contains the anonymous namespace. By default anonymous namespace
462# are hidden.
463# The default value is: NO.
464
465EXTRACT_ANON_NSPACES = NO
466
467# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
468# undocumented members inside documented classes or files. If set to NO these
469# members will be included in the various overviews, but no documentation
470# section is generated. This option has no effect if EXTRACT_ALL is enabled.
471# The default value is: NO.
472
473HIDE_UNDOC_MEMBERS = NO
474
475# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
476# undocumented classes that are normally visible in the class hierarchy. If set
477# to NO, these classes will be included in the various overviews. This option
478# has no effect if EXTRACT_ALL is enabled.
479# The default value is: NO.
480
481HIDE_UNDOC_CLASSES = NO
482
483# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
484# (class|struct|union) declarations. If set to NO, these declarations will be
485# included in the documentation.
486# The default value is: NO.
487
488HIDE_FRIEND_COMPOUNDS = NO
489
490# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
491# documentation blocks found inside the body of a function. If set to NO, these
492# blocks will be appended to the function's detailed documentation block.
493# The default value is: NO.
494
495HIDE_IN_BODY_DOCS = NO
496
497# The INTERNAL_DOCS tag determines if documentation that is typed after a
498# \internal command is included. If the tag is set to NO then the documentation
499# will be excluded. Set it to YES to include the internal documentation.
500# The default value is: NO.
501
502INTERNAL_DOCS = NO
503
504# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
505# names in lower-case letters. If set to YES, upper-case letters are also
506# allowed. This is useful if you have classes or files whose names only differ
507# in case and if your file system supports case sensitive file names. Windows
508# and Mac users are advised to set this option to NO.
509# The default value is: system dependent.
510
511CASE_SENSE_NAMES = NO
512
513# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
514# their full class and namespace scopes in the documentation. If set to YES, the
515# scope will be hidden.
516# The default value is: NO.
517
518HIDE_SCOPE_NAMES = NO
519
520# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
521# append additional text to a page's title, such as Class Reference. If set to
522# YES the compound reference will be hidden.
523# The default value is: NO.
524
525HIDE_COMPOUND_REFERENCE= NO
526
527# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
528# the files that are included by a file in the documentation of that file.
529# The default value is: YES.
530
531SHOW_INCLUDE_FILES = YES
532
533# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
534# grouped member an include statement to the documentation, telling the reader
535# which file to include in order to use the member.
536# The default value is: NO.
537
538SHOW_GROUPED_MEMB_INC = NO
539
540# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
541# files with double quotes in the documentation rather than with sharp brackets.
542# The default value is: NO.
543
544FORCE_LOCAL_INCLUDES = NO
545
546# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
547# documentation for inline members.
548# The default value is: YES.
549
550INLINE_INFO = YES
551
552# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
553# (detailed) documentation of file and class members alphabetically by member
554# name. If set to NO, the members will appear in declaration order.
555# The default value is: YES.
556
557SORT_MEMBER_DOCS = YES
558
559# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
560# descriptions of file, namespace and class members alphabetically by member
561# name. If set to NO, the members will appear in declaration order. Note that
562# this will also influence the order of the classes in the class list.
563# The default value is: NO.
564
565SORT_BRIEF_DOCS = NO
566
567# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
568# (brief and detailed) documentation of class members so that constructors and
569# destructors are listed first. If set to NO the constructors will appear in the
570# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
571# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
572# member documentation.
573# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
574# detailed member documentation.
575# The default value is: NO.
576
577SORT_MEMBERS_CTORS_1ST = NO
578
579# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
580# of group names into alphabetical order. If set to NO the group names will
581# appear in their defined order.
582# The default value is: NO.
583
584SORT_GROUP_NAMES = NO
585
586# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
587# fully-qualified names, including namespaces. If set to NO, the class list will
588# be sorted only by class name, not including the namespace part.
589# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
590# Note: This option applies only to the class list, not to the alphabetical
591# list.
592# The default value is: NO.
593
594SORT_BY_SCOPE_NAME = NO
595
596# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
597# type resolution of all parameters of a function it will reject a match between
598# the prototype and the implementation of a member function even if there is
599# only one candidate or it is obvious which candidate to choose by doing a
600# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
601# accept a match between prototype and implementation in such cases.
602# The default value is: NO.
603
604STRICT_PROTO_MATCHING = NO
605
606# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
607# list. This list is created by putting \todo commands in the documentation.
608# The default value is: YES.
609
610GENERATE_TODOLIST = NO
611
612# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
613# list. This list is created by putting \test commands in the documentation.
614# The default value is: YES.
615
616GENERATE_TESTLIST = NO
617
618# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
619# list. This list is created by putting \bug commands in the documentation.
620# The default value is: YES.
621
622GENERATE_BUGLIST = NO
623
624# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
625# the deprecated list. This list is created by putting \deprecated commands in
626# the documentation.
627# The default value is: YES.
628
629GENERATE_DEPRECATEDLIST= YES
630
631# The ENABLED_SECTIONS tag can be used to enable conditional documentation
632# sections, marked by \if <section_label> ... \endif and \cond <section_label>
633# ... \endcond blocks.
634
635ENABLED_SECTIONS =
636
637# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
638# initial value of a variable or macro / define can have for it to appear in the
639# documentation. If the initializer consists of more lines than specified here
640# it will be hidden. Use a value of 0 to hide initializers completely. The
641# appearance of the value of individual variables and macros / defines can be
642# controlled using \showinitializer or \hideinitializer command in the
643# documentation regardless of this setting.
644# Minimum value: 0, maximum value: 10000, default value: 30.
645
646MAX_INITIALIZER_LINES = 30
647
648# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
649# the bottom of the documentation of classes and structs. If set to YES, the
650# list will mention the files that were used to generate the documentation.
651# The default value is: YES.
652
653SHOW_USED_FILES = YES
654
655# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
656# will remove the Files entry from the Quick Index and from the Folder Tree View
657# (if specified).
658# The default value is: YES.
659
660SHOW_FILES = YES
661
662# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
663# page. This will remove the Namespaces entry from the Quick Index and from the
664# Folder Tree View (if specified).
665# The default value is: YES.
666
667SHOW_NAMESPACES = YES
668
669# The FILE_VERSION_FILTER tag can be used to specify a program or script that
670# doxygen should invoke to get the current version for each file (typically from
671# the version control system). Doxygen will invoke the program by executing (via
672# popen()) the command command input-file, where command is the value of the
673# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
674# by doxygen. Whatever the program writes to standard output is used as the file
675# version. For an example see the documentation.
676
677FILE_VERSION_FILTER =
678
679# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
680# by doxygen. The layout file controls the global structure of the generated
681# output files in an output format independent way. To create the layout file
682# that represents doxygen's defaults, run doxygen with the -l option. You can
683# optionally specify a file name after the option, if omitted DoxygenLayout.xml
684# will be used as the name of the layout file.
685#
686# Note that if you run doxygen from a directory containing a file called
687# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
688# tag is left empty.
689
690LAYOUT_FILE =
691
692# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
693# the reference definitions. This must be a list of .bib files. The .bib
694# extension is automatically appended if omitted. This requires the bibtex tool
695# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
696# For LaTeX the style of the bibliography can be controlled using
697# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
698# search path. See also \cite for info how to create references.
699
700CITE_BIB_FILES =
701
702#---------------------------------------------------------------------------
703# Configuration options related to warning and progress messages
704#---------------------------------------------------------------------------
705
706# The QUIET tag can be used to turn on/off the messages that are generated to
707# standard output by doxygen. If QUIET is set to YES this implies that the
708# messages are off.
709# The default value is: NO.
710
711QUIET = YES
712
713# The WARNINGS tag can be used to turn on/off the warning messages that are
714# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
715# this implies that the warnings are on.
716#
717# Tip: Turn warnings on while writing the documentation.
718# The default value is: YES.
719
720WARNINGS = YES
721
722# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
723# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
724# will automatically be disabled.
725# The default value is: YES.
726
727WARN_IF_UNDOCUMENTED = YES
728
729# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
730# potential errors in the documentation, such as not documenting some parameters
731# in a documented function, or documenting parameters that don't exist or using
732# markup commands wrongly.
733# The default value is: YES.
734
735WARN_IF_DOC_ERROR = YES
736
737# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
738# are documented, but have no documentation for their parameters or return
739# value. If set to NO, doxygen will only warn about wrong or incomplete
740# parameter documentation, but not about the absence of documentation.
741# The default value is: NO.
742
743WARN_NO_PARAMDOC = YES
744
745# The WARN_FORMAT tag determines the format of the warning messages that doxygen
746# can produce. The string should contain the $file, $line, and $text tags, which
747# will be replaced by the file and line number from which the warning originated
748# and the warning text. Optionally the format may contain $version, which will
749# be replaced by the version of the file (if it could be obtained via
750# FILE_VERSION_FILTER)
751# The default value is: $file:$line: $text.
752
753WARN_FORMAT = "$file:$line: $text"
754
755# The WARN_LOGFILE tag can be used to specify a file to which warning and error
756# messages should be written. If left blank the output is written to standard
757# error (stderr).
758
759WARN_LOGFILE =
760
761#---------------------------------------------------------------------------
762# Configuration options related to the input files
763#---------------------------------------------------------------------------
764
765# The INPUT tag is used to specify the files and/or directories that contain
766# documented source files. You may enter file names like myfile.cpp or
767# directories like /usr/src/myproject. Separate the files or directories with
768# spaces.
769# Note: If this tag is empty the current directory is searched.
770
771INPUT = ./
772
773# This tag can be used to specify the character encoding of the source files
774# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
775# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
776# documentation (see: http://www.gnu.org/software/libiconv) for the list of
777# possible encodings.
778# The default value is: UTF-8.
779
780INPUT_ENCODING = UTF-8
781
782# If the value of the INPUT tag contains directories, you can use the
783# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
784# *.h) to filter out the source-files in the directories. If left blank the
785# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
786# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
787# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
788# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
789# *.qsf, *.as and *.js.
790
791FILE_PATTERNS = *.h \
792 *.c \
793 *.txt
794
795# The RECURSIVE tag can be used to specify whether or not subdirectories should
796# be searched for input files as well.
797# The default value is: NO.
798
799RECURSIVE = YES
800
801# The EXCLUDE tag can be used to specify files and/or directories that should be
802# excluded from the INPUT source files. This way you can easily exclude a
803# subdirectory from a directory tree whose root is specified with the INPUT tag.
804#
805# Note that relative paths are relative to the directory from which doxygen is
806# run.
807
808EXCLUDE = Documentation/
809
810# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
811# directories that are symbolic links (a Unix file system feature) are excluded
812# from the input.
813# The default value is: NO.
814
815EXCLUDE_SYMLINKS = NO
816
817# If the value of the INPUT tag contains directories, you can use the
818# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
819# certain files from those directories.
820#
821# Note that the wildcards are matched against the file with absolute path, so to
822# exclude all test directories for example use the pattern */test/*
823
824EXCLUDE_PATTERNS =
825
826# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
827# (namespaces, classes, functions, etc.) that should be excluded from the
828# output. The symbol name can be a fully qualified name, a word, or if the
829# wildcard * is used, a substring. Examples: ANamespace, AClass,
830# AClass::ANamespace, ANamespace::*Test
831#
832# Note that the wildcards are matched against the file with absolute path, so to
833# exclude all test directories use the pattern */test/*
834
835EXCLUDE_SYMBOLS = __* \
836 INCLUDE_FROM_*
837
838# The EXAMPLE_PATH tag can be used to specify one or more files or directories
839# that contain example code fragments that are included (see the \include
840# command).
841
842EXAMPLE_PATH =
843
844# If the value of the EXAMPLE_PATH tag contains directories, you can use the
845# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
846# *.h) to filter out the source-files in the directories. If left blank all
847# files are included.
848
849EXAMPLE_PATTERNS = *
850
851# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
852# searched for input files to be used with the \include or \dontinclude commands
853# irrespective of the value of the RECURSIVE tag.
854# The default value is: NO.
855
856EXAMPLE_RECURSIVE = NO
857
858# The IMAGE_PATH tag can be used to specify one or more files or directories
859# that contain images that are to be included in the documentation (see the
860# \image command).
861
862IMAGE_PATH =
863
864# The INPUT_FILTER tag can be used to specify a program that doxygen should
865# invoke to filter for each input file. Doxygen will invoke the filter program
866# by executing (via popen()) the command:
867#
868# <filter> <input-file>
869#
870# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
871# name of an input file. Doxygen will then use the output that the filter
872# program writes to standard output. If FILTER_PATTERNS is specified, this tag
873# will be ignored.
874#
875# Note that the filter must not add or remove lines; it is applied before the
876# code is scanned, but not when the output code is generated. If lines are added
877# or removed, the anchors will not be placed correctly.
878
879INPUT_FILTER =
880
881# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
882# basis. Doxygen will compare the file name with each pattern and apply the
883# filter if there is a match. The filters are a list of the form: pattern=filter
884# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
885# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
886# patterns match the file name, INPUT_FILTER is applied.
887
888FILTER_PATTERNS =
889
890# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
891# INPUT_FILTER) will also be used to filter the input files that are used for
892# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
893# The default value is: NO.
894
895FILTER_SOURCE_FILES = NO
896
897# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
898# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
899# it is also possible to disable source filtering for a specific pattern using
900# *.ext= (so without naming a filter).
901# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
902
903FILTER_SOURCE_PATTERNS =
904
905# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
906# is part of the input, its contents will be placed on the main page
907# (index.html). This can be useful if you have a project on for instance GitHub
908# and want to reuse the introduction page also for the doxygen output.
909
910USE_MDFILE_AS_MAINPAGE =
911
912#---------------------------------------------------------------------------
913# Configuration options related to source browsing
914#---------------------------------------------------------------------------
915
916# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
917# generated. Documented entities will be cross-referenced with these sources.
918#
919# Note: To get rid of all source code in the generated output, make sure that
920# also VERBATIM_HEADERS is set to NO.
921# The default value is: NO.
922
923SOURCE_BROWSER = NO
924
925# Setting the INLINE_SOURCES tag to YES will include the body of functions,
926# classes and enums directly into the documentation.
927# The default value is: NO.
928
929INLINE_SOURCES = NO
930
931# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
932# special comment blocks from generated source code fragments. Normal C, C++ and
933# Fortran comments will always remain visible.
934# The default value is: YES.
935
936STRIP_CODE_COMMENTS = YES
937
938# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
939# function all documented functions referencing it will be listed.
940# The default value is: NO.
941
942REFERENCED_BY_RELATION = NO
943
944# If the REFERENCES_RELATION tag is set to YES then for each documented function
945# all documented entities called/used by that function will be listed.
946# The default value is: NO.
947
948REFERENCES_RELATION = NO
949
950# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
951# to YES then the hyperlinks from functions in REFERENCES_RELATION and
952# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
953# link to the documentation.
954# The default value is: YES.
955
956REFERENCES_LINK_SOURCE = NO
957
958# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
959# source code will show a tooltip with additional information such as prototype,
960# brief description and links to the definition and documentation. Since this
961# will make the HTML file larger and loading of large files a bit slower, you
962# can opt to disable this feature.
963# The default value is: YES.
964# This tag requires that the tag SOURCE_BROWSER is set to YES.
965
966SOURCE_TOOLTIPS = YES
967
968# If the USE_HTAGS tag is set to YES then the references to source code will
969# point to the HTML generated by the htags(1) tool instead of doxygen built-in
970# source browser. The htags tool is part of GNU's global source tagging system
971# (see http://www.gnu.org/software/global/global.html). You will need version
972# 4.8.6 or higher.
973#
974# To use it do the following:
975# - Install the latest version of global
976# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
977# - Make sure the INPUT points to the root of the source tree
978# - Run doxygen as normal
979#
980# Doxygen will invoke htags (and that will in turn invoke gtags), so these
981# tools must be available from the command line (i.e. in the search path).
982#
983# The result: instead of the source browser generated by doxygen, the links to
984# source code will now point to the output of htags.
985# The default value is: NO.
986# This tag requires that the tag SOURCE_BROWSER is set to YES.
987
988USE_HTAGS = NO
989
990# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
991# verbatim copy of the header file for each class for which an include is
992# specified. Set to NO to disable this.
993# See also: Section \class.
994# The default value is: YES.
995
996VERBATIM_HEADERS = NO
997
998# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
999# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
1000# cost of reduced performance. This can be particularly helpful with template
1001# rich C++ code for which doxygen's built-in parser lacks the necessary type
1002# information.
1003# Note: The availability of this option depends on whether or not doxygen was
1004# compiled with the --with-libclang option.
1005# The default value is: NO.
1006
1007CLANG_ASSISTED_PARSING = NO
1008
1009# If clang assisted parsing is enabled you can provide the compiler with command
1010# line options that you would normally use when invoking the compiler. Note that
1011# the include paths will already be set by doxygen for the files and directories
1012# specified with INPUT and INCLUDE_PATH.
1013# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
1014
1015CLANG_OPTIONS =
1016
1017#---------------------------------------------------------------------------
1018# Configuration options related to the alphabetical class index
1019#---------------------------------------------------------------------------
1020
1021# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
1022# compounds will be generated. Enable this if the project contains a lot of
1023# classes, structs, unions or interfaces.
1024# The default value is: YES.
1025
1026ALPHABETICAL_INDEX = YES
1027
1028# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
1029# which the alphabetical index list will be split.
1030# Minimum value: 1, maximum value: 20, default value: 5.
1031# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
1032
1033COLS_IN_ALPHA_INDEX = 5
1034
1035# In case all classes in a project start with a common prefix, all classes will
1036# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
1037# can be used to specify a prefix (or a list of prefixes) that should be ignored
1038# while generating the index headers.
1039# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
1040
1041IGNORE_PREFIX =
1042
1043#---------------------------------------------------------------------------
1044# Configuration options related to the HTML output
1045#---------------------------------------------------------------------------
1046
1047# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
1048# The default value is: YES.
1049
1050GENERATE_HTML = YES
1051
1052# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
1053# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
1054# it.
1055# The default directory is: html.
1056# This tag requires that the tag GENERATE_HTML is set to YES.
1057
1058HTML_OUTPUT = html
1059
1060# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
1061# generated HTML page (for example: .htm, .php, .asp).
1062# The default value is: .html.
1063# This tag requires that the tag GENERATE_HTML is set to YES.
1064
1065HTML_FILE_EXTENSION = .html
1066
1067# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
1068# each generated HTML page. If the tag is left blank doxygen will generate a
1069# standard header.
1070#
1071# To get valid HTML the header file that includes any scripts and style sheets
1072# that doxygen needs, which is dependent on the configuration options used (e.g.
1073# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
1074# default header using
1075# doxygen -w html new_header.html new_footer.html new_stylesheet.css
1076# YourConfigFile
1077# and then modify the file new_header.html. See also section "Doxygen usage"
1078# for information on how to generate the default header that doxygen normally
1079# uses.
1080# Note: The header is subject to change so you typically have to regenerate the
1081# default header when upgrading to a newer version of doxygen. For a description
1082# of the possible markers and block names see the documentation.
1083# This tag requires that the tag GENERATE_HTML is set to YES.
1084
1085HTML_HEADER =
1086
1087# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
1088# generated HTML page. If the tag is left blank doxygen will generate a standard
1089# footer. See HTML_HEADER for more information on how to generate a default
1090# footer and what special commands can be used inside the footer. See also
1091# section "Doxygen usage" for information on how to generate the default footer
1092# that doxygen normally uses.
1093# This tag requires that the tag GENERATE_HTML is set to YES.
1094
1095HTML_FOOTER =
1096
1097# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
1098# sheet that is used by each HTML page. It can be used to fine-tune the look of
1099# the HTML output. If left blank doxygen will generate a default style sheet.
1100# See also section "Doxygen usage" for information on how to generate the style
1101# sheet that doxygen normally uses.
1102# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
1103# it is more robust and this tag (HTML_STYLESHEET) will in the future become
1104# obsolete.
1105# This tag requires that the tag GENERATE_HTML is set to YES.
1106
1107HTML_STYLESHEET =
1108
1109# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
1110# cascading style sheets that are included after the standard style sheets
1111# created by doxygen. Using this option one can overrule certain style aspects.
1112# This is preferred over using HTML_STYLESHEET since it does not replace the
1113# standard style sheet and is therefore more robust against future updates.
1114# Doxygen will copy the style sheet files to the output directory.
1115# Note: The order of the extra style sheet files is of importance (e.g. the last
1116# style sheet in the list overrules the setting of the previous ones in the
1117# list). For an example see the documentation.
1118# This tag requires that the tag GENERATE_HTML is set to YES.
1119
1120HTML_EXTRA_STYLESHEET =
1121
1122# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
1123# other source files which should be copied to the HTML output directory. Note
1124# that these files will be copied to the base HTML output directory. Use the
1125# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
1126# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
1127# files will be copied as-is; there are no commands or markers available.
1128# This tag requires that the tag GENERATE_HTML is set to YES.
1129
1130HTML_EXTRA_FILES =
1131
1132# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
1133# will adjust the colors in the style sheet and background images according to
1134# this color. Hue is specified as an angle on a colorwheel, see
1135# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
1136# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
1137# purple, and 360 is red again.
1138# Minimum value: 0, maximum value: 359, default value: 220.
1139# This tag requires that the tag GENERATE_HTML is set to YES.
1140
1141HTML_COLORSTYLE_HUE = 220
1142
1143# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
1144# in the HTML output. For a value of 0 the output will use grayscales only. A
1145# value of 255 will produce the most vivid colors.
1146# Minimum value: 0, maximum value: 255, default value: 100.
1147# This tag requires that the tag GENERATE_HTML is set to YES.
1148
1149HTML_COLORSTYLE_SAT = 100
1150
1151# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
1152# luminance component of the colors in the HTML output. Values below 100
1153# gradually make the output lighter, whereas values above 100 make the output
1154# darker. The value divided by 100 is the actual gamma applied, so 80 represents
1155# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
1156# change the gamma.
1157# Minimum value: 40, maximum value: 240, default value: 80.
1158# This tag requires that the tag GENERATE_HTML is set to YES.
1159
1160HTML_COLORSTYLE_GAMMA = 80
1161
1162# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
1163# page will contain the date and time when the page was generated. Setting this
1164# to NO can help when comparing the output of multiple runs.
1165# The default value is: YES.
1166# This tag requires that the tag GENERATE_HTML is set to YES.
1167
1168HTML_TIMESTAMP = NO
1169
1170# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
1171# documentation will contain sections that can be hidden and shown after the
1172# page has loaded.
1173# The default value is: NO.
1174# This tag requires that the tag GENERATE_HTML is set to YES.
1175
1176HTML_DYNAMIC_SECTIONS = YES
1177
1178# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
1179# shown in the various tree structured indices initially; the user can expand
1180# and collapse entries dynamically later on. Doxygen will expand the tree to
1181# such a level that at most the specified number of entries are visible (unless
1182# a fully collapsed tree already exceeds this amount). So setting the number of
1183# entries 1 will produce a full collapsed tree by default. 0 is a special value
1184# representing an infinite number of entries and will result in a full expanded
1185# tree by default.
1186# Minimum value: 0, maximum value: 9999, default value: 100.
1187# This tag requires that the tag GENERATE_HTML is set to YES.
1188
1189HTML_INDEX_NUM_ENTRIES = 100
1190
1191# If the GENERATE_DOCSET tag is set to YES, additional index files will be
1192# generated that can be used as input for Apple's Xcode 3 integrated development
1193# environment (see: http://developer.apple.com/tools/xcode/), introduced with
1194# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
1195# Makefile in the HTML output directory. Running make will produce the docset in
1196# that directory and running make install will install the docset in
1197# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
1198# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
1199# for more information.
1200# The default value is: NO.
1201# This tag requires that the tag GENERATE_HTML is set to YES.
1202
1203GENERATE_DOCSET = NO
1204
1205# This tag determines the name of the docset feed. A documentation feed provides
1206# an umbrella under which multiple documentation sets from a single provider
1207# (such as a company or product suite) can be grouped.
1208# The default value is: Doxygen generated docs.
1209# This tag requires that the tag GENERATE_DOCSET is set to YES.
1210
1211DOCSET_FEEDNAME = "Doxygen generated docs"
1212
1213# This tag specifies a string that should uniquely identify the documentation
1214# set bundle. This should be a reverse domain-name style string, e.g.
1215# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
1216# The default value is: org.doxygen.Project.
1217# This tag requires that the tag GENERATE_DOCSET is set to YES.
1218
1219DOCSET_BUNDLE_ID = org.doxygen.Project
1220
1221# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
1222# the documentation publisher. This should be a reverse domain-name style
1223# string, e.g. com.mycompany.MyDocSet.documentation.
1224# The default value is: org.doxygen.Publisher.
1225# This tag requires that the tag GENERATE_DOCSET is set to YES.
1226
1227DOCSET_PUBLISHER_ID = org.doxygen.Publisher
1228
1229# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
1230# The default value is: Publisher.
1231# This tag requires that the tag GENERATE_DOCSET is set to YES.
1232
1233DOCSET_PUBLISHER_NAME = Publisher
1234
1235# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
1236# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
1237# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
1238# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
1239# Windows.
1240#
1241# The HTML Help Workshop contains a compiler that can convert all HTML output
1242# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
1243# files are now used as the Windows 98 help format, and will replace the old
1244# Windows help format (.hlp) on all Windows platforms in the future. Compressed
1245# HTML files also contain an index, a table of contents, and you can search for
1246# words in the documentation. The HTML workshop also contains a viewer for
1247# compressed HTML files.
1248# The default value is: NO.
1249# This tag requires that the tag GENERATE_HTML is set to YES.
1250
1251GENERATE_HTMLHELP = NO
1252
1253# The CHM_FILE tag can be used to specify the file name of the resulting .chm
1254# file. You can add a path in front of the file if the result should not be
1255# written to the html output directory.
1256# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
1257
1258CHM_FILE =
1259
1260# The HHC_LOCATION tag can be used to specify the location (absolute path
1261# including file name) of the HTML help compiler (hhc.exe). If non-empty,
1262# doxygen will try to run the HTML help compiler on the generated index.hhp.
1263# The file has to be specified with full path.
1264# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
1265
1266HHC_LOCATION =
1267
1268# The GENERATE_CHI flag controls if a separate .chi index file is generated
1269# (YES) or that it should be included in the master .chm file (NO).
1270# The default value is: NO.
1271# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
1272
1273GENERATE_CHI = NO
1274
1275# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
1276# and project file content.
1277# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
1278
1279CHM_INDEX_ENCODING =
1280
1281# The BINARY_TOC flag controls whether a binary table of contents is generated
1282# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
1283# enables the Previous and Next buttons.
1284# The default value is: NO.
1285# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
1286
1287BINARY_TOC = NO
1288
1289# The TOC_EXPAND flag can be set to YES to add extra items for group members to
1290# the table of contents of the HTML help documentation and to the tree view.
1291# The default value is: NO.
1292# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
1293
1294TOC_EXPAND = YES
1295
1296# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
1297# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
1298# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
1299# (.qch) of the generated HTML documentation.
1300# The default value is: NO.
1301# This tag requires that the tag GENERATE_HTML is set to YES.
1302
1303GENERATE_QHP = NO
1304
1305# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
1306# the file name of the resulting .qch file. The path specified is relative to
1307# the HTML output folder.
1308# This tag requires that the tag GENERATE_QHP is set to YES.
1309
1310QCH_FILE =
1311
1312# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
1313# Project output. For more information please see Qt Help Project / Namespace
1314# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
1315# The default value is: org.doxygen.Project.
1316# This tag requires that the tag GENERATE_QHP is set to YES.
1317
1318QHP_NAMESPACE = org.doxygen.Project
1319
1320# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
1321# Help Project output. For more information please see Qt Help Project / Virtual
1322# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
1323# folders).
1324# The default value is: doc.
1325# This tag requires that the tag GENERATE_QHP is set to YES.
1326
1327QHP_VIRTUAL_FOLDER = doc
1328
1329# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
1330# filter to add. For more information please see Qt Help Project / Custom
1331# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
1332# filters).
1333# This tag requires that the tag GENERATE_QHP is set to YES.
1334
1335QHP_CUST_FILTER_NAME =
1336
1337# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
1338# custom filter to add. For more information please see Qt Help Project / Custom
1339# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
1340# filters).
1341# This tag requires that the tag GENERATE_QHP is set to YES.
1342
1343QHP_CUST_FILTER_ATTRS =
1344
1345# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
1346# project's filter section matches. Qt Help Project / Filter Attributes (see:
1347# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
1348# This tag requires that the tag GENERATE_QHP is set to YES.
1349
1350QHP_SECT_FILTER_ATTRS =
1351
1352# The QHG_LOCATION tag can be used to specify the location of Qt's
1353# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
1354# generated .qhp file.
1355# This tag requires that the tag GENERATE_QHP is set to YES.
1356
1357QHG_LOCATION =
1358
1359# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
1360# generated, together with the HTML files, they form an Eclipse help plugin. To
1361# install this plugin and make it available under the help contents menu in
1362# Eclipse, the contents of the directory containing the HTML and XML files needs
1363# to be copied into the plugins directory of eclipse. The name of the directory
1364# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
1365# After copying Eclipse needs to be restarted before the help appears.
1366# The default value is: NO.
1367# This tag requires that the tag GENERATE_HTML is set to YES.
1368
1369GENERATE_ECLIPSEHELP = NO
1370
1371# A unique identifier for the Eclipse help plugin. When installing the plugin
1372# the directory name containing the HTML and XML files should also have this
1373# name. Each documentation set should have its own identifier.
1374# The default value is: org.doxygen.Project.
1375# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
1376
1377ECLIPSE_DOC_ID = org.doxygen.Project
1378
1379# If you want full control over the layout of the generated HTML pages it might
1380# be necessary to disable the index and replace it with your own. The
1381# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
1382# of each HTML page. A value of NO enables the index and the value YES disables
1383# it. Since the tabs in the index contain the same information as the navigation
1384# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
1385# The default value is: NO.
1386# This tag requires that the tag GENERATE_HTML is set to YES.
1387
1388DISABLE_INDEX = YES
1389
1390# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
1391# structure should be generated to display hierarchical information. If the tag
1392# value is set to YES, a side panel will be generated containing a tree-like
1393# index structure (just like the one that is generated for HTML Help). For this
1394# to work a browser that supports JavaScript, DHTML, CSS and frames is required
1395# (i.e. any modern browser). Windows users are probably better off using the
1396# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
1397# further fine-tune the look of the index. As an example, the default style
1398# sheet generated by doxygen has an example that shows how to put an image at
1399# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
1400# the same information as the tab index, you could consider setting
1401# DISABLE_INDEX to YES when enabling this option.
1402# The default value is: NO.
1403# This tag requires that the tag GENERATE_HTML is set to YES.
1404
1405GENERATE_TREEVIEW = YES
1406
1407# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
1408# doxygen will group on one line in the generated HTML documentation.
1409#
1410# Note that a value of 0 will completely suppress the enum values from appearing
1411# in the overview section.
1412# Minimum value: 0, maximum value: 20, default value: 4.
1413# This tag requires that the tag GENERATE_HTML is set to YES.
1414
1415ENUM_VALUES_PER_LINE = 1
1416
1417# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
1418# to set the initial width (in pixels) of the frame in which the tree is shown.
1419# Minimum value: 0, maximum value: 1500, default value: 250.
1420# This tag requires that the tag GENERATE_HTML is set to YES.
1421
1422TREEVIEW_WIDTH = 250
1423
1424# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
1425# external symbols imported via tag files in a separate window.
1426# The default value is: NO.
1427# This tag requires that the tag GENERATE_HTML is set to YES.
1428
1429EXT_LINKS_IN_WINDOW = NO
1430
1431# Use this tag to change the font size of LaTeX formulas included as images in
1432# the HTML documentation. When you change the font size after a successful
1433# doxygen run you need to manually remove any form_*.png images from the HTML
1434# output directory to force them to be regenerated.
1435# Minimum value: 8, maximum value: 50, default value: 10.
1436# This tag requires that the tag GENERATE_HTML is set to YES.
1437
1438FORMULA_FONTSIZE = 10
1439
1440# Use the FORMULA_TRANPARENT tag to determine whether or not the images
1441# generated for formulas are transparent PNGs. Transparent PNGs are not
1442# supported properly for IE 6.0, but are supported on all modern browsers.
1443#
1444# Note that when changing this option you need to delete any form_*.png files in
1445# the HTML output directory before the changes have effect.
1446# The default value is: YES.
1447# This tag requires that the tag GENERATE_HTML is set to YES.
1448
1449FORMULA_TRANSPARENT = YES
1450
1451# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
1452# http://www.mathjax.org) which uses client side Javascript for the rendering
1453# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
1454# installed or if you want to formulas look prettier in the HTML output. When
1455# enabled you may also need to install MathJax separately and configure the path
1456# to it using the MATHJAX_RELPATH option.
1457# The default value is: NO.
1458# This tag requires that the tag GENERATE_HTML is set to YES.
1459
1460USE_MATHJAX = NO
1461
1462# When MathJax is enabled you can set the default output format to be used for
1463# the MathJax output. See the MathJax site (see:
1464# http://docs.mathjax.org/en/latest/output.html) for more details.
1465# Possible values are: HTML-CSS (which is slower, but has the best
1466# compatibility), NativeMML (i.e. MathML) and SVG.
1467# The default value is: HTML-CSS.
1468# This tag requires that the tag USE_MATHJAX is set to YES.
1469
1470MATHJAX_FORMAT = HTML-CSS
1471
1472# When MathJax is enabled you need to specify the location relative to the HTML
1473# output directory using the MATHJAX_RELPATH option. The destination directory
1474# should contain the MathJax.js script. For instance, if the mathjax directory
1475# is located at the same level as the HTML output directory, then
1476# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
1477# Content Delivery Network so you can quickly see the result without installing
1478# MathJax. However, it is strongly recommended to install a local copy of
1479# MathJax from http://www.mathjax.org before deployment.
1480# The default value is: http://cdn.mathjax.org/mathjax/latest.
1481# This tag requires that the tag USE_MATHJAX is set to YES.
1482
1483MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
1484
1485# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
1486# extension names that should be enabled during MathJax rendering. For example
1487# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
1488# This tag requires that the tag USE_MATHJAX is set to YES.
1489
1490MATHJAX_EXTENSIONS =
1491
1492# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
1493# of code that will be used on startup of the MathJax code. See the MathJax site
1494# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
1495# example see the documentation.
1496# This tag requires that the tag USE_MATHJAX is set to YES.
1497
1498MATHJAX_CODEFILE =
1499
1500# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
1501# the HTML output. The underlying search engine uses javascript and DHTML and
1502# should work on any modern browser. Note that when using HTML help
1503# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
1504# there is already a search function so this one should typically be disabled.
1505# For large projects the javascript based search engine can be slow, then
1506# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
1507# search using the keyboard; to jump to the search box use <access key> + S
1508# (what the <access key> is depends on the OS and browser, but it is typically
1509# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
1510# key> to jump into the search results window, the results can be navigated
1511# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
1512# the search. The filter options can be selected when the cursor is inside the
1513# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
1514# to select a filter and <Enter> or <escape> to activate or cancel the filter
1515# option.
1516# The default value is: YES.
1517# This tag requires that the tag GENERATE_HTML is set to YES.
1518
1519SEARCHENGINE = NO
1520
1521# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
1522# implemented using a web server instead of a web client using Javascript. There
1523# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
1524# setting. When disabled, doxygen will generate a PHP script for searching and
1525# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
1526# and searching needs to be provided by external tools. See the section
1527# "External Indexing and Searching" for details.
1528# The default value is: NO.
1529# This tag requires that the tag SEARCHENGINE is set to YES.
1530
1531SERVER_BASED_SEARCH = NO
1532
1533# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
1534# script for searching. Instead the search results are written to an XML file
1535# which needs to be processed by an external indexer. Doxygen will invoke an
1536# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
1537# search results.
1538#
1539# Doxygen ships with an example indexer (doxyindexer) and search engine
1540# (doxysearch.cgi) which are based on the open source search engine library
1541# Xapian (see: http://xapian.org/).
1542#
1543# See the section "External Indexing and Searching" for details.
1544# The default value is: NO.
1545# This tag requires that the tag SEARCHENGINE is set to YES.
1546
1547EXTERNAL_SEARCH = NO
1548
1549# The SEARCHENGINE_URL should point to a search engine hosted by a web server
1550# which will return the search results when EXTERNAL_SEARCH is enabled.
1551#
1552# Doxygen ships with an example indexer (doxyindexer) and search engine
1553# (doxysearch.cgi) which are based on the open source search engine library
1554# Xapian (see: http://xapian.org/). See the section "External Indexing and
1555# Searching" for details.
1556# This tag requires that the tag SEARCHENGINE is set to YES.
1557
1558SEARCHENGINE_URL =
1559
1560# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
1561# search data is written to a file for indexing by an external tool. With the
1562# SEARCHDATA_FILE tag the name of this file can be specified.
1563# The default file is: searchdata.xml.
1564# This tag requires that the tag SEARCHENGINE is set to YES.
1565
1566SEARCHDATA_FILE = searchdata.xml
1567
1568# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
1569# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
1570# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
1571# projects and redirect the results back to the right project.
1572# This tag requires that the tag SEARCHENGINE is set to YES.
1573
1574EXTERNAL_SEARCH_ID =
1575
1576# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
1577# projects other than the one defined by this configuration file, but that are
1578# all added to the same external search index. Each project needs to have a
1579# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
1580# to a relative location where the documentation can be found. The format is:
1581# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
1582# This tag requires that the tag SEARCHENGINE is set to YES.
1583
1584EXTRA_SEARCH_MAPPINGS =
1585
1586#---------------------------------------------------------------------------
1587# Configuration options related to the LaTeX output
1588#---------------------------------------------------------------------------
1589
1590# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
1591# The default value is: YES.
1592
1593GENERATE_LATEX = NO
1594
1595# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
1596# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
1597# it.
1598# The default directory is: latex.
1599# This tag requires that the tag GENERATE_LATEX is set to YES.
1600
1601LATEX_OUTPUT = latex
1602
1603# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
1604# invoked.
1605#
1606# Note that when enabling USE_PDFLATEX this option is only used for generating
1607# bitmaps for formulas in the HTML output, but not in the Makefile that is
1608# written to the output directory.
1609# The default file is: latex.
1610# This tag requires that the tag GENERATE_LATEX is set to YES.
1611
1612LATEX_CMD_NAME = latex
1613
1614# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
1615# index for LaTeX.
1616# The default file is: makeindex.
1617# This tag requires that the tag GENERATE_LATEX is set to YES.
1618
1619MAKEINDEX_CMD_NAME = makeindex
1620
1621# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
1622# documents. This may be useful for small projects and may help to save some
1623# trees in general.
1624# The default value is: NO.
1625# This tag requires that the tag GENERATE_LATEX is set to YES.
1626
1627COMPACT_LATEX = NO
1628
1629# The PAPER_TYPE tag can be used to set the paper type that is used by the
1630# printer.
1631# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
1632# 14 inches) and executive (7.25 x 10.5 inches).
1633# The default value is: a4.
1634# This tag requires that the tag GENERATE_LATEX is set to YES.
1635
1636PAPER_TYPE = a4wide
1637
1638# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
1639# that should be included in the LaTeX output. To get the times font for
1640# instance you can specify
1641# EXTRA_PACKAGES=times
1642# If left blank no extra packages will be included.
1643# This tag requires that the tag GENERATE_LATEX is set to YES.
1644
1645EXTRA_PACKAGES =
1646
1647# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
1648# generated LaTeX document. The header should contain everything until the first
1649# chapter. If it is left blank doxygen will generate a standard header. See
1650# section "Doxygen usage" for information on how to let doxygen write the
1651# default header to a separate file.
1652#
1653# Note: Only use a user-defined header if you know what you are doing! The
1654# following commands have a special meaning inside the header: $title,
1655# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
1656# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
1657# string, for the replacement values of the other commands the user is referred
1658# to HTML_HEADER.
1659# This tag requires that the tag GENERATE_LATEX is set to YES.
1660
1661LATEX_HEADER =
1662
1663# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
1664# generated LaTeX document. The footer should contain everything after the last
1665# chapter. If it is left blank doxygen will generate a standard footer. See
1666# LATEX_HEADER for more information on how to generate a default footer and what
1667# special commands can be used inside the footer.
1668#
1669# Note: Only use a user-defined footer if you know what you are doing!
1670# This tag requires that the tag GENERATE_LATEX is set to YES.
1671
1672LATEX_FOOTER =
1673
1674# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
1675# LaTeX style sheets that are included after the standard style sheets created
1676# by doxygen. Using this option one can overrule certain style aspects. Doxygen
1677# will copy the style sheet files to the output directory.
1678# Note: The order of the extra style sheet files is of importance (e.g. the last
1679# style sheet in the list overrules the setting of the previous ones in the
1680# list).
1681# This tag requires that the tag GENERATE_LATEX is set to YES.
1682
1683LATEX_EXTRA_STYLESHEET =
1684
1685# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
1686# other source files which should be copied to the LATEX_OUTPUT output
1687# directory. Note that the files will be copied as-is; there are no commands or
1688# markers available.
1689# This tag requires that the tag GENERATE_LATEX is set to YES.
1690
1691LATEX_EXTRA_FILES =
1692
1693# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
1694# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
1695# contain links (just like the HTML output) instead of page references. This
1696# makes the output suitable for online browsing using a PDF viewer.
1697# The default value is: YES.
1698# This tag requires that the tag GENERATE_LATEX is set to YES.
1699
1700PDF_HYPERLINKS = YES
1701
1702# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
1703# the PDF file directly from the LaTeX files. Set this option to YES, to get a
1704# higher quality PDF documentation.
1705# The default value is: YES.
1706# This tag requires that the tag GENERATE_LATEX is set to YES.
1707
1708USE_PDFLATEX = YES
1709
1710# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
1711# command to the generated LaTeX files. This will instruct LaTeX to keep running
1712# if errors occur, instead of asking the user for help. This option is also used
1713# when generating formulas in HTML.
1714# The default value is: NO.
1715# This tag requires that the tag GENERATE_LATEX is set to YES.
1716
1717LATEX_BATCHMODE = NO
1718
1719# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
1720# index chapters (such as File Index, Compound Index, etc.) in the output.
1721# The default value is: NO.
1722# This tag requires that the tag GENERATE_LATEX is set to YES.
1723
1724LATEX_HIDE_INDICES = NO
1725
1726# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
1727# code with syntax highlighting in the LaTeX output.
1728#
1729# Note that which sources are shown also depends on other settings such as
1730# SOURCE_BROWSER.
1731# The default value is: NO.
1732# This tag requires that the tag GENERATE_LATEX is set to YES.
1733
1734LATEX_SOURCE_CODE = NO
1735
1736# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
1737# bibliography, e.g. plainnat, or ieeetr. See
1738# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
1739# The default value is: plain.
1740# This tag requires that the tag GENERATE_LATEX is set to YES.
1741
1742LATEX_BIB_STYLE = plain
1743
1744#---------------------------------------------------------------------------
1745# Configuration options related to the RTF output
1746#---------------------------------------------------------------------------
1747
1748# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
1749# RTF output is optimized for Word 97 and may not look too pretty with other RTF
1750# readers/editors.
1751# The default value is: NO.
1752
1753GENERATE_RTF = NO
1754
1755# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
1756# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
1757# it.
1758# The default directory is: rtf.
1759# This tag requires that the tag GENERATE_RTF is set to YES.
1760
1761RTF_OUTPUT = rtf
1762
1763# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
1764# documents. This may be useful for small projects and may help to save some
1765# trees in general.
1766# The default value is: NO.
1767# This tag requires that the tag GENERATE_RTF is set to YES.
1768
1769COMPACT_RTF = NO
1770
1771# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
1772# contain hyperlink fields. The RTF file will contain links (just like the HTML
1773# output) instead of page references. This makes the output suitable for online
1774# browsing using Word or some other Word compatible readers that support those
1775# fields.
1776#
1777# Note: WordPad (write) and others do not support links.
1778# The default value is: NO.
1779# This tag requires that the tag GENERATE_RTF is set to YES.
1780
1781RTF_HYPERLINKS = NO
1782
1783# Load stylesheet definitions from file. Syntax is similar to doxygen's config
1784# file, i.e. a series of assignments. You only have to provide replacements,
1785# missing definitions are set to their default value.
1786#
1787# See also section "Doxygen usage" for information on how to generate the
1788# default style sheet that doxygen normally uses.
1789# This tag requires that the tag GENERATE_RTF is set to YES.
1790
1791RTF_STYLESHEET_FILE =
1792
1793# Set optional variables used in the generation of an RTF document. Syntax is
1794# similar to doxygen's config file. A template extensions file can be generated
1795# using doxygen -e rtf extensionFile.
1796# This tag requires that the tag GENERATE_RTF is set to YES.
1797
1798RTF_EXTENSIONS_FILE =
1799
1800# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
1801# with syntax highlighting in the RTF output.
1802#
1803# Note that which sources are shown also depends on other settings such as
1804# SOURCE_BROWSER.
1805# The default value is: NO.
1806# This tag requires that the tag GENERATE_RTF is set to YES.
1807
1808RTF_SOURCE_CODE = NO
1809
1810#---------------------------------------------------------------------------
1811# Configuration options related to the man page output
1812#---------------------------------------------------------------------------
1813
1814# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
1815# classes and files.
1816# The default value is: NO.
1817
1818GENERATE_MAN = NO
1819
1820# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
1821# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
1822# it. A directory man3 will be created inside the directory specified by
1823# MAN_OUTPUT.
1824# The default directory is: man.
1825# This tag requires that the tag GENERATE_MAN is set to YES.
1826
1827MAN_OUTPUT = man
1828
1829# The MAN_EXTENSION tag determines the extension that is added to the generated
1830# man pages. In case the manual section does not start with a number, the number
1831# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
1832# optional.
1833# The default value is: .3.
1834# This tag requires that the tag GENERATE_MAN is set to YES.
1835
1836MAN_EXTENSION = .3
1837
1838# The MAN_SUBDIR tag determines the name of the directory created within
1839# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
1840# MAN_EXTENSION with the initial . removed.
1841# This tag requires that the tag GENERATE_MAN is set to YES.
1842
1843MAN_SUBDIR =
1844
1845# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
1846# will generate one additional man file for each entity documented in the real
1847# man page(s). These additional files only source the real man page, but without
1848# them the man command would be unable to find the correct page.
1849# The default value is: NO.
1850# This tag requires that the tag GENERATE_MAN is set to YES.
1851
1852MAN_LINKS = NO
1853
1854#---------------------------------------------------------------------------
1855# Configuration options related to the XML output
1856#---------------------------------------------------------------------------
1857
1858# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
1859# captures the structure of the code including all documentation.
1860# The default value is: NO.
1861
1862GENERATE_XML = NO
1863
1864# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
1865# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
1866# it.
1867# The default directory is: xml.
1868# This tag requires that the tag GENERATE_XML is set to YES.
1869
1870XML_OUTPUT = xml
1871
1872# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
1873# listings (including syntax highlighting and cross-referencing information) to
1874# the XML output. Note that enabling this will significantly increase the size
1875# of the XML output.
1876# The default value is: YES.
1877# This tag requires that the tag GENERATE_XML is set to YES.
1878
1879XML_PROGRAMLISTING = YES
1880
1881#---------------------------------------------------------------------------
1882# Configuration options related to the DOCBOOK output
1883#---------------------------------------------------------------------------
1884
1885# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
1886# that can be used to generate PDF.
1887# The default value is: NO.
1888
1889GENERATE_DOCBOOK = NO
1890
1891# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
1892# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
1893# front of it.
1894# The default directory is: docbook.
1895# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
1896
1897DOCBOOK_OUTPUT = docbook
1898
1899# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
1900# program listings (including syntax highlighting and cross-referencing
1901# information) to the DOCBOOK output. Note that enabling this will significantly
1902# increase the size of the DOCBOOK output.
1903# The default value is: NO.
1904# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
1905
1906DOCBOOK_PROGRAMLISTING = NO
1907
1908#---------------------------------------------------------------------------
1909# Configuration options for the AutoGen Definitions output
1910#---------------------------------------------------------------------------
1911
1912# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
1913# AutoGen Definitions (see http://autogen.sf.net) file that captures the
1914# structure of the code including all documentation. Note that this feature is
1915# still experimental and incomplete at the moment.
1916# The default value is: NO.
1917
1918GENERATE_AUTOGEN_DEF = NO
1919
1920#---------------------------------------------------------------------------
1921# Configuration options related to the Perl module output
1922#---------------------------------------------------------------------------
1923
1924# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
1925# file that captures the structure of the code including all documentation.
1926#
1927# Note that this feature is still experimental and incomplete at the moment.
1928# The default value is: NO.
1929
1930GENERATE_PERLMOD = NO
1931
1932# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
1933# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
1934# output from the Perl module output.
1935# The default value is: NO.
1936# This tag requires that the tag GENERATE_PERLMOD is set to YES.
1937
1938PERLMOD_LATEX = NO
1939
1940# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
1941# formatted so it can be parsed by a human reader. This is useful if you want to
1942# understand what is going on. On the other hand, if this tag is set to NO, the
1943# size of the Perl module output will be much smaller and Perl will parse it
1944# just the same.
1945# The default value is: YES.
1946# This tag requires that the tag GENERATE_PERLMOD is set to YES.
1947
1948PERLMOD_PRETTY = YES
1949
1950# The names of the make variables in the generated doxyrules.make file are
1951# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
1952# so different doxyrules.make files included by the same Makefile don't
1953# overwrite each other's variables.
1954# This tag requires that the tag GENERATE_PERLMOD is set to YES.
1955
1956PERLMOD_MAKEVAR_PREFIX =
1957
1958#---------------------------------------------------------------------------
1959# Configuration options related to the preprocessor
1960#---------------------------------------------------------------------------
1961
1962# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
1963# C-preprocessor directives found in the sources and include files.
1964# The default value is: YES.
1965
1966ENABLE_PREPROCESSING = YES
1967
1968# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
1969# in the source code. If set to NO, only conditional compilation will be
1970# performed. Macro expansion can be done in a controlled way by setting
1971# EXPAND_ONLY_PREDEF to YES.
1972# The default value is: NO.
1973# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
1974
1975MACRO_EXPANSION = YES
1976
1977# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
1978# the macro expansion is limited to the macros specified with the PREDEFINED and
1979# EXPAND_AS_DEFINED tags.
1980# The default value is: NO.
1981# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
1982
1983EXPAND_ONLY_PREDEF = YES
1984
1985# If the SEARCH_INCLUDES tag is set to YES, the include files in the
1986# INCLUDE_PATH will be searched if a #include is found.
1987# The default value is: YES.
1988# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
1989
1990SEARCH_INCLUDES = YES
1991
1992# The INCLUDE_PATH tag can be used to specify one or more directories that
1993# contain include files that are not input files but should be processed by the
1994# preprocessor.
1995# This tag requires that the tag SEARCH_INCLUDES is set to YES.
1996
1997INCLUDE_PATH =
1998
1999# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
2000# patterns (like *.h and *.hpp) to filter out the header-files in the
2001# directories. If left blank, the patterns specified with FILE_PATTERNS will be
2002# used.
2003# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
2004
2005INCLUDE_FILE_PATTERNS =
2006
2007# The PREDEFINED tag can be used to specify one or more macro names that are
2008# defined before the preprocessor is started (similar to the -D option of e.g.
2009# gcc). The argument of the tag is a list of macros of the form: name or
2010# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
2011# is assumed. To prevent a macro definition from being undefined via #undef or
2012# recursively expanded use the := operator instead of the = operator.
2013# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
2014
2015PREDEFINED = __DOXYGEN__ \
2016 PROGMEM
2017
2018# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
2019# tag can be used to specify a list of macro names that should be expanded. The
2020# macro definition that is found in the sources will be used. Use the PREDEFINED
2021# tag if you want to use a different macro definition that overrules the
2022# definition found in the source code.
2023# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
2024
2025EXPAND_AS_DEFINED =
2026
2027# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
2028# remove all references to function-like macros that are alone on a line, have
2029# an all uppercase name, and do not end with a semicolon. Such function macros
2030# are typically used for boiler-plate code, and will confuse the parser if not
2031# removed.
2032# The default value is: YES.
2033# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
2034
2035SKIP_FUNCTION_MACROS = YES
2036
2037#---------------------------------------------------------------------------
2038# Configuration options related to external references
2039#---------------------------------------------------------------------------
2040
2041# The TAGFILES tag can be used to specify one or more tag files. For each tag
2042# file the location of the external documentation should be added. The format of
2043# a tag file without this location is as follows:
2044# TAGFILES = file1 file2 ...
2045# Adding location for the tag files is done as follows:
2046# TAGFILES = file1=loc1 "file2 = loc2" ...
2047# where loc1 and loc2 can be relative or absolute paths or URLs. See the
2048# section "Linking to external documentation" for more information about the use
2049# of tag files.
2050# Note: Each tag file must have a unique name (where the name does NOT include
2051# the path). If a tag file is not located in the directory in which doxygen is
2052# run, you must also specify the path to the tagfile here.
2053
2054TAGFILES =
2055
2056# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
2057# tag file that is based on the input files it reads. See section "Linking to
2058# external documentation" for more information about the usage of tag files.
2059
2060GENERATE_TAGFILE =
2061
2062# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
2063# the class index. If set to NO, only the inherited external classes will be
2064# listed.
2065# The default value is: NO.
2066
2067ALLEXTERNALS = NO
2068
2069# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
2070# in the modules index. If set to NO, only the current project's groups will be
2071# listed.
2072# The default value is: YES.
2073
2074EXTERNAL_GROUPS = YES
2075
2076# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
2077# the related pages index. If set to NO, only the current project's pages will
2078# be listed.
2079# The default value is: YES.
2080
2081EXTERNAL_PAGES = YES
2082
2083# The PERL_PATH should be the absolute path and name of the perl script
2084# interpreter (i.e. the result of 'which perl').
2085# The default file (with absolute path) is: /usr/bin/perl.
2086
2087PERL_PATH = /usr/bin/perl
2088
2089#---------------------------------------------------------------------------
2090# Configuration options related to the dot tool
2091#---------------------------------------------------------------------------
2092
2093# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
2094# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
2095# NO turns the diagrams off. Note that this option also works with HAVE_DOT
2096# disabled, but it is recommended to install and use dot, since it yields more
2097# powerful graphs.
2098# The default value is: YES.
2099
2100CLASS_DIAGRAMS = NO
2101
2102# You can define message sequence charts within doxygen comments using the \msc
2103# command. Doxygen will then run the mscgen tool (see:
2104# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
2105# documentation. The MSCGEN_PATH tag allows you to specify the directory where
2106# the mscgen tool resides. If left empty the tool is assumed to be found in the
2107# default search path.
2108
2109MSCGEN_PATH =
2110
2111# You can include diagrams made with dia in doxygen documentation. Doxygen will
2112# then run dia to produce the diagram and insert it in the documentation. The
2113# DIA_PATH tag allows you to specify the directory where the dia binary resides.
2114# If left empty dia is assumed to be found in the default search path.
2115
2116DIA_PATH =
2117
2118# If set to YES the inheritance and collaboration graphs will hide inheritance
2119# and usage relations if the target is undocumented or is not a class.
2120# The default value is: YES.
2121
2122HIDE_UNDOC_RELATIONS = YES
2123
2124# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
2125# available from the path. This tool is part of Graphviz (see:
2126# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
2127# Bell Labs. The other options in this section have no effect if this option is
2128# set to NO
2129# The default value is: NO.
2130
2131HAVE_DOT = NO
2132
2133# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
2134# to run in parallel. When set to 0 doxygen will base this on the number of
2135# processors available in the system. You can set it explicitly to a value
2136# larger than 0 to get control over the balance between CPU load and processing
2137# speed.
2138# Minimum value: 0, maximum value: 32, default value: 0.
2139# This tag requires that the tag HAVE_DOT is set to YES.
2140
2141DOT_NUM_THREADS = 0
2142
2143# When you want a differently looking font in the dot files that doxygen
2144# generates you can specify the font name using DOT_FONTNAME. You need to make
2145# sure dot is able to find the font, which can be done by putting it in a
2146# standard location or by setting the DOTFONTPATH environment variable or by
2147# setting DOT_FONTPATH to the directory containing the font.
2148# The default value is: Helvetica.
2149# This tag requires that the tag HAVE_DOT is set to YES.
2150
2151DOT_FONTNAME =
2152
2153# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
2154# dot graphs.
2155# Minimum value: 4, maximum value: 24, default value: 10.
2156# This tag requires that the tag HAVE_DOT is set to YES.
2157
2158DOT_FONTSIZE = 10
2159
2160# By default doxygen will tell dot to use the default font as specified with
2161# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
2162# the path where dot can find it using this tag.
2163# This tag requires that the tag HAVE_DOT is set to YES.
2164
2165DOT_FONTPATH =
2166
2167# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
2168# each documented class showing the direct and indirect inheritance relations.
2169# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
2170# The default value is: YES.
2171# This tag requires that the tag HAVE_DOT is set to YES.
2172
2173CLASS_GRAPH = NO
2174
2175# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
2176# graph for each documented class showing the direct and indirect implementation
2177# dependencies (inheritance, containment, and class references variables) of the
2178# class with other documented classes.
2179# The default value is: YES.
2180# This tag requires that the tag HAVE_DOT is set to YES.
2181
2182COLLABORATION_GRAPH = NO
2183
2184# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
2185# groups, showing the direct groups dependencies.
2186# The default value is: YES.
2187# This tag requires that the tag HAVE_DOT is set to YES.
2188
2189GROUP_GRAPHS = NO
2190
2191# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
2192# collaboration diagrams in a style similar to the OMG's Unified Modeling
2193# Language.
2194# The default value is: NO.
2195# This tag requires that the tag HAVE_DOT is set to YES.
2196
2197UML_LOOK = NO
2198
2199# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
2200# class node. If there are many fields or methods and many nodes the graph may
2201# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
2202# number of items for each type to make the size more manageable. Set this to 0
2203# for no limit. Note that the threshold may be exceeded by 50% before the limit
2204# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
2205# but if the number exceeds 15, the total amount of fields shown is limited to
2206# 10.
2207# Minimum value: 0, maximum value: 100, default value: 10.
2208# This tag requires that the tag HAVE_DOT is set to YES.
2209
2210UML_LIMIT_NUM_FIELDS = 10
2211
2212# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
2213# collaboration graphs will show the relations between templates and their
2214# instances.
2215# The default value is: NO.
2216# This tag requires that the tag HAVE_DOT is set to YES.
2217
2218TEMPLATE_RELATIONS = NO
2219
2220# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
2221# YES then doxygen will generate a graph for each documented file showing the
2222# direct and indirect include dependencies of the file with other documented
2223# files.
2224# The default value is: YES.
2225# This tag requires that the tag HAVE_DOT is set to YES.
2226
2227INCLUDE_GRAPH = NO
2228
2229# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
2230# set to YES then doxygen will generate a graph for each documented file showing
2231# the direct and indirect include dependencies of the file with other documented
2232# files.
2233# The default value is: YES.
2234# This tag requires that the tag HAVE_DOT is set to YES.
2235
2236INCLUDED_BY_GRAPH = NO
2237
2238# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
2239# dependency graph for every global function or class method.
2240#
2241# Note that enabling this option will significantly increase the time of a run.
2242# So in most cases it will be better to enable call graphs for selected
2243# functions only using the \callgraph command.
2244# The default value is: NO.
2245# This tag requires that the tag HAVE_DOT is set to YES.
2246
2247CALL_GRAPH = NO
2248
2249# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
2250# dependency graph for every global function or class method.
2251#
2252# Note that enabling this option will significantly increase the time of a run.
2253# So in most cases it will be better to enable caller graphs for selected
2254# functions only using the \callergraph command.
2255# The default value is: NO.
2256# This tag requires that the tag HAVE_DOT is set to YES.
2257
2258CALLER_GRAPH = NO
2259
2260# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
2261# hierarchy of all classes instead of a textual one.
2262# The default value is: YES.
2263# This tag requires that the tag HAVE_DOT is set to YES.
2264
2265GRAPHICAL_HIERARCHY = NO
2266
2267# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
2268# dependencies a directory has on other directories in a graphical way. The
2269# dependency relations are determined by the #include relations between the
2270# files in the directories.
2271# The default value is: YES.
2272# This tag requires that the tag HAVE_DOT is set to YES.
2273
2274DIRECTORY_GRAPH = NO
2275
2276# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
2277# generated by dot.
2278# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
2279# to make the SVG files visible in IE 9+ (other browsers do not have this
2280# requirement).
2281# Possible values are: png, jpg, gif and svg.
2282# The default value is: png.
2283# This tag requires that the tag HAVE_DOT is set to YES.
2284
2285DOT_IMAGE_FORMAT = png
2286
2287# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
2288# enable generation of interactive SVG images that allow zooming and panning.
2289#
2290# Note that this requires a modern browser other than Internet Explorer. Tested
2291# and working are Firefox, Chrome, Safari, and Opera.
2292# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
2293# the SVG files visible. Older versions of IE do not have SVG support.
2294# The default value is: NO.
2295# This tag requires that the tag HAVE_DOT is set to YES.
2296
2297INTERACTIVE_SVG = NO
2298
2299# The DOT_PATH tag can be used to specify the path where the dot tool can be
2300# found. If left blank, it is assumed the dot tool can be found in the path.
2301# This tag requires that the tag HAVE_DOT is set to YES.
2302
2303DOT_PATH =
2304
2305# The DOTFILE_DIRS tag can be used to specify one or more directories that
2306# contain dot files that are included in the documentation (see the \dotfile
2307# command).
2308# This tag requires that the tag HAVE_DOT is set to YES.
2309
2310DOTFILE_DIRS =
2311
2312# The MSCFILE_DIRS tag can be used to specify one or more directories that
2313# contain msc files that are included in the documentation (see the \mscfile
2314# command).
2315
2316MSCFILE_DIRS =
2317
2318# The DIAFILE_DIRS tag can be used to specify one or more directories that
2319# contain dia files that are included in the documentation (see the \diafile
2320# command).
2321
2322DIAFILE_DIRS =
2323
2324# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
2325# path where java can find the plantuml.jar file. If left blank, it is assumed
2326# PlantUML is not used or called during a preprocessing step. Doxygen will
2327# generate a warning when it encounters a \startuml command in this case and
2328# will not generate output for the diagram.
2329
2330PLANTUML_JAR_PATH =
2331
2332# When using plantuml, the specified paths are searched for files specified by
2333# the !include statement in a plantuml block.
2334
2335PLANTUML_INCLUDE_PATH =
2336
2337# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
2338# that will be shown in the graph. If the number of nodes in a graph becomes
2339# larger than this value, doxygen will truncate the graph, which is visualized
2340# by representing a node as a red box. Note that doxygen if the number of direct
2341# children of the root node in a graph is already larger than
2342# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
2343# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
2344# Minimum value: 0, maximum value: 10000, default value: 50.
2345# This tag requires that the tag HAVE_DOT is set to YES.
2346
2347DOT_GRAPH_MAX_NODES = 15
2348
2349# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
2350# generated by dot. A depth value of 3 means that only nodes reachable from the
2351# root by following a path via at most 3 edges will be shown. Nodes that lay
2352# further from the root node will be omitted. Note that setting this option to 1
2353# or 2 may greatly reduce the computation time needed for large code bases. Also
2354# note that the size of a graph can be further restricted by
2355# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
2356# Minimum value: 0, maximum value: 1000, default value: 0.
2357# This tag requires that the tag HAVE_DOT is set to YES.
2358
2359MAX_DOT_GRAPH_DEPTH = 2
2360
2361# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
2362# background. This is disabled by default, because dot on Windows does not seem
2363# to support this out of the box.
2364#
2365# Warning: Depending on the platform used, enabling this option may lead to
2366# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
2367# read).
2368# The default value is: NO.
2369# This tag requires that the tag HAVE_DOT is set to YES.
2370
2371DOT_TRANSPARENT = YES
2372
2373# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
2374# files in one run (i.e. multiple -o and -T options on the command line). This
2375# makes dot run faster, but since only newer versions of dot (>1.8.10) support
2376# this, this feature is disabled by default.
2377# The default value is: NO.
2378# This tag requires that the tag HAVE_DOT is set to YES.
2379
2380DOT_MULTI_TARGETS = NO
2381
2382# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
2383# explaining the meaning of the various boxes and arrows in the dot generated
2384# graphs.
2385# The default value is: YES.
2386# This tag requires that the tag HAVE_DOT is set to YES.
2387
2388GENERATE_LEGEND = YES
2389
2390# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
2391# files that are used to generate the various graphs.
2392# The default value is: YES.
2393# This tag requires that the tag HAVE_DOT is set to YES.
2394
2395DOT_CLEANUP = YES
diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/makefile b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/makefile
new file mode 100644
index 000000000..82687c1f1
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/makefile
@@ -0,0 +1,44 @@
1#
2# LUFA Library
3# Copyright (C) Dean Camera, 2017.
4#
5# dean [at] fourwalledcubicle [dot] com
6# www.lufa-lib.org
7#
8# --------------------------------------
9# LUFA Project Makefile.
10# --------------------------------------
11
12# Run "make help" for target help.
13
14MCU = at90usb1287
15ARCH = AVR8
16BOARD = USBKEY
17F_CPU = 8000000
18F_USB = $(F_CPU)
19OPTIMIZATION = s
20TARGET = RNDISEthernet
21SRC = $(TARGET).c Descriptors.c Lib/Ethernet.c Lib/ProtocolDecoders.c Lib/RNDIS.c Lib/ICMP.c Lib/TCP.c Lib/UDP.c \
22 Lib/DHCP.c Lib/ARP.c Lib/IP.c Lib/Webserver.c $(LUFA_SRC_USB) $(LUFA_SRC_SERIAL)
23LUFA_PATH = ../../../../LUFA
24CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/
25LD_FLAGS =
26
27# Default target
28all:
29
30# Include LUFA-specific DMBS extension modules
31DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
32include $(DMBS_LUFA_PATH)/lufa-sources.mk
33include $(DMBS_LUFA_PATH)/lufa-gcc.mk
34
35# Include common DMBS build system modules
36DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
37include $(DMBS_PATH)/core.mk
38include $(DMBS_PATH)/cppcheck.mk
39include $(DMBS_PATH)/doxygen.mk
40include $(DMBS_PATH)/dfu.mk
41include $(DMBS_PATH)/gcc.mk
42include $(DMBS_PATH)/hid.mk
43include $(DMBS_PATH)/avrdude.mk
44include $(DMBS_PATH)/atprogram.mk