-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Change remaining names and fix compiler warnings (#10)
- Loading branch information
Showing
19 changed files
with
280 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ list( | |
SOURCES | ||
src/Config.cpp | ||
src/Discovery.cpp | ||
src/Log.cpp | ||
src/Session.cpp | ||
src/StringFunctions.cpp | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
10 changes: 5 additions & 5 deletions
10
libebpfdiscoveryshared/headers/ebpfdiscoveryshared/Constants.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
#pragma once | ||
|
||
#define BUFFER_MAX_DATA_SIZE 10240 // 10 KiB | ||
#define MAX_SESSIONS 8192 | ||
#define EVENT_QUEUE_SIZE 512 | ||
#define DISCOVERY_BUFFER_MAX_DATA_SIZE 10240 // 10 KiB | ||
#define DISCOVERY_MAX_SESSIONS 8192 | ||
#define DISCOVERY_EVENT_QUEUE_SIZE 512 | ||
|
||
#define MAX_HTTP_REQUEST_LENGTH BUFFER_MAX_DATA_SIZE | ||
#define MIN_HTTP_REQUEST_LENGTH 16 | ||
#define DISCOVERY_MAX_HTTP_REQUEST_LENGTH DISCOVERY_BUFFER_MAX_DATA_SIZE | ||
#define DISCOVERY_MIN_HTTP_REQUEST_LENGTH 16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
#pragma once | ||
|
||
#include "ebpfdiscoveryshared/Constants.h" | ||
|
||
#include "vmlinux.h" | ||
|
||
#include <bpf/bpf_helpers.h> | ||
|
||
__attribute__((always_inline)) inline static int dataProbeIsEqualToString(const char* src, const char* str, size_t len) { | ||
char ch; | ||
for (size_t i = 0; i < len; ++i) { | ||
int result = bpf_probe_read(&ch, sizeof(char), (char*)src + i); | ||
if (result < 0) { | ||
return result; | ||
} | ||
|
||
if (ch != str[i] || ch == '\0') { | ||
return i + 1; | ||
} | ||
} | ||
return len; | ||
} | ||
|
||
__attribute__((always_inline)) inline static bool dataProbeIsBeginningOfHttpRequest(const char* ptr, size_t len) { | ||
// We expect only GET and POST requests. We expect request URI's to start with a slash as absolute urls are mainly used in | ||
// requests to proxy servers. | ||
return len >= DISCOVERY_MIN_HTTP_REQUEST_LENGTH && | ||
(dataProbeIsEqualToString(ptr, "GET /", 5) || dataProbeIsEqualToString(ptr, "POST /", 6)); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.