AFIM: A trusted routing algorithm based on fuzzy logic for mobile ad hoc networks