Communitating with XBee module


I am new with Arduino and XBee and I am trying to develop 6lowpan and the ipv6 stack for Arduino, using XBee for the 802.15.4 layer.

The problem I found is that the Arduino library for XBee ( uses its own protocol to send and receive data, which adds a START BYTE, the LENGTH, etc. as an extra header, which is not compatible for communicating with a device that implements 802.15.4, 6LoWPAN, ipv6, etc. but does not use an XBee module (a TMote Sky with Contiki, for example).

I saw the code and I can avoid sending that extra header but the problem will be when reading a message, as the XBee will be receiving something but it does not know its length. The question is: - Can I get the size of the 802.15.4 received frame in some way? (in the case that I do not receive the extra header added by the Arduino-XBee library) - If not, do you think that it is possible to read the data (byte by byte) directly from the serial port until it is empty? The problem I see would be to receive two messages faster than the time it takes to read the complete serial buffer.. do you think that this is feasible?

Thank you very much.