2 * collectd - src/netcmd.c
3 * Copyright (C) 2007-2012 Florian octo Forster
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 * Florian octo Forster <octo at collectd.org>
30 #include "configfile.h"
32 #include "utils_cmd_flush.h"
33 #include "utils_cmd_getval.h"
34 #include "utils_cmd_listval.h"
35 #include "utils_cmd_putval.h"
36 #include "utils_cmd_putnotif.h"
38 /* Folks without pthread will need to disable this plugin. */
41 #include <sys/socket.h>
49 #include <gnutls/gnutls.h>
51 #define NC_DEFAULT_SERVICE "25826"
52 #define NC_TLS_DH_BITS 1024
55 * Private data structures
68 _Bool tls_verify_peer;
70 gnutls_certificate_credentials_t tls_credentials;
71 gnutls_dh_params_t tls_dh_params;
72 gnutls_priority_t tls_priority;
75 typedef struct nc_peer_s nc_peer_t;
78 # define NC_READ_BUFFER_SIZE PAGESIZE
79 #elif defined(PAGE_SIZE)
80 # define NC_READ_BUFFER_SIZE PAGE_SIZE
82 # define NC_READ_BUFFER_SIZE 4096
85 struct nc_connection_s
90 size_t read_buffer_fill;
96 gnutls_session_t tls_session;
97 _Bool have_tls_session;
99 typedef struct nc_connection_s nc_connection_t;
105 /* socket configuration */
106 static nc_peer_t *peers = NULL;
107 static size_t peers_num;
109 static struct pollfd *pollfd = NULL;
110 static size_t pollfd_num;
112 static int listen_thread_loop = 0;
113 static int listen_thread_running = 0;
114 static pthread_t listen_thread;
119 static nc_peer_t *nc_fd_to_peer (int fd) /* {{{ */
123 for (i = 0; i < peers_num; i++)
127 for (j = 0; j < peers[i].fds_num; j++)
128 if (peers[i].fds[j] == fd)
133 } /* }}} nc_peer_t *nc_fd_to_peer */
135 static void nc_free_peer (nc_peer_t *p) /* {{{ */
144 for (i = 0; i < p->fds_num; i++)
153 sfree (p->tls_cert_file);
154 sfree (p->tls_key_file);
155 sfree (p->tls_ca_file);
156 sfree (p->tls_crl_file);
158 gnutls_certificate_free_credentials (p->tls_credentials);
159 gnutls_dh_params_deinit (p->tls_dh_params);
160 gnutls_priority_deinit (p->tls_priority);
161 } /* }}} void nc_free_peer */
163 static int nc_register_fd (nc_peer_t *peer, int fd) /* {{{ */
165 struct pollfd *poll_ptr;
168 poll_ptr = realloc (pollfd, (pollfd_num + 1) * sizeof (*pollfd));
169 if (poll_ptr == NULL)
171 ERROR ("netcmd plugin: realloc failed.");
176 memset (&pollfd[pollfd_num], 0, sizeof (pollfd[pollfd_num]));
177 pollfd[pollfd_num].fd = fd;
178 pollfd[pollfd_num].events = POLLIN | POLLPRI;
179 pollfd[pollfd_num].revents = 0;
185 fd_ptr = realloc (peer->fds, (peer->fds_num + 1) * sizeof (*peer->fds));
188 ERROR ("netcmd plugin: realloc failed.");
192 peer->fds[peer->fds_num] = fd;
196 } /* }}} int nc_register_fd */
198 static int nc_tls_init (nc_peer_t *peer) /* {{{ */
205 if ((peer->tls_cert_file == NULL)
206 || (peer->tls_key_file == NULL))
208 DEBUG ("netcmd plugin: Not setting up TLS environment for peer.");
212 DEBUG ("netcmd plugin: Setting up TLS environment for peer.");
214 /* Initialize the structure holding our certificate information. */
215 status = gnutls_certificate_allocate_credentials (&peer->tls_credentials);
216 if (status != GNUTLS_E_SUCCESS)
218 ERROR ("netcmd plugin: gnutls_certificate_allocate_credentials failed: %s",
219 gnutls_strerror (status));
223 /* Set up the configured certificates. */
224 if (peer->tls_ca_file != NULL)
226 status = gnutls_certificate_set_x509_trust_file (peer->tls_credentials,
227 peer->tls_ca_file, GNUTLS_X509_FMT_PEM);
230 ERROR ("netcmd plugin: gnutls_certificate_set_x509_trust_file (%s) "
232 peer->tls_ca_file, gnutls_strerror (status));
237 DEBUG ("netcmd plugin: Successfully loaded %i CA(s).", status);
241 if (peer->tls_crl_file != NULL)
243 status = gnutls_certificate_set_x509_crl_file (peer->tls_credentials,
244 peer->tls_crl_file, GNUTLS_X509_FMT_PEM);
247 ERROR ("netcmd plugin: gnutls_certificate_set_x509_crl_file (%s) "
249 peer->tls_crl_file, gnutls_strerror (status));
254 DEBUG ("netcmd plugin: Successfully loaded %i CRL(s).", status);
258 status = gnutls_certificate_set_x509_key_file (peer->tls_credentials,
259 peer->tls_cert_file, peer->tls_key_file, GNUTLS_X509_FMT_PEM);
260 if (status != GNUTLS_E_SUCCESS)
262 ERROR ("netcmd plugin: gnutls_certificate_set_x509_key_file failed: %s",
263 gnutls_strerror (status));
267 /* Initialize Diffie-Hellman parameters. */
268 gnutls_dh_params_init (&peer->tls_dh_params);
269 gnutls_dh_params_generate2 (peer->tls_dh_params, NC_TLS_DH_BITS);
270 gnutls_certificate_set_dh_params (peer->tls_credentials,
271 peer->tls_dh_params);
273 /* Initialize a "priority cache". This will tell GNUTLS which algorithms to
274 * use and which to avoid. We use the "NORMAL" method for now. */
275 gnutls_priority_init (&peer->tls_priority,
276 /* priority = */ "NORMAL", /* errpos = */ NULL);
279 } /* }}} int nc_tls_init */
281 static gnutls_session_t nc_tls_get_session (nc_peer_t *peer) /* {{{ */
283 gnutls_session_t session;
286 if (peer->tls_credentials == NULL)
289 DEBUG ("netcmd plugin: nc_tls_get_session (%s)", peer->node);
291 /* Initialize new session. */
292 gnutls_init (&session, GNUTLS_SERVER);
294 /* Set cipher priority and credentials based on the information stored with
296 status = gnutls_priority_set (session, peer->tls_priority);
297 if (status != GNUTLS_E_SUCCESS)
299 ERROR ("netcmd plugin: gnutls_priority_set failed: %s",
300 gnutls_strerror (status));
301 gnutls_deinit (session);
305 status = gnutls_credentials_set (session,
306 GNUTLS_CRD_CERTIFICATE, peer->tls_credentials);
307 if (status != GNUTLS_E_SUCCESS)
309 ERROR ("netcmd plugin: gnutls_credentials_set failed: %s",
310 gnutls_strerror (status));
311 gnutls_deinit (session);
315 /* Request the client certificate. If TLSVerifyPeer is set to true,
316 * *require* a client certificate. */
317 gnutls_certificate_server_set_request (session,
318 peer->tls_verify_peer ? GNUTLS_CERT_REQUIRE : GNUTLS_CERT_REQUEST);
321 } /* }}} gnutls_session_t nc_tls_get_session */
323 static int nc_open_socket (nc_peer_t *peer) /* {{{ */
325 struct addrinfo ai_hints;
326 struct addrinfo *ai_list;
327 struct addrinfo *ai_ptr;
330 const char *node = NULL;
331 const char *service = NULL;
336 service = peer->service;
340 service = NC_DEFAULT_SERVICE;
342 memset (&ai_hints, 0, sizeof (ai_hints));
344 ai_hints.ai_flags |= AI_PASSIVE;
347 ai_hints.ai_flags |= AI_ADDRCONFIG;
349 ai_hints.ai_family = AF_UNSPEC;
350 ai_hints.ai_socktype = SOCK_STREAM;
355 service = NC_DEFAULT_SERVICE;
357 status = getaddrinfo (node, service, &ai_hints, &ai_list);
360 ERROR ("netcmd plugin: getaddrinfo failed: %s",
361 gai_strerror (status));
365 for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next)
370 fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype,
371 ai_ptr->ai_protocol);
374 ERROR ("netcmd plugin: socket(2) failed: %s",
375 sstrerror (errno, errbuf, sizeof (errbuf)));
379 status = bind (fd, ai_ptr->ai_addr, ai_ptr->ai_addrlen);
383 ERROR ("netcmd plugin: bind(2) failed: %s",
384 sstrerror (errno, errbuf, sizeof (errbuf)));
388 status = listen (fd, /* backlog = */ 8);
392 ERROR ("netcmd plugin: listen(2) failed: %s",
393 sstrerror (errno, errbuf, sizeof (errbuf)));
397 status = nc_register_fd (peer, fd);
403 } /* for (ai_next) */
405 freeaddrinfo (ai_list);
407 return (nc_tls_init (peer));
408 } /* }}} int nc_open_socket */
410 static void nc_connection_close (nc_connection_t *conn) /* {{{ */
421 if (conn->fh_in != NULL)
423 fclose (conn->fh_in);
427 if (conn->fh_out != NULL)
429 fclose (conn->fh_out);
433 if (conn->have_tls_session)
435 gnutls_deinit (conn->tls_session);
436 conn->have_tls_session = 0;
440 } /* }}} void nc_connection_close */
442 static int nc_connection_init (nc_connection_t *conn) /* {{{ */
447 DEBUG ("netcmd plugin: nc_connection_init();");
449 if (conn->have_tls_session)
454 conn->read_buffer = malloc (NC_READ_BUFFER_SIZE);
455 if (conn->read_buffer == NULL)
457 memset (conn->read_buffer, 0, NC_READ_BUFFER_SIZE);
459 /* Make (relatively) sure that 'fd' and 'void*' have the same size to make
461 fd = (intptr_t) conn->fd;
462 gnutls_transport_set_ptr (conn->tls_session,
463 (gnutls_transport_ptr_t) fd);
467 status = gnutls_handshake (conn->tls_session);
468 if (status == GNUTLS_E_SUCCESS)
470 else if ((status == GNUTLS_E_AGAIN) || (status == GNUTLS_E_INTERRUPTED))
474 ERROR ("netcmd plugin: gnutls_handshake failed: %s",
475 gnutls_strerror (status));
483 /* Duplicate the file descriptor. We need two file descriptors, because we
484 * create two FILE* objects. If they pointed to the same FD and we called
485 * fclose() on each, that would call close() twice on the same FD. If
486 * another file is opened in between those two calls, it could get assigned
487 * that FD and weird stuff would happen. */
488 fd_copy = dup (conn->fd);
491 ERROR ("netcmd plugin: dup(2) failed: %s",
492 sstrerror (errno, errbuf, sizeof (errbuf)));
496 conn->fh_in = fdopen (conn->fd, "r");
497 if (conn->fh_in == NULL)
499 ERROR ("netcmd plugin: fdopen failed: %s",
500 sstrerror (errno, errbuf, sizeof (errbuf)));
503 /* Prevent other code from using the FD directly. */
506 conn->fh_out = fdopen (fd_copy, "w");
507 /* Prevent nc_connection_close from calling close(2) on this fd. */
508 if (conn->fh_out == NULL)
510 ERROR ("netcmd plugin: fdopen failed: %s",
511 sstrerror (errno, errbuf, sizeof (errbuf)));
515 /* change output buffer to line buffered mode */
516 if (setvbuf (conn->fh_out, NULL, _IOLBF, 0) != 0)
518 ERROR ("netcmd plugin: setvbuf failed: %s",
519 sstrerror (errno, errbuf, sizeof (errbuf)));
520 nc_connection_close (conn);
525 } /* }}} int nc_connection_init */
527 static char *nc_connection_gets (nc_connection_t *conn, /* {{{ */
528 char *buffer, size_t buffer_size)
531 char *orig_buffer = buffer;
539 if (!conn->have_tls_session)
540 return (fgets (buffer, (int) buffer_size, conn->fh_in));
542 if ((buffer == NULL) || (buffer_size < 2))
548 /* ensure null termination */
549 memset (buffer, 0, buffer_size);
554 size_t max_copy_bytes;
559 /* If there's no more data in the read buffer, read another chunk from the
561 if (conn->read_buffer_fill < 1)
563 status = gnutls_record_recv (conn->tls_session,
564 conn->read_buffer, NC_READ_BUFFER_SIZE);
565 if (status < 0) /* error */
567 ERROR ("netcmd plugin: Error while reading from TLS stream.");
570 else if (status == 0) /* we reached end of file */
572 if (orig_buffer == buffer) /* nothing has been written to the buffer yet */
573 return (NULL); /* end of file */
575 return (orig_buffer);
579 conn->read_buffer_fill = (size_t) status;
582 assert (conn->read_buffer_fill > 0);
584 /* Determine where the first newline character is in the buffer. We're not
585 * using strcspn(3) here, becaus the buffer is possibly not
586 * null-terminated. */
587 newline_pos = conn->read_buffer_fill;
589 for (i = 0; i < conn->read_buffer_fill; i++)
591 if (conn->read_buffer[i] == '\n')
599 /* Determine how many bytes to copy at most. This is MIN(buffer available,
600 * read buffer size, characters to newline). */
601 max_copy_bytes = buffer_size;
602 if (max_copy_bytes > conn->read_buffer_fill)
603 max_copy_bytes = conn->read_buffer_fill;
604 if (max_copy_bytes > (newline_pos + 1))
605 max_copy_bytes = newline_pos + 1;
606 assert (max_copy_bytes > 0);
608 /* Copy bytes to the output buffer. */
609 memcpy (buffer, conn->read_buffer, max_copy_bytes);
610 buffer += max_copy_bytes;
611 assert (buffer_size >= max_copy_bytes);
612 buffer_size -= max_copy_bytes;
614 /* If there is data left in the read buffer, move it to the front of the
616 if (max_copy_bytes < conn->read_buffer_fill)
618 size_t data_left_size = conn->read_buffer_fill - max_copy_bytes;
619 memmove (conn->read_buffer, conn->read_buffer + max_copy_bytes,
621 conn->read_buffer_fill -= max_copy_bytes;
625 assert (max_copy_bytes == conn->read_buffer_fill);
626 conn->read_buffer_fill = 0;
632 if (buffer_size == 0) /* no more space in the output buffer */
636 return (orig_buffer);
637 } /* }}} char *nc_connection_gets */
639 static void *nc_handle_client (void *arg) /* {{{ */
641 nc_connection_t *conn;
647 DEBUG ("netcmd plugin: nc_handle_client: Reading from fd #%i", conn->fd);
649 status = nc_connection_init (conn);
652 nc_connection_close (conn);
653 pthread_exit ((void *) 1);
659 char buffer_copy[1024];
665 if (nc_connection_gets (conn, buffer, sizeof (buffer)) == NULL)
669 WARNING ("netcmd plugin: failed to read from socket #%i: %s",
670 fileno (conn->fh_in),
671 sstrerror (errno, errbuf, sizeof (errbuf)));
676 len = strlen (buffer);
678 && ((buffer[len - 1] == '\n') || (buffer[len - 1] == '\r')))
679 buffer[--len] = '\0';
684 sstrncpy (buffer_copy, buffer, sizeof (buffer_copy));
686 fields_num = strsplit (buffer_copy, fields,
687 sizeof (fields) / sizeof (fields[0]));
691 nc_connection_close (conn);
695 if (strcasecmp (fields[0], "getval") == 0)
697 handle_getval (conn->fh_out, buffer);
699 else if (strcasecmp (fields[0], "putval") == 0)
701 handle_putval (conn->fh_out, buffer);
703 else if (strcasecmp (fields[0], "listval") == 0)
705 handle_listval (conn->fh_out, buffer);
707 else if (strcasecmp (fields[0], "putnotif") == 0)
709 handle_putnotif (conn->fh_out, buffer);
711 else if (strcasecmp (fields[0], "flush") == 0)
713 handle_flush (conn->fh_out, buffer);
717 if (fprintf (conn->fh_out, "-1 Unknown command: %s\n", fields[0]) < 0)
719 WARNING ("netcmd plugin: failed to write to socket #%i: %s",
720 fileno (conn->fh_out),
721 sstrerror (errno, errbuf, sizeof (errbuf)));
725 } /* while (fgets) */
727 DEBUG ("netcmd plugin: nc_handle_client: Exiting..");
728 nc_connection_close (conn);
730 pthread_exit ((void *) 0);
732 } /* }}} void *nc_handle_client */
734 static void *nc_server_thread (void __attribute__((unused)) *arg) /* {{{ */
738 pthread_attr_t th_attr;
742 for (i = 0; i < peers_num; i++)
743 nc_open_socket (peers + i);
746 nc_open_socket (NULL);
750 ERROR ("netcmd plugin: No sockets could be opened.");
751 pthread_exit ((void *) -1);
754 while (listen_thread_loop != 0)
756 status = poll (pollfd, (nfds_t) pollfd_num, /* timeout = */ -1);
759 if ((errno == EINTR) || (errno == EAGAIN))
762 ERROR ("netcmd plugin: poll(2) failed: %s",
763 sstrerror (errno, errbuf, sizeof (errbuf)));
764 listen_thread_loop = 0;
768 for (i = 0; i < pollfd_num; i++)
771 nc_connection_t *conn;
773 if (pollfd[i].revents == 0)
777 else if ((pollfd[i].revents & (POLLERR | POLLHUP | POLLNVAL))
780 WARNING ("netcmd plugin: File descriptor %i failed.",
782 close (pollfd[i].fd);
784 pollfd[i].events = 0;
785 pollfd[i].revents = 0;
788 pollfd[i].revents = 0;
790 peer = nc_fd_to_peer (pollfd[i].fd);
793 ERROR ("netcmd plugin: Unable to find peer structure for file "
794 "descriptor #%i.", pollfd[i].fd);
798 status = accept (pollfd[i].fd,
799 /* sockaddr = */ NULL,
800 /* sockaddr_len = */ NULL);
804 ERROR ("netcmd plugin: accept failed: %s",
805 sstrerror (errno, errbuf, sizeof (errbuf)));
809 conn = malloc (sizeof (*conn));
812 ERROR ("netcmd plugin: malloc failed.");
816 memset (conn, 0, sizeof (*conn));
822 && (peer->tls_cert_file != NULL))
824 DEBUG ("netcmd plugin: Starting TLS session on [%s]:%s",
825 (peer->node != NULL) ? peer->node : "any",
826 (peer->service != NULL) ? peer->service : NC_DEFAULT_SERVICE);
827 conn->tls_session = nc_tls_get_session (peer);
828 conn->have_tls_session = 1;
831 DEBUG ("Spawning child to handle connection on fd %i", conn->fd);
833 pthread_attr_init (&th_attr);
834 pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
836 status = pthread_create (&th, &th_attr, nc_handle_client,
840 WARNING ("netcmd plugin: pthread_create failed: %s",
841 sstrerror (errno, errbuf, sizeof (errbuf)));
842 nc_connection_close (conn);
846 } /* while (listen_thread_loop) */
848 for (i = 0; i < pollfd_num; i++)
850 if (pollfd[i].fd < 0)
853 close (pollfd[i].fd);
855 pollfd[i].events = 0;
856 pollfd[i].revents = 0;
863 } /* }}} void *nc_server_thread */
870 * TLSCertFile "/path/to/cert"
871 * TLSKeyFile "/path/to/key"
872 * TLSCAFile "/path/to/ca"
873 * TLSCRLFile "/path/to/crl"
874 * TLSVerifyPeer yes|no
878 static int nc_config_peer (const oconfig_item_t *ci) /* {{{ */
884 p = realloc (peers, sizeof (*peers) * (peers_num + 1));
887 ERROR ("netcmd plugin: realloc failed.");
891 p = peers + peers_num;
892 memset (p, 0, sizeof (*p));
895 p->tls_cert_file = NULL;
896 p->tls_key_file = NULL;
897 p->tls_ca_file = NULL;
898 p->tls_crl_file = NULL;
899 p->tls_verify_peer = 0;
901 for (i = 0; i < ci->children_num; i++)
903 oconfig_item_t *child = ci->children + i;
905 if (strcasecmp ("Address", child->key) == 0)
906 cf_util_get_string (child, &p->node);
907 else if (strcasecmp ("Port", child->key) == 0)
908 cf_util_get_string (child, &p->service);
909 else if (strcasecmp ("TLSCertFile", child->key) == 0)
910 cf_util_get_string (child, &p->tls_cert_file);
911 else if (strcasecmp ("TLSKeyFile", child->key) == 0)
912 cf_util_get_string (child, &p->tls_key_file);
913 else if (strcasecmp ("TLSCAFile", child->key) == 0)
914 cf_util_get_string (child, &p->tls_ca_file);
915 else if (strcasecmp ("TLSCRLFile", child->key) == 0)
916 cf_util_get_string (child, &p->tls_crl_file);
917 else if (strcasecmp ("TLSVerifyPeer", child->key) == 0)
918 cf_util_get_boolean (child, &p->tls_verify_peer);
920 WARNING ("netcmd plugin: The option \"%s\" is not recognized within "
921 "a \"%s\" block.", child->key, ci->key);
926 if (p->tls_verify_peer
927 && ((p->tls_cert_file == NULL)
928 || (p->tls_key_file == NULL)
929 || (p->tls_ca_file == NULL)))
931 ERROR ("netcmd plugin: You have requested to verify peers (using the "
932 "\"TLSVerifyPeer\" option), but the TLS setup is incomplete. "
933 "The \"TLSCertFile\", \"TLSKeyFile\" and \"TLSCAFile\" are "
934 "required for this to work. This \"Listen\" block will be disabled.");
944 DEBUG ("netcmd plugin: node = \"%s\"; service = \"%s\";", p->node, p->service);
949 } /* }}} int nc_config_peer */
951 static int nc_config (oconfig_item_t *ci) /* {{{ */
955 for (i = 0; i < ci->children_num; i++)
957 oconfig_item_t *child = ci->children + i;
959 if (strcasecmp ("Listen", child->key) == 0)
960 nc_config_peer (child);
962 WARNING ("netcmd plugin: The option \"%s\" is not recognized.",
967 } /* }}} int nc_config */
969 static int nc_init (void) /* {{{ */
971 static int have_init = 0;
975 /* Initialize only once. */
980 gnutls_global_init ();
982 listen_thread_loop = 1;
984 status = pthread_create (&listen_thread, NULL, nc_server_thread, NULL);
988 listen_thread_loop = 0;
989 listen_thread_running = 0;
990 ERROR ("netcmd plugin: pthread_create failed: %s",
991 sstrerror (errno, errbuf, sizeof (errbuf)));
995 listen_thread_running = 1;
997 } /* }}} int nc_init */
999 static int nc_shutdown (void) /* {{{ */
1003 listen_thread_loop = 0;
1005 if (listen_thread != (pthread_t) 0)
1009 pthread_kill (listen_thread, SIGTERM);
1010 pthread_join (listen_thread, &ret);
1011 listen_thread = (pthread_t) 0;
1014 plugin_unregister_init ("netcmd");
1015 plugin_unregister_shutdown ("netcmd");
1017 for (i = 0; i < peers_num; i++)
1018 nc_free_peer (peers + i);
1023 } /* }}} int nc_shutdown */
1025 void module_register (void)
1027 plugin_register_complex_config ("netcmd", nc_config);
1028 plugin_register_init ("netcmd", nc_init);
1029 plugin_register_shutdown ("netcmd", nc_shutdown);
1030 } /* void module_register (void) */
1032 /* vim: set sw=2 sts=2 tw=78 et fdm=marker : */