libcollectdclient: Add lcc_network_parse_options_t to lcc_listener_t.
authorFlorian Forster <octo@collectd.org>
Tue, 2 May 2017 08:52:58 +0000 (10:52 +0200)
committerFlorian Forster <octo@collectd.org>
Tue, 2 May 2017 08:52:58 +0000 (10:52 +0200)
This avoids listing the same fields twice.

src/libcollectdclient/collectd/server.h
src/libcollectdclient/server.c

index 48b5874..d190217 100644 (file)
@@ -59,18 +59,12 @@ typedef struct {
    * lcc_network_parse() if set to NULL. */
   lcc_network_parser_t parser;
 
-  /* writer is the callback used to send incoming lcc_value_list_t to. */
-  lcc_value_list_writer_t writer;
+  /* parse_options contains options for parser and is passed on verbatimely. */
+  lcc_network_parse_options_t parse_options;
 
   /* buffer_size determines the maximum packet size to accept. */
   uint16_t buffer_size;
 
-  /* password_lookup is used to look up the password for a given username. */
-  lcc_password_lookup_t password_lookup;
-
-  /* security_level is the minimal required security level. */
-  lcc_security_level_t security_level;
-
   /* interface is the name of the interface to use when subscribing to a
    * multicast group. Has no effect when using unicast. */
   char *interface;
index 68e4a9e..1c4a101 100644 (file)
@@ -203,12 +203,7 @@ int lcc_listen_and_write(lcc_listener_t srv) {
       break;
     }
 
-    (void)srv.parser(buffer, (size_t)len,
-                     (lcc_network_parse_options_t){
-                         .writer = srv.writer,
-                         .password_lookup = srv.password_lookup,
-                         .security_level = srv.security_level,
-                     });
+    (void)srv.parser(buffer, (size_t)len, srv.parse_options);
   }
 
   if (close_socket) {