I don't think there is specific code for the former. There also is no deliberate code that keeps barbarians out of specific areas (I wish I had this already because it might be helpful in some cases), but the DLL somewhat controls when barbarians can start entering foreign borders in general.