2 * Copyright (C) 2010 Martin Willi
3 * Copyright (C) 2010 revosec AG
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 dhcp_transaction dhcp_transaction
21 #ifndef DHCP_TRANSACTION_H_
22 #define DHCP_TRANSACTION_H_
24 #include <utils/host.h>
25 #include <utils/identification.h>
27 typedef struct dhcp_transaction_t dhcp_transaction_t
;
30 * DHCP transaction class.
32 struct dhcp_transaction_t
{
35 * Get the DCHP transaction ID.
37 * @return DHCP transaction identifier
39 u_int32_t (*get_id
)(dhcp_transaction_t
*this);
42 * Get the peer identity this transaction is used for.
44 * @return peer Identity
46 identification_t
* (*get_identity
)(dhcp_transaction_t
*this);
49 * Set the DHCP address received using this transaction.
51 * @param host received DHCP address
53 void (*set_address
)(dhcp_transaction_t
*this, host_t
*address
);
56 * Get the DHCP address received using this transaction.
58 * @return received DHCP address
60 host_t
* (*get_address
)(dhcp_transaction_t
*this);
63 * Destroy a dhcp_transaction_t.
65 void (*destroy
)(dhcp_transaction_t
*this);
69 * Create a dhcp_transaction instance.
71 * @param id DHCP transaction identifier
72 * @param identity peer identity this transaction is used for
73 * @return transaction instance
75 dhcp_transaction_t
*dhcp_transaction_create(u_int32_t id
,
76 identification_t
*identity
);
78 #endif /** DHCP_TRANSACTION_H_ @}*/