Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ jobs:
libboost-system-dev libboost-filesystem-dev libboost-thread-dev \
libevent-dev libtool flex bison pkg-config g++ libssl-dev
bash ./ci/install-thrift.sh
bash ./ci/install-nanomsg.sh
bash ./ci/install-pynng.sh
bash ./ci/install-nng.sh
sudo ldconfig
bash ./ci/install-pynng.sh

- name: Configure CMake
run: |
Expand Down Expand Up @@ -79,9 +79,9 @@ jobs:
libboost-system-dev libboost-filesystem-dev libboost-thread-dev \
libevent-dev libtool flex bison pkg-config g++ libssl-dev
bash ./ci/install-thrift.sh
bash ./ci/install-nanomsg.sh
bash ./ci/install-pynng.sh
bash ./ci/install-nng.sh
sudo ldconfig
bash ./ci/install-pynng.sh

- name: Configure CMake
run: |
Expand Down
22 changes: 15 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Options
option(WITH_NANOMSG "Support generating Nanomsg events" ON)
option(WITH_NNG "Support generating Nanomsg-nng events" ON)
option(WITH_THRIFT "Build Thrift RPC service" ON)
option(WITH_PI "Build PI implementation for bmv2" OFF)
option(WITH_PDFIXED "Build pdfixed for bmv2" OFF)
Expand All @@ -46,7 +46,7 @@ option(WITH_STRESS_TESTS "Include stress tests" OFF)
option(ENABLE_DEBUGGER "Enable bmv2 remote debugger" OFF)
option(ENABLE_COVERAGE "Enable code coverage tracking" OFF)
option(ENABLE_LOGGING_MACROS "Enable compile time debug and trace logging macros" ON)
option(ENABLE_ELOGGER "Enable nanomsg event logger" ON)
option(ENABLE_ELOGGER "Enable nanomsg-nng event logger" ON)
option(ENABLE_MODULES "Allow loading third-party modules at runtime" ON)
option(REQUIRE_MODULES "Require support for loading third-party modules at runtime" OFF)
option(ENABLE_UNDETERMINISTIC_TESTS "Run undeterministic tests (e.g. queueing) when running tests" ON)
Expand Down Expand Up @@ -127,9 +127,17 @@ endforeach()
find_library(GMP_LIBRARY gmp REQUIRED)
find_library(PCAP_LIBRARY pcap REQUIRED)

if(WITH_NANOMSG)
find_library(NANOMSG_LIBRARY nanomsg REQUIRED)
add_definitions(-DNANOMSG_ON)
if(WITH_NNG)
find_library(NNG_LIBRARY NAMES nng)

# Check if the library was found
if(NNG_LIBRARY)
message(STATUS "Found nng: ${NNG_LIBRARY}")
else()
message(FATAL_ERROR "Could not find nng library")
endif()

add_definitions(-DNNG_ON)

if(ENABLE_ELOGGER)
add_definitions(-DELOG_ON)
Expand Down Expand Up @@ -208,7 +216,7 @@ add_subdirectory(third_party)
add_subdirectory(src)
add_subdirectory(include)

if(WITH_THRIFT AND WITH_NANOMSG AND WITH_TARGETS)
if(WITH_THRIFT AND WITH_NNG AND WITH_TARGETS)
add_subdirectory(tests)
endif()

Expand Down Expand Up @@ -236,7 +244,7 @@ message(STATUS "Configuration summary:")
message(STATUS " Version: ${BM_VERSION}")
message(STATUS " Coverage enabled: ${ENABLE_COVERAGE}")
message(STATUS " Logging macros enabled: ${ENABLE_LOGGING_MACROS}")
message(STATUS " With Nanomsg: ${WITH_NANOMSG}")
message(STATUS " With Nanomsg-nng: ${WITH_NNG}")
message(STATUS " Event logger enabled: ${ENABLE_ELOGGER}")
message(STATUS " Debugger enabled: ${ENABLE_DEBUGGER}")
message(STATUS " With Thrift: ${WITH_THRIFT}")
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ sudo dpkg -i /path/to/package.deb
The following options can be specified during the configuration step:

```bash
# Disable Nanomsg support
cmake -DWITH_NANOMSG=OFF ..
# Disable Nanomsg-nng support
cmake -DWITH_NNG=OFF ..

# Disable Thrift support
cmake -DWITH_THRIFT=OFF ..
Expand Down Expand Up @@ -247,7 +247,7 @@ To run the unit tests, simply do:

make check

**If you get a nanomsg error when running the tests (make check), try running
**If you get a nanomsg-nng error when running the tests (make check), try running
them as sudo**

### cmake-based build
Expand Down Expand Up @@ -425,8 +425,8 @@ directory. You can also browse this documentation
32-bit fields) and **variable-length fields are now supported**.
- We finally have unit tests!
- While it is still incomplete, we provide a convenient 'event-logger' built on
top of nanomsg. Every time a 'significant' event happens (e.g. table hit,
parser transition,...) a message is broadcast on a nanomsg channel and any
top of nanomsg-nng. Every time a 'significant' event happens (e.g. table hit,
parser transition,...) a message is broadcast on a nanomsg-nng channel and any
client can consume it.

### Are all features supported yet?
Expand Down
22 changes: 0 additions & 22 deletions ci/install-nanomsg.sh

This file was deleted.

20 changes: 20 additions & 0 deletions ci/install-nng.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /bin/bash

THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source $THIS_DIR/common.sh

check_lib libnng libnng.so.1

exit 0

set -ex
git clone https://github.com/nanomsg/nng
cd nng
git checkout v1.11

mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON ..
make
# Installs into /usr/local by default
sudo make install
12 changes: 6 additions & 6 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Translate some variables for use by config.h
if (WITH_NANOMSG AND ENABLE_ELOGGER)
if (WITH_NNG AND ENABLE_ELOGGER)
set (BM_ELOG_ON 1)
endif()
if (HAVE_DLFCN_H)
Expand All @@ -11,15 +11,15 @@ endif()
if (HAVE_THRIFT_STDCXX_H)
set (BM_HAVE_THRIFT_STDCXX_H 1)
endif()
if (WITH_NANOMSG AND ENABLE_DEBUGGER)
if (WITH_NNG AND ENABLE_DEBUGGER)
set(BM_DEBUG_ON 1)
endif()
if (ENABLE_LOGGING_MACROS)
set(BM_LOG_DEBUG_ON 1)
set(BM_LOG_TRACE_ON 1)
endif()
if (WITH_NANOMSG)
set(BM_NANOMSG_ON 1)
if (WITH_NNG)
set(BM_NNG_ON 1)
endif()
if (WITH_THRIFT)
set(BM_THRIFT_ON 1)
Expand Down Expand Up @@ -74,8 +74,8 @@ if(WITH_THRIFT)
)
endif()

# Install bm_apps headers if nanomsg is enabled
if(WITH_NANOMSG)
# Install bm_apps headers if nanomsg-nng is enabled
if(WITH_NNG)
set(BM_APPS_HEADERS
bm/bm_apps/notifications.h
bm/bm_apps/packet_pipe.h
Expand Down
2 changes: 1 addition & 1 deletion include/bm/bm_sim/dev_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class DevMgr : public PacketDispatcherIface {
// wait before starting to process packets.
void set_dev_mgr_files(unsigned wait_time_in_seconds);

#ifdef BM_NANOMSG_ON
#ifdef BM_NNG_ON
// if enforce ports is set to true, packets coming in on un-registered ports
// are dropped
void set_dev_mgr_packet_in(
Expand Down
2 changes: 1 addition & 1 deletion include/bm/bm_sim/nn.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifndef NN_HPP_INCLUDED
#define NN_HPP_INCLUDED

#include <nanomsg/nn.h>
#include <nng/compat/nanomsg/nn.h>

#include <cassert>
#include <cstring>
Expand Down
2 changes: 1 addition & 1 deletion include/bm/bm_sim/transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TransportIface {
return send_msgs_(msgs);
}

#ifdef BM_NANOMSG_ON
#ifdef BM_NNG_ON
static std::unique_ptr<TransportIface> make_nanomsg(const std::string &addr);
#endif
static std::unique_ptr<TransportIface> make_dummy();
Expand Down
2 changes: 1 addition & 1 deletion include/bm/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
#cmakedefine BM_LOG_TRACE_ON @BM_LOG_TRACE_ON@

/* Enable Nanomsg support */
#cmakedefine BM_NANOMSG_ON @BM_NANOMSG_ON@
#cmakedefine BM_NNG_ON @BM_NNG_ON@

/* Enable Thrift support */
#cmakedefine BM_THRIFT_ON @BM_THRIFT_ON@
Expand Down
2 changes: 1 addition & 1 deletion install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ tmpdir=`mktemp -d -p .`
cd $tmpdir

bash ../ci/install-thrift.sh
bash ../ci/install-nanomsg.sh
bash ../ci/install-nng.sh
sudo ldconfig
bash ../ci/install-pynng.sh

Expand Down
2 changes: 1 addition & 1 deletion install_deps_ubuntu_22.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ apt-get install -qq --no-install-recommends \
libgrpc++-dev \
libgrpc-dev \
libopenmpi-dev \
libnanomsg-dev \
libnng-dev \
libpcap-dev \
libprotobuf-dev \
libprotoc-dev \
Expand Down
2 changes: 1 addition & 1 deletion pdfixed/src/pd_notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <bm/bm_sim/nn.h>
#include <bm/pdfixed/int/pd_notifications.h>

#include <nanomsg/pubsub.h>
#include <nng/compat/nanomsg/pubsub.h>

#include <iostream>
#include <thread>
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(WITH_THRIFT)
add_subdirectory(bm_runtime)
endif()

if(WITH_NANOMSG)
if(WITH_NNG)
add_subdirectory(bm_apps)
endif()

Expand Down Expand Up @@ -38,9 +38,9 @@ install(TARGETS bmall
ARCHIVE DESTINATION lib
)

# Create apps library if nanomsg is enabled
# Create apps library if nanomsg-nng is enabled
# FIXME: do we need bmp4apps?
##if(WITH_NANOMSG)
##if(WITH_NNG)
## add_library(bmp4apps SHARED)
## target_link_libraries(bmp4apps
## PUBLIC
Expand Down
8 changes: 4 additions & 4 deletions src/bm_apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Should only be built if compiling with nanomsg
if(NOT WITH_NANOMSG)
message(SEND_ERROR "bm_apps compilation requires NANOMSG")
# Should only be built if compiling with nanomsg-nng
if(NOT WITH_NNG)
message(SEND_ERROR "bm_apps compilation requires nanomsg-nng")
endif()

add_subdirectory(examples)
Expand All @@ -14,7 +14,7 @@ add_library(bmapps STATIC
# Link libraries
target_link_libraries(bmapps PUBLIC
${CMAKE_THREAD_LIBS_INIT}
${NANOMSG_LIBRARY}
${NNG_LIBRARY}
)

if(WITH_THRIFT)
Expand Down
2 changes: 1 addition & 1 deletion src/bm_apps/learn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace thrift_provider = apache::thrift;
#include <bm/Standard.h>
#include <bm/SimplePre.h>

#include <nanomsg/pubsub.h>
#include <nng/compat/nanomsg/pubsub.h>

#include <iostream>
#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion src/bm_apps/nn.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifndef NN_HPP_INCLUDED
#define NN_HPP_INCLUDED

#include <nanomsg/nn.h>
#include <nng/compat/nanomsg/nn.h>

#include <cassert>
#include <cstring>
Expand Down
2 changes: 1 addition & 1 deletion src/bm_apps/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <bm/bm_apps/notifications.h>

#include <nanomsg/pubsub.h>
#include <nng/compat/nanomsg/pubsub.h>

#include <string>
#include <thread>
Expand Down
2 changes: 1 addition & 1 deletion src/bm_apps/packet_pipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <bm/bm_apps/packet_pipe.h>

#include <nanomsg/pair.h>
#include <nng/compat/nanomsg/pair.h>

#include <string>
#include <thread>
Expand Down
4 changes: 2 additions & 2 deletions src/bm_sim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ target_link_libraries(bmsim PUBLIC
Boost::thread
)

if(WITH_NANOMSG)
target_link_libraries(bmsim PUBLIC ${NANOMSG_LIBRARY})
if(WITH_NNG)
target_link_libraries(bmsim PUBLIC ${NNG_LIBRARY})
endif()
2 changes: 1 addition & 1 deletion src/bm_sim/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// temporary deps?
#include <bm/bm_sim/bytecontainer.h>
#include <bm/bm_sim/logger.h>
#include <nanomsg/reqrep.h>
#include <nng/compat/nanomsg/reqrep.h>

#include <chrono>
#include <memory>
Expand Down
6 changes: 3 additions & 3 deletions src/bm_sim/dev_mgr_packet_in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

#include <bm/config.h>

#ifdef BM_NANOMSG_ON
#ifdef BM_NNG_ON

#include <bm/bm_sim/dev_mgr.h>
#include <bm/bm_sim/logger.h>
#include <bm/bm_sim/nn.h>

#include <nanomsg/pair.h>
#include <nng/compat/nanomsg/pair.h>

#include <atomic>
#include <thread>
Expand Down Expand Up @@ -327,4 +327,4 @@ DevMgr::set_dev_mgr_packet_in(

} // namespace bm

#endif // BM_NANOMSG_ON
#endif // BM_NNG_ON
Loading
Loading