if (lease.hwaddr_) {
// We may not have hardware information
row.writeAt(getColumnIndex("hwaddr"), lease.hwaddr_->toText(false));
- row.writeAt(getColumnIndex("hwtype"), lease.hwaddr_->htype_);
- row.writeAt(getColumnIndex("hwaddr_source"), lease.hwaddr_->source_);
}
row.writeAt(getColumnIndex("state"), lease.state_);
// User context is optional.
addColumn("fqdn_rev", "1.0");
addColumn("hostname", "1.0");
addColumn("hwaddr", "2.0");
- addColumn("hwtype", "4.0", "1" /* == HTYPE_ETHER */);
- addColumn("hwaddr_source", "4.0", "0" /* == HWADDR_SOURCE_UNKNOWN */);
addColumn("state", "3.0", "0");
addColumn("user_context", "3.1");
// Any file with less than hostname is invalid
CSVLeaseFile6::readHWAddr(const CSVRow& row) {
try {
- uint16_t hwtype(readHWType(row));
- HWAddr hwaddr(HWAddr::fromText(row.readAt(getColumnIndex("hwaddr")), hwtype));
+ const HWAddr& hwaddr = HWAddr::fromText(row.readAt(getColumnIndex("hwaddr")));
if (hwaddr.hwaddr_.empty()) {
return (HWAddrPtr());
}
- hwaddr.source_ = readHWAddrSource(row);
-
/// @todo: HWAddr returns an object, not a pointer. Without HWAddr
/// refactoring, at least one copy is unavoidable.
}
}
-uint16_t
-CSVLeaseFile6::readHWType(const CSVRow& row) {
- return row.readAndConvertAt<uint16_t>(getColumnIndex("hwtype"));
-}
-
-uint32_t
-CSVLeaseFile6::readHWAddrSource(const CSVRow& row) {
- return row.readAndConvertAt<uint32_t>(getColumnIndex("hwaddr_source"));
-}
-
uint32_t
CSVLeaseFile6::readState(const util::CSVRow& row) {
uint32_t state = row.readAndConvertAt<uint32_t>(getColumnIndex("state"));
/// - fqdn_rev
/// - hostname
/// - hwaddr
- /// - hwtype
- /// - hwaddr_source
/// - state
/// - user_context
void initColumns();
/// @return pointer to the HWAddr structure that was read
HWAddrPtr readHWAddr(const util::CSVRow& row);
- /// @brief Reads hardware address type from the CSV file row.
- ///
- /// @param row CSV file row holding lease information.
- /// @return pointer to the HWAddr structure that was read
- uint16_t readHWType(const util::CSVRow& row);
-
- /// @brief Reads hardware address source from the CSV file row.
- ///
- /// @param row CSV file row holding lease information.
- /// @return pointer to the HWAddr structure that was read
- uint32_t readHWAddrSource(const util::CSVRow& row);
-
/// @brief Reads lease state from the CSV file row.
///
/// @param row CSV file row holding lease information.