(no commit message)
[strongswan.git] / Source / charon / sa / states / ike_auth_requested.c
1 /**
2 * @file ike_auth_requested.c
3 *
4 * @brief Implementation of ike_auth_requested_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #include "ike_auth_requested.h"
24
25 #include <utils/allocator.h>
26
27
28 typedef struct private_ike_auth_requested_t private_ike_auth_requested_t;
29
30 /**
31 * Private data of a ike_auth_requested_t object.
32 *
33 */
34 struct private_ike_auth_requested_t {
35 /**
36 * methods of the state_t interface
37 */
38 ike_auth_requested_t public;
39
40 /**
41 * Sent nonce value
42 */
43 chunk_t sent_nonce;
44
45 /**
46 * Received nonce
47 */
48 chunk_t received_nonce;
49
50 /**
51 * Assigned IKE_SA
52 */
53 protected_ike_sa_t *ike_sa;
54 };
55
56 /**
57 * Implements state_t.get_state
58 */
59 static status_t process_message(private_ike_auth_requested_t *this, message_t *message)
60 {
61 return SUCCESS;
62 }
63
64 /**
65 * Implements state_t.get_state
66 */
67 static ike_sa_state_t get_state(private_ike_auth_requested_t *this)
68 {
69 return IKE_AUTH_REQUESTED;
70 }
71
72 /**
73 * Implements state_t.get_state
74 */
75 static void destroy(private_ike_auth_requested_t *this)
76 {
77 allocator_free(this->sent_nonce.ptr);
78 allocator_free(this->received_nonce.ptr);
79 allocator_free(this);
80 }
81
82 /*
83 * Described in header.
84 */
85 ike_auth_requested_t *ike_auth_requested_create(protected_ike_sa_t *ike_sa, chunk_t sent_nonce, chunk_t received_nonce)
86 {
87 private_ike_auth_requested_t *this = allocator_alloc_thing(private_ike_auth_requested_t);
88
89 /* interface functions */
90 this->public.state_interface.process_message = (status_t (*) (state_t *,message_t *)) process_message;
91 this->public.state_interface.get_state = (ike_sa_state_t (*) (state_t *)) get_state;
92 this->public.state_interface.destroy = (void (*) (state_t *)) destroy;
93
94 /* private data */
95 this->ike_sa = ike_sa;
96 this->sent_nonce = sent_nonce;
97 this->received_nonce = received_nonce;
98
99
100 return &(this->public);
101 }