NSD: fix build when feature is disabled

Added ifdef guards to avoid compiling disabled modules.