Projects/1. Router/router.c
int is_router_ip(uint32_t ip) {
	struct sockaddr_in router_ip;
	for(int i = 0; i < ROUTER_NUM_INTERFACES; i++) {
		if(inet_aton(get_interface_ip(i), &router_ip.sin_addr) == 0) {
			fprintf(stderr, "Invalid router IP\n");
			continue;
		}
		if(router_ip.sin_addr.s_addr == ip)
			return i;
	}
	return -1;
}
/* Returns -1, if given IP doesn't belong to router
 * 		   the interface, if ip belongs to router 
 */
1, if given IP doesn't belong to router
the interface, if ip belongs to router
1 if given IP doesn ' t belong to router the interface if ip belongs to router
int is_router_ip(uint32_t ip) {
	struct sockaddr_in router_ip;
	for(int i = 0; i < ROUTER_NUM_INTERFACES; i++) {
		if(inet_aton(get_interface_ip(i), &router_ip.sin_addr) == 0) {
			fprintf(stderr, "Invalid router IP\n");
			continue;
		}
		if(router_ip.sin_addr.s_addr == ip)
			return i;
	}
	return -1;
}
int is_router_ip ( uint32_t ip ) { struct sockaddr_in router_ip ; for ( int i = 0 ; i < ROUTER_NUM_INTERFACES ; i ++ ) { if ( inet_aton ( get_interface_ip ( i ) , & router_ip . sin_addr ) == 0 ) { fprintf ( stderr , " \n " ) ; continue ; } if ( router_ip . sin_addr . s_addr == ip ) return i ; } return -1 ; }
Returns -1, if given IP doesn't belong to router
                 the interface, if ip belongs to router
Returns - 1 if given IP doesn ' t belong to router the interface if ip belongs to router