pim_sock.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. PIM for Quagga
  3. Copyright (C) 2008 Everton da Silva Marques
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; see the file COPYING; if not, write to the
  14. Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
  15. MA 02110-1301 USA
  16. $QuaggaId: $Format:%an, %ai, %h$ $
  17. */
  18. #ifndef PIM_SOCK_H
  19. #define PIM_SOCK_H
  20. #include <netinet/in.h>
  21. #define PIM_SOCK_ERR_NONE (0) /* No error */
  22. #define PIM_SOCK_ERR_SOCKET (-1) /* socket() */
  23. #define PIM_SOCK_ERR_RA (-2) /* Router Alert option */
  24. #define PIM_SOCK_ERR_REUSE (-3) /* Reuse option */
  25. #define PIM_SOCK_ERR_TTL (-4) /* TTL option */
  26. #define PIM_SOCK_ERR_LOOP (-5) /* Loopback option */
  27. #define PIM_SOCK_ERR_IFACE (-6) /* Outgoing interface option */
  28. #define PIM_SOCK_ERR_DSTADDR (-7) /* Outgoing interface option */
  29. #define PIM_SOCK_ERR_NONBLOCK_GETFL (-8) /* Get O_NONBLOCK */
  30. #define PIM_SOCK_ERR_NONBLOCK_SETFL (-9) /* Set O_NONBLOCK */
  31. #define PIM_SOCK_ERR_NAME (-10) /* Socket name (getsockname) */
  32. int pim_socket_raw(int protocol);
  33. int pim_socket_mcast(int protocol, struct in_addr ifaddr, int loop);
  34. int pim_socket_join(int fd, struct in_addr group,
  35. struct in_addr ifaddr, ifindex_t ifindex);
  36. int pim_socket_join_source(int fd, ifindex_t ifindex,
  37. struct in_addr group_addr,
  38. struct in_addr source_addr,
  39. const char *ifname);
  40. int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
  41. struct sockaddr_in *from, socklen_t *fromlen,
  42. struct sockaddr_in *to, socklen_t *tolen,
  43. ifindex_t *ifindex);
  44. int pim_socket_mcastloop_get(int fd);
  45. int pim_socket_getsockname(int fd, struct sockaddr *name, socklen_t *namelen);
  46. #endif /* PIM_SOCK_H */