1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Add ICMPv6 multicast listener report message structure

This commit is contained in:
Matias Fontanini
2016-01-01 10:24:45 -08:00
parent 2b7714500c
commit d7e0d17154
3 changed files with 166 additions and 1 deletions

View File

@@ -521,6 +521,30 @@ public:
static new_advert_interval_type from_option(const option &opt);
};
/**
* The type used to represent a multicast address record
*/
struct multicast_address_record {
typedef std::vector<ipaddress_type> sources_type;
typedef std::vector<uint8_t> aux_data_type;
multicast_address_record(uint8_t type) : type(type) { }
multicast_address_record(const uint8_t* buffer, uint32_t total_sz);
void serialize(uint8_t* buffer, uint32_t total_sz) const;
uint32_t size() const;
uint8_t type;
ipaddress_type multicast_address;
sources_type sources;
aux_data_type aux_data;
};
/*
* The type used to store all multicast address records in a packet
*/
typedef std::list<multicast_address_record> multicast_address_records_list;
/**
* \brief Constructs an ICMPv6 object.
*
@@ -707,6 +731,13 @@ public:
return _header.rfc4884.length;
}
/**
* \brief Getter for the multicast address records field
*/
const multicast_address_records_list& multicast_address_records() const {
return multicast_records_;
}
// Setters
/**
@@ -817,6 +848,13 @@ public:
*/
void retransmit_timer(uint32_t new_retrans_timer);
/**
* \brief Setter for the multicast address records field.
*
* This field is only valid if the type of this PDU is MLD2_REPORT
*/
void multicast_address_records(const multicast_address_records_list& records);
/**
* \brief Getter for the PDU's type.
*
@@ -1374,6 +1412,11 @@ private:
uint8_t length;
uint8_t unused[3];
} rfc4884;
// Multicast Listener Report Message (mld2)
struct {
uint16_t reserved;
uint16_t record_count;
} mlrm2 ;
};
} TINS_END_PACK;
@@ -1411,6 +1454,7 @@ private:
options_type _options;
uint32_t _options_size;
uint32_t reach_time, retrans_timer;
multicast_address_records_list multicast_records_;
ICMPExtensionsStructure extensions_;
};
}