?? mld6igmp_vif.hh
字號(hào):
// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-// Copyright (c) 2001-2008 XORP, Inc.//// Permission is hereby granted, free of charge, to any person obtaining a// copy of this software and associated documentation files (the "Software")// to deal in the Software without restriction, subject to the conditions// listed in the XORP LICENSE file. These conditions include: you must// preserve this copyright notice, and you cannot mention the copyright// holders in advertising related to the Software without their permission.// The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This// notice is a summary of the XORP LICENSE file; the license in that file is// legally binding.// $XORP: xorp/contrib/mld6igmp_lite/mld6igmp_vif.hh,v 1.2 2008/07/23 05:09:49 pavlin Exp $#ifndef __MLD6IGMP_MLD6IGMP_VIF_HH__#define __MLD6IGMP_MLD6IGMP_VIF_HH__//// IGMP and MLD virtual interface definition.//#include <utility>#include "libxorp/config_param.hh"#include "libxorp/timer.hh"#include "libxorp/vif.hh"#include "libproto/proto_unit.hh"#include "mrt/buffer.h"#include "mrt/multicast_defs.h"#include "igmp_proto.h"#include "mld6_proto.h"#include "mld6igmp_node.hh"#include "mld6igmp_group_record.hh"//// Constants definitions////// Structures/classes, typedefs and macros///** * @short A class for MLD/IGMP-specific virtual interface. */class Mld6igmpVif : public ProtoUnit, public Vif {public: /** * Constructor for a given MLD/IGMP node and a generic virtual interface. * * @param mld6igmp_node the @ref Mld6igmpNode this interface belongs to. * @param vif the generic Vif interface that contains various information. */ Mld6igmpVif(Mld6igmpNode& mld6igmp_node, const Vif& vif); /** * Destructor */ virtual ~Mld6igmpVif(); /** * Set the current protocol version. * * The protocol version must be in the interval * [IGMP_VERSION_MIN, IGMP_VERSION_MAX] * or [MLD_VERSION_MIN, MLD_VERSION_MAX] * * @param proto_version the protocol version to set. * @return XORP_OK on success, otherwise XORP_ERROR. */ int set_proto_version(int proto_version); /** * Start MLD/IGMP on a single virtual interface. * * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. */ int start(string& error_msg); /** * Stop MLD/IGMP on a single virtual interface. * * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. */ int stop(string& error_msg); /** * Enable MLD/IGMP on a single virtual interface. * * If an unit is not enabled, it cannot be start, or pending-start. */ void enable(); /** * Disable MLD/IGMP on a single virtual interface. * * If an unit is disabled, it cannot be start or pending-start. * If the unit was runnning, it will be stop first. */ void disable(); /** * Receive a protocol message. * * @param src the source address of the message. * @param dst the destination address of the message. * @param ip_ttl the IP TTL of the message. If it has a negative value * it should be ignored. * @param ip_ttl the IP TOS of the message. If it has a negative value, * it should be ignored. * @param ip_router_alert if true, the IP Router Alert option in the IP * packet was set (when applicable). * @param ip_internet_control if true, then this is IP control traffic. * @param buffer the data buffer with the received message. * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. */ int mld6igmp_recv(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); /** * Get the string with the flags about the vif status. * * TODO: temporary here. Should go to the Vif class after the Vif * class starts using the Proto class. * * @return the C++ style string with the flags about the vif status * (e.g., UP/DOWN/DISABLED, etc). */ string flags_string() const; /** * Get the MLD6IGMP node (@ref Mld6igmpNode). * * @return a reference to the MLD6IGMP node (@ref Mld6igmpNode). */ Mld6igmpNode& mld6igmp_node() const { return (_mld6igmp_node); } /** * Get my primary address on this interface. * * @return my primary address on this interface. */ const IPvX& primary_addr() const { return (_primary_addr); } /** * Set my primary address on this interface. * * @param v the value of the primary address. */ void set_primary_addr(const IPvX& v) { _primary_addr = v; } /** * Update the primary address. * * The primary address should be a link-local unicast address, and * is used for transmitting the multicast control packets on the LAN. * * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. */ int update_primary_address(string& error_msg); /** * Get the MLD/IGMP querier address. * * @return the MLD/IGMP querier address. */ const IPvX& querier_addr() const { return (_querier_addr); } /** * Set the MLD6/IGMP querier address. * * @param v the value of the MLD/IGMP querier address. */ void set_querier_addr(const IPvX& v) { _querier_addr = v; } /** * Get the set with the multicast group records information * (@ref Mld6igmpGroupSet). * * @return the set with the multicast group records information * (@ref Mld6igmpGroupSet). */ Mld6igmpGroupSet& group_records() { return (_group_records); } /** * Get the const set with the multicast group records information * (@ref Mld6igmpGroupSet). * * @return the const set with the multicast group records information * (@ref Mld6igmpGroupSet). */ const Mld6igmpGroupSet& group_records() const { return (_group_records); } /** * Test if the protocol is Source-Specific Multicast (e.g., IGMPv3 * or MLDv2). * * @return true if the protocol is Source-Specific Multicast (e.g., IGMPv3 * or MLDv2). */ bool proto_is_ssm() const; /** * Get the timer to timeout the (other) MLD/IGMP querier. * * @return a reference to the timer to timeout the (other) * MLD/IGMP querier. * */ const XorpTimer& const_other_querier_timer() const { return (_other_querier_timer); } /** * Optain a reference to the "IP Router Alert option check" flag. * * @return a reference to the "IP Router Alert option check" flag. */ ConfigParam<bool>& ip_router_alert_option_check() { return (_ip_router_alert_option_check); } /** * Optain a reference to the configured Query Interval. * * @return a reference to the configured Query Interval. */ ConfigParam<TimeVal>& configured_query_interval() { return (_configured_query_interval); } /** * Get the effective Query Interval value. * * Note that this value may be modified by reconfiguring the router, * or by the Query message from the current Querier. * * @return the value of the effective Query Interval. */ const TimeVal& effective_query_interval() const { return (_effective_query_interval); } /** * Set the effective Query Interval. * * Note that this value may be modified by reconfiguring the router, * or by the Query message from the current Querier. * * @param v the value of the effective Query Interval. */ void set_effective_query_interval(const TimeVal& v); /** * Optain a reference to the Last Member Query Interval. * * @return a reference to the Last Member Query Interval. */ ConfigParam<TimeVal>& query_last_member_interval() { return (_query_last_member_interval); } /** * Optain a reference to the Query Response Interval. * * @return a reference to the Query Response Interval. */ ConfigParam<TimeVal>& query_response_interval() { return (_query_response_interval); } /** * Optain a reference to the configured Robustness Variable count. * * @return a reference to the configured Robustness Variable count. */ ConfigParam<uint32_t>& configured_robust_count() { return (_configured_robust_count); } /** * Get the effective Robustness Variable value. * * Note that this value may be modified by reconfiguring the router, * or by the Query messages from the current Querier. * * @return the value of the effective Robustness Variable. */ uint32_t effective_robustness_variable() const { return (_effective_robustness_variable); } /** * Set the effective Robustness Variable. * * Note that this value may be modified by reconfiguring the router, * or by the Query messages from the current Querier. * * @param v the value of the effective Robustness Variable. */ void set_effective_robustness_variable(uint32_t v); /** * Get the Last Member Query Count value. * * Note: According to the IGMP/MLD spec, the default value for the * Last Member Query Count is the Robustness Variable. * Hence, the Last Member Query Count itself should be configurable. * For simplicity (and for consistency with other router vendors), it * is always same as the Robustness Variable. * * @return the value of the Last Member Query Count. */ uint32_t last_member_query_count() const { return (_last_member_query_count); } /** * Obtain a reference to the Group Membership Interval. * * Note that it is not directly configurable, but may be tuned by * changing the values of the parameters it depends on. * * @return a reference to the Group Membership Interval. */ const TimeVal& group_membership_interval() const { return (_group_membership_interval); } /** * Obtain a reference to the Last Member Query Time. * * Note that it is not directly configurable, but may be tuned by * changing the values of the parameters it depends on. * * @return a reference to the Last Member Query Time. */ const TimeVal& last_member_query_time() const { return (_last_member_query_time); } /** * Obtain a reference to the Older Version Host Present Interval. * * Note that it is not directly configurable, but may be tuned by * changing the values of the parameters it depends on. * * @return a reference to the Older Version Host Present Interval. */ const TimeVal& older_version_host_present_interval() const { return (_older_version_host_present_interval); } // // Add/delete routing protocols that need to be notified for membership // changes. // /** * Add a protocol that needs to be notified about multicast membership * changes. * * Add a protocol to the list of entries that would be notified * if there is membership change on a particular interface. * * @param module_instance_name the module instance name of the * protocol to add. * @param module_id the module ID (@ref xorp_module_id) of the * protocol to add. * @return XORP_OK on success, otherwise XORP_ERROR. */ int add_protocol(xorp_module_id module_id, const string& module_instance_name); /** * Delete a protocol that needs to be notified about multicast membership * changes. * * Delete a protocol from the list of entries that would be notified * if there is membership change on a particular interface. * * @param module_instance_name the module instance name of the * protocol to delete.
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -