under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
You should have received a copy of the GNU Lesser General Public
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
You should have received a copy of the GNU Lesser General Public
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
memset(gen, 0, sizeof(struct rtgenmsg));
gen->rtgen_family = AF_UNSPEC;
memset(gen, 0, sizeof(struct rtgenmsg));
gen->rtgen_family = AF_UNSPEC;
-static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdata) {
- AvahiInterfaceMonitor *m = userdata;
+static void netlink_callback(CattaNetlink *nl, struct nlmsghdr *n, void* userdata) {
+ CattaInterfaceMonitor *m = userdata;
/* A new interface appeared or an existing one has been modified */
struct ifinfomsg *ifinfomsg = NLMSG_DATA(n);
/* A new interface appeared or an existing one has been modified */
struct ifinfomsg *ifinfomsg = NLMSG_DATA(n);
* for this link, so that we can update its data. Note that
* Netlink sends us an RTM_NEWLINK not only when a new
* interface appears, but when it changes, too */
* for this link, so that we can update its data. Note that
* Netlink sends us an RTM_NEWLINK not only when a new
* interface appears, but when it changes, too */
/* Update any associated RRs of this interface. (i.e. the
* _workstation._tcp record containing the MAC address) */
/* Update any associated RRs of this interface. (i.e. the
* _workstation._tcp record containing the MAC address) */
} else if (n->nlmsg_type == RTM_DELLINK) {
/* An interface has been removed */
struct ifinfomsg *ifinfomsg = NLMSG_DATA(n);
} else if (n->nlmsg_type == RTM_DELLINK) {
/* An interface has been removed */
struct ifinfomsg *ifinfomsg = NLMSG_DATA(n);
- /* Get a reference to our AvahiHwInterface object of this interface */
- if (!(hw = avahi_interface_monitor_get_hw_interface(m, (AvahiIfIndex) ifinfomsg->ifi_index)))
+ /* Get a reference to our CattaHwInterface object of this interface */
+ if (!(hw = catta_interface_monitor_get_hw_interface(m, (CattaIfIndex) ifinfomsg->ifi_index)))
} else if (n->nlmsg_type == RTM_NEWADDR || n->nlmsg_type == RTM_DELADDR) {
/* An address has been added, modified or removed */
struct ifaddrmsg *ifaddrmsg = NLMSG_DATA(n);
} else if (n->nlmsg_type == RTM_NEWADDR || n->nlmsg_type == RTM_DELADDR) {
/* An address has been added, modified or removed */
struct ifaddrmsg *ifaddrmsg = NLMSG_DATA(n);
int raddr_valid = 0, rlocal_valid = 0;
/* We are only interested in IPv4 and IPv6 */
if (ifaddrmsg->ifa_family != AF_INET && ifaddrmsg->ifa_family != AF_INET6)
return;
int raddr_valid = 0, rlocal_valid = 0;
/* We are only interested in IPv4 and IPv6 */
if (ifaddrmsg->ifa_family != AF_INET && ifaddrmsg->ifa_family != AF_INET6)
return;
* interface this address is assigned to. If ther is no object
* for this interface, we ignore this address. */
* interface this address is assigned to. If ther is no object
* for this interface, we ignore this address. */
- if (!(i = avahi_interface_monitor_get_interface(m, (AvahiIfIndex) ifaddrmsg->ifa_index, avahi_af_to_proto(ifaddrmsg->ifa_family))))
+ if (!(i = catta_interface_monitor_get_interface(m, (CattaIfIndex) ifaddrmsg->ifa_index, catta_af_to_proto(ifaddrmsg->ifa_family))))
- if ((rlocal.proto == AVAHI_PROTO_INET6 && RTA_PAYLOAD(a) != 16) ||
- (rlocal.proto == AVAHI_PROTO_INET && RTA_PAYLOAD(a) != 4))
+ if ((rlocal.proto == CATTA_PROTO_INET6 && RTA_PAYLOAD(a) != 16) ||
+ (rlocal.proto == CATTA_PROTO_INET && RTA_PAYLOAD(a) != 4))
- if ((raddr.proto == AVAHI_PROTO_INET6 && RTA_PAYLOAD(a) != 16) ||
- (raddr.proto == AVAHI_PROTO_INET && RTA_PAYLOAD(a) != 4))
+ if ((raddr.proto == CATTA_PROTO_INET6 && RTA_PAYLOAD(a) != 16) ||
+ (raddr.proto == CATTA_PROTO_INET && RTA_PAYLOAD(a) != 4))
- if (!(addr = avahi_interface_address_new(m, i, r, ifaddrmsg->ifa_prefixlen)))
+ if (!(addr = catta_interface_address_new(m, i, r, ifaddrmsg->ifa_prefixlen)))
return; /* OOM */
/* Update the scope field for the address */
addr->global_scope = ifaddrmsg->ifa_scope == RT_SCOPE_UNIVERSE || ifaddrmsg->ifa_scope == RT_SCOPE_SITE;
addr->deprecated = !!(ifaddrmsg->ifa_flags & IFA_F_DEPRECATED);
} else {
return; /* OOM */
/* Update the scope field for the address */
addr->global_scope = ifaddrmsg->ifa_scope == RT_SCOPE_UNIVERSE || ifaddrmsg->ifa_scope == RT_SCOPE_SITE;
addr->deprecated = !!(ifaddrmsg->ifa_flags & IFA_F_DEPRECATED);
} else {
- /* Try to get a reference to our AvahiInterfaceAddress object for this address */
- if (!(addr = avahi_interface_monitor_get_address(m, i, r)))
+ /* Try to get a reference to our CattaInterfaceAddress object for this address */
+ if (!(addr = catta_interface_monitor_get_address(m, i, r)))
* attached relevant. Since we migh have added or removed an
* address, let's have it check again whether the interface is
* now relevant */
* attached relevant. Since we migh have added or removed an
* address, let's have it check again whether the interface is
* now relevant */
* let's go on with wild dumping the addresses */
if (netlink_list_items(m->osdep.netlink, RTM_GETADDR, &m->osdep.query_addr_seq) < 0) {
* let's go on with wild dumping the addresses */
if (netlink_list_items(m->osdep.netlink, RTM_GETADDR, &m->osdep.query_addr_seq) < 0) {
* will start to announce or browse on all interfaces. It
* is originaly set to 0, which means that relevancy
* checks and RR updates are disabled during the wild
* will start to announce or browse on all interfaces. It
* is originaly set to 0, which means that relevancy
* checks and RR updates are disabled during the wild
* makes netlink easier to use. It will attach to the main loop
* for us and call netlink_callback() whenever an event
* happens. */
* makes netlink easier to use. It will attach to the main loop
* for us and call netlink_callback() whenever an event
* happens. */
- if (!(m->osdep.netlink = avahi_netlink_new(m->server->poll_api, RTMGRP_LINK|RTMGRP_IPV4_IFADDR|RTMGRP_IPV6_IFADDR, netlink_callback, m)))
+ if (!(m->osdep.netlink = catta_netlink_new(m->server->poll_api, RTMGRP_LINK|RTMGRP_IPV4_IFADDR|RTMGRP_IPV6_IFADDR, netlink_callback, m)))