-
Notifications
You must be signed in to change notification settings - Fork 79
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
Merge middleware into main #609
Merged
ArnoStiefvater
merged 33 commits into
greenbone:main
from
ArnoStiefvater:merge-middleware
Oct 20, 2021
Merged
Merge middleware into main #609
ArnoStiefvater
merged 33 commits into
greenbone:main
from
ArnoStiefvater:merge-middleware
Oct 20, 2021
Conversation
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 is reintroduction after rebase. For details see Base: https://github.com/greenbone/gvm-libs/pull/505/commits Fix: https://github.com/greenbone/gvm-libs/pull/511/commits
Remove feature guards. Add function for single message publish. Getters and setters. Reset function. Init mqtt_t on publish if mqtt_t is NULL.
Do not send unnecessary message (backport greenbone#561)
Hide mqtt_t. Fix mqtt_reset().
Merge Master into Middleware branch
[middleware] Add function for mqtt init status
To retrieve messages 1. mqtt_subscribe 1. mqtt_retrieve_message 1. mqtt_unsubscribe are implemented. Since at least in openvas most retrieving functionalities are done a in request/response fashion `mqtt_retrieve_message` is written in a blocking way instead of using the callback functionality of paho. With that we have fine granular control over threads and processes and can decide how we want to treat message retrieval in more abstract libraries. There is a small example on how to use the mqtt_* api retrieve messages: ``` \#include <gvm/util/mqtt.h> \#include <signal.h> \#include <stdio.h> \#include <stdlib.h> \#define TOPIC "#" void signalhandler (int signum) { printf ("Caught %d, reset mqtt\n", signum); mqtt_unsubscribe (TOPIC); mqtt_reset (); exit (0); } int main () { signal (SIGINT, signalhandler); int rc; if ((rc = mqtt_init ("localhost:9138")) != 0) { printf ("init returned %d, quitting\n", rc); goto exit; } if ((rc = mqtt_subscribe (TOPIC)) != 0) { printf ("subscribe returned %d, quitting\n", rc); goto exit; } while (1) { char *topic; int topic_len; char *payload; int payload_len; if ((rc = mqtt_retrieve_message (&topic, &topic_len, &payload, &payload_len)) == -1) { printf ("unable to retrieve message, quitting\n"); goto exit; } if (rc == 0) printf ("[%d] Got message: %s on topic %s\n", payload_len, payload != NULL ? payload : "N/A", topic != NULL ? topic : "N/A"); else rc = 0; if (payload != NULL) free (payload); if (topic != NULL) free (topic); } exit: mqtt_unsubscribe (TOPIC); mqtt_reset (); return rc; } ``` to compile it please install libgvm and build it via: ``` gcc $(pkg-config --cflags glib-2.0) main.c -lgvm_util -lgvm_base $(pkg-config --libs glib-2.0) ```
Because it is now handle as script preference.
The timeout is not stored under the redis key `nvt:<OID>` anymore.
The timeout must be get from script preferences. It was currently not used by libs or scanner.
Handle script timeout as script preference
Avoid warning/error when the compiler uses the -Werror=strict-prototypes flag
ArnoStiefvater
force-pushed
the
merge-middleware
branch
from
October 19, 2021 08:09
83eaf5f
to
11037fc
Compare
2 tasks
y0urself
approved these changes
Oct 19, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What:
Why:
How:
Checklist: