I suggest you to go through this tutorial. I guess your use case is a mix between switch and AP examples.