I'm trying to find a way to pause hostapd from transmitting (or receiving) data without stopping it. It could be by any method - c program, shell, python and any linux command. I tried searching in the configurations, hostapd_cli and all over the net without answer. the important thing is the ability to pause and resume transmission without stopping hostapd. thank you.
iptables
You could use iptables to block outbound traffic on the interface that hostapd is using, that way the hostapd service stays online but traffic won't be able to get through.
e.g. if your default policy is to ACCEPT, then you could add the following rule to an existing ruleset to block all outbound traffic on the wlan0
interface:
iptables -A OUTPUT -i wlan0 -j DROP
If you also wanted to block all inbound traffic on that same interface you could also add this rule:
iptables -A INPUT -i wlan0 -j DROP
The rules would then need to be removed afterward (when you want to "un-pause"), either by flushing the entire ruleset with iptables -F
or loading in new rules with, say, iptables-restore
loading in a file that contains the rest of your existing rules.
Alternative approach
I'm not sure why you want to "pause" hostapd in the first place, I could guess that maybe you're having trouble with service hostapd restart
being unreliable? If that is the case, then maybe you'd be interested in my experience with making hostapd more reliable.