Network quality-of-service and network security have been considered as separate entities and research in these areas have largely proceeded independently. However, security impacts overall QoS and it is therefore essential to consider both security and QoS together when designing protocols for ad hoc environments as one impacts the other. In this paper we propose a mechanism for a distributed dynamic management system which aims to maximize QoS and/or security while maintaining a minimum user acceptable level of QoS and/or security even as network resource availability change. In order to achieve this objective, we propose three basic frameworks: a policy based plug-in security framework, multi-layer QoS guided routing and a proportional integral derivative (PID) controller. Simulation results indicate the proposed PID optimized security and QoS algorithm produce similar performance as non-secure QoS routing protocols under various traffic loads.