mld6igmp_vif.hh
来自「MLDv2 support igmpv3 lite」· HH 代码 · 共 740 行 · 第 1/2 页
HH
740 行
* @param module_id the module ID (@ref xorp_module_id) of the * protocol to delete. * @return XORP_OK on success, otherwise XORP_ERROR. */ int delete_protocol(xorp_module_id module_id, const string& module_instance_name); /** * Notify the interested parties that there is membership change among * the local members. * * @param source the source address of the (S,G) entry that has changed. * In case of group-specific membership, it could be IPvX::ZERO(). * @param group the group address of the (S,G) entry that has changed. * @param action_jp the membership change: @ref ACTION_JOIN * or @ref ACTION_PRUNE. * @return XORP_OK on success, otherwise XORP_ERROR. */ int join_prune_notify_routing(const IPvX& source, const IPvX& group, action_jp_t action_jp) const; // // Functions for sending protocol messages // /** * Send MLD or IGMP message. * * @param src the message source address. * @param dst the message destination address. * @param message_type the MLD or IGMP type of the message. * @param max_resp_code the "Maximum Response Code" or "Max Resp Code" * field in the MLD or IGMP headers respectively (in the particular * protocol resolution). * @param group_address the "Multicast Address" or "Group Address" field * in the MLD or IGMP headers respectively. * @param buffer the buffer with the rest of the message. * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. **/ int mld6igmp_send(const IPvX& src, const IPvX& dst, uint8_t message_type, uint16_t max_resp_code, const IPvX& group_address, buffer_t *buffer, string& error_msg); /** * Send Group-Specific Query message. * * @param group_address the "Multicast Address" or "Group Address" field * in the MLD or IGMP headers respectively. * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. **/ int mld6igmp_group_query_send(const IPvX& group_address, string& error_msg); /** * Send MLDv2 or IGMPv3 Group-and-Source-Specific Query message. * * @param group_address the "Multicast Address" or "Group Address" field * in the MLD or IGMP headers respectively. * @param sources the set of source addresses. * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. **/ int mld6igmp_group_source_query_send(const IPvX& group_address, const set<IPvX>& sources, string& error_msg); /** * Send MLD or IGMP Query message. * * @param src the message source address. * @param dst the message destination address. * @param max_resp_time the maximum response time. * @param group_address the "Multicast Address" or "Group Address" field * in the MLD or IGMP headers respectively. * @param sources the set of source addresses (for IGMPv3 or MLDv2 only). * @param s_flag the "Suppress Router-Side Processing" bit (for IGMPv3 * or MLDv2 only; in all other cases it should be set to false). * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. **/ int mld6igmp_query_send(const IPvX& src, const IPvX& dst, const TimeVal& max_resp_time, const IPvX& group_address, const set<IPvX>& sources, bool s_flag, string& error_msg); /** * Test if the interface is running in IGMPv1 mode. * * @return true if the interface is running in IGMPv1 mode, * otherwise false. */ bool is_igmpv1_mode() const; /** * Test if the interface is running in IGMPv2 mode. * * @return true if the interface is running in IGMPv2 mode, * otherwise false. */ bool is_igmpv2_mode() const; /** * Test if the interface is running in IGMPv3 mode. * * @return true if the interface is running in IGMPv3 mode, * otherwise false. */ bool is_igmpv3_mode() const; /** * Test if the interface is running in MLDv1 mode. * * @return true if the interface is running in MLDv1 mode, * otherwise false. */ bool is_mldv1_mode() const; /** * Test if the interface is running in MLDv2 mode. * * @return true if the interface is running in MLDv2 mode, * otherwise false. */ bool is_mldv2_mode() const; /** * Test if a group is running in IGMPv1 mode. * * Note that if @ref group_record is NULL, then we test whether the * interface itself is running in IGMPv1 mode. * @param group_record the group record to test. * @return true if the group is running in IGMPv1 mode, * otherwise false. */ bool is_igmpv1_mode(const Mld6igmpGroupRecord* group_record) const; /** * Test if a group is running in IGMPv2 mode. * * Note that if @ref group_record is NULL, then we test whether the * interface itself is running in IGMPv2 mode. * @param group_record the group record to test. * @return true if the group is running in IGMPv2 mode, * otherwise false. */ bool is_igmpv2_mode(const Mld6igmpGroupRecord* group_record) const; /** * Test if a group is running in IGMPv3 mode. * * Note that if @ref group_record is NULL, then we test whether the * interface itself is running in IGMPv3 mode. * @param group_record the group record to test. * @return true if the group is running in IGMPv3 mode, * otherwise false. */ bool is_igmpv3_mode(const Mld6igmpGroupRecord* group_record) const; /** * Test if a group is running in MLDv1 mode. * * Note that if @ref group_record is NULL, then we test whether the * interface itself is running in MLDv1 mode. * @param group_record the group record to test. * @return true if the group is running in MLDv1 mode, * otherwise false. */ bool is_mldv1_mode(const Mld6igmpGroupRecord* group_record) const; /** * Test if a group is running in MLDv2 mode. * * Note that if @ref group_record is NULL, then we test whether the * interface itself is running in MLDv2 mode. * @param group_record the group record to test. * @return true if the group is running in MLDv2 mode, * otherwise false. */ bool is_mldv2_mode(const Mld6igmpGroupRecord* group_record) const;private: // // Private functions // /** * Return the ASCII text description of the protocol message. * * @param message_type the protocol message type. * @return the ASCII text descrpition of the protocol message. */ const char *proto_message_type2ascii(uint8_t message_type) const; /** * Reset and prepare the buffer for sending data. * * @return the prepared buffer. */ buffer_t *buffer_send_prepare(); /** * Calculate the checksum of an IPv6 "pseudo-header" as described * in RFC 2460. * * @param src the source address of the pseudo-header. * @param dst the destination address of the pseudo-header. * @param len the upper-layer packet length of the pseudo-header * (in host-order). * @param protocol the upper-layer protocol number. * @return the checksum of the IPv6 "pseudo-header". */ uint16_t calculate_ipv6_pseudo_header_checksum(const IPvX& src, const IPvX& dst, size_t len, uint8_t protocol); /** * Test whether I am the querier for this vif. * * @return true if I am the querier for this vif, otherwise false. */ bool i_am_querier() const; /** * Set the state whether I am the querier for this vif. * * @param v if true, then I am the querier for this vif. */ void set_i_am_querier(bool v); // // Callbacks for configuration and non-configurable parameters // void set_configured_query_interval_cb(TimeVal v); void set_query_last_member_interval_cb(TimeVal v); void set_query_response_interval_cb(TimeVal v); void set_configured_robust_count_cb(uint32_t v); void recalculate_effective_query_interval(); void recalculate_effective_robustness_variable(); void recalculate_last_member_query_count(); void recalculate_group_membership_interval(); void recalculate_last_member_query_time(); void recalculate_older_version_host_present_interval(); void restore_effective_variables(); // // Private state // Mld6igmpNode& _mld6igmp_node; // The MLD6IGMP node I belong to buffer_t *_buffer_send; // Buffer for sending messages enum { MLD6IGMP_VIF_QUERIER = 1 << 0 // I am the querier }; uint32_t _proto_flags; // Various flags (MLD6IGMP_VIF_*) IPvX _primary_addr; // The primary address on this vif IPvX _querier_addr; // IP address of the current querier XorpTimer _other_querier_timer; // To timeout the (other) 'querier' XorpTimer _query_timer; // Timer to send queries uint8_t _startup_query_count; // Number of queries to send quickly // during startup Mld6igmpGroupSet _group_records; // The group records // // Misc configuration parameters // ConfigParam<bool> _ip_router_alert_option_check; // The IP Router Alert option check flag ConfigParam<TimeVal> _configured_query_interval; // The configured Query Interval TimeVal _effective_query_interval; // The effective Query Interval ConfigParam<TimeVal> _query_last_member_interval; // The Last Member Query Interval ConfigParam<TimeVal> _query_response_interval; // The Query Response Interval ConfigParam<uint32_t> _configured_robust_count; // The configured Robustness Variable count uint32_t _effective_robustness_variable; // The effective Robustness Variable // // Other parameters that are not directly configurable // uint32_t _last_member_query_count; // The Last Member Query Count TimeVal _group_membership_interval; // The Group Membership Interval TimeVal _last_member_query_time; // The Last Member Query Time TimeVal _older_version_host_present_interval; // The Older Version Host Present Interval // // Misc. other state // // Registered protocols to notify for membership change. vector<pair<xorp_module_id, string> > _notify_routing_protocols; bool _dummy_flag; // Dummy flag // // Not-so handy private functions that should go somewhere else // // MLD/IGMP control messages recv functions int mld6igmp_membership_query_recv(const IPvX& src, const IPvX& dst, uint8_t message_type, uint16_t max_resp_code, const IPvX& group_address, buffer_t *buffer); int mld6igmp_ssm_membership_query_recv(const IPvX& src, const IPvX& dst, uint8_t message_type, uint16_t max_resp_code, const IPvX& group_address, buffer_t *buffer); int mld6igmp_membership_report_recv(const IPvX& src, const IPvX& dst, uint8_t message_type, uint16_t max_resp_code, const IPvX& group_address, buffer_t *buffer); int mld6igmp_leave_group_recv(const IPvX& src, const IPvX& dst, uint8_t message_type, uint16_t max_resp_code, const IPvX& group_address, buffer_t *buffer); int mld6igmp_ssm_membership_report_recv(const IPvX& src, const IPvX& dst, uint8_t message_type, buffer_t *buffer); int mld6igmp_query_version_consistency_check(const IPvX& src, const IPvX& dst, uint8_t message_type, int message_version); // MLD/IGMP control messages process functions int mld6igmp_process(const IPvX& src, const IPvX& dst, int ip_ttl, int ip_tos, bool ip_router_alert, bool ip_internet_control, buffer_t *buffer, string& error_msg); // MLD/IGMP uniform interface for protocol-related constants size_t mld6igmp_constant_minlen() const; uint32_t mld6igmp_constant_timer_scale() const; uint8_t mld6igmp_constant_membership_query() const; void other_querier_timer_timeout(); void query_timer_timeout(); void decode_exp_time_code8(uint8_t code, TimeVal& timeval, uint32_t timer_scale); void decode_exp_time_code16(uint16_t code, TimeVal& timeval, uint32_t timer_scale); void encode_exp_time_code8(const TimeVal& timeval, uint8_t& code, uint32_t timer_scale); void encode_exp_time_code16(const TimeVal& timeval, uint16_t& code, uint32_t timer_scale);};//// Global variables////// Global functions prototypes//#endif // __MLD6IGMP_MLD6IGMP_VIF_HH__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?