- renamed IKE_SA_INITIALIZED to IKE_SA_ESTABLISHED
authorMartin Willi <martin@strongswan.org>
Mon, 21 Nov 2005 15:03:44 +0000 (15:03 -0000)
committerMartin Willi <martin@strongswan.org>
Mon, 21 Nov 2005 15:03:44 +0000 (15:03 -0000)
- added states for ike_auth_requested and ike_sa_established

Source/charon/states/ike_auth_requested.c [new file with mode: 0644]
Source/charon/states/ike_auth_requested.h [new file with mode: 0644]
Source/charon/states/ike_sa_established.c [new file with mode: 0644]
Source/charon/states/ike_sa_established.h [new file with mode: 0644]
Source/charon/states/state.c
Source/charon/states/state.h

diff --git a/Source/charon/states/ike_auth_requested.c b/Source/charon/states/ike_auth_requested.c
new file mode 100644 (file)
index 0000000..cb6996a
--- /dev/null
@@ -0,0 +1,84 @@
+/**
+ * @file ike_auth_requested.c
+ * 
+ * @brief State of an IKE_SA, which has requested an IKE_AUTH.
+ * 
+ */
+
+/*
+ * 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 "ike_auth_requested.h"
+
+#include "../utils/allocator.h"
+
+/**
+ * Private data of a ike_auth_requested_t object.
+ *
+ */
+typedef struct private_ike_auth_requested_s private_ike_auth_requested_t;
+struct private_ike_auth_requested_s {
+       /**
+        * methods of the state_t interface
+        */
+       ike_auth_requested_t public;
+       
+};
+
+/**
+ * Implements state_t.get_state
+ */
+static status_t process_message(private_ike_auth_requested_t *this, message_t *message, state_t **new_state)
+{
+       *new_state = (state_t *) this;
+       return SUCCESS;
+}
+
+/**
+ * Implements state_t.get_state
+ */
+static ike_sa_state_t get_state(private_ike_auth_requested_t *this)
+{
+       return IKE_AUTH_REQUESTED;
+}
+
+/**
+ * Implements state_t.get_state
+ */
+static status_t destroy(private_ike_auth_requested_t *this)
+{
+       allocator_free(this);
+       return SUCCESS;
+}
+
+/* 
+ * Described in header.
+ */
+ike_auth_requested_t *ike_auth_requested_create()
+{
+       private_ike_auth_requested_t *this = allocator_alloc_thing(private_ike_auth_requested_t);
+       
+       if (this == NULL)
+       {
+               return NULL;
+       }
+
+       /* interface functions */
+       this->public.state_interface.process_message = (status_t (*) (state_t *,message_t *,state_t **)) process_message;
+       this->public.state_interface.get_state = (ike_sa_state_t (*) (state_t *)) get_state;
+       this->public.state_interface.destroy  = (status_t (*) (state_t *)) destroy;
+       
+       return &(this->public);
+}
diff --git a/Source/charon/states/ike_auth_requested.h b/Source/charon/states/ike_auth_requested.h
new file mode 100644 (file)
index 0000000..7c6beb9
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * @file ike_auth_requested.h
+ * 
+ * @brief State of an IKE_SA, which has requested an IKE_AUTH.
+ * 
+ */
+
+/*
+ * 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 IKE_AUTH_REQUESTED_H_
+#define IKE_AUTH_REQUESTED_H_
+
+#include "state.h"
+
+/**
+ * @brief This class represents an IKE_SA, which has requested an IKE_AUTH.
+ *
+ */
+typedef struct ike_auth_requested_s ike_auth_requested_t;
+
+struct ike_auth_requested_s {
+       /**
+        * methods of the state_t interface
+        */
+       state_t state_interface;
+
+};
+
+/**
+ * Constructor of class ike_auth_requested_t
+ */
+ike_auth_requested_t *ike_auth_requested_create();
+
+#endif /*IKE_AUTH_REQUESTED_H_*/
diff --git a/Source/charon/states/ike_sa_established.c b/Source/charon/states/ike_sa_established.c
new file mode 100644 (file)
index 0000000..3831a75
--- /dev/null
@@ -0,0 +1,84 @@
+/**
+ * @file ike_sa_established.c
+ * 
+ * @brief State of an established IKE_SA.
+ * 
+ */
+
+/*
+ * 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 "ike_sa_established.h"
+
+#include "../utils/allocator.h"
+
+/**
+ * Private data of a ike_sa_established_t object.
+ *
+ */
+typedef struct private_ike_sa_established_s private_ike_sa_established_t;
+struct private_ike_sa_established_s {
+       /**
+        * methods of the state_t interface
+        */
+       ike_sa_established_t public;
+       
+};
+
+/**
+ * Implements state_t.get_state
+ */
+static status_t process_message(private_ike_sa_established_t *this, message_t *message, state_t **new_state)
+{
+       *new_state = (state_t *) this;
+       return SUCCESS;
+}
+
+/**
+ * Implements state_t.get_state
+ */
+static ike_sa_state_t get_state(private_ike_sa_established_t *this)
+{
+       return IKE_SA_ESTABLISHED;
+}
+
+/**
+ * Implements state_t.get_state
+ */
+static status_t destroy(private_ike_sa_established_t *this)
+{
+       allocator_free(this);
+       return SUCCESS;
+}
+
+/* 
+ * Described in header.
+ */
+ike_sa_established_t *ike_sa_established_create()
+{
+       private_ike_sa_established_t *this = allocator_alloc_thing(private_ike_sa_established_t);
+       
+       if (this == NULL)
+       {
+               return NULL;
+       }
+
+       /* interface functions */
+       this->public.state_interface.process_message = (status_t (*) (state_t *,message_t *,state_t **)) process_message;
+       this->public.state_interface.get_state = (ike_sa_state_t (*) (state_t *)) get_state;
+       this->public.state_interface.destroy  = (status_t (*) (state_t *)) destroy;
+       
+       return &(this->public);
+}
diff --git a/Source/charon/states/ike_sa_established.h b/Source/charon/states/ike_sa_established.h
new file mode 100644 (file)
index 0000000..0f90fc0
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * @file ike_sa_established.h
+ * 
+ * @brief State of an established IKE_SA.
+ * 
+ */
+
+/*
+ * 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 IKE_SA_ESTABLISHED_H_
+#define IKE_SA_ESTABLISHED_H_
+
+#include "state.h"
+
+/**
+ * @brief This class represents an the state of an established
+ * IKE_SA.
+ *
+ */
+typedef struct ike_sa_established_s ike_sa_established_t;
+
+struct ike_sa_established_s {
+       /**
+        * methods of the state_t interface
+        */
+       state_t state_interface;
+
+};
+
+/**
+ * Constructor of class ike_sa_established_t
+ */
+ike_sa_established_t *ike_sa_established_create();
+
+#endif /*IKE_SA_ESTABLISHED_H_*/
index 3c6bcdb..661eaa3 100644 (file)
@@ -32,6 +32,6 @@ mapping_t ike_sa_state_m[] = {
        {IKE_SA_INIT_REQUESTED, "IKE_SA_INIT_REQUESTED"},
        {IKE_SA_INIT_RESPONDED, "IKE_SA_INIT_RESPONDED"},
        {IKE_AUTH_REQUESTED, "IKE_AUTH_REQUESTED"},
-       {IKE_SA_INITIALIZED, "IKE_SA_INITIALIZED"},
+       {IKE_SA_ESTABLISHED, "IKE_SA_ESTABLISHED"},
        {MAPPING_END, NULL}
 };
index bdcff33..2e5df9c 100644 (file)
@@ -65,7 +65,7 @@ enum ike_sa_state_e {
         * In this state, all the informations for an IKE_SA
         * and one CHILD_SA are known.
         */
-       IKE_SA_INITIALIZED = 6
+       IKE_SA_ESTABLISHED = 6
 };
 
 /**