Recently I've been working on raw ethernet support in embedded system. Mostly for educational purposes and know-how. Using some data found on google i was able to implement ARP support, and separate UDP/TCP transport layer support. Unfortunately, I have a problem with supporting them both (UDP/TCP) at the same time. Basically i cannot recognize incoming frame protocol, therefore cannot decide if send it to UDP or TCP handler. Cannot send it to both without risk of getting malformed data. I expected some bitfield denoting that information, but cannot find it.
I am looking for this information for several days but cannot find any source, propably because i am missunderstanding something.
Can i ask some more experienced IT for help by explaining subject/hinting where to look? I feel like i am in dead end.
Thank You in advance.