totemip.c File Reference
`#include <config.h>`
`#include <sys/ioctl.h>`
`#include <sys/types.h>`
`#include <sys/socket.h>`
`#include <netinet/in.h>`
`#include <arpa/inet.h>`
`#include <netdb.h>`
`#include <net/if.h>`
`#include <string.h>`
`#include <stdio.h>`
`#include <errno.h>`
`#include <assert.h>`
`#include <stdlib.h>`
`#include <unistd.h>`
`#include <ifaddrs.h>`
`#include <corosync/totem/totemip.h>`
`#include <corosync/logsys.h>`
`#include <corosync/swab.h>`
Include dependency graph for totemip.c:

Go to the source code of this file.

## Macros

#define | LOCALHOST_IPV4 "127.0.0.1"
#define | LOCALHOST_IPV6 "::1"
#define | NETLINK_BUFSIZE 16384
#define | TOTEMIP_UDP_HEADER_SIZE 8
#define | TOTEMIP_IPV4_HEADER_SIZE 20
#define | TOTEMIP_IPV6_HEADER_SIZE 40

## Functions

int | totemip_equal (const struct totem_ip_address *addr1, const struct totem_ip_address *addr2)
int | totemip_sa_equal (const struct totem_ip_address *totem_ip, const struct sockaddr *sa)
void | totemip_copy (struct totem_ip_address *addr1, const struct totem_ip_address *addr2)
int32_t | totemip_is_mcast (struct totem_ip_address *ip_addr)
int | totemip_compare (const void *a, const void *b)
int | totemip_localhost (int family, struct totem_ip_address *localhost)
int | totemip_localhost_check (const struct totem_ip_address *addr)
const char * | totemip_sa_print (const struct sockaddr *sa)
const char * | totemip_print (const struct totem_ip_address *addr)
int | totemip_totemip_to_sockaddr_convert (struct totem_ip_address *ip_addr, uint16_t port, struct sockaddr_storage *saddr, int *addrlen)
int | totemip_parse (struct totem_ip_address *totemip, const char *addr, enum totem_ip_version_enum ip_version)
int | totemip_sockaddr_to_totemip_convert (const struct sockaddr_storage *saddr, struct totem_ip_address *ip_addr)
int | totemip_getifaddrs (struct qb_list_head *addrs)
void | totemip_freeifaddrs (struct qb_list_head *addrs)
int | totemip_iface_check (struct totem_ip_address *bindnet, struct totem_ip_address *boundto, int *interface_up, int *interface_num, int mask_high_bit)
size_t | totemip_udpip_header_size (int family)

## Macro Definition Documentation

## LOCALHOST_IPV4

#define LOCALHOST_IPV4 "127.0.0.1"

Definition at line 58 of file totemip.c.

## LOCALHOST_IPV6

#define LOCALHOST_IPV6 "::1"

Definition at line 59 of file totemip.c.

## NETLINK_BUFSIZE

#define NETLINK_BUFSIZE 16384

Definition at line 61 of file totemip.c.

## TOTEMIP_IPV4_HEADER_SIZE

#define TOTEMIP_IPV4_HEADER_SIZE 20

Definition at line 605 of file totemip.c.

## TOTEMIP_IPV6_HEADER_SIZE

#define TOTEMIP_IPV6_HEADER_SIZE 40

Definition at line 606 of file totemip.c.

## TOTEMIP_UDP_HEADER_SIZE

#define TOTEMIP_UDP_HEADER_SIZE 8

Definition at line 604 of file totemip.c.

## Function Documentation

## totemip_compare()

int totemip_compare | ( | const void * | a,
|  | const void * | b
| ) |  |

Definition at line 150 of file totemip.c.

References family, and nodeid.

Referenced by totemudp_member_remove(), and totemudpu_member_remove().

## totemip_copy()

void totemip_copy | ( | struct totem_ip_address * | addr1,
|  | const struct totem_ip_address * | addr2
| ) |  |

Definition at line 123 of file totemip.c.

References nodeid.

Referenced by main_iface_change_fn(), totemip_iface_check(), totemknet_iface_set(), totemknet_initialize(), totemsrp_iface_set(), totemsrp_initialize(), and totemudp_initialize().

## totemip_equal()

int totemip_equal | ( | const struct totem_ip_address * | addr1,
|  | const struct totem_ip_address * | addr2
| ) |  |

Definition at line 72 of file totemip.c.

References nodeid.

Referenced by totemip_iface_check(), and totemip_localhost_check().

## totemip_freeifaddrs()

void totemip_freeifaddrs | ( | struct qb_list_head * | addrs | ) |

Definition at line 514 of file totemip.c.

References nodeid.

Referenced by totemip_getifaddrs(), and totemip_iface_check().

## totemip_getifaddrs()

int totemip_getifaddrs | ( | struct qb_list_head * | addrs | ) |

Definition at line 446 of file totemip.c.

References nodeid, totemip_freeifaddrs(), and totemip_sockaddr_to_totemip_convert().

Referenced by totemip_iface_check().

## totemip_iface_check()

int totemip_iface_check | ( | struct totem_ip_address * | bindnet,
|  | struct totem_ip_address * | boundto,
|  | int * | interface_up,
|  | int * | interface_num,
|  | int | mask_high_bit
| ) |  |

Definition at line 529 of file totemip.c.

References totem_ip_address::family, nodeid, totem_ip_address::nodeid, totemip_copy(), totemip_equal(), totemip_freeifaddrs(), and totemip_getifaddrs().

## totemip_is_mcast()

int32_t totemip_is_mcast | ( | struct totem_ip_address * | ip_addr | ) |

Definition at line 134 of file totemip.c.

References addr, totem_ip_address::addr, totem_ip_address::family, and nodeid.

Referenced by totem_config_validate().

## totemip_localhost()

int totemip_localhost | ( | int | family,
|  | struct totem_ip_address * | localhost
| ) |  |

Definition at line 202 of file totemip.c.

References totem_ip_address::addr, family, totem_ip_address::family, LOCALHOST_IPV4, LOCALHOST_IPV6, nodeid, and totem_ip_address::nodeid.

Referenced by totemip_localhost_check(), and totemudp_initialize().

## totemip_localhost_check()

int totemip_localhost_check | ( | const struct totem_ip_address * | addr | ) |

Definition at line 225 of file totemip.c.

References addr, totemip_equal(), and totemip_localhost().

## totemip_parse()

int totemip_parse | ( | struct totem_ip_address * | totemip,
|  | const char * | addr,
|  | enum totem_ip_version_enum | ip_version
| ) |  |

Definition at line 306 of file totemip.c.

References addr, log_printf, LOGSYS_LEVEL_DEBUG, nodeid, TOTEM_IP_VERSION_4, TOTEM_IP_VERSION_4_6, TOTEM_IP_VERSION_6, TOTEM_IP_VERSION_6_4, and totemip_print().

Referenced by totem_config_read().

## totemip_print()

const char * totemip_print | ( | const struct totem_ip_address * | addr | ) |

Definition at line 256 of file totemip.c.

References addr, and nodeid.

Referenced by totem_config_read(), totem_volatile_config_validate(), totemip_parse(), totemknet_iface_set(), totemknet_member_add(), totempg_ifaces_print(), totemudp_nodestatus_get(), totemudpu_member_add(), totemudpu_member_remove(), and totemudpu_nodestatus_get().

## totemip_sa_equal()

int totemip_sa_equal | ( | const struct totem_ip_address * | totem_ip,
|  | const struct sockaddr * | sa
| ) |  |

Definition at line 95 of file totemip.c.

References nodeid.

## totemip_sa_print()

const char * totemip_sa_print | ( | const struct sockaddr * | sa | ) |

Definition at line 234 of file totemip.c.

References nodeid.

Referenced by main_deliver_fn().

## totemip_sockaddr_to_totemip_convert()

int totemip_sockaddr_to_totemip_convert | ( | const struct sockaddr_storage * | saddr,
|  | struct totem_ip_address * | ip_addr
| ) |  |

Definition at line 420 of file totemip.c.

References totem_ip_address::addr, totem_ip_address::family, nodeid, and totem_ip_address::nodeid.

Referenced by totemip_getifaddrs().

## totemip_totemip_to_sockaddr_convert()

int totemip_totemip_to_sockaddr_convert | ( | struct totem_ip_address * | ip_addr,
|  | uint16_t | port,
|  | struct sockaddr_storage * | saddr,
|  | int * | addrlen
| ) |  |

Definition at line 264 of file totemip.c.

References totem_ip_address::addr, totem_ip_address::family, and nodeid.

Referenced by totemknet_member_add().

## totemip_udpip_header_size()

size_t totemip_udpip_header_size | ( | int | family | ) |

Definition at line 608 of file totemip.c.

References family, nodeid, TOTEMIP_IPV4_HEADER_SIZE, TOTEMIP_IPV6_HEADER_SIZE, and TOTEMIP_UDP_HEADER_SIZE.

Referenced by totemudp_net_mtu_adjust(), and totemudpu_net_mtu_adjust().