Is there a way to control the amount of data sent-recd on wireless adhoc connection?

I'll elaborate the purpose, the project was just born out of a thought experiment:
If I'm browsing the internet over a Mobile Broadband connection & if a friend asks me to create a adhoc connection so that he can share it, I would like to control the amount of data that he requests on aggregate - say I want to allow him only 10mb of surfing just like the isp gives me only some specific amount of data per month.

Is there a way to do such a thing? Are there libraries in c/java etc that allow one to do such tasks?

Thanks