Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 1 | /* |
| 2 | PIM for Quagga |
| 3 | Copyright (C) 2008 Everton da Silva Marques |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation; either version 2 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, but |
| 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; see the file COPYING; if not, write to the |
| 17 | Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
| 18 | MA 02110-1301 USA |
| 19 | |
| 20 | $QuaggaId: $Format:%an, %ai, %h$ $ |
| 21 | */ |
| 22 | |
| 23 | #ifndef PIM_PIM_H |
| 24 | #define PIM_PIM_H |
| 25 | |
| 26 | #include <zebra.h> |
| 27 | |
| 28 | #include "if.h" |
| 29 | |
| 30 | #define PIM_PIM_BUFSIZE_READ (20000) |
| 31 | #define PIM_PIM_BUFSIZE_WRITE (20000) |
| 32 | |
| 33 | #define PIM_NEXTHOP_IFINDEX_TAB_SIZE (20) |
| 34 | |
| 35 | #define PIM_DEFAULT_HELLO_PERIOD (30) /* seconds, RFC 4601: 4.11 */ |
| 36 | #define PIM_DEFAULT_TRIGGERED_HELLO_DELAY (5) /* seconds, RFC 4601: 4.11 */ |
| 37 | #define PIM_DEFAULT_DR_PRIORITY (1) /* RFC 4601: 4.3.1 */ |
| 38 | #define PIM_DEFAULT_PROPAGATION_DELAY_MSEC (500) /* RFC 4601: 4.11. Timer Values */ |
| 39 | #define PIM_DEFAULT_OVERRIDE_INTERVAL_MSEC (2500) /* RFC 4601: 4.11. Timer Values */ |
| 40 | #define PIM_DEFAULT_CAN_DISABLE_JOIN_SUPPRESSION (0) /* boolean */ |
| 41 | #define PIM_DEFAULT_T_PERIODIC (60) /* RFC 4601: 4.11. Timer Values */ |
| 42 | |
| 43 | #define PIM_MSG_TYPE_HELLO (0) |
Donald Sharp | dea43de | 2015-10-01 12:40:51 -0400 | [diff] [blame] | 44 | #define PIM_MSG_TYPE_REGISTER (1) |
| 45 | #define PIM_MSG_TYPE_REG_STOP (2) |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 46 | #define PIM_MSG_TYPE_JOIN_PRUNE (3) |
Donald Sharp | dea43de | 2015-10-01 12:40:51 -0400 | [diff] [blame] | 47 | #define PIM_MSG_TYPE_BOOTSTRAP (4) |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 48 | #define PIM_MSG_TYPE_ASSERT (5) |
Donald Sharp | dea43de | 2015-10-01 12:40:51 -0400 | [diff] [blame] | 49 | #define PIM_MSG_TYPE_GRAFT (6) |
| 50 | #define PIM_MSG_TYPE_GRAFT_ACK (7) |
| 51 | #define PIM_MSG_TYPE_CANDIDATE (8) |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 52 | |
| 53 | #define PIM_MSG_HDR_OFFSET_VERSION(pim_msg) (pim_msg) |
| 54 | #define PIM_MSG_HDR_OFFSET_TYPE(pim_msg) (pim_msg) |
| 55 | #define PIM_MSG_HDR_OFFSET_RESERVED(pim_msg) (((char *)(pim_msg)) + 1) |
| 56 | #define PIM_MSG_HDR_OFFSET_CHECKSUM(pim_msg) (((char *)(pim_msg)) + 2) |
| 57 | |
| 58 | #define PIM_MSG_HDR_GET_VERSION(pim_msg) ((*(uint8_t*) PIM_MSG_HDR_OFFSET_VERSION(pim_msg)) >> 4) |
| 59 | #define PIM_MSG_HDR_GET_TYPE(pim_msg) ((*(uint8_t*) PIM_MSG_HDR_OFFSET_TYPE(pim_msg)) & 0xF) |
| 60 | #define PIM_MSG_HDR_GET_CHECKSUM(pim_msg) (*(uint16_t*) PIM_MSG_HDR_OFFSET_CHECKSUM(pim_msg)) |
| 61 | |
| 62 | void pim_ifstat_reset(struct interface *ifp); |
| 63 | void pim_sock_reset(struct interface *ifp); |
| 64 | int pim_sock_add(struct interface *ifp); |
| 65 | void pim_sock_delete(struct interface *ifp, const char *delete_message); |
| 66 | void pim_hello_restart_now(struct interface *ifp); |
| 67 | void pim_hello_restart_triggered(struct interface *ifp); |
| 68 | |
David Lamparter | f8cfeb2 | 2012-02-16 04:31:08 +0000 | [diff] [blame] | 69 | int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len); |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 70 | |
| 71 | int pim_msg_send(int fd, |
| 72 | struct in_addr dst, |
David Lamparter | f8cfeb2 | 2012-02-16 04:31:08 +0000 | [diff] [blame] | 73 | uint8_t *pim_msg, |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 74 | int pim_msg_size, |
| 75 | const char *ifname); |
| 76 | |
| 77 | #endif /* PIM_PIM_H */ |