Return to traffic_selector_substructure.h CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libcharon / encoding / payloads |
1.1 misho 1: /* 2: * Copyright (C) 2005-2006 Martin Willi 3: * Copyright (C) 2005 Jan Hutter 4: * HSR Hochschule fuer Technik Rapperswil 5: * 6: * This program is free software; you can redistribute it and/or modify it 7: * under the terms of the GNU General Public License as published by the 8: * Free Software Foundation; either version 2 of the License, or (at your 9: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. 10: * 11: * This program is distributed in the hope that it will be useful, but 12: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14: * for more details. 15: */ 16: 17: /** 18: * @defgroup traffic_selector_substructure traffic_selector_substructure 19: * @{ @ingroup payloads 20: */ 21: 22: #ifndef TRAFFIC_SELECTOR_SUBSTRUCTURE_H_ 23: #define TRAFFIC_SELECTOR_SUBSTRUCTURE_H_ 24: 25: typedef struct traffic_selector_substructure_t traffic_selector_substructure_t; 26: 27: #include <library.h> 28: #include <networking/host.h> 29: #include <selectors/traffic_selector.h> 30: #include <encoding/payloads/payload.h> 31: 32: /** 33: * Class representing an IKEv2 TRAFFIC SELECTOR. 34: * 35: * The TRAFFIC SELECTOR format is described in RFC section 3.13.1. 36: */ 37: struct traffic_selector_substructure_t { 38: /** 39: * The payload_t interface. 40: */ 41: payload_t payload_interface; 42: 43: /** 44: * Get the type of Traffic selector. 45: * 46: * @return type of traffic selector 47: * 48: */ 49: ts_type_t (*get_ts_type) (traffic_selector_substructure_t *this); 50: 51: /** 52: * Set the type of Traffic selector. 53: * 54: * @param ts_type type of traffic selector 55: */ 56: void (*set_ts_type) (traffic_selector_substructure_t *this, 57: ts_type_t ts_type); 58: 59: /** 60: * Get the IP protocol ID of Traffic selector. 61: * 62: * @return type of traffic selector 63: * 64: */ 65: uint8_t (*get_protocol_id) (traffic_selector_substructure_t *this); 66: 67: /** 68: * Set the IP protocol ID of Traffic selector 69: * 70: * @param protocol_id protocol ID of traffic selector 71: */ 72: void (*set_protocol_id) (traffic_selector_substructure_t *this, 73: uint8_t protocol_id); 74: 75: /** 76: * Get the start port and address as host_t object. 77: * 78: * Returned host_t object has to get destroyed by the caller. 79: * 80: * @return start host as host_t object 81: * 82: */ 83: host_t *(*get_start_host) (traffic_selector_substructure_t *this); 84: 85: /** 86: * Set the start port and address as host_t object. 87: * 88: * @param start_host start host as host_t object 89: */ 90: void (*set_start_host) (traffic_selector_substructure_t *this, 91: host_t *start_host); 92: 93: /** 94: * Get the end port and address as host_t object. 95: * 96: * Returned host_t object has to get destroyed by the caller. 97: * 98: * @return end host as host_t object 99: * 100: */ 101: host_t *(*get_end_host) (traffic_selector_substructure_t *this); 102: 103: /** 104: * Set the end port and address as host_t object. 105: * 106: * @param end_host end host as host_t object 107: */ 108: void (*set_end_host) (traffic_selector_substructure_t *this, 109: host_t *end_host); 110: 111: /** 112: * Get a traffic_selector_t from this substructure. 113: * 114: * @warning traffic_selector_t must be destroyed after usage. 115: * 116: * @return contained traffic_selector_t 117: */ 118: traffic_selector_t *(*get_traffic_selector) ( 119: traffic_selector_substructure_t *this); 120: 121: /** 122: * Destroys an traffic_selector_substructure_t object. 123: */ 124: void (*destroy) (traffic_selector_substructure_t *this); 125: }; 126: 127: /** 128: * Creates an empty traffic_selector_substructure_t object. 129: * 130: * TS type is set to default TS_IPV4_ADDR_RANGE! 131: * 132: * @return traffic_selector_substructure_t object 133: */ 134: traffic_selector_substructure_t *traffic_selector_substructure_create(void); 135: 136: /** 137: * Creates an initialized traffic selector substructure using 138: * the values from a traffic_selector_t. 139: * 140: * @param traffic_selector traffic_selector_t to use for initialization 141: * @return traffic_selector_substructure_t object 142: */ 143: traffic_selector_substructure_t *traffic_selector_substructure_create_from_traffic_selector( 144: traffic_selector_t *traffic_selector); 145: 146: #endif /** TRAFFIC_SELECTOR_SUBSTRUCTURE_H_ @}*/