cleaner error handling on UDP encapsultion sockopt failure
[strongswan.git] / src / charon / network / interfaces.h
1 /**
2 * @file interfaces.h
3 *
4 * @brief Interface of interfaces_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2006 Tobias Brunner, Daniel Roethlisberger
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 #ifndef INTERFACES_H_
24 #define INTERFACES_H_
25
26 #include <utils/linked_list.h>
27 #include <utils/host.h>
28
29 typedef struct interfaces_t interfaces_t;
30
31 /**
32 * @brief Provides methods to enumerate local interfaces
33 *
34 * @b Constructors:
35 * - interfaces_create()
36 *
37 * @todo Handle changes in interface list.
38 *
39 * @ingroup network
40 */
41 struct interfaces_t {
42
43 /**
44 * @brief Get addresses of local interfaces
45 *
46 * @param this calling object
47 * @return linked_list_t of host_t objects
48 */
49 linked_list_t* (*get_addresses) (interfaces_t *ifaces);
50
51 /**
52 * @brief Check if address is associated with a local interface
53 *
54 * @param this calling object
55 * @param host address to set as destination
56 * @return TRUE if address is associated with a local interface, FALSE otherwise
57 */
58 bool (*is_local_address) (interfaces_t *ifaces, host_t *host);
59
60 /**
61 * @brief Destroy the object, freeing contained data.
62 *
63 * @param this object to destroy
64 */
65 void (*destroy) (interfaces_t *ifaces);
66 };
67
68 /**
69 * @brief Create an object of type interfaces_t
70 *
71 * @param port the port that gets added to the addresses
72 *
73 * @return interfaces_t object
74 *
75 * @ingroup network
76 */
77 interfaces_t *interfaces_create(u_int16_t port);
78
79
80 #endif /*INTERFACES_H_*/