Added mstpcap for MacOS (#705)
* Updated the Makefile for mstpcap to accomodate macOS and to build the bacnet lib. Compiling working version of mstpcap on macOS 14, although compiling should work on many earlier versions. The --extcap-interfaces flag now works for macOS which allows one to use mstpcap as an extcap for Wireshark while listing the available serial ports and baud rates. * note: Had to use uname to figure out if one is on Darwin/macOS vs vanilla BSD. From there, macOS specific supported features and location are used. For instance, the 76800 baud rate is natively supported. * note: MacOS doesn't like placing the mstpcap executable in the global extcap plugin directory as it corrupts the Wireshark executable from an xattr and SIP (System Integrity Protection) perspective and macOS will refuse to run it calling it 'corrupt'. One could turn off xattr stuff, using xattr -cr, but could be risky long term. A safer, permissible workaround is to place the executable in the user .local extcap directory: '/Users/<your_user_name>/.local/lib/wireshark/extcap/'. If the directory doesn't exist just create it and copy the executable there. * note: make the executable from the root or apps folder, as there are defines in the apps folder that are common to all the apps. The mstpcap executable is copied to bacnet-stack/bin/ folder. --------- Co-authored-by: Michael O'Neill <em.pee.oh@gmail.com>
This commit is contained in:
+10
-6
@@ -31,8 +31,6 @@ SRCS = main.c \
|
||||
# This demo seems to be a little unique
|
||||
DEFINES = $(BACNET_DEFINES) -DBACDL_MSTP
|
||||
|
||||
# BACNET_PORT, BACNET_PORT_DIR, BACNET_PORT_SRC are defined in common Makefile
|
||||
# BACNET_SRC_DIR is defined in common apps Makefile
|
||||
# WARNINGS, DEBUGGING, OPTIMIZATION are defined in common apps Makefile
|
||||
# BACNET_DEFINES is defined in common apps Makefile
|
||||
# put all the flags together
|
||||
@@ -43,20 +41,26 @@ LFLAGS := -Wl,$(SYSTEM_LIB)
|
||||
|
||||
# GCC dead code removal
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
ifeq ($(shell uname -s),Darwin)
|
||||
LFLAGS += -Wl,-dead_strip
|
||||
else
|
||||
LFLAGS += -Wl,--gc-sections
|
||||
endif
|
||||
# GCC dead code removal
|
||||
|
||||
# TARGET_EXT defined in common apps Makefile
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${TARGET_BIN}: ${OBJS} Makefile
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
|
||||
+14
-3
@@ -60,11 +60,22 @@
|
||||
#endif
|
||||
|
||||
/* define our Data Link Type for libPCAP */
|
||||
#define DLT_BACNET_MS_TP 165
|
||||
#define DLT_BACNET_MS_TP (165)
|
||||
/* local min/max macros */
|
||||
#ifndef max
|
||||
#define max(a, b) (((a)(b)) ? (a) : (b))
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define max(a,b) \
|
||||
({ \
|
||||
__typeof__ (a) _a = (a); \
|
||||
__typeof__ (b) _b = (b); \
|
||||
_a > _b ? _a : _b; \
|
||||
})
|
||||
|
||||
#define min(a,b) \
|
||||
({ \
|
||||
__typeof__ (a) _a = (a); \
|
||||
__typeof__ (b) _b = (b); \
|
||||
_a < _b ? _a : _b; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define MSTP_HEADER_MAX (2 + 1 + 1 + 1 + 2 + 1)
|
||||
|
||||
Reference in New Issue
Block a user