- started implementation of netlink kernel interface

This commit is contained in:
Martin Willi
2005-12-04 19:05:52 +00:00
parent c7314095e7
commit 3ebebc5e96
8 changed files with 539 additions and 31 deletions
+4
View File
@@ -29,5 +29,9 @@ $(BUILD_DIR)ike_sa.o : $(SA_DIR)ike_sa.c $(SA_DIR)ike_sa.h
OBJS+= $(BUILD_DIR)authenticator.o
$(BUILD_DIR)authenticator.o : $(SA_DIR)authenticator.c $(SA_DIR)authenticator.h
$(CC) $(CFLAGS) -c -o $@ $<
OBJS+= $(BUILD_DIR)child_sa.o
$(BUILD_DIR)child_sa.o : $(SA_DIR)child_sa.c $(SA_DIR)child_sa.h
$(CC) $(CFLAGS) -c -o $@ $<
include $(SA_DIR)states/Makefile.states
+82
View File
@@ -0,0 +1,82 @@
/**
* @file child_sa.c
*
* @brief Implementation of child_sa_t.
*
*/
/*
* Copyright (C) 2005 Jan Hutter, Martin Willi
* Hochschule fuer Technik Rapperswil
*
* This program 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 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program 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 General Public License
* for more details.
*/
#include "child_sa.h"
#include <utils/allocator.h>
typedef struct private_child_sa_t private_child_sa_t;
/**
* Private data of an child_sa_t object
*/
struct private_child_sa_t {
/**
* Public part of a child_sa object
*/
child_sa_t public;
/**
* type of this child sa, ESP or AH
*/
protocol_id_t sa_type;
};
/**
* implements child_sa_t.clone.
*/
static u_int32_t get_spi(private_child_sa_t *this)
{
return 0;
}
/**
* implements child_sa_t.clone.
*/
static void destroy(private_child_sa_t *this)
{
allocator_free(this);
}
/*
* Described in Header-File
*/
child_sa_t * child_sa_create(protocol_id_t sa_type, prf_plus_t *prf_plus)
{
private_child_sa_t *this = allocator_alloc_thing(private_child_sa_t);
/* Public functions */
this->public.get_spi = (u_int32_t(*)(child_sa_t*))get_spi;
this->public.destroy = (void(*)(child_sa_t*))destroy;
/* private data */
this->sa_type = sa_type;
return (&this->public);
}
+56
View File
@@ -0,0 +1,56 @@
/**
* @file child_sa.h
*
* @brief Interface of child_sa_t.
*
*/
/*
* Copyright (C) 2005 Jan Hutter, Martin Willi
* Hochschule fuer Technik Rapperswil
*
* This program 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 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program 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 General Public License
* for more details.
*/
#ifndef CHILD_SA_H_
#define CHILD_SA_H_
#include <types.h>
#include <transforms/prf_plus.h>
#include <encoding/payloads/proposal_substructure.h>
typedef struct child_sa_t child_sa_t;
/**
* @brief
* @ingroup sa
*/
struct child_sa_t {
u_int32_t (*get_spi) (child_sa_t *this);
/**
* @brief Destroys a child_sa.
*
* @param this child_sa_t object
*/
void (*destroy) (child_sa_t *this);
};
/**
* @brief
*
* @ingroup sa
*/
child_sa_t * child_sa_create(protocol_id_t protocol_id, prf_plus_t *prf_plus);
#endif /*CHILD_SA_H_*/