If you just need it to monitor raw packets, you can use a sniffer. Designing and Implementing a OSI layer is complex task involving too many things which can't be easily discussed in a forum like this. You may get an answer if you have something more specific to ask about.