On-the-fly Traffic Classification and Control with a Stateful SDN approach