Nathan Skrzypczak | 8acc5ee | 2021-10-12 14:00:25 +0200 | [diff] [blame] | 1 | .. _libmemif_build_doc: |
| 2 | |
| 3 | Build Instructions |
| 4 | ================== |
| 5 | |
| 6 | Install dependencies |
| 7 | -------------------- |
| 8 | |
| 9 | :: |
| 10 | |
Jakub Grajciar | e74c04f | 2021-01-04 11:28:33 +0100 | [diff] [blame] | 11 | sudo apt-get install -y git cmake autoconf pkg_config libtool |
Nathan Skrzypczak | 8acc5ee | 2021-10-12 14:00:25 +0200 | [diff] [blame] | 12 | |
| 13 | Libmemif is now part of VPP repository. Follow fd.io wiki to pull source |
| 14 | code from VPP repository. |
| 15 | https://wiki.fd.io/view/VPP/Pulling,_Building,_Running,_Hacking_and_Pushing_VPP_Code#Pushing_Patches |
| 16 | |
Jakub Grajciar | e74c04f | 2021-01-04 11:28:33 +0100 | [diff] [blame] | 17 | Libmemif is located under extras/libmemif. From the vpp workspace root directory:: |
Nathan Skrzypczak | 8acc5ee | 2021-10-12 14:00:25 +0200 | [diff] [blame] | 18 | |
Jakub Grajciar | e74c04f | 2021-01-04 11:28:33 +0100 | [diff] [blame] | 19 | mkdir -p extras/libmemif/build |
| 20 | cd extras/libmemif/build |
| 21 | cmake .. |
| 22 | make install |
Nathan Skrzypczak | 8acc5ee | 2021-10-12 14:00:25 +0200 | [diff] [blame] | 23 | |
| 24 | Verify installation: |
| 25 | -------------------- |
| 26 | |
| 27 | :: |
| 28 | |
Jakub Grajciar | e74c04f | 2021-01-04 11:28:33 +0100 | [diff] [blame] | 29 | ./examples/icmp_responder -? |
Nathan Skrzypczak | 8acc5ee | 2021-10-12 14:00:25 +0200 | [diff] [blame] | 30 | |
Jakub Grajciar | e74c04f | 2021-01-04 11:28:33 +0100 | [diff] [blame] | 31 | Use ``-?`` flag to display help:: |
Nathan Skrzypczak | 8acc5ee | 2021-10-12 14:00:25 +0200 | [diff] [blame] | 32 | |
Jakub Grajciar | e74c04f | 2021-01-04 11:28:33 +0100 | [diff] [blame] | 33 | LIBMEMIF EXAMPLE APP: icmp_responder_example |
| 34 | ============================== |
| 35 | libmemif version: 4.0, memif version: 2.0 |
| 36 | ============================== |
| 37 | In this example, memif endpoint connects to an external application. |
| 38 | The example application can resolve ARP and reply to ICMPv4 packets. |
| 39 | The program will exit once the interface is disconnected. |
| 40 | ============================== |
| 41 | Usage: icmp_responder [OPTIONS] |
Nathan Skrzypczak | 8acc5ee | 2021-10-12 14:00:25 +0200 | [diff] [blame] | 42 | |
Jakub Grajciar | e74c04f | 2021-01-04 11:28:33 +0100 | [diff] [blame] | 43 | Options: |
| 44 | -r Interface role <slave|master>. Default: slave |
| 45 | -s Socket path. Supports abstract socket using @ before the path. Default: /run/vpp/memif.sock |
| 46 | -i Interface id. Default: 0 |
| 47 | -a IPv4 address. Default: 192.168.1.1 |
| 48 | -h Mac address. Default: aa:aa:aa:aa:aa:aa |
| 49 | -? Show help and exit. |
| 50 | -v Show libmemif and memif version information and exit. |
Nathan Skrzypczak | 8acc5ee | 2021-10-12 14:00:25 +0200 | [diff] [blame] | 51 | |
Daniel Béreš | 9853342 | 2023-01-19 10:19:27 +0100 | [diff] [blame] | 52 | Running tests: |
| 53 | -------------- |
| 54 | |
| 55 | Tests needs to their proper functioning Unity framework which is depended externally and cloned from official git repository:: |
| 56 | |
| 57 | mkdir -p extras/libmemif/build |
| 58 | cd extras/libmemif/build |
| 59 | cmake .. |
| 60 | make |
| 61 | ctest |
| 62 | |
| 63 | ``ctest`` will execute the tests and print out brief information about test suites with their statuses. |
| 64 | |
| 65 | In case we want verbose: :: |
| 66 | |
| 67 | ctest --verbose |
| 68 | ctest --extra-verbose |
| 69 | |
| 70 | If there are any needs to debug tests, just add to cmake command ``-DCMAKE_BUILD_TYPE=Debug`` flag. |
| 71 | |
Jakub Grajciar | e74c04f | 2021-01-04 11:28:33 +0100 | [diff] [blame] | 72 | Use Cases |
| 73 | --------- |
Nathan Skrzypczak | 8acc5ee | 2021-10-12 14:00:25 +0200 | [diff] [blame] | 74 | |
Jakub Grajciar | e74c04f | 2021-01-04 11:28:33 +0100 | [diff] [blame] | 75 | Once the library is built/installed, refer to :ref:`libmemif_gettingstarted_doc` |
| 76 | and :ref:`libmemif_examples_doc` for additional information on basic use cases |
| 77 | and API usage. |