-
Notifications
You must be signed in to change notification settings - Fork 4
Generate and verify Go FFI bindings #374
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
Open
fuchsnj
wants to merge
4
commits into
main
Choose a base branch
from
fuchsnj/sdsp-488-go-binding-ci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,24 +1,43 @@ | ||
| // From the Go documentation, it's recommended to include stdlib.h if we need | ||
| // to use C.free. | ||
| #include <stdlib.h> | ||
| #ifndef DD_SDS_H | ||
| #define DD_SDS_H | ||
|
|
||
| /* Generated from the Rust FFI. Run `make update-sds-go-header` to update. */ | ||
|
|
||
| #include <stdarg.h> | ||
| #include <stdbool.h> | ||
| #include <stdint.h> | ||
| #include <stdlib.h> | ||
|
|
||
| void append_rule_to_list(int64_t rule, int64_t list); | ||
|
|
||
| int64_t create_regex_rule(const char *json_config); | ||
|
|
||
| int64_t create_rule_list(void); | ||
|
|
||
| int64_t create_scanner(int64_t rules, | ||
| const char *encoded_labels, | ||
| int32_t enable_debug_observability, | ||
| const char **error_out); | ||
|
|
||
| void delete_scanner(int64_t scanner_id); | ||
|
|
||
| long create_regex_rule(const char* json_config); | ||
| void free_any_rule(int64_t rule_ptr); | ||
|
|
||
| long create_scanner(long rule_list, const char* encoded_labels, int enable_debug_observability, const char** error); | ||
| void delete_scanner(long scanner_id); | ||
| void free_rule_list(int64_t list); | ||
|
|
||
| // event is a non-null terminated TODO | ||
| // scan_metadata_json may be NULL, or a null-terminated UTF-8 JSON object string. | ||
| const char* scan(long scanner_id, const void* event, long event_size, long *retsize, long *retcap, const char** error, int with_validate_matching, const char* scan_metadata_json); | ||
| void free_string(const char *ptr); | ||
|
|
||
| void free_vec(const char* string, long len, long cap); | ||
| void free_string(const char* string); | ||
| void free_vec(const char *ptr, int64_t len, int64_t cap); | ||
|
|
||
| void free_any_rule(long rule_ptr); | ||
| const char *scan(int64_t scanner_id, | ||
| const void *event, | ||
| int64_t event_size, | ||
| int64_t *retsize, | ||
| int64_t *retcapacity, | ||
| const char **error_out, | ||
| int32_t with_validate_matching, | ||
| const char *scan_metadata_json); | ||
|
|
||
| long create_rule_list(); | ||
| void append_rule_to_list(long rule_ptr, long list_ptr); | ||
| void free_rule_list(long list_ptr); | ||
| const char *validate_regex(const char *regex, const char **error_out); | ||
|
|
||
| const char* validate_regex(const char* regex, const char** error_out); | ||
| #endif /* DD_SDS_H */ |
This file contains hidden or 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 hidden or 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 hidden or 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,9 @@ | ||
| language = "C" | ||
| include_guard = "DD_SDS_H" | ||
| autogen_warning = "/* Generated from the Rust FFI. Run `make update-sds-go-header` to update. */" | ||
| documentation = false | ||
| style = "type" | ||
| sort_by = "Name" | ||
|
|
||
| [export] | ||
| item_types = ["functions"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this need self documented in the command if it's missing, would it be possible to add a pre-check before re-generating the bindings:
and then calling the check in
update-sds-go-headerThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed