service-management: use virtual functions

This PR contains a refactored version of service-management.{c,h}.