Annotation of embedaddon/strongswan/src/libcharon/plugins/android_log/android_log_plugin.c, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2012 Tobias Brunner
                      3:  * HSR Hochschule fuer Technik Rapperswil
                      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 "android_log_plugin.h"
                     17: #include "android_log_logger.h"
                     18: 
                     19: #include <daemon.h>
                     20: 
                     21: typedef struct private_android_log_plugin_t private_android_log_plugin_t;
                     22: 
                     23: /**
                     24:  * Private data of an android_log_plugin_t object.
                     25:  */
                     26: struct private_android_log_plugin_t {
                     27: 
                     28:        /**
                     29:         * Public android_log_plugin_t interface.
                     30:         */
                     31:        android_log_plugin_t public;
                     32: 
                     33:        /**
                     34:         * Android specific logger
                     35:         */
                     36:        android_log_logger_t *logger;
                     37: 
                     38: };
                     39: 
                     40: METHOD(plugin_t, get_name, char*,
                     41:        private_android_log_plugin_t *this)
                     42: {
                     43:        return "android-log";
                     44: }
                     45: 
                     46: METHOD(plugin_t, get_features, int,
                     47:        private_android_log_plugin_t *this, plugin_feature_t *features[])
                     48: {
                     49:        static plugin_feature_t f[] = {
                     50:                PLUGIN_NOOP,
                     51:                        PLUGIN_PROVIDE(CUSTOM, "android-log"),
                     52:        };
                     53:        *features = f;
                     54:        return countof(f);
                     55: }
                     56: 
                     57: METHOD(plugin_t, destroy, void,
                     58:        private_android_log_plugin_t *this)
                     59: {
                     60:        charon->bus->remove_logger(charon->bus, &this->logger->logger);
                     61:        this->logger->destroy(this->logger);
                     62:        free(this);
                     63: }
                     64: 
                     65: /**
                     66:  * See header
                     67:  */
                     68: plugin_t *android_log_plugin_create()
                     69: {
                     70:        private_android_log_plugin_t *this;
                     71: 
                     72:        INIT(this,
                     73:                .public = {
                     74:                        .plugin = {
                     75:                                .get_name = _get_name,
                     76:                                .get_features = _get_features,
                     77:                                .destroy = _destroy,
                     78:                        },
                     79:                },
                     80:                .logger = android_log_logger_create(),
                     81:        );
                     82: 
                     83:        charon->bus->add_logger(charon->bus, &this->logger->logger);
                     84: 
                     85:        return &this->public.plugin;
                     86: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>