libbgp  0.6
A C++ BGP Library.

libbgp is a BGP (Border Gateway Protocol) library written in C++. It comes with BGP message serializer/deserializer and a BGP Finite State Machine which has all the infrastructures needed (BGP RIB, Packet Sink, Route filtering) to build a BGP speaker.

BgpPacket (document) is a BGP message deserialization/serialization tool.

BgpFsm (document) is a finite state machine that handles a single BGP session. Multiple BgpFsms can be created to handle multiple sessions with different peers. BGP FSM will uses RouteEventBus to communicate with other FSMs. BgpFsm holds no information about the underlying transport protocol (for BGP, the standard is to use TCP), and it is only an FSM that take streams of binary data and output, a stream of binary data.

For simple usage and quick start, refer to examples. For detailed API usages, refer to document.


libbgp uses autotools for build automation. In general, you need the following build dependencies:

If you use a Debian based operating system, you should be able to install these with the following apt command:

# apt install g++ make autoconf autoconf-archive automake m4 libtool doxygen

Once you have the dependencies installed, use the following commands to build libbgp:

$ ./ && ./configure && make
# make install


libbgp document is available online at You may also build the document by running doxygen command under the project root directory. (where the Doxyfile is located) You will find the document under docs/ folder.


Examples are available under the examples/ directory. You may build example programs with the following command after installing libbgp:

$ c++ -lbgp -o name_of_example