2 * Copyright (C) 2010 Tobias Brunner
3 * Hochschule fuer Technik Rapperswil
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>.
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
17 * @defgroup whack_attribute
21 #ifndef WHACK_ATTRIBUTE_H_
22 #define WHACK_ATTRIBUTE_H_
25 #include <attributes/attribute_provider.h>
27 typedef struct whack_attribute_t whack_attribute_t
;
30 * Whack attribute provider (basically an in-memory IP address pool)
32 struct whack_attribute_t
{
35 * Implements attribute provider interface
37 attribute_provider_t provider
;
40 * Add a virtual IP address pool.
42 * @param name name of the pool
43 * @param right "right" end of whack message
44 * @return TRUE, if the pool was successfully added
46 bool (*add_pool
)(whack_attribute_t
*this, const char *name
,
47 const whack_end_t
*right
);
50 * Remove a virtual IP address pool.
52 * @param name name of the pool
54 void (*del_pool
)(whack_attribute_t
*this, char *name
);
57 * Create an enumerator over installed pools.
59 * Enumerator enumerates over
60 * char *pool, u_int size, u_int offline, u_int online.
64 enumerator_t
* (*create_pool_enumerator
)(whack_attribute_t
*this);
67 * Create an enumerator over the leases of a pool.
69 * Enumerator enumerates over
70 * identification_t *id, host_t *address, bool online
72 * @param name name of the pool to enumerate
73 * @return enumerator, NULL if pool not found
75 enumerator_t
* (*create_lease_enumerator
)(whack_attribute_t
*this,
80 * Global object to manage pools. Set between calls to
81 * whack_attribute_initialize() and whack_attribute_finalize().
83 extern whack_attribute_t
*whack_attr
;
86 * Initialize the whack attribute provider
88 void whack_attribute_initialize();
91 * Finalize the whack attribute provider
93 void whack_attribute_finalize();
95 #endif /** WHACK_ATTRIBUTE_H_ @}*/