I need to following using Raspberry Pi using only C program (or C++)
start and stop access point
connect to a particular access point(with username and password)
- disconnect from access point
- stop and start WiFi
If you are looking out for ways to interact with any wpa_supplicant then you can use the control interface exposed by it. wpa_supplicant source itself has two files wpa_ctrl.c and wpa_ctrl.h you can create a library on top of this file, the following link will provide the necessary details on how to use the control interface to interact with wpa_supplicant.
Also wpa_cli itself uses this control interface to talk with wpa_supplicant you can checkout wpa_cli code for reference as well.
WPA Supplicant exposes its API via D-Bus interface typically called
fi.w1.wpa_supplicant1, so you can use that. The advantage of D-Bus is that you can connect to it with debug tools like
dbus-monitor and test the API before you start writing code.
Here are some useful sources: