diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2015-02-04 07:01:14 +0100 | 
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetwroks.com> | 2016-05-25 20:38:32 -0400 | 
| commit | 12e41d03bd49a60da9238694b5d8bd0bde3eff97 (patch) | |
| tree | af456c2fa25230e9e08e48bb72308f3ac113a15e /pimd/pim_tlv.h | |
| parent | 5b282f59b1b5331d1738414cadc97cc60fbb193e (diff) | |
pimd: merge pimd as of 2015-01-19
Welcome pimd to the Quagga daemon zoo!
This is a merge of commit 77ae369 ("pimd: Log ifindex found for an
interface when zebra lib reports a new connected address."), with
the intermediate "reconnect" changes removed (c9adf00...d274381).
d274381 is replaced with b162ab7, which includes some changes.  In
addition, 4 reconnect-related changes and 1 cosmetic one have been
bumped out.
The rebase command used to produce the branch that is merged here is:
  git rebase --onto b162ab7 c9adf00 77ae369
Note that 3 patches had their author rewritten from
    "Anonymous SR#108542 <>" (which is not a valid git author ID)
to: "Savannah SR#108542 <nbahr@atcorp.com>" (which is the e-mail address
                               listed in the associated Savannah ticket)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_tlv.h')
| -rw-r--r-- | pimd/pim_tlv.h | 133 | 
1 files changed, 133 insertions, 0 deletions
diff --git a/pimd/pim_tlv.h b/pimd/pim_tlv.h new file mode 100644 index 0000000000..b802cf8977 --- /dev/null +++ b/pimd/pim_tlv.h @@ -0,0 +1,133 @@ +/* +  PIM for Quagga +  Copyright (C) 2008  Everton da Silva Marques + +  This program is free software; you can redistribute it and/or modify +  it under the terms of the GNU General Public License as published by +  the Free Software Foundation; either version 2 of the License, or +  (at your option) any later version. + +  This program is distributed in the hope that it will be useful, but +  WITHOUT ANY WARRANTY; without even the implied warranty of +  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU +  General Public License for more details. +   +  You should have received a copy of the GNU General Public License +  along with this program; see the file COPYING; if not, write to the +  Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +  MA 02110-1301 USA +   +  $QuaggaId: $Format:%an, %ai, %h$ $ +*/ + +#ifndef PIM_TLV_H +#define PIM_TLV_H + +#include <zebra.h> + +#include "config.h" +#include "if.h" +#include "linklist.h" + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif /* HAVE_INTTYPES_H */ + +#define PIM_MSG_OPTION_TYPE_HOLDTIME         (1) +#define PIM_MSG_OPTION_TYPE_LAN_PRUNE_DELAY  (2) +#define PIM_MSG_OPTION_TYPE_DR_PRIORITY      (19) +#define PIM_MSG_OPTION_TYPE_GENERATION_ID    (20) +#define PIM_MSG_OPTION_TYPE_DM_STATE_REFRESH (21) +#define PIM_MSG_OPTION_TYPE_ADDRESS_LIST     (24) + +typedef uint32_t pim_hello_options; +#define PIM_OPTION_MASK_HOLDTIME                     (1 << 0) /* recv holdtime */ +#define PIM_OPTION_MASK_LAN_PRUNE_DELAY              (1 << 1) /* recv lan_prune_delay */ +#define PIM_OPTION_MASK_DR_PRIORITY                  (1 << 2) /* recv dr_priority */ +#define PIM_OPTION_MASK_GENERATION_ID                (1 << 3) /* recv generation_id */ +#define PIM_OPTION_MASK_ADDRESS_LIST                 (1 << 4) /* recv secondary address list */ +#define PIM_OPTION_MASK_CAN_DISABLE_JOIN_SUPPRESSION (1 << 5) /* T bit value (valid if recv lan_prune_delay) */ + +#define PIM_RPT_BIT_MASK      (1 << 0) +#define PIM_WILDCARD_BIT_MASK (1 << 1) + +#define PIM_OPTION_SET(options, option_mask) ((options) |= (option_mask)) +#define PIM_OPTION_UNSET(options, option_mask) ((options) &= ~(option_mask)) +#define PIM_OPTION_IS_SET(options, option_mask) ((options) & (option_mask)) + +#define PIM_TLV_GET_UINT16(buf) ntohs(*(const uint16_t *)(buf)) +#define PIM_TLV_GET_UINT32(buf) ntohl(*(const uint32_t *)(buf)) +#define PIM_TLV_GET_TYPE(buf) PIM_TLV_GET_UINT16(buf) +#define PIM_TLV_GET_LENGTH(buf) PIM_TLV_GET_UINT16(buf) +#define PIM_TLV_GET_HOLDTIME(buf) PIM_TLV_GET_UINT16(buf) +#define PIM_TLV_GET_PROPAGATION_DELAY(buf) (PIM_TLV_GET_UINT16(buf) & 0x7FFF) +#define PIM_TLV_GET_OVERRIDE_INTERVAL(buf) PIM_TLV_GET_UINT16(buf) +#define PIM_TLV_GET_CAN_DISABLE_JOIN_SUPPRESSION(buf) ((*(const uint8_t *)(buf)) & 0x80) +#define PIM_TLV_GET_DR_PRIORITY(buf) PIM_TLV_GET_UINT32(buf) +#define PIM_TLV_GET_GENERATION_ID(buf) PIM_TLV_GET_UINT32(buf) + +#define PIM_TLV_TYPE_SIZE               (2) +#define PIM_TLV_LENGTH_SIZE             (2) +#define PIM_TLV_MIN_SIZE                (PIM_TLV_TYPE_SIZE + PIM_TLV_LENGTH_SIZE) +#define PIM_TLV_OPTION_SIZE(option_len) (PIM_TLV_MIN_SIZE + (option_len)) + +uint8_t *pim_tlv_append_uint16(uint8_t *buf, +			       const uint8_t *buf_pastend, +			       uint16_t option_type, +			       uint16_t option_value); +uint8_t *pim_tlv_append_2uint16(uint8_t *buf, +				const uint8_t *buf_pastend, +				uint16_t option_type, +				uint16_t option_value1, +				uint16_t option_value2); +uint8_t *pim_tlv_append_uint32(uint8_t *buf, +			       const uint8_t *buf_pastend, +			       uint16_t option_type, +			       uint32_t option_value); +uint8_t *pim_tlv_append_addrlist_ucast(uint8_t *buf, +				       const uint8_t *buf_pastend, +				       struct list *ifconnected); + +int pim_tlv_parse_holdtime(const char *ifname, struct in_addr src_addr, +			   pim_hello_options *hello_options, +			   uint16_t *hello_option_holdtime, +			   uint16_t option_len, +			   const uint8_t *tlv_curr); +int pim_tlv_parse_lan_prune_delay(const char *ifname, struct in_addr src_addr, +				  pim_hello_options *hello_options, +				  uint16_t *hello_option_propagation_delay, +				  uint16_t *hello_option_override_interval, +				  uint16_t option_len, +				  const uint8_t *tlv_curr); +int pim_tlv_parse_dr_priority(const char *ifname, struct in_addr src_addr, +			      pim_hello_options *hello_options, +			      uint32_t *hello_option_dr_priority, +			      uint16_t option_len, +			      const uint8_t *tlv_curr); +int pim_tlv_parse_generation_id(const char *ifname, struct in_addr src_addr, +				pim_hello_options *hello_options, +				uint32_t *hello_option_generation_id, +				uint16_t option_len, +				const uint8_t *tlv_curr); +int pim_tlv_parse_addr_list(const char *ifname, struct in_addr src_addr, +			    pim_hello_options *hello_options, +			    struct list **hello_option_addr_list, +			    uint16_t option_len, +			    const uint8_t *tlv_curr); + +int pim_parse_addr_ucast(const char *ifname, struct in_addr src_addr, +			 struct prefix *p, +			 const uint8_t *buf, +			 int buf_size); +int pim_parse_addr_group(const char *ifname, struct in_addr src_addr, +			 struct prefix *p, +			 const uint8_t *buf, +			 int buf_size); +int pim_parse_addr_source(const char *ifname, +			  struct in_addr src_addr, +			  struct prefix *p, +			  uint8_t *flags, +			  const uint8_t *buf, +			  int buf_size); + +#endif /* PIM_TLV_H */  | 
