2 * collectd - src/curl_json.c
3 * Copyright (C) 2009 Doug MacEachern
4 * Copyright (C) 2006-2013 Florian octo Forster
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; only version 2 of the License is applicable.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * Doug MacEachern <dougm at hyperic.com>
21 * Florian octo Forster <octo at collectd.org>
28 #include "configfile.h"
29 #include "utils_avltree.h"
30 #include "utils_complain.h"
31 #include "utils_curl_stats.h"
33 #include <sys/types.h>
36 #include <curl/curl.h>
38 #include <yajl/yajl_parse.h>
39 #if HAVE_YAJL_YAJL_VERSION_H
40 # include <yajl/yajl_version.h>
43 #if defined(YAJL_MAJOR) && (YAJL_MAJOR > 1)
44 # define HAVE_YAJL_V2 1
47 #define CJ_DEFAULT_HOST "localhost"
48 #define CJ_KEY_MAGIC 0x43484b59UL /* CHKY */
49 #define CJ_IS_KEY(key) ((key)->magic == CJ_KEY_MAGIC)
51 #define COUCH_MIN(x,y) ((x) < (y) ? (x) : (y))
54 typedef struct cj_key_s cj_key_t;
55 struct cj_key_s /* {{{ */
79 struct curl_slist *headers;
86 char curl_errbuf[CURL_ERROR_SIZE];
99 char name[DATA_MAX_NAME_LEN];
100 } state[YAJL_MAX_DEPTH];
102 typedef struct cj_s cj_t; /* }}} */
105 typedef size_t yajl_len_t;
107 typedef unsigned int yajl_len_t;
110 static int cj_read (user_data_t *ud);
111 static void cj_submit (cj_t *db, cj_key_t *key, value_t *value);
113 static size_t cj_curl_callback (void *buf, /* {{{ */
114 size_t size, size_t nmemb, void *user_data)
129 status = yajl_parse(db->yajl, (unsigned char *)buf, len);
130 if (status == yajl_status_ok)
133 else if (status == yajl_status_insufficient_data)
137 unsigned char *msg = yajl_get_error(db->yajl, /* verbose = */ 1,
138 /* jsonText = */ (unsigned char *) buf, (unsigned int) len);
139 ERROR ("curl_json plugin: yajl_parse failed: %s", msg);
140 yajl_free_error(db->yajl, msg);
141 return (0); /* abort write callback */
142 } /* }}} size_t cj_curl_callback */
144 static int cj_get_type (cj_key_t *key)
146 const data_set_t *ds;
148 ds = plugin_get_ds (key->type);
151 static char type[DATA_MAX_NAME_LEN] = "!!!invalid!!!";
153 assert (key->type != NULL);
154 if (strcmp (type, key->type) != 0)
156 ERROR ("curl_json plugin: Unable to look up DS type \"%s\".",
158 sstrncpy (type, key->type, sizeof (type));
163 else if (ds->ds_num > 1)
165 static c_complain_t complaint = C_COMPLAIN_INIT_STATIC;
167 c_complain_once (LOG_WARNING, &complaint,
168 "curl_json plugin: The type \"%s\" has more than one data source. "
169 "This is currently not supported. I will return the type of the "
170 "first data source, but this will likely lead to problems later on.",
174 return ds->ds[0].type;
177 static int cj_cb_map_key (void *ctx, const unsigned char *val,
180 static void cj_cb_inc_array_index (void *ctx, _Bool update_key)
182 cj_t *db = (cj_t *)ctx;
184 if (!db->state[db->depth].in_array)
187 db->state[db->depth].index++;
191 char name[DATA_MAX_NAME_LEN];
193 ssnprintf (name, sizeof (name), "%d", db->state[db->depth].index - 1);
195 cj_cb_map_key (ctx, (unsigned char *)name, (yajl_len_t) strlen (name));
200 #define CJ_CB_ABORT 0
201 #define CJ_CB_CONTINUE 1
203 static int cj_cb_boolean (void * ctx, int boolVal)
205 cj_cb_inc_array_index (ctx, /* update_key = */ 0);
206 return (CJ_CB_CONTINUE);
209 static int cj_cb_null (void * ctx)
211 cj_cb_inc_array_index (ctx, /* update_key = */ 0);
212 return (CJ_CB_CONTINUE);
215 static int cj_cb_number (void *ctx,
216 const char *number, yajl_len_t number_len)
218 char buffer[number_len + 1];
220 cj_t *db = (cj_t *)ctx;
221 cj_key_t *key = db->state[db->depth].key;
226 /* Create a null-terminated version of the string. */
227 memcpy (buffer, number, number_len);
228 buffer[sizeof (buffer) - 1] = 0;
230 if ((key == NULL) || !CJ_IS_KEY (key)) {
231 if (key != NULL && !db->state[db->depth].in_array/*can be inhomogeneous*/)
232 NOTICE ("curl_json plugin: Found \"%s\", but the configuration expects"
234 cj_cb_inc_array_index (ctx, /* update_key = */ 1);
235 key = db->state[db->depth].key;
237 return (CJ_CB_CONTINUE);
242 cj_cb_inc_array_index (ctx, /* update_key = */ 1);
245 type = cj_get_type (key);
246 status = parse_value (buffer, &vt, type);
249 NOTICE ("curl_json plugin: Unable to parse number: \"%s\"", buffer);
250 return (CJ_CB_CONTINUE);
253 cj_submit (db, key, &vt);
254 return (CJ_CB_CONTINUE);
255 } /* int cj_cb_number */
257 /* Queries the key-tree of the parent context for "in_name" and, if found,
258 * updates the "key" field of the current context. Otherwise, "key" is set to
260 static int cj_cb_map_key (void *ctx,
261 unsigned char const *in_name, yajl_len_t in_name_len)
263 cj_t *db = (cj_t *)ctx;
266 tree = db->state[db->depth-1].tree;
270 cj_key_t *value = NULL;
274 /* Create a null-terminated version of the name. */
275 name = db->state[db->depth].name;
276 name_len = COUCH_MIN ((size_t) in_name_len,
277 sizeof (db->state[db->depth].name) - 1);
278 memcpy (name, in_name, name_len);
281 if (c_avl_get (tree, name, (void *) &value) == 0) {
282 if (CJ_IS_KEY((cj_key_t*)value)) {
283 db->state[db->depth].key = value;
286 db->state[db->depth].tree = (c_avl_tree_t*) value;
289 else if (c_avl_get (tree, CJ_ANY, (void *) &value) == 0)
290 if (CJ_IS_KEY((cj_key_t*)value)) {
291 db->state[db->depth].key = value;
294 db->state[db->depth].tree = (c_avl_tree_t*) value;
297 db->state[db->depth].key = NULL;
300 return (CJ_CB_CONTINUE);
303 static int cj_cb_string (void *ctx, const unsigned char *val,
306 /* Handle the string as if it was a number. */
307 return (cj_cb_number (ctx, (const char *) val, len));
308 } /* int cj_cb_string */
310 static int cj_cb_start (void *ctx)
312 cj_t *db = (cj_t *)ctx;
313 if (++db->depth >= YAJL_MAX_DEPTH)
315 ERROR ("curl_json plugin: %s depth exceeds max, aborting.",
316 db->url ? db->url : db->sock);
317 return (CJ_CB_ABORT);
319 return (CJ_CB_CONTINUE);
322 static int cj_cb_end (void *ctx)
324 cj_t *db = (cj_t *)ctx;
325 db->state[db->depth].tree = NULL;
327 return (CJ_CB_CONTINUE);
330 static int cj_cb_start_map (void *ctx)
332 cj_cb_inc_array_index (ctx, /* update_key = */ 1);
333 return cj_cb_start (ctx);
336 static int cj_cb_end_map (void *ctx)
338 return cj_cb_end (ctx);
341 static int cj_cb_start_array (void * ctx)
343 cj_t *db = (cj_t *)ctx;
344 cj_cb_inc_array_index (ctx, /* update_key = */ 1);
345 if (db->depth+1 < YAJL_MAX_DEPTH) {
346 db->state[db->depth+1].in_array = 1;
347 db->state[db->depth+1].index = 0;
349 return cj_cb_start (ctx);
352 static int cj_cb_end_array (void * ctx)
354 cj_t *db = (cj_t *)ctx;
355 db->state[db->depth].in_array = 0;
356 return cj_cb_end (ctx);
359 static yajl_callbacks ycallbacks = {
360 cj_cb_null, /* null */
361 cj_cb_boolean, /* boolean */
373 /* end yajl callbacks */
375 static void cj_key_free (cj_key_t *key) /* {{{ */
382 sfree (key->instance);
385 } /* }}} void cj_key_free */
387 static void cj_tree_free (c_avl_tree_t *tree) /* {{{ */
392 while (c_avl_pick (tree, (void *) &name, (void *) &value) == 0)
394 cj_key_t *key = (cj_key_t *)value;
399 cj_tree_free ((c_avl_tree_t *)value);
404 c_avl_destroy (tree);
405 } /* }}} void cj_tree_free */
407 static void cj_free (void *arg) /* {{{ */
411 DEBUG ("curl_json plugin: cj_free (arg = %p);", arg);
418 if (db->curl != NULL)
419 curl_easy_cleanup (db->curl);
422 if (db->tree != NULL)
423 cj_tree_free (db->tree);
426 sfree (db->instance);
434 sfree (db->credentials);
436 sfree (db->post_body);
437 curl_slist_free_all (db->headers);
438 curl_stats_destroy (db->stats);
441 } /* }}} void cj_free */
443 /* Configuration handling functions {{{ */
445 static c_avl_tree_t *cj_avl_create(void)
447 return c_avl_create ((int (*) (const void *, const void *)) strcmp);
450 static int cj_config_append_string (const char *name, struct curl_slist **dest, /* {{{ */
453 struct curl_slist *temp = NULL;
454 if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
456 WARNING ("curl_json plugin: `%s' needs exactly one string argument.", name);
460 temp = curl_slist_append(*dest, ci->values[0].value.string);
467 } /* }}} int cj_config_append_string */
469 static int cj_config_add_key (cj_t *db, /* {{{ */
475 if ((ci->values_num != 1)
476 || (ci->values[0].type != OCONFIG_TYPE_STRING))
478 WARNING ("curl_json plugin: The `Key' block "
479 "needs exactly one string argument.");
483 key = calloc (1, sizeof (*key));
486 ERROR ("curl_json plugin: calloc failed.");
489 key->magic = CJ_KEY_MAGIC;
491 if (strcasecmp ("Key", ci->key) == 0)
493 status = cf_util_get_string (ci, &key->path);
502 ERROR ("curl_json plugin: cj_config: "
503 "Invalid key: %s", ci->key);
509 for (int i = 0; i < ci->children_num; i++)
511 oconfig_item_t *child = ci->children + i;
513 if (strcasecmp ("Type", child->key) == 0)
514 status = cf_util_get_string (child, &key->type);
515 else if (strcasecmp ("Instance", child->key) == 0)
516 status = cf_util_get_string (child, &key->instance);
519 WARNING ("curl_json plugin: Option `%s' not allowed here.", child->key);
525 } /* for (i = 0; i < ci->children_num; i++) */
533 if (key->type == NULL)
535 WARNING ("curl_json plugin: `Type' missing in `Key' block.");
540 /* store path in a tree that will match the json map structure, example:
541 * "httpd/requests/count",
542 * "httpd/requests/current" ->
543 * { "httpd": { "requests": { "count": $key, "current": $key } } }
549 if (db->tree == NULL)
550 db->tree = cj_avl_create();
558 while ((ptr = strchr (name, '/')) != NULL)
568 len = COUCH_MIN(len, sizeof (ent)-1);
569 sstrncpy (ent, name, len+1);
571 if (c_avl_get (tree, ent, (void *) &value) != 0)
573 value = cj_avl_create ();
574 c_avl_insert (tree, strdup (ent), value);
581 if (strlen (name) == 0)
583 ERROR ("curl_json plugin: invalid key: %s", key->path);
588 c_avl_insert (tree, strdup (name), key);
590 } /* }}} int cj_config_add_key */
592 static int cj_init_curl (cj_t *db) /* {{{ */
594 db->curl = curl_easy_init ();
595 if (db->curl == NULL)
597 ERROR ("curl_json plugin: curl_easy_init failed.");
601 curl_easy_setopt (db->curl, CURLOPT_NOSIGNAL, 1L);
602 curl_easy_setopt (db->curl, CURLOPT_WRITEFUNCTION, cj_curl_callback);
603 curl_easy_setopt (db->curl, CURLOPT_WRITEDATA, db);
604 curl_easy_setopt (db->curl, CURLOPT_USERAGENT, COLLECTD_USERAGENT);
605 curl_easy_setopt (db->curl, CURLOPT_ERRORBUFFER, db->curl_errbuf);
606 curl_easy_setopt (db->curl, CURLOPT_URL, db->url);
607 curl_easy_setopt (db->curl, CURLOPT_FOLLOWLOCATION, 1L);
608 curl_easy_setopt (db->curl, CURLOPT_MAXREDIRS, 50L);
610 if (db->user != NULL)
612 #ifdef HAVE_CURLOPT_USERNAME
613 curl_easy_setopt (db->curl, CURLOPT_USERNAME, db->user);
614 curl_easy_setopt (db->curl, CURLOPT_PASSWORD,
615 (db->pass == NULL) ? "" : db->pass);
617 size_t credentials_size;
619 credentials_size = strlen (db->user) + 2;
620 if (db->pass != NULL)
621 credentials_size += strlen (db->pass);
623 db->credentials = malloc (credentials_size);
624 if (db->credentials == NULL)
626 ERROR ("curl_json plugin: malloc failed.");
630 ssnprintf (db->credentials, credentials_size, "%s:%s",
631 db->user, (db->pass == NULL) ? "" : db->pass);
632 curl_easy_setopt (db->curl, CURLOPT_USERPWD, db->credentials);
636 curl_easy_setopt (db->curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
639 curl_easy_setopt (db->curl, CURLOPT_SSL_VERIFYPEER, (long) db->verify_peer);
640 curl_easy_setopt (db->curl, CURLOPT_SSL_VERIFYHOST,
641 db->verify_host ? 2L : 0L);
642 if (db->cacert != NULL)
643 curl_easy_setopt (db->curl, CURLOPT_CAINFO, db->cacert);
644 if (db->headers != NULL)
645 curl_easy_setopt (db->curl, CURLOPT_HTTPHEADER, db->headers);
646 if (db->post_body != NULL)
647 curl_easy_setopt (db->curl, CURLOPT_POSTFIELDS, db->post_body);
649 #ifdef HAVE_CURLOPT_TIMEOUT_MS
650 if (db->timeout >= 0)
651 curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS, (long) db->timeout);
652 else if (db->interval > 0)
653 curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS, (long) CDTIME_T_TO_MS(db->timeout));
655 curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS, (long) CDTIME_T_TO_MS(plugin_get_interval()));
659 } /* }}} int cj_init_curl */
661 static int cj_config_add_url (oconfig_item_t *ci) /* {{{ */
666 if ((ci->values_num != 1)
667 || (ci->values[0].type != OCONFIG_TYPE_STRING))
669 WARNING ("curl_json plugin: The `URL' block "
670 "needs exactly one string argument.");
674 db = calloc (1, sizeof (*db));
677 ERROR ("curl_json plugin: calloc failed.");
683 if (strcasecmp ("URL", ci->key) == 0)
684 status = cf_util_get_string (ci, &db->url);
685 else if (strcasecmp ("Sock", ci->key) == 0)
686 status = cf_util_get_string (ci, &db->sock);
689 ERROR ("curl_json plugin: cj_config: "
690 "Invalid key: %s", ci->key);
700 /* Fill the `cj_t' structure.. */
701 for (int i = 0; i < ci->children_num; i++)
703 oconfig_item_t *child = ci->children + i;
705 if (strcasecmp ("Instance", child->key) == 0)
706 status = cf_util_get_string (child, &db->instance);
707 else if (strcasecmp ("Host", child->key) == 0)
708 status = cf_util_get_string (child, &db->host);
709 else if (db->url && strcasecmp ("User", child->key) == 0)
710 status = cf_util_get_string (child, &db->user);
711 else if (db->url && strcasecmp ("Password", child->key) == 0)
712 status = cf_util_get_string (child, &db->pass);
713 else if (strcasecmp ("Digest", child->key) == 0)
714 status = cf_util_get_boolean (child, &db->digest);
715 else if (db->url && strcasecmp ("VerifyPeer", child->key) == 0)
716 status = cf_util_get_boolean (child, &db->verify_peer);
717 else if (db->url && strcasecmp ("VerifyHost", child->key) == 0)
718 status = cf_util_get_boolean (child, &db->verify_host);
719 else if (db->url && strcasecmp ("CACert", child->key) == 0)
720 status = cf_util_get_string (child, &db->cacert);
721 else if (db->url && strcasecmp ("Header", child->key) == 0)
722 status = cj_config_append_string ("Header", &db->headers, child);
723 else if (db->url && strcasecmp ("Post", child->key) == 0)
724 status = cf_util_get_string (child, &db->post_body);
725 else if (strcasecmp ("Key", child->key) == 0)
726 status = cj_config_add_key (db, child);
727 else if (strcasecmp ("Interval", child->key) == 0)
728 status = cf_util_get_cdtime(child, &db->interval);
729 else if (strcasecmp ("Timeout", child->key) == 0)
730 status = cf_util_get_int (child, &db->timeout);
731 else if (strcasecmp ("Statistics", child->key) == 0)
733 db->stats = curl_stats_from_config (child);
734 if (db->stats == NULL)
739 WARNING ("curl_json plugin: Option `%s' not allowed here.", child->key);
749 if (db->tree == NULL)
751 WARNING ("curl_json plugin: No (valid) `Key' block within `%s' \"`%s'\".",
752 db->url ? "URL" : "Sock", db->url ? db->url : db->sock);
755 if (status == 0 && db->url)
756 status = cj_init_curl (db);
759 /* If all went well, register this database for reading */
762 user_data_t ud = { 0 };
765 if (db->instance == NULL)
766 db->instance = strdup("default");
768 DEBUG ("curl_json plugin: Registering new read callback: %s",
771 ud.data = (void *) db;
772 ud.free_func = cj_free;
774 cb_name = ssnprintf_alloc ("curl_json-%s-%s",
775 db->instance, db->url ? db->url : db->sock);
777 plugin_register_complex_read (/* group = */ NULL, cb_name, cj_read,
778 /* interval = */ db->interval,
790 /* }}} int cj_config_add_database */
792 static int cj_config (oconfig_item_t *ci) /* {{{ */
801 for (int i = 0; i < ci->children_num; i++)
803 oconfig_item_t *child = ci->children + i;
805 if (strcasecmp ("Sock", child->key) == 0
806 || strcasecmp ("URL", child->key) == 0)
808 status = cj_config_add_url (child);
816 WARNING ("curl_json plugin: Option `%s' not allowed here.", child->key);
821 if ((success == 0) && (errors > 0))
823 ERROR ("curl_json plugin: All statements failed.");
828 } /* }}} int cj_config */
830 /* }}} End of configuration handling functions */
832 static const char *cj_host (cj_t *db) /* {{{ */
834 if ((db->host == NULL)
835 || (strcmp ("", db->host) == 0)
836 || (strcmp (CJ_DEFAULT_HOST, db->host) == 0))
841 static void cj_submit (cj_t *db, cj_key_t *key, value_t *value) /* {{{ */
843 value_list_t vl = VALUE_LIST_INIT;
848 if (key->instance == NULL)
851 for (int i = 0; i < db->depth; i++)
852 len += ssnprintf(vl.type_instance+len, sizeof(vl.type_instance)-len,
853 i ? "-%s" : "%s", db->state[i+1].name);
856 sstrncpy (vl.type_instance, key->instance, sizeof (vl.type_instance));
858 sstrncpy (vl.host, cj_host (db), sizeof (vl.host));
859 sstrncpy (vl.plugin, "curl_json", sizeof (vl.plugin));
860 sstrncpy (vl.plugin_instance, db->instance, sizeof (vl.plugin_instance));
861 sstrncpy (vl.type, key->type, sizeof (vl.type));
863 if (db->interval > 0)
864 vl.interval = db->interval;
866 plugin_dispatch_values (&vl);
867 } /* }}} int cj_submit */
869 static int cj_sock_perform (cj_t *db) /* {{{ */
872 struct sockaddr_un sa_unix = { 0 };
873 sa_unix.sun_family = AF_UNIX;
874 sstrncpy (sa_unix.sun_path, db->sock, sizeof (sa_unix.sun_path));
876 int fd = socket (AF_UNIX, SOCK_STREAM, 0);
879 if (connect (fd, (struct sockaddr *)&sa_unix, sizeof(sa_unix)) < 0)
881 ERROR ("curl_json plugin: connect(%s) failed: %s",
882 (db->sock != NULL) ? db->sock : "<null>",
883 sstrerror(errno, errbuf, sizeof (errbuf)));
890 unsigned char buffer[4096];
891 red = read (fd, buffer, sizeof(buffer));
893 ERROR ("curl_json plugin: read(%s) failed: %s",
894 (db->sock != NULL) ? db->sock : "<null>",
895 sstrerror(errno, errbuf, sizeof (errbuf)));
899 if (!cj_curl_callback (buffer, red, 1, db))
904 } /* }}} int cj_sock_perform */
907 static int cj_curl_perform(cj_t *db) /* {{{ */
914 status = curl_easy_perform (db->curl);
915 if (status != CURLE_OK)
917 ERROR ("curl_json plugin: curl_easy_perform failed with status %i: %s (%s)",
918 status, db->curl_errbuf, url);
921 if (db->stats != NULL)
922 curl_stats_dispatch (db->stats, db->curl, cj_host (db), "curl_json", db->instance);
924 curl_easy_getinfo(db->curl, CURLINFO_EFFECTIVE_URL, &url);
925 curl_easy_getinfo(db->curl, CURLINFO_RESPONSE_CODE, &rc);
927 /* The response code is zero if a non-HTTP transport was used. */
928 if ((rc != 0) && (rc != 200))
930 ERROR ("curl_json plugin: curl_easy_perform failed with "
931 "response code %ld (%s)", rc, url);
935 } /* }}} int cj_curl_perform */
937 static int cj_perform (cj_t *db) /* {{{ */
940 yajl_handle yprev = db->yajl;
942 db->yajl = yajl_alloc (&ycallbacks,
944 /* alloc funcs = */ NULL,
946 /* alloc funcs = */ NULL, NULL,
948 /* context = */ (void *)db);
949 if (db->yajl == NULL)
951 ERROR ("curl_json plugin: yajl_alloc failed.");
957 status = cj_curl_perform (db);
959 status = cj_sock_perform (db);
962 yajl_free (db->yajl);
968 status = yajl_complete_parse(db->yajl);
970 status = yajl_parse_complete(db->yajl);
972 if (status != yajl_status_ok)
974 unsigned char *errmsg;
976 errmsg = yajl_get_error (db->yajl, /* verbose = */ 0,
977 /* jsonText = */ NULL, /* jsonTextLen = */ 0);
978 ERROR ("curl_json plugin: yajl_parse_complete failed: %s",
980 yajl_free_error (db->yajl, errmsg);
981 yajl_free (db->yajl);
986 yajl_free (db->yajl);
989 } /* }}} int cj_perform */
991 static int cj_read (user_data_t *ud) /* {{{ */
995 if ((ud == NULL) || (ud->data == NULL))
997 ERROR ("curl_json plugin: cj_read: Invalid user data.");
1001 db = (cj_t *) ud->data;
1004 memset (&db->state, 0, sizeof(db->state));
1005 db->state[db->depth].tree = db->tree;
1008 return cj_perform (db);
1009 } /* }}} int cj_read */
1011 static int cj_init (void) /* {{{ */
1013 /* Call this while collectd is still single-threaded to avoid
1014 * initialization issues in libgcrypt. */
1015 curl_global_init (CURL_GLOBAL_SSL);
1017 } /* }}} int cj_init */
1019 void module_register (void)
1021 plugin_register_complex_config ("curl_json", cj_config);
1022 plugin_register_init ("curl_json", cj_init);
1023 } /* void module_register */
1025 /* vim: set sw=2 sts=2 et fdm=marker : */