Add support to set the thread name.
[collectd.git] / src / email.c
1 /**
2  * collectd - src/email.c
3  * Copyright (C) 2006-2008  Sebastian Harl
4  *
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:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
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.
22  *
23  * Authors:
24  *   Sebastian Harl <sh at tokkee.org>
25  **/
26
27 /*
28  * This plugin communicates with a spam filter, a virus scanner or similar
29  * software using a UNIX socket and a very simple protocol:
30  *
31  * e-mail type (e.g. ham, spam, virus, ...) and size
32  * e:<type>:<bytes>
33  *
34  * spam score
35  * s:<value>
36  *
37  * successful spam checks
38  * c:<type1>[,<type2>,...]
39  */
40
41 #include "collectd.h"
42
43 #include "common.h"
44 #include "plugin.h"
45
46 #include <stddef.h>
47
48 #include <sys/un.h>
49 #include <sys/select.h>
50
51 /* some systems (e.g. Darwin) seem to not define UNIX_PATH_MAX at all */
52 #ifndef UNIX_PATH_MAX
53 # define UNIX_PATH_MAX sizeof (((struct sockaddr_un *)0)->sun_path)
54 #endif /* UNIX_PATH_MAX */
55
56 #if HAVE_GRP_H
57 #       include <grp.h>
58 #endif /* HAVE_GRP_H */
59
60 #define SOCK_PATH LOCALSTATEDIR"/run/"PACKAGE_NAME"-email"
61 #define MAX_CONNS 5
62 #define MAX_CONNS_LIMIT 16384
63
64 #define log_debug(...) DEBUG ("email: "__VA_ARGS__)
65 #define log_err(...) ERROR ("email: "__VA_ARGS__)
66 #define log_warn(...) WARNING ("email: "__VA_ARGS__)
67
68 /*
69  * Private data structures
70  */
71 /* linked list of email and check types */
72 typedef struct type {
73         char        *name;
74         int         value;
75         struct type *next;
76 } type_t;
77
78 typedef struct {
79         type_t *head;
80         type_t *tail;
81 } type_list_t;
82
83 /* collector thread control information */
84 typedef struct collector {
85         pthread_t thread;
86
87         /* socket descriptor of the current/last connection */
88         FILE *socket;
89 } collector_t;
90
91 /* linked list of pending connections */
92 typedef struct conn {
93         /* socket to read data from */
94         FILE *socket;
95
96         /* linked list of connections */
97         struct conn *next;
98 } conn_t;
99
100 typedef struct {
101         conn_t *head;
102         conn_t *tail;
103 } conn_list_t;
104
105 /*
106  * Private variables
107  */
108 /* valid configuration file keys */
109 static const char *config_keys[] =
110 {
111         "SocketFile",
112         "SocketGroup",
113         "SocketPerms",
114         "MaxConns"
115 };
116 static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
117
118 /* socket configuration */
119 static char *sock_file  = NULL;
120 static char *sock_group = NULL;
121 static int  sock_perms  = S_IRWXU | S_IRWXG;
122 static int  max_conns   = MAX_CONNS;
123
124 /* state of the plugin */
125 static int disabled = 0;
126
127 /* thread managing "client" connections */
128 static pthread_t connector = (pthread_t) 0;
129 static int connector_socket = -1;
130
131 /* tell the collector threads that a new connection is available */
132 static pthread_cond_t conn_available = PTHREAD_COND_INITIALIZER;
133
134 /* connections that are waiting to be processed */
135 static pthread_mutex_t conns_mutex = PTHREAD_MUTEX_INITIALIZER;
136 static conn_list_t conns;
137
138 /* tell the connector thread that a collector is available */
139 static pthread_cond_t collector_available = PTHREAD_COND_INITIALIZER;
140
141 /* collector threads */
142 static collector_t **collectors = NULL;
143
144 static pthread_mutex_t available_mutex = PTHREAD_MUTEX_INITIALIZER;
145 static int available_collectors;
146
147 static pthread_mutex_t count_mutex = PTHREAD_MUTEX_INITIALIZER;
148 static type_list_t list_count;
149 static type_list_t list_count_copy;
150
151 static pthread_mutex_t size_mutex = PTHREAD_MUTEX_INITIALIZER;
152 static type_list_t list_size;
153 static type_list_t list_size_copy;
154
155 static pthread_mutex_t score_mutex = PTHREAD_MUTEX_INITIALIZER;
156 static double score;
157 static int score_count;
158
159 static pthread_mutex_t check_mutex = PTHREAD_MUTEX_INITIALIZER;
160 static type_list_t list_check;
161 static type_list_t list_check_copy;
162
163 /*
164  * Private functions
165  */
166 static int email_config (const char *key, const char *value)
167 {
168         if (0 == strcasecmp (key, "SocketFile")) {
169                 if (NULL != sock_file)
170                         free (sock_file);
171                 sock_file = sstrdup (value);
172         }
173         else if (0 == strcasecmp (key, "SocketGroup")) {
174                 if (NULL != sock_group)
175                         free (sock_group);
176                 sock_group = sstrdup (value);
177         }
178         else if (0 == strcasecmp (key, "SocketPerms")) {
179                 /* the user is responsible for providing reasonable values */
180                 sock_perms = (int)strtol (value, NULL, 8);
181         }
182         else if (0 == strcasecmp (key, "MaxConns")) {
183                 long int tmp = strtol (value, NULL, 0);
184
185                 if (tmp < 1) {
186                         fprintf (stderr, "email plugin: `MaxConns' was set to invalid "
187                                         "value %li, will use default %i.\n",
188                                         tmp, MAX_CONNS);
189                         ERROR ("email plugin: `MaxConns' was set to invalid "
190                                         "value %li, will use default %i.\n",
191                                         tmp, MAX_CONNS);
192                         max_conns = MAX_CONNS;
193                 }
194                 else if (tmp > MAX_CONNS_LIMIT) {
195                         fprintf (stderr, "email plugin: `MaxConns' was set to invalid "
196                                         "value %li, will use hardcoded limit %i.\n",
197                                         tmp, MAX_CONNS_LIMIT);
198                         ERROR ("email plugin: `MaxConns' was set to invalid "
199                                         "value %li, will use hardcoded limit %i.\n",
200                                         tmp, MAX_CONNS_LIMIT);
201                         max_conns = MAX_CONNS_LIMIT;
202                 }
203                 else {
204                         max_conns = (int)tmp;
205                 }
206         }
207         else {
208                 return -1;
209         }
210         return 0;
211 } /* static int email_config (char *, char *) */
212
213 /* Increment the value of the given name in the given list by incr. */
214 static void type_list_incr (type_list_t *list, char *name, int incr)
215 {
216         if (NULL == list->head) {
217                 list->head = smalloc (sizeof (*list->head));
218
219                 list->head->name  = sstrdup (name);
220                 list->head->value = incr;
221                 list->head->next  = NULL;
222
223                 list->tail = list->head;
224         }
225         else {
226                 type_t *ptr;
227
228                 for (ptr = list->head; NULL != ptr; ptr = ptr->next) {
229                         if (0 == strcmp (name, ptr->name))
230                                 break;
231                 }
232
233                 if (NULL == ptr) {
234                         list->tail->next = smalloc (sizeof (*list->tail->next));
235                         list->tail = list->tail->next;
236
237                         list->tail->name  = sstrdup (name);
238                         list->tail->value = incr;
239                         list->tail->next  = NULL;
240                 }
241                 else {
242                         ptr->value += incr;
243                 }
244         }
245         return;
246 } /* static void type_list_incr (type_list_t *, char *) */
247
248 static void *collect (void *arg)
249 {
250         collector_t *this = (collector_t *)arg;
251
252         while (1) {
253                 conn_t *connection;
254
255                 pthread_mutex_lock (&conns_mutex);
256
257                 while (NULL == conns.head) {
258                         pthread_cond_wait (&conn_available, &conns_mutex);
259                 }
260
261                 connection = conns.head;
262                 conns.head = conns.head->next;
263
264                 if (NULL == conns.head) {
265                         conns.tail = NULL;
266                 }
267
268                 pthread_mutex_unlock (&conns_mutex);
269
270                 /* make the socket available to the global
271                  * thread and connection management */
272                 this->socket = connection->socket;
273
274                 log_debug ("collect: handling connection on fd #%i",
275                                 fileno (this->socket));
276
277                 while (42) {
278                         /* 256 bytes ought to be enough for anybody ;-) */
279                         char line[256 + 1]; /* line + '\0' */
280                         int  len = 0;
281
282                         errno = 0;
283                         if (NULL == fgets (line, sizeof (line), this->socket)) {
284                                 if (0 != errno) {
285                                         char errbuf[1024];
286                                         log_err ("collect: reading from socket (fd #%i) "
287                                                         "failed: %s", fileno (this->socket),
288                                                         sstrerror (errno, errbuf, sizeof (errbuf)));
289                                 }
290                                 break;
291                         }
292
293                         len = strlen (line);
294                         if (('\n' != line[len - 1]) && ('\r' != line[len - 1])) {
295                                 log_warn ("collect: line too long (> %zu characters): "
296                                                 "'%s' (truncated)", sizeof (line) - 1, line);
297
298                                 while (NULL != fgets (line, sizeof (line), this->socket))
299                                         if (('\n' == line[len - 1]) || ('\r' == line[len - 1]))
300                                                 break;
301                                 continue;
302                         }
303                         if (len < 3) { /* [a-z] ':' '\n' */
304                                 continue;
305                         }
306
307                         line[len - 1] = 0;
308
309                         log_debug ("collect: line = '%s'", line);
310
311                         if (':' != line[1]) {
312                                 log_err ("collect: syntax error in line '%s'", line);
313                                 continue;
314                         }
315
316                         if ('e' == line[0]) { /* e:<type>:<bytes> */
317                                 char *ptr  = NULL;
318                                 char *type = strtok_r (line + 2, ":", &ptr);
319                                 char *tmp  = strtok_r (NULL, ":", &ptr);
320                                 int  bytes = 0;
321
322                                 if (NULL == tmp) {
323                                         log_err ("collect: syntax error in line '%s'", line);
324                                         continue;
325                                 }
326
327                                 bytes = atoi (tmp);
328
329                                 pthread_mutex_lock (&count_mutex);
330                                 type_list_incr (&list_count, type, /* increment = */ 1);
331                                 pthread_mutex_unlock (&count_mutex);
332
333                                 if (bytes > 0) {
334                                         pthread_mutex_lock (&size_mutex);
335                                         type_list_incr (&list_size, type, /* increment = */ bytes);
336                                         pthread_mutex_unlock (&size_mutex);
337                                 }
338                         }
339                         else if ('s' == line[0]) { /* s:<value> */
340                                 pthread_mutex_lock (&score_mutex);
341                                 score = (score * (double)score_count + atof (line + 2))
342                                                 / (double)(score_count + 1);
343                                 ++score_count;
344                                 pthread_mutex_unlock (&score_mutex);
345                         }
346                         else if ('c' == line[0]) { /* c:<type1>[,<type2>,...] */
347                                 char *dummy = line + 2;
348                                 char *endptr = NULL;
349                                 char *type;
350
351                                 pthread_mutex_lock (&check_mutex);
352                                 while ((type = strtok_r (dummy, ",", &endptr)) != NULL)
353                                 {
354                                         dummy = NULL;
355                                         type_list_incr (&list_check, type, /* increment = */ 1);
356                                 }
357                                 pthread_mutex_unlock (&check_mutex);
358                         }
359                         else {
360                                 log_err ("collect: unknown type '%c'", line[0]);
361                         }
362                 } /* while (42) */
363
364                 log_debug ("Shutting down connection on fd #%i",
365                                 fileno (this->socket));
366
367                 fclose (connection->socket);
368                 free (connection);
369
370                 this->socket = NULL;
371
372                 pthread_mutex_lock (&available_mutex);
373                 ++available_collectors;
374                 pthread_mutex_unlock (&available_mutex);
375
376                 pthread_cond_signal (&collector_available);
377         } /* while (1) */
378
379         pthread_exit ((void *)0);
380         return ((void *) 0);
381 } /* static void *collect (void *) */
382
383 static void *open_connection (void __attribute__((unused)) *arg)
384 {
385         struct sockaddr_un addr;
386
387         const char *path  = (NULL == sock_file) ? SOCK_PATH : sock_file;
388         const char *group = (NULL == sock_group) ? COLLECTD_GRP_NAME : sock_group;
389
390         /* create UNIX socket */
391         errno = 0;
392         if (-1 == (connector_socket = socket (PF_UNIX, SOCK_STREAM, 0))) {
393                 char errbuf[1024];
394                 disabled = 1;
395                 log_err ("socket() failed: %s",
396                                 sstrerror (errno, errbuf, sizeof (errbuf)));
397                 pthread_exit ((void *)1);
398         }
399
400         addr.sun_family = AF_UNIX;
401         sstrncpy (addr.sun_path, path, (size_t)(UNIX_PATH_MAX - 1));
402
403         errno = 0;
404         if (-1 == bind (connector_socket, (struct sockaddr *)&addr,
405                                 offsetof (struct sockaddr_un, sun_path)
406                                         + strlen(addr.sun_path))) {
407                 char errbuf[1024];
408                 disabled = 1;
409                 close (connector_socket);
410                 connector_socket = -1;
411                 log_err ("bind() failed: %s",
412                                 sstrerror (errno, errbuf, sizeof (errbuf)));
413                 pthread_exit ((void *)1);
414         }
415
416         errno = 0;
417         if (-1 == listen (connector_socket, 5)) {
418                 char errbuf[1024];
419                 disabled = 1;
420                 close (connector_socket);
421                 connector_socket = -1;
422                 log_err ("listen() failed: %s",
423                                 sstrerror (errno, errbuf, sizeof (errbuf)));
424                 pthread_exit ((void *)1);
425         }
426
427         {
428                 struct group sg;
429                 struct group *grp;
430                 char grbuf[2048];
431                 int status;
432
433                 grp = NULL;
434                 status = getgrnam_r (group, &sg, grbuf, sizeof (grbuf), &grp);
435                 if (status != 0)
436                 {
437                         char errbuf[1024];
438                         log_warn ("getgrnam_r (%s) failed: %s", group,
439                                         sstrerror (errno, errbuf, sizeof (errbuf)));
440                 }
441                 else if (grp == NULL)
442                 {
443                         log_warn ("No such group: `%s'", group);
444                 }
445                 else
446                 {
447                         status = chown (path, (uid_t) -1, grp->gr_gid);
448                         if (status != 0)
449                         {
450                                 char errbuf[1024];
451                                 log_warn ("chown (%s, -1, %i) failed: %s",
452                                                 path, (int) grp->gr_gid,
453                                                 sstrerror (errno, errbuf, sizeof (errbuf)));
454                         }
455                 }
456         }
457
458         errno = 0;
459         if (0 != chmod (path, sock_perms)) {
460                 char errbuf[1024];
461                 log_warn ("chmod() failed: %s",
462                                 sstrerror (errno, errbuf, sizeof (errbuf)));
463         }
464
465         { /* initialize collector threads */
466                 pthread_attr_t ptattr;
467
468                 conns.head = NULL;
469                 conns.tail = NULL;
470
471                 pthread_attr_init (&ptattr);
472                 pthread_attr_setdetachstate (&ptattr, PTHREAD_CREATE_DETACHED);
473
474                 available_collectors = max_conns;
475
476                 collectors =
477                         smalloc (max_conns * sizeof (*collectors));
478
479                 for (int i = 0; i < max_conns; ++i) {
480                         collectors[i] = smalloc (sizeof (*collectors[i]));
481                         collectors[i]->socket = NULL;
482
483                         if (plugin_thread_create (&collectors[i]->thread,
484                                                         &ptattr, collect, collectors[i],
485                                                         "email collector") != 0) {
486                                 char errbuf[1024];
487                                 log_err ("plugin_thread_create() failed: %s",
488                                                 sstrerror (errno, errbuf, sizeof (errbuf)));
489                                 collectors[i]->thread = (pthread_t) 0;
490                         }
491                 }
492
493                 pthread_attr_destroy (&ptattr);
494         }
495
496         while (1) {
497                 int remote = 0;
498
499                 conn_t *connection;
500
501                 pthread_mutex_lock (&available_mutex);
502
503                 while (0 == available_collectors) {
504                         pthread_cond_wait (&collector_available, &available_mutex);
505                 }
506
507                 --available_collectors;
508
509                 pthread_mutex_unlock (&available_mutex);
510
511                 while (42) {
512                         errno = 0;
513
514                         remote = accept (connector_socket, NULL, NULL);
515                         if (remote == -1) {
516                                 char errbuf[1024];
517
518                                 if (errno == EINTR)
519                                         continue;
520
521                                 disabled = 1;
522                                 close (connector_socket);
523                                 connector_socket = -1;
524                                 log_err ("accept() failed: %s",
525                                                  sstrerror (errno, errbuf, sizeof (errbuf)));
526                                 pthread_exit ((void *)1);
527                         }
528
529                         /* access() succeeded. */
530                         break;
531                 }
532
533                 connection = calloc (1, sizeof (*connection));
534                 if (connection == NULL)
535                 {
536                         close (remote);
537                         continue;
538                 }
539
540                 connection->socket = fdopen (remote, "r");
541                 connection->next   = NULL;
542
543                 if (NULL == connection->socket) {
544                         close (remote);
545                         sfree (connection);
546                         continue;
547                 }
548
549                 pthread_mutex_lock (&conns_mutex);
550
551                 if (NULL == conns.head) {
552                         conns.head = connection;
553                         conns.tail = connection;
554                 }
555                 else {
556                         conns.tail->next = connection;
557                         conns.tail = conns.tail->next;
558                 }
559
560                 pthread_mutex_unlock (&conns_mutex);
561
562                 pthread_cond_signal (&conn_available);
563         }
564
565         pthread_exit ((void *) 0);
566         return ((void *) 0);
567 } /* static void *open_connection (void *) */
568
569 static int email_init (void)
570 {
571         if (plugin_thread_create (&connector, NULL,
572                                 open_connection, NULL, "email listener") != 0) {
573                 char errbuf[1024];
574                 disabled = 1;
575                 log_err ("plugin_thread_create() failed: %s",
576                                 sstrerror (errno, errbuf, sizeof (errbuf)));
577                 return (-1);
578         }
579
580         return (0);
581 } /* int email_init */
582
583 static void type_list_free (type_list_t *t)
584 {
585         type_t *this;
586
587         this = t->head;
588         while (this != NULL)
589         {
590                 type_t *next = this->next;
591
592                 sfree (this->name);
593                 sfree (this);
594
595                 this = next;
596         }
597
598         t->head = NULL;
599         t->tail = NULL;
600 }
601
602 static int email_shutdown (void)
603 {
604         if (connector != ((pthread_t) 0)) {
605                 pthread_kill (connector, SIGTERM);
606                 connector = (pthread_t) 0;
607         }
608
609         if (connector_socket >= 0) {
610                 close (connector_socket);
611                 connector_socket = -1;
612         }
613
614         /* don't allow any more connections to be processed */
615         pthread_mutex_lock (&conns_mutex);
616
617         available_collectors = 0;
618
619         if (collectors != NULL) {
620                 for (int i = 0; i < max_conns; ++i) {
621                         if (collectors[i] == NULL)
622                                 continue;
623
624                         if (collectors[i]->thread != ((pthread_t) 0)) {
625                                 pthread_kill (collectors[i]->thread, SIGTERM);
626                                 collectors[i]->thread = (pthread_t) 0;
627                         }
628
629                         if (collectors[i]->socket != NULL) {
630                                 fclose (collectors[i]->socket);
631                                 collectors[i]->socket = NULL;
632                         }
633
634                         sfree (collectors[i]);
635                 }
636                 sfree (collectors);
637         } /* if (collectors != NULL) */
638
639         pthread_mutex_unlock (&conns_mutex);
640
641         type_list_free (&list_count);
642         type_list_free (&list_count_copy);
643         type_list_free (&list_size);
644         type_list_free (&list_size_copy);
645         type_list_free (&list_check);
646         type_list_free (&list_check_copy);
647
648         unlink ((NULL == sock_file) ? SOCK_PATH : sock_file);
649
650         sfree (sock_file);
651         sfree (sock_group);
652         return (0);
653 } /* static void email_shutdown (void) */
654
655 static void email_submit (const char *type, const char *type_instance, gauge_t value)
656 {
657         value_list_t vl = VALUE_LIST_INIT;
658
659         vl.values = &(value_t) { .gauge = value };
660         vl.values_len = 1;
661         sstrncpy (vl.plugin, "email", sizeof (vl.plugin));
662         sstrncpy (vl.type, type, sizeof (vl.type));
663         sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
664
665         plugin_dispatch_values (&vl);
666 } /* void email_submit */
667
668 /* Copy list l1 to list l2. l2 may partly exist already, but it is assumed
669  * that neither the order nor the name of any element of either list is
670  * changed and no elements are deleted. The values of l1 are reset to zero
671  * after they have been copied to l2. */
672 static void copy_type_list (type_list_t *l1, type_list_t *l2)
673 {
674         type_t *last = NULL;
675
676         for (type_t *ptr1 = l1->head, *ptr2 = l2->head; NULL != ptr1;
677                         ptr1 = ptr1->next, last = ptr2, ptr2 = ptr2->next) {
678                 if (NULL == ptr2) {
679                         ptr2 = smalloc (sizeof (*ptr2));
680                         ptr2->name = NULL;
681                         ptr2->next = NULL;
682
683                         if (NULL == last) {
684                                 l2->head = ptr2;
685                         }
686                         else {
687                                 last->next = ptr2;
688                         }
689
690                         l2->tail = ptr2;
691                 }
692
693                 if (NULL == ptr2->name) {
694                         ptr2->name = sstrdup (ptr1->name);
695                 }
696
697                 ptr2->value = ptr1->value;
698                 ptr1->value = 0;
699         }
700         return;
701 }
702
703 static int email_read (void)
704 {
705         double score_old;
706         int score_count_old;
707
708         if (disabled)
709                 return (-1);
710
711         /* email count */
712         pthread_mutex_lock (&count_mutex);
713
714         copy_type_list (&list_count, &list_count_copy);
715
716         pthread_mutex_unlock (&count_mutex);
717
718         for (type_t *ptr = list_count_copy.head; NULL != ptr; ptr = ptr->next) {
719                 email_submit ("email_count", ptr->name, ptr->value);
720         }
721
722         /* email size */
723         pthread_mutex_lock (&size_mutex);
724
725         copy_type_list (&list_size, &list_size_copy);
726
727         pthread_mutex_unlock (&size_mutex);
728
729         for (type_t *ptr = list_size_copy.head; NULL != ptr; ptr = ptr->next) {
730                 email_submit ("email_size", ptr->name, ptr->value);
731         }
732
733         /* spam score */
734         pthread_mutex_lock (&score_mutex);
735
736         score_old = score;
737         score_count_old = score_count;
738         score = 0.0;
739         score_count = 0;
740
741         pthread_mutex_unlock (&score_mutex);
742
743         if (score_count_old > 0)
744                 email_submit ("spam_score", "", score_old);
745
746         /* spam checks */
747         pthread_mutex_lock (&check_mutex);
748
749         copy_type_list (&list_check, &list_check_copy);
750
751         pthread_mutex_unlock (&check_mutex);
752
753         for (type_t *ptr = list_check_copy.head; NULL != ptr; ptr = ptr->next)
754                 email_submit ("spam_check", ptr->name, ptr->value);
755
756         return (0);
757 } /* int email_read */
758
759 void module_register (void)
760 {
761         plugin_register_config ("email", email_config, config_keys, config_keys_num);
762         plugin_register_init ("email", email_init);
763         plugin_register_read ("email", email_read);
764         plugin_register_shutdown ("email", email_shutdown);
765 } /* void module_register */
766
767 /* vim: set sw=4 ts=4 tw=78 noexpandtab : */