File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libipsec / ipsec.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Jun 3 09:46:44 2020 UTC (4 years, 2 months ago) by misho
Branches: strongswan, MAIN
CVS tags: v5_9_2p0, v5_8_4p7, HEAD
Strongswan

    1: /*
    2:  * Copyright (C) 2012 Giuliano Grassi
    3:  * Copyright (C) 2012 Ralf Sager
    4:  * Copyright (C) 2012 Tobias Brunner
    5:  * HSR Hochschule fuer Technik Rapperswil
    6:  *
    7:  * This program is free software; you can redistribute it and/or modify it
    8:  * under the terms of the GNU General Public License as published by the
    9:  * Free Software Foundation; either version 2 of the License, or (at your
   10:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
   11:  *
   12:  * This program is distributed in the hope that it will be useful, but
   13:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   14:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   15:  * for more details.
   16:  */
   17: 
   18: #include "ipsec.h"
   19: 
   20: #include <utils/debug.h>
   21: 
   22: typedef struct private_ipsec_t private_ipsec_t;
   23: 
   24: /**
   25:  * Private additions to ipsec_t.
   26:  */
   27: struct private_ipsec_t {
   28: 
   29: 	/**
   30: 	 * Public members of ipsec_t.
   31: 	 */
   32: 	ipsec_t public;
   33: };
   34: 
   35: /**
   36:  * Single instance of ipsec_t.
   37:  */
   38: ipsec_t *ipsec;
   39: 
   40: /**
   41:  * Described in header.
   42:  */
   43: void libipsec_deinit()
   44: {
   45: 	private_ipsec_t *this = (private_ipsec_t*)ipsec;
   46: 	DESTROY_IF(this->public.processor);
   47: 	DESTROY_IF(this->public.events);
   48: 	DESTROY_IF(this->public.policies);
   49: 	DESTROY_IF(this->public.sas);
   50: 	free(this);
   51: 	ipsec = NULL;
   52: }
   53: 
   54: /**
   55:  * Described in header.
   56:  */
   57: bool libipsec_init()
   58: {
   59: 	private_ipsec_t *this;
   60: 
   61: 	INIT(this);
   62: 	ipsec = &this->public;
   63: 
   64: 	if (lib->integrity &&
   65: 		!lib->integrity->check(lib->integrity, "libipsec", libipsec_init))
   66: 	{
   67: 		DBG1(DBG_LIB, "integrity check of libipsec failed");
   68: 		return FALSE;
   69: 	}
   70: 
   71: 	this->public.sas = ipsec_sa_mgr_create();
   72: 	this->public.policies = ipsec_policy_mgr_create();
   73: 	this->public.events = ipsec_event_relay_create();
   74: 	this->public.processor = ipsec_processor_create();
   75: 	return TRUE;
   76: }
   77: 

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