TODO: - rework comments and function headers(also coding style) - support soft-ap and p2p mode - support resume/suspend function