Skip to content

Commit 9289320

Browse files
committed
add stomp 1.2 subprotocol
1 parent a7c84cc commit 9289320

File tree

1,045 files changed

+105614
-102333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,045 files changed

+105614
-102333
lines changed

Makefile.am

Lines changed: 84 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,39 @@ LDADD_COMMON = $(ssl_LIBS) $(crypto_LIBS) $(pthread_LIBS) -lpthread -lz
88

99
COMMON = src/cwebsocket/utf8.h src/cwebsocket/utf8.c src/cwebsocket/common.h src/cwebsocket/common.c
1010
ECHO_CLIENT = src/cwebsocket/subprotocol/echo/echo_client.h src/cwebsocket/subprotocol/echo/echo_client.c
11+
STOMP_CLIENT = src/cwebsocket/subprotocol/stomp/stomp_client.h src/cwebsocket/subprotocol/stomp/stomp_client.c
1112
WEBSOCKET_CLIENT = src/cwebsocket/client.h src/cwebsocket/client.c
1213

13-
bin_PROGRAMS = websocket-client websocket-testsuite
14+
bin_PROGRAMS = websocket-client websocket-testsuite stomp-client stomp-compliance-test
1415
websocket_client_SOURCES = $(ECHO_CLIENT) $(COMMON) $(WEBSOCKET_CLIENT) src/websocket-client.c
1516
websocket_client_LDADD = $(LDADD_COMMON)
1617
websocket_testsuite_SOURCES = $(COMMON) $(WEBSOCKET_CLIENT) src/websocket-testsuite.c
1718
websocket_testsuite_LDADD = $(LDADD_COMMON)
19+
stomp_client_SOURCES = $(STOMP_CLIENT) $(COMMON) $(WEBSOCKET_CLIENT) src/stomp-client.c
20+
stomp_client_LDADD = $(LDADD_COMMON)
21+
stomp_compliance_test_SOURCES = $(STOMP_CLIENT) $(COMMON) $(WEBSOCKET_CLIENT) test/stomp/stomp-compliance-test.c
22+
stomp_compliance_test_LDADD = $(LDADD_COMMON)
1823

1924
noinst_PROGRAMS = tests-unit
2025
tests_unit_SOURCES = $(COMMON) $(WEBSOCKET_CLIENT) src/tests-unit.c
2126
tests_unit_CPPFLAGS = -DUNIT_TESTING $(AM_CPPFLAGS)
2227
tests_unit_LDADD = $(LDADD_COMMON)
2328

2429
noinst_LIBRARIES = libwsclient.a
25-
libwsclient_a_SOURCES = $(ECHO_CLIENT) $(COMMON) $(WEBSOCKET_CLIENT)
30+
libwsclient_a_SOURCES = $(ECHO_CLIENT) $(STOMP_CLIENT) $(COMMON) $(WEBSOCKET_CLIENT)
2631

2732
so:
2833
gcc -shared -fPIC $(ECHO_CLIENT) $(WEBSOCKET_CLIENT) -o libwsclient.so
2934

3035
# Files to remove with 'make clean' (build outputs, object files, etc.)
3136
CLEANFILES = \
3237
libwsclient.so \
33-
*.o src/*.o src/cwebsocket/*.o src/cwebsocket/subprotocol/echo/*.o \
38+
*.o src/*.o src/cwebsocket/*.o src/cwebsocket/subprotocol/echo/*.o src/cwebsocket/subprotocol/stomp/*.o \
3439
*~ src/*~ src/cwebsocket/*~ \
3540
vgcore.* \
3641
*.log integration*.log test*.log testsuite.log autoscan.log \
3742
*.gcda *.gcno src/*.gcda src/*.gcno src/cwebsocket/*.gcda src/cwebsocket/*.gcno \
38-
valgrind-report.txt memcheck-report.txt helgrind-report.txt \
43+
valgrind-report.txt valgrind-echo-test.txt memcheck-report.txt helgrind-report.txt \
3944
cppcheck-report.txt clang-analyze-report.txt flawfinder-report.txt
4045

4146
# Files to remove with 'make distclean' (generated by configure)
@@ -52,40 +57,37 @@ MAINTAINERCLEANFILES = \
5257
configure configure~ \
5358
depcomp install-sh missing ltmain.sh
5459

55-
# Additional cleanup hook to remove directories and test reports
60+
# Complete cleanup - removes ALL generated files
5661
clean-local:
5762
@echo "Removing build artifacts and dependency files..."
58-
rm -rf src/.deps src/.dirstamp
59-
rm -rf src/cwebsocket/.deps src/cwebsocket/.dirstamp
60-
rm -rf src/cwebsocket/subprotocol/echo/.deps src/cwebsocket/subprotocol/echo/.dirstamp
61-
rm -rf .deps/
63+
find . -type d -name ".deps" -exec rm -rf {} + 2>/dev/null || true
64+
find . -type f -name ".dirstamp" -delete 2>/dev/null || true
65+
find . -type f -name "*.Po" -delete 2>/dev/null || true
6266
rm -rf Debug/ "RPI Debug" Release/
67+
rm -rf .libs/
6368
@echo "Removing test reports..."
6469
rm -rf test/autobahn/reports/clients/*
6570
@echo "Removing QA reports..."
6671
rm -rf analysis-reports/
67-
@echo "Clean complete"
68-
69-
# Full clean for git commit - removes ALL generated files including autotools
70-
maintainer-clean-local:
71-
@echo "Removing all generated files for clean git repository..."
72+
@echo "Removing autotools generated files..."
7273
rm -rf autom4te.cache/
7374
rm -rf m4/
7475
rm -f aclocal.m4
7576
rm -f compile config.guess config.sub
7677
rm -f configure configure~
7778
rm -f config.h.in config.h.in~
7879
rm -f depcomp install-sh missing ltmain.sh
79-
@echo "Maintainer clean complete - run ./autogen.sh to regenerate"
80-
81-
# Remove generated autotools files with 'make distclean'
82-
distclean-local:
83-
rm -rf autom4te.cache/
84-
rm -rf m4/
80+
@echo "Removing configure-generated files..."
81+
rm -f config.h config.log config.status
82+
rm -f libtool stamp-h1
83+
rm -f Makefile.in Makefile
84+
@echo "Clean complete - run ./autogen.sh && ./configure to rebuild"
8585

8686
.PHONY: autobahn-up autobahn-down autobahn-test-client autobahn-clean \
8787
docker-build docker-shell test integration-test inside-unit inside-integration docker-network \
8888
autobahn autobahn-local \
89+
stomp-test stomp-test-clean \
90+
build-stomp-client build-websocket-client build-websocket-testsuite build-all \
8991
valgrind valgrind-full memcheck memcheck-full helgrind \
9092
static-analysis cppcheck clang-analyze scan-build \
9193
security-scan flawfinder security \
@@ -105,6 +107,33 @@ autobahn-test-client: integration-test
105107
autobahn-clean:
106108
@rm -rf test/autobahn/reports/clients/*
107109

110+
# Force rebuild targets (workaround for automake-generated binaries)
111+
build-stomp-client:
112+
@rm -f stomp-client
113+
@$(MAKE) stomp-client
114+
115+
build-websocket-client:
116+
@rm -f websocket-client
117+
@$(MAKE) websocket-client
118+
119+
build-websocket-testsuite:
120+
@rm -f websocket-testsuite
121+
@$(MAKE) websocket-testsuite
122+
123+
build-all:
124+
@rm -f stomp-client websocket-client websocket-testsuite
125+
@$(MAKE) all
126+
127+
# STOMP Integration Test
128+
stomp-test: build-stomp-client
129+
@echo "Running STOMP integration test..."
130+
@./test/stomp/test-stomp.sh
131+
132+
stomp-test-clean:
133+
@echo "Cleaning up STOMP test environment..."
134+
@docker rm -f stomp-broker 2>/dev/null || true
135+
@docker network rm stomp-test 2>/dev/null || true
136+
108137
# Dockerized workflow (no host installs required)
109138
IMAGE_NAME = cwebsocket/test:latest
110139
REPORTS_WAIT_SECS ?= 900
@@ -177,25 +206,47 @@ inside-integration:
177206
# Valgrind - Memory Testing
178207
# ============================================================================
179208

180-
valgrind: tests-unit
181-
@echo "Running Valgrind memory check (basic)..."
209+
valgrind: tests-unit websocket-client
210+
@echo "Running Valgrind memory check (basic) - Unit tests..."
182211
@valgrind --leak-check=yes \
183212
--error-exitcode=1 \
213+
--errors-for-leak-kinds=definite \
184214
--track-origins=yes \
185-
--show-leak-kinds=definite,possible \
215+
--show-leak-kinds=definite \
186216
./tests-unit
217+
@echo ""
218+
@echo "Running Valgrind memory check (basic) - WebSocket echo test..."
219+
@timeout 10 bash -c 'echo "Hello Valgrind!" | valgrind --leak-check=yes \
220+
--error-exitcode=1 \
221+
--errors-for-leak-kinds=definite \
222+
--track-origins=yes \
223+
--show-leak-kinds=definite \
224+
./websocket-client wss://echo.websocket.org' || \
225+
(echo "WebSocket echo test completed or timed out (expected)")
187226

188-
valgrind-full: tests-unit
189-
@echo "Running Valgrind memory check (comprehensive)..."
227+
valgrind-full: tests-unit websocket-client
228+
@echo "Running Valgrind memory check (comprehensive) - Unit tests..."
190229
@valgrind --leak-check=full \
191230
--show-leak-kinds=all \
192231
--track-origins=yes \
193232
--verbose \
194233
--error-exitcode=1 \
195234
--log-file=valgrind-report.txt \
196235
./tests-unit
197-
@echo "Report saved to: valgrind-report.txt"
236+
@echo "Unit test report saved to: valgrind-report.txt"
198237
@grep -E "ERROR SUMMARY|definitely lost|indirectly lost|possibly lost" valgrind-report.txt || true
238+
@echo ""
239+
@echo "Running Valgrind memory check (comprehensive) - WebSocket echo test..."
240+
@timeout 10 bash -c 'echo "Hello Valgrind!" | valgrind --leak-check=full \
241+
--show-leak-kinds=all \
242+
--track-origins=yes \
243+
--verbose \
244+
--error-exitcode=1 \
245+
--log-file=valgrind-echo-test.txt \
246+
./websocket-client wss://echo.websocket.org' || \
247+
(echo "WebSocket echo test completed or timed out (expected)")
248+
@echo "WebSocket echo test report saved to: valgrind-echo-test.txt"
249+
@grep -E "ERROR SUMMARY|definitely lost|indirectly lost|possibly lost" valgrind-echo-test.txt || true
199250

200251
memcheck: tests-unit
201252
@echo "Running Valgrind memcheck..."
@@ -331,13 +382,16 @@ docker-valgrind: docker-build
331382
@docker run --rm -v $(PWD):/host $(IMAGE_NAME) bash -c "\
332383
cd /app && \
333384
valgrind --leak-check=full \
334-
--show-leak-kinds=all \
385+
--show-leak-kinds=definite \
386+
--errors-for-leak-kinds=definite \
335387
--track-origins=yes \
336388
--error-exitcode=1 \
337-
--log-file=/host/valgrind-report.txt \
338-
./tests-unit"
389+
./tests-unit 2>&1 | tee /host/valgrind-report.txt"
390+
@echo ""
339391
@echo "✓ Valgrind report saved to: valgrind-report.txt"
340-
@grep -E "ERROR SUMMARY|definitely lost|indirectly lost|possibly lost" valgrind-report.txt || true
392+
@echo ""
393+
@echo "Summary:"
394+
@grep -E "ERROR SUMMARY|definitely lost" valgrind-report.txt || true
341395

342396
docker-memcheck: docker-build
343397
@echo "Running Valgrind memcheck (in Docker)..."

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ cwebsocket is compliant with the following standards:
2121

2222
### Build
2323

24-
By defaults, cwebsocket is built with multi-threading and SSL support.
24+
cwebsocket is built with multi-threading and SSL support by default.
2525

2626
To build, run:
2727

0 commit comments

Comments
 (0)