Displaying 10 results from an estimated 10 matches for "mode_base64exportnam".
Did you mean:
mode_base64exportname
2019 Sep 15
0
[PATCH nbdkit 1/4] Add reflection plugin.
...lib.h>
+#include <string.h>
+
+#if defined(HAVE_GNUTLS) && defined(HAVE_GNUTLS_BASE64_DECODE2)
+#include <gnutls/gnutls.h>
+#define HAVE_BASE64 1
+#endif
+
+#define NBDKIT_API_VERSION 2
+
+#include <nbdkit-plugin.h>
+
+/* The mode. */
+enum mode {
+ MODE_EXPORTNAME,
+ MODE_BASE64EXPORTNAME,
+};
+static enum mode mode = MODE_EXPORTNAME;
+
+static int
+reflection_config (const char *key, const char *value)
+{
+ if (strcmp (key, "mode") == 0) {
+ if (strcasecmp (value, "exportname") == 0) {
+ mode = MODE_EXPORTNAME;
+ }
+ else if (strcasecmp (value, &...
2019 Sep 15
13
[PATCH nbdkit 0/4] Reflection plugin, peer name.
This series is based on my blog posting here:
https://rwmj.wordpress.com/2019/09/13/nbdkit-supports-exportnames/
It depends on the fix for realloc:
https://www.redhat.com/archives/libguestfs/2019-September/thread.html#00103
This series adds a fun plugin, and also an semi-related feature I've
long thought to be desirable. You can consider patches 1 & 4, and
patches 2 & 3 as forming
2019 Sep 15
0
Re: [PATCH nbdkit 0/4] Reflection plugin, peer name.
...n;
}
-/* Read-only plugin so multi-conn is safe. */
static int
reflection_can_multi_conn (void *handle)
{
- return 1;
+ switch (mode) {
+ /* Safe for exportname modes since clients should only request
+ * multi-conn with the same export name.
+ */
+ case MODE_EXPORTNAME:
+ case MODE_BASE64EXPORTNAME:
+ return 1;
+ /* Unsafe for mode=address because all multi-conn connections
+ * won't necessarily originate from the same client address.
+ */
+ case MODE_ADDRESS:
+ return 0;
+ }
}
/* Cache. */
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.red...
2019 Sep 28
2
[PATCH nbdkit 1/2] common/include: Add function for subtracting struct timeval.
---
common/include/test-tvdiff.c | 75 +++++++++++++++++++++++++++++-------
common/include/tvdiff.h | 13 ++++++-
2 files changed, 74 insertions(+), 14 deletions(-)
diff --git a/common/include/test-tvdiff.c b/common/include/test-tvdiff.c
index 9cbcfc0..abefb2e 100644
--- a/common/include/test-tvdiff.c
+++ b/common/include/test-tvdiff.c
@@ -36,7 +36,6 @@
#include <stdlib.h>
#include
2019 Sep 28
0
[PATCH nbdkit 2/2] reflection: Add mode for reflecting server time.
...nclude <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -48,14 +49,29 @@
#include <nbdkit-plugin.h>
+#include "byte-swapping.h"
+#include "tvdiff.h"
+
/* The mode. */
enum mode {
MODE_EXPORTNAME,
MODE_BASE64EXPORTNAME,
MODE_ADDRESS,
+ MODE_TIME,
+ MODE_UPTIME,
+ MODE_CONNTIME,
};
static enum mode mode = MODE_EXPORTNAME;
+/* Plugin load time. */
+static struct timeval load_t;
+
+static void
+reflection_load (void)
+{
+ gettimeofday (&load_t, NULL);
+}
+
static int
reflection_config (const char *...
2019 Sep 28
0
[PATCH nbdkit v2 3/4] info: Add mode for sending back server time.
...nclude <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -48,14 +49,29 @@
#include <nbdkit-plugin.h>
+#include "byte-swapping.h"
+#include "tvdiff.h"
+
/* The mode. */
enum mode {
MODE_EXPORTNAME,
MODE_BASE64EXPORTNAME,
MODE_ADDRESS,
+ MODE_TIME,
+ MODE_UPTIME,
+ MODE_CONNTIME,
};
static enum mode mode = MODE_EXPORTNAME;
+/* Plugin load time. */
+static struct timeval load_t;
+
+static void
+info_load (void)
+{
+ gettimeofday (&load_t, NULL);
+}
+
static int
info_config (const char *key, const c...
2019 Sep 15
0
[PATCH nbdkit 4/4] reflection: Enhance plugin to support client address mode.
...<stdlib.h>
#include <string.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
#if defined(HAVE_GNUTLS) && defined(HAVE_GNUTLS_BASE64_DECODE2)
#include <gnutls/gnutls.h>
@@ -49,6 +52,7 @@
enum mode {
MODE_EXPORTNAME,
MODE_BASE64EXPORTNAME,
+ MODE_ADDRESS,
};
static enum mode mode = MODE_EXPORTNAME;
@@ -67,6 +71,9 @@ reflection_config (const char *key, const char *value)
return -1;
#endif
}
+ else if (strcasecmp (value, "address") == 0) {
+ mode = MODE_ADDRESS;
+ }
else {
nbdkit_err...
2019 Sep 16
2
Re: [PATCH nbdkit 1/4] Add reflection plugin.
...plugin(1)>,
> +L<nbdkit-memory-plugin(1)/Preloading small amounts of data>.
Except that nbdkit-memory-plugin points only to nbdkit-data-plugin, so
is this link helping?
> +++ b/plugins/reflection/reflection.c
> +/* The mode. */
> +enum mode {
> + MODE_EXPORTNAME,
> + MODE_BASE64EXPORTNAME,
> +};
> +static enum mode mode = MODE_EXPORTNAME;
Explicit assignment to a 0 value, instead of relying on .bss; but I'm
okay with it (it's not as obvious as =0 or =false).
> +
> +static int
> +reflection_config (const char *key, const char *value)
> +{
> + if (strc...
2020 May 19
1
[PATCH nbdkit] common/include: Add locale-safe ascii_strcasecmp and ascii_strncasecmp.
...quot;base64exportname") == 0 ||
- strcasecmp (value, "base64-export-name") == 0) {
+ else if (ascii_strcasecmp (value, "base64exportname") == 0 ||
+ ascii_strcasecmp (value, "base64-export-name") == 0) {
#ifdef HAVE_BASE64
mode = MODE_BASE64EXPORTNAME;
#else
@@ -89,13 +90,13 @@ info_config (const char *key, const char *value)
return -1;
#endif
}
- else if (strcasecmp (value, "address") == 0)
+ else if (ascii_strcasecmp (value, "address") == 0)
mode = MODE_ADDRESS;
- else if (strcasecmp (value, &...
2019 Sep 28
9
[PATCH nbdkit v2 0/4] info: Add mode for sending back server time.
v1 was:
https://www.redhat.com/archives/libguestfs/2019-September/thread.html#00361
v2:
- Adds a patch to rename the reflection plugin to the info plugin.
- Adds tests.
Rich.