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_SOCK_H |
| 24 | #define PIM_SOCK_H |
| 25 | |
Everton Marques | 40765fe | 2009-09-30 17:10:11 -0300 | [diff] [blame] | 26 | #include <netinet/in.h> |
| 27 | |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 28 | #define PIM_SOCK_ERR_NONE (0) /* No error */ |
| 29 | #define PIM_SOCK_ERR_SOCKET (-1) /* socket() */ |
| 30 | #define PIM_SOCK_ERR_RA (-2) /* Router Alert option */ |
| 31 | #define PIM_SOCK_ERR_REUSE (-3) /* Reuse option */ |
| 32 | #define PIM_SOCK_ERR_TTL (-4) /* TTL option */ |
| 33 | #define PIM_SOCK_ERR_LOOP (-5) /* Loopback option */ |
| 34 | #define PIM_SOCK_ERR_IFACE (-6) /* Outgoing interface option */ |
| 35 | #define PIM_SOCK_ERR_DSTADDR (-7) /* Outgoing interface option */ |
| 36 | #define PIM_SOCK_ERR_NONBLOCK_GETFL (-8) /* Get O_NONBLOCK */ |
| 37 | #define PIM_SOCK_ERR_NONBLOCK_SETFL (-9) /* Set O_NONBLOCK */ |
Everton Marques | e8c11bb | 2009-10-08 15:06:32 -0300 | [diff] [blame] | 38 | #define PIM_SOCK_ERR_NAME (-10) /* Socket name (getsockname) */ |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 39 | |
| 40 | int pim_socket_raw(int protocol); |
| 41 | int pim_socket_mcast(int protocol, struct in_addr ifaddr, int loop); |
| 42 | int pim_socket_join(int fd, struct in_addr group, |
Paul Jakma | 9099f9b | 2016-01-18 10:12:10 +0000 | [diff] [blame] | 43 | struct in_addr ifaddr, ifindex_t ifindex); |
| 44 | int pim_socket_join_source(int fd, ifindex_t ifindex, |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 45 | struct in_addr group_addr, |
| 46 | struct in_addr source_addr, |
| 47 | const char *ifname); |
David Lamparter | f8cfeb2 | 2012-02-16 04:31:08 +0000 | [diff] [blame] | 48 | int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len, |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 49 | struct sockaddr_in *from, socklen_t *fromlen, |
| 50 | struct sockaddr_in *to, socklen_t *tolen, |
Paul Jakma | 9099f9b | 2016-01-18 10:12:10 +0000 | [diff] [blame] | 51 | ifindex_t *ifindex); |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 52 | |
| 53 | int pim_socket_mcastloop_get(int fd); |
| 54 | |
David Lamparter | e269b96 | 2012-02-16 04:32:08 +0000 | [diff] [blame] | 55 | int pim_socket_getsockname(int fd, struct sockaddr *name, socklen_t *namelen); |
Everton Marques | e8c11bb | 2009-10-08 15:06:32 -0300 | [diff] [blame] | 56 | |
Everton Marques | 871dbcf | 2009-08-11 15:43:05 -0300 | [diff] [blame] | 57 | #endif /* PIM_SOCK_H */ |