# How to read BGP session information with C



## asadfx (Mar 15, 2011)

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.

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.


----------



## SirDice (Mar 16, 2011)

asadfx said:
			
		

> The program will almost work like a sniffer.


Have a look at pcap(3) and perhaps bpf(4).

As far as I know there are no headers or libraries regarding BGP in the base. But there may be a port that has something like that. Otherwise you'll have to decode everything yourself.


----------

