aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/network/interfaces.h
blob: 33143e07c465cf8e724dd0fea7a55f01ced41ada (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
 * @file interfaces.h
 *
 * @brief Interface of interfaces_t.
 *
 */

/*
 * Copyright (C) 2006 Tobias Brunner, Daniel Roethlisberger
 * 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 INTERFACES_H_
#define INTERFACES_H_

#include <utils/linked_list.h>
#include <utils/host.h>

typedef struct interfaces_t interfaces_t;

/**
 * @brief Provides methods to enumerate local interfaces
 *
 * @b Constructors:
 * - interfaces_create()
 * 
 * @todo Handle changes in interface list.
 *
 * @ingroup network
 */
struct interfaces_t {

	/**
	 * @brief Get an iterator over addresses of local interfaces
	 *
	 * @param this		calling object
	 * @return			iterator over host_t objects
	 */
	iterator_t* (*create_address_iterator) (interfaces_t *this);
	
	/**
	 * @brief Check if address is associated with a local interface
	 *
	 * @param this		calling object
	 * @param host		address to set as destination
	 * @return			TRUE if address is associated with a local interface, FALSE otherwise
	 */
	bool (*is_local_address) (interfaces_t *this, host_t *host);
	
	/**
	 * @brief Destroy the object, freeing contained data.
	 *
	 * @param this		object to destroy
	 */
	void (*destroy) (interfaces_t *ifaces);
};

/**
 * @brief Create an object of type interfaces_t
 *
 * @param port		the port that gets added to the addresses
 * 
 * @return interfaces_t object
 *
 * @ingroup network
 */
interfaces_t *interfaces_create(u_int16_t port);


#endif /* INTERFACES_H_ */