Annotation of embedaddon/strongswan/src/libstrongswan/plugins/soup/soup_plugin.c, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2010 Martin Willi
! 3: * Copyright (C) 2010 revosec AG
! 4: *
! 5: * This program is free software; you can redistribute it and/or modify it
! 6: * under the terms of the GNU General Public License as published by the
! 7: * Free Software Foundation; either version 2 of the License, or (at your
! 8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
! 9: *
! 10: * This program is distributed in the hope that it will be useful, but
! 11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
! 12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
! 13: * for more details.
! 14: */
! 15:
! 16: #include "soup_plugin.h"
! 17: #include "soup_fetcher.h"
! 18:
! 19: #include <glib.h>
! 20: #include <glib-object.h>
! 21:
! 22: #include <library.h>
! 23:
! 24: typedef struct private_soup_plugin_t private_soup_plugin_t;
! 25:
! 26: /**
! 27: * private data of soup_plugin
! 28: */
! 29: struct private_soup_plugin_t {
! 30:
! 31: /**
! 32: * public functions
! 33: */
! 34: soup_plugin_t public;
! 35: };
! 36:
! 37: METHOD(plugin_t, get_name, char*,
! 38: private_soup_plugin_t *this)
! 39: {
! 40: return "soup";
! 41: }
! 42:
! 43: METHOD(plugin_t, get_features, int,
! 44: private_soup_plugin_t *this, plugin_feature_t *features[])
! 45: {
! 46: static plugin_feature_t f[] = {
! 47: PLUGIN_REGISTER(FETCHER, soup_fetcher_create),
! 48: PLUGIN_PROVIDE(FETCHER, "http://"),
! 49: PLUGIN_PROVIDE(FETCHER, "https://"),
! 50: };
! 51: *features = f;
! 52: return countof(f);
! 53: }
! 54:
! 55: METHOD(plugin_t, destroy, void,
! 56: private_soup_plugin_t *this)
! 57: {
! 58: free(this);
! 59: }
! 60:
! 61: /*
! 62: * see header file
! 63: */
! 64: plugin_t *soup_plugin_create()
! 65: {
! 66: private_soup_plugin_t *this;
! 67:
! 68: #if !GLIB_CHECK_VERSION(2,36,0)
! 69: g_type_init();
! 70: #endif
! 71:
! 72: #if !GLIB_CHECK_VERSION(2,23,0)
! 73: if (!g_thread_get_initialized())
! 74: {
! 75: g_thread_init(NULL);
! 76: }
! 77: #endif
! 78:
! 79: INIT(this,
! 80: .public = {
! 81: .plugin = {
! 82: .get_name = _get_name,
! 83: .get_features = _get_features,
! 84: .destroy = _destroy,
! 85: },
! 86: },
! 87: );
! 88:
! 89: return &this->public.plugin;
! 90: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>