How to share over ethernet but not over wifi
OS X's firewall is very comprehensive, but it's GUI is limited, it can do what you want, but it's somewhat complex. I would try the following this guide http://www.techrepublic.com/article/configure-apples-built-in-network-firewall-with-icefloor/

For more advanced support you'd probably have more luck asking over on Server Fault (StackExchange) rather than here as it starts getting into the system and networking level stuff rather than OS X specifically.