Normally, the network stack of the mesh network would handle this. Zigbee is an example of a mesh network and it's spec describes three device types:
Source: Wikipedia Zigbee
Zigbee devices are of three kinds:
Zigbee Coordinator (ZC): The most capable device, the Coordinator forms the root of the network tree and might bridge to other networks. There is precisely one zigbee Coordinator in each network since it is the device that started the network originally (the zigbee LightLink specification also allows operation without a zigbee Coordinator, making it more usable for off-the-shelf home products). It stores information about the network, including acting as the Trust Center & repository for security keys.
Zigbee Router (ZR): As well as running an application function, a Router can act as an intermediate router, passing on data from other devices.
Zigbee End Device (ZED): Contains just enough functionality to talk to the parent node (either the Coordinator or a Router); it cannot relay data from other devices. This relationship allows the node to be asleep a significant amount of the time thereby giving long battery life. A ZED requires the least amount of memory, and, therefore, can be less expensive to manufacture than a ZR or ZC.
So, for your situation, you should have several Zigbee End Devices, ten Zigbee routers and a single internet connected Zigbee Coordinator.
The Wikipedia page notes this open source Zigbee implementation: http://zboss.dsr-wireless.com/