]> git.ipfire.org Git - thirdparty/strongswan.git/blame - src/libcharon/plugins/p_cscf/p_cscf_plugin.c
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libcharon / plugins / p_cscf / p_cscf_plugin.c
CommitLineData
12ac5fac
TB
1/*
2 * Copyright (C) 2016 Tobias Brunner
19ef2aec
TB
3 *
4 * Copyright (C) secunet Security Networks AG
12ac5fac
TB
5 *
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; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17#include "p_cscf_plugin.h"
3d91d013 18#include "p_cscf_handler.h"
12ac5fac
TB
19
20#include <daemon.h>
21
22typedef struct private_p_cscf_plugin_t private_p_cscf_plugin_t;
23
24/**
25 * Private data
26 */
27struct private_p_cscf_plugin_t {
28
29 /**
30 * Public interface
31 */
32 p_cscf_plugin_t public;
3d91d013
TB
33
34 /**
35 * P-CSCF server address attribute handler
36 */
37 p_cscf_handler_t *handler;
12ac5fac
TB
38};
39
40METHOD(plugin_t, get_name, char*,
41 private_p_cscf_plugin_t *this)
42{
43 return "p-cscf";
44}
45
3d91d013
TB
46/**
47 * Register handler
48 */
49static bool plugin_cb(private_p_cscf_plugin_t *this,
50 plugin_feature_t *feature, bool reg, void *cb_data)
51{
52 if (reg)
53 {
54 charon->attributes->add_handler(charon->attributes,
55 &this->handler->handler);
56 }
57 else
58 {
59 charon->attributes->remove_handler(charon->attributes,
60 &this->handler->handler);
61 }
62 return TRUE;
63}
64
65METHOD(plugin_t, get_features, int,
66 private_p_cscf_plugin_t *this, plugin_feature_t *features[])
67{
68 static plugin_feature_t f[] = {
69 PLUGIN_CALLBACK((plugin_feature_callback_t)plugin_cb, NULL),
70 PLUGIN_PROVIDE(CUSTOM, "p-cscf"),
71 };
72 *features = f;
73 return countof(f);
74}
75
12ac5fac
TB
76METHOD(plugin_t, destroy, void,
77 private_p_cscf_plugin_t *this)
78{
3d91d013 79 this->handler->destroy(this->handler);
12ac5fac
TB
80 free(this);
81}
82
83/**
84 * See header
85 */
86plugin_t *p_cscf_plugin_create()
87{
88 private_p_cscf_plugin_t *this;
89
90 INIT(this,
91 .public = {
92 .plugin = {
93 .get_name = _get_name,
3d91d013 94 .get_features = _get_features,
12ac5fac
TB
95 .destroy = _destroy,
96 },
97 },
3d91d013 98 .handler = p_cscf_handler_create(),
12ac5fac
TB
99 );
100
101 return &this->public.plugin;
102}