Return to connect_manager.h CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libcharon / sa / ikev2 |
1.1 misho 1: /* 2: * Copyright (C) 2007-2008 Tobias Brunner 3: * HSR Hochschule fuer Technik Rapperswil 4: * 5: * This program is free software; you can redistribute it and/or modify it 6: * under the terms of the GNU General Public License as published by the 7: * Free Software Foundation; either version 2 of the License, or (at your 8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. 9: * 10: * This program is distributed in the hope that it will be useful, but 11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13: * for more details. 14: */ 15: 16: /** 17: * @defgroup connect_manager connect_manager 18: * @{ @ingroup ikev2 19: */ 20: 21: #ifndef CONNECT_MANAGER_H_ 22: #define CONNECT_MANAGER_H_ 23: 24: typedef struct connect_manager_t connect_manager_t; 25: 26: #include <encoding/message.h> 27: #include <sa/ike_sa_id.h> 28: #include <utils/identification.h> 29: 30: /** 31: * The connection manager is responsible for establishing a direct 32: * connection with another peer. 33: */ 34: struct connect_manager_t { 35: 36: /** 37: * Checks if a there is already a mediated connection registered 38: * between two peers. 39: * 40: * @param id my id 41: * @param peer_id the other peer's id 42: * @param mediated_sa the IKE_SA ID of the mediated connection 43: * @returns 44: * - TRUE, if a mediated connection is registered 45: * - FALSE, otherwise 46: */ 47: bool (*check_and_register) (connect_manager_t *this, identification_t *id, 48: identification_t *peer_id, 49: ike_sa_id_t *mediated_sa); 50: 51: /** 52: * Checks if there are waiting connections with a specific peer. 53: * If so, reinitiate them. 54: * 55: * @param id my id 56: * @param peer_id the other peer's id 57: */ 58: void (*check_and_initiate) (connect_manager_t *this, 59: ike_sa_id_t *mediation_sa, identification_t *id, 60: identification_t *peer_id); 61: 62: /** 63: * Creates a checklist and sets the initiator's data. 64: * 65: * @param initiator ID of the initiator 66: * @param responder ID of the responder 67: * @param connect_id the connect ID provided by the initiator 68: * @param key the initiator's key 69: * @param endpoints the initiator's endpoints 70: * @param is_initiator TRUE, if the caller of this method is the initiator 71: * @returns SUCCESS 72: */ 73: status_t (*set_initiator_data) (connect_manager_t *this, 74: identification_t *initiator, 75: identification_t *responder, 76: chunk_t connect_id, chunk_t key, 77: linked_list_t *endpoints, 78: bool is_initiator); 79: 80: /** 81: * Updates a checklist and sets the responder's data. The checklist's 82: * state is advanced to WAITING which means that checks will be sent. 83: * 84: * @param connect_id the connect ID 85: * @param chunk_t the responder's key 86: * @param endpoints the responder's endpoints 87: * @returns 88: * - NOT_FOUND, if the checklist has not been found 89: * - SUCCESS, otherwise 90: */ 91: status_t (*set_responder_data) (connect_manager_t *this, 92: chunk_t connect_id, chunk_t key, 93: linked_list_t *endpoints); 94: 95: /** 96: * Stops checks for a checklist. Called after the responder received an 97: * IKE_SA_INIT request which contains a ME_CONNECTID payload. 98: * 99: * @param connect_id the connect ID 100: * @returns 101: * - NOT_FOUND, if the checklist has not been found 102: * - SUCCESS, otherwise 103: */ 104: status_t (*stop_checks) (connect_manager_t *this, chunk_t connect_id); 105: 106: /** 107: * Processes a connectivity check 108: * 109: * @param message the received message 110: */ 111: void (*process_check) (connect_manager_t *this, message_t *message); 112: 113: /** 114: * Destroys the manager with all data. 115: */ 116: void (*destroy) (connect_manager_t *this); 117: }; 118: 119: /** 120: * Create a manager. 121: * 122: * @returns connect_manager_t object 123: */ 124: connect_manager_t *connect_manager_create(void); 125: 126: #endif /** CONNECT_MANAGER_H_ @}*/