Nathan Skrzypczak | cbb4e46 | 2021-10-13 12:40:42 +0200 | [diff] [blame] | 1 | .. _cppvpp: |
| 2 | |
| 3 | ============== |
| 4 | C++ api client |
| 5 | ============== |
| 6 | |
| 7 | This describes how to write a C++ api client connecting to VPP's binary API. |
| 8 | |
| 9 | Connecting to VPP is done with : |
| 10 | |
| 11 | :: |
| 12 | |
| 13 | auto err = con.connect("example_client", nullptr, 32, 32); |
| 14 | |
| 15 | |
| 16 | You can specify the path to the api socket/shared memory you want to connect to |
| 17 | with the second parameter (set to ``nullptr``, meaning default) |
| 18 | |
| 19 | .. literalinclude:: ./api_example/api_example.cc |
| 20 | :language: cpp |
| 21 | |
| 22 | To build this you could use the following makefile |
| 23 | |
| 24 | .. literalinclude:: ./api_example/Makefile |
| 25 | :language: makefile |
| 26 | |