/*
- 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$ $
-*/
+ * 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
+ */
#ifndef PIM_TLV_H
#define PIM_TLV_H
#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,
+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);
+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 family);
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,
+ 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);
+ 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);
+ 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);
+ 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);
+ uint16_t option_len, const uint8_t *tlv_curr);
+
+int pim_encode_addr_ucast(uint8_t *buf, struct prefix *p);
+int pim_encode_addr_group(uint8_t *buf, afi_t afi, int bidir, int scope,
+ struct in_addr group);
-int pim_parse_addr_ucast (struct prefix *p,
- const uint8_t *buf,
- int buf_size);
-int pim_parse_addr_group (struct prefix *p,
- const uint8_t *buf,
- int buf_size);
-int pim_parse_addr_source(struct prefix *p,
- uint8_t *flags,
- const uint8_t *buf,
- int buf_size);
+int pim_parse_addr_ucast(struct prefix *p, const uint8_t *buf, int buf_size);
+int pim_parse_addr_group(struct prefix_sg *sg, const uint8_t *buf,
+ int buf_size);
+int pim_parse_addr_source(struct prefix_sg *sg, uint8_t *flags,
+ const uint8_t *buf, int buf_size);
#endif /* PIM_TLV_H */