79 lines
2.1 KiB
C
79 lines
2.1 KiB
C
/****************************************************************************
|
|
_ _
|
|
| | | |
|
|
_ | | ___ _ _| | _ ____ ____ ____ ___
|
|
/ || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \
|
|
( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| |
|
|
\____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/
|
|
(_____|
|
|
|
|
Copyright (C) 2009 xxxyyyzzz <imsframework(at)gmail.com>
|
|
|
|
This file is part of Open Source Doubango IMS Client Framework project.
|
|
|
|
DOUBANGO is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
DOUBANGO is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with DOUBANGO.
|
|
****************************************************************************/
|
|
#include "ipsec.h"
|
|
#include <time.h>
|
|
|
|
#if HAVE_LINUX_IPSEC
|
|
|
|
/* ipsec context for linux platform */
|
|
typedef struct ipsec_linux_context_s
|
|
{
|
|
int FIXME;
|
|
}
|
|
ipsec_linux_context_t;
|
|
|
|
/* initialize ipsec context */
|
|
/* returns 0 if succeed and nonzero otherwise */
|
|
ipsec_error_t ipsec_context_init(ipsec_context_t* context)
|
|
{
|
|
memset(context, 0, sizeof(ipsec_context_t));
|
|
srand (time(0));
|
|
|
|
/* SAs */
|
|
for(i=0; i<SA_COUNT; i++)
|
|
{
|
|
ipsec_sa_init(context->SAs[i]);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
/* free ipsec context */
|
|
void ipsec_context_free(ipsec_context_t** context)
|
|
{
|
|
if(*context)
|
|
{
|
|
/* flush all SAs */
|
|
ipsec_flush(*context);
|
|
|
|
/* SAs */
|
|
for(i=0; i<SA_COUNT; i++)
|
|
{
|
|
ipsec_sa_free(&(context->SAs[i]));
|
|
}
|
|
|
|
free(*context);
|
|
(*context) = 0;
|
|
}
|
|
}
|
|
|
|
/* flush all associated ipsec SAs */
|
|
void ipsec_flush(const ipsec_context_t* context)
|
|
{
|
|
}
|
|
|
|
#endif /* HAVE_IPSEC_TOOLS */ |