Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up order of includes #2015

Merged
merged 18 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More header fixes
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
  • Loading branch information
dthaler committed Feb 3, 2023
commit c84d9133786185a5a105890ca3943e780f886ec2
4 changes: 4 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ IncludeCategories:
- Regex: '^<ntifs.h'
Priority: 2
SortPriority: 4
# ndis.h must be before fwpsk.h
- Regex: '^<ndis.h'
Priority: 2
SortPriority: 4
- Regex: '\.c"'
Priority: 6
- Regex: '^"'
Expand Down
1 change: 1 addition & 0 deletions ebpfapi/rpc_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "ebpf_api.h"
#include "ebpf_platform.h"

#include "rpc_interface_c.c"

// Windows.h needs to be included before other headers.
Expand Down
2 changes: 1 addition & 1 deletion netebpfext/user/netebpfext_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <ws2def.h>
#include <ws2ipdef.h>
#include <ndis.h>
#include <../km/fwpmk.h>
#include <../km/fwpsk.h>
#include <../km/netioddk.h>
Expand All @@ -15,6 +16,5 @@
#include <fwpstypes.h>
#include <fwpvi.h>
#include <iphlpapi.h>
#include <ndis.h>
#include <netiodef.h>
#include <winnt.h>
2 changes: 1 addition & 1 deletion tests/api_test/api_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
#include "socket_helper.h"

#include <winsock2.h>
#include <ws2tcpip.h>
#include <chrono>
#include <io.h>
#include <mstcpip.h>
#include <mutex>
#include <ntsecapi.h>
#include <thread>
#include <vector>
#include <ws2tcpip.h>

#define SAMPLE_PATH ""

Expand Down
5 changes: 2 additions & 3 deletions tests/bpf2c_tests/expected/bpf_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>
#include "bpf2c.h"

#include <windows.h>
#include <stdio.h>

#include "bpf2c.h"

#define metadata_table bpf##_metadata_table
extern metadata_table_t metadata_table;

Expand Down
5 changes: 2 additions & 3 deletions tests/bpf2c_tests/expected/droppacket_unsafe_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>
#include "bpf2c.h"

#include <windows.h>
#include <stdio.h>

#include "bpf2c.h"

#define metadata_table droppacket_unsafe##_metadata_table
extern metadata_table_t metadata_table;

Expand Down
5 changes: 2 additions & 3 deletions tests/bpf2c_tests/expected/empty_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>
#include "bpf2c.h"

#include <windows.h>
#include <stdio.h>

#include "bpf2c.h"

#define metadata_table empty##_metadata_table
extern metadata_table_t metadata_table;

Expand Down
5 changes: 2 additions & 3 deletions tests/bpf2c_tests/expected/printk_unsafe_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>
#include "bpf2c.h"

#include <windows.h>
#include <stdio.h>

#include "bpf2c.h"

#define metadata_table printk_unsafe##_metadata_table
extern metadata_table_t metadata_table;

Expand Down
2 changes: 1 addition & 1 deletion tests/sample/ext/app/sample_ext_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "common_tests.h"
#include "netsh_test_helper.h"
#include "program_helper.h"
#include "service_helper.h"
#include "sample_ext_app.h"
#include "service_helper.h"

#include <chrono>
#include <mutex>
Expand Down
3 changes: 1 addition & 2 deletions tests/sample/ext/drv/sample_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
#include "ebpf_program_types.h"
#include "ebpf_store_helper.h"
#include "ebpf_structs.h"

#include "sample_ext_program_info.h"
#include "sample_ext_helpers.h"
#include "sample_ext_ioctls.h"
#include "sample_ext_program_info.h"

#define SAMPLE_EBPF_EXTENSION_NPI_PROVIDER_VERSION 0

Expand Down
1 change: 0 additions & 1 deletion tests/sample/ext/drv/sample_ext_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

#include "ebpf_platform.h"

#include "sample_ext.h"
#include "sample_ext_helpers.h"
#include "sample_ext_ioctls.h"
Expand Down
2 changes: 1 addition & 1 deletion tools/dnsflood/dns_flood.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// SPDX-License-Identifier: MIT

#include <WinSock2.h>
#include <ws2tcpip.h>
#include <iostream>
#include <thread>
#include <vector>
#include <ws2tcpip.h>
#pragma comment(lib, "ws2_32.lib")

struct _address_info
Expand Down
3 changes: 2 additions & 1 deletion tools/export_program_info/export_program_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING

#include "ebpf_api.h"
#include "ebpf_general_helpers.c"
#include "ebpf_nethooks.h"
#include "ebpf_store_helper.h"
#include "export_program_info.h"
#include "windows_program_type.h"

#include <codecvt>

#include "ebpf_general_helpers.c"

#define REG_CREATE_FLAGS (KEY_WRITE | DELETE | KEY_READ)
#define REG_OPEN_FLAGS (DELETE | KEY_READ)

Expand Down