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
16 #include "dhcp_transaction.h"
18 typedef struct private_dhcp_transaction_t private_dhcp_transaction_t
;
21 * Private data of an dhcp_transaction_t object.
23 struct private_dhcp_transaction_t
{
26 * Public dhcp_transaction_t interface.
28 dhcp_transaction_t
public;
38 identification_t
*identity
;
41 * received DHCP address
46 METHOD(dhcp_transaction_t
, get_id
, u_int32_t
,
47 private_dhcp_transaction_t
*this)
52 METHOD(dhcp_transaction_t
, get_identity
, identification_t
*,
53 private_dhcp_transaction_t
*this)
55 return this->identity
;
58 METHOD(dhcp_transaction_t
, set_address
, void,
59 private_dhcp_transaction_t
*this, host_t
*address
)
61 DESTROY_IF(this->address
);
62 this->address
= address
;
65 METHOD(dhcp_transaction_t
, get_address
, host_t
*,
66 private_dhcp_transaction_t
*this)
71 METHOD(dhcp_transaction_t
, destroy
, void,
72 private_dhcp_transaction_t
*this)
74 this->identity
->destroy(this->identity
);
75 DESTROY_IF(this->address
);
82 dhcp_transaction_t
*dhcp_transaction_create(u_int32_t id
,
83 identification_t
*identity
)
85 private_dhcp_transaction_t
*this;
90 .get_identity
= _get_identity
,
91 .set_address
= _set_address
,
92 .get_address
= _get_address
,
96 .identity
= identity
->clone(identity
),