corosync
2.4.1
|
#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/swab.h>
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) |
void | totemip_copy (struct totem_ip_address *addr1, const struct totem_ip_address *addr2) |
void | totemip_copy_endian_convert (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_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, int family) |
int | totemip_sockaddr_to_totemip_convert (const struct sockaddr_storage *saddr, struct totem_ip_address *ip_addr) |
int | totemip_getifaddrs (struct list_head *addrs) |
void | totemip_freeifaddrs (struct 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) |
#define LOCALHOST_IPV4 "127.0.0.1" |
Definition at line 57 of file totemip.c.
Referenced by totemip_localhost().
#define LOCALHOST_IPV6 "::1" |
Definition at line 58 of file totemip.c.
Referenced by totemip_localhost().
#define TOTEMIP_IPV4_HEADER_SIZE 20 |
Definition at line 493 of file totemip.c.
Referenced by totemip_udpip_header_size().
#define TOTEMIP_IPV6_HEADER_SIZE 40 |
Definition at line 494 of file totemip.c.
Referenced by totemip_udpip_header_size().
#define TOTEMIP_UDP_HEADER_SIZE 8 |
Definition at line 492 of file totemip.c.
Referenced by totemip_udpip_header_size().
int totemip_compare | ( | const void * | a, |
const void * | b | ||
) |
Definition at line 130 of file totemip.c.
References totem_ip_address::addr, family, and totem_ip_address::family.
Referenced by totemudpu_member_remove(), and totemudpu_member_set_active().
void totemip_copy | ( | struct totem_ip_address * | addr1, |
const struct totem_ip_address * | addr2 | ||
) |
Definition at line 95 of file totemip.c.
Referenced by main_iface_change_fn(), totemip_iface_check(), totemsrp_initialize(), and totemudp_initialize().
void totemip_copy_endian_convert | ( | struct totem_ip_address * | addr1, |
const struct totem_ip_address * | addr2 | ||
) |
Definition at line 101 of file totemip.c.
References totem_ip_address::addr, totem_ip_address::family, totem_ip_address::nodeid, swab16, swab32, and TOTEMIP_ADDRLEN.
int totemip_equal | ( | const struct totem_ip_address * | addr1, |
const struct totem_ip_address * | addr2 | ||
) |
Definition at line 71 of file totemip.c.
References totem_ip_address::addr, and totem_ip_address::family.
Referenced by totem_config_find_local_addr_in_nodelist(), totem_config_validate(), totemip_iface_check(), and totemip_localhost_check().
void totemip_freeifaddrs | ( | struct list_head * | addrs | ) |
Definition at line 389 of file totemip.c.
References totem_ip_if_address::list, list_entry, totem_ip_if_address::name, and list_head::next.
Referenced by totem_config_find_local_addr_in_nodelist(), totemip_getifaddrs(), and totemip_iface_check().
int totemip_getifaddrs | ( | struct list_head * | addrs | ) |
Definition at line 321 of file totemip.c.
References totem_ip_if_address::interface_num, totem_ip_if_address::interface_up, totem_ip_if_address::ip_addr, totem_ip_if_address::list, totem_ip_if_address::mask_addr, totem_ip_if_address::name, totemip_freeifaddrs(), and totemip_sockaddr_to_totemip_convert().
Referenced by totem_config_find_local_addr_in_nodelist(), and 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 405 of file totemip.c.
References totem_ip_address::addr, totem_ip_address::family, totem_ip_if_address::interface_num, totem_ip_if_address::interface_up, totem_ip_if_address::ip_addr, list_entry, totem_ip_if_address::mask_addr, list_head::next, nodeid, totem_ip_address::nodeid, swab32, totemip_copy(), totemip_equal(), totemip_freeifaddrs(), and totemip_getifaddrs().
int32_t totemip_is_mcast | ( | struct totem_ip_address * | ip_addr | ) |
Definition at line 114 of file totemip.c.
References addr, totem_ip_address::addr, and totem_ip_address::family.
Referenced by totem_config_validate().
int totemip_localhost | ( | int | family, |
struct totem_ip_address * | localhost | ||
) |
Definition at line 182 of file totemip.c.
References totem_ip_address::addr, family, totem_ip_address::family, LOCALHOST_IPV4, LOCALHOST_IPV6, and totem_ip_address::nodeid.
Referenced by totemip_localhost_check(), totemudp_initialize(), and totemudpu_initialize().
int totemip_localhost_check | ( | const struct totem_ip_address * | addr | ) |
Definition at line 205 of file totemip.c.
References totem_ip_address::family, totemip_equal(), and totemip_localhost().
int totemip_parse | ( | struct totem_ip_address * | totemip, |
const char * | addr, | ||
int | family | ||
) |
Definition at line 263 of file totemip.c.
References totem_ip_address::addr, family, and totem_ip_address::family.
Referenced by totem_config_find_local_addr_in_nodelist(), and totem_config_read().
const char* totemip_print | ( | const struct totem_ip_address * | addr | ) |
Definition at line 214 of file totemip.c.
References totem_ip_address::addr, and totem_ip_address::family.
Referenced by main_iface_change_fn(), totem_config_read(), totemiba_iface_print(), totempg_ifaces_print(), totemudp_iface_print(), totemudpu_iface_print(), totemudpu_member_add(), totemudpu_member_remove(), and totemudpu_member_set_active().
int totemip_sockaddr_to_totemip_convert | ( | const struct sockaddr_storage * | saddr, |
struct totem_ip_address * | ip_addr | ||
) |
Definition at line 295 of file totemip.c.
References totem_ip_address::addr, totem_ip_address::family, and totem_ip_address::nodeid.
Referenced by totemip_getifaddrs().
int totemip_totemip_to_sockaddr_convert | ( | struct totem_ip_address * | ip_addr, |
uint16_t | port, | ||
struct sockaddr_storage * | saddr, | ||
int * | addrlen | ||
) |
Definition at line 222 of file totemip.c.
References totem_ip_address::addr, and totem_ip_address::family.
Referenced by totemiba_token_target_set().
size_t totemip_udpip_header_size | ( | int | family | ) |
Definition at line 496 of file totemip.c.
References TOTEMIP_IPV4_HEADER_SIZE, TOTEMIP_IPV6_HEADER_SIZE, and TOTEMIP_UDP_HEADER_SIZE.
Referenced by totemudp_net_mtu_adjust(), and totemudpu_net_mtu_adjust().