How to read BGP session information with C

Friends,

I want to read BGP session information with C ( in FreeBSD ). The program will almost work like a sniffer. My FreeBSD box (which is not a BGP speaker) will look at BGP session information (after catching and parsing it) and take a decision based on the information it sees. :wall:

So,does anyone know how to catch and parse BGP session information using Unix C? Any suggestions? any tutorial? library (i.e. *.h files)?

Bye.

You can use libpcap for this purpose. For an example of how to do it, look at the sources of tcpdump.