# Routes override
#
# This is the simple interface to the db/routes file.  The function that
# interprets the value returned is routes_spec, provided there because it
# is of general use.

require routesdb crossbar
provide routes

routes_neighbour (domain, address, A) {
	local tmp

	# We have Alternate default-lookup for cases of locally generated
	# ERROR MESSAGES -- for case where the dot (.) leads to error!
	# and we want to reply with DIFFERENT address, thus:  '.:ERROR' key.

	$(iserrormsg) &&
		tmp=$(routesdb "$domain" -: '.:ERROR') &&
			tmp=$(routes_spec "$tmp" "$address" $A) &&
				returns $tmp

	tmp="$(get $A type)"
	tmp=$(routesdb "$domain" -: ".:$tmp" -: '.') &&
		tmp=$(routes_spec "$tmp" "$address" $A) &&
			returns $tmp

#| The routes_spec function interprets the return value from the
#| routesdb lookup.

	return 1
}

