Skip to content

libpacket Binary toolkit #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0)
project(libpacket C)
cmake_minimum_required(VERSION 3.20)
project(libpacket C CXX)
add_subdirectory(src)

# Install library headers
Expand Down
23 changes: 23 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Using www.github.com/wtfbbqhax/krakatoa
FROM amd64/krakatoa AS libpacket_dev_env

USER root
RUN apk update

VOLUME /volume/libpacket
WORKDIR /volume/libpacket

RUN apk add \
libdaq-dev@local \
libdaq-pcap-module@local \
libdaq-dump-module@local

RUN apk add \
build-base \
cmake \
ninja \
gtest-dev

RUN echo alias vi=nvim > /root/.profile

RUN apk add neovim tmux ctags
42 changes: 38 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,56 @@
.PHONY: build clean install test uninstall
.DEFAULT_GOAL := build

# Makefile rules to build the libpacket source code
.PHONY: build
build:
cmake -B build -G Ninja . \
-D CMAKE_BUILD_TYPE:STRING=Debug \
-D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE
cmake --build build

clean:
rm -rf build/

.PHONY: install
install: build
cmake --install build

.PHONY: clean
clean:
rm -rf build/

.PHONY: test
test: install
make -C tests/

.PHONY: uninstall
uninstall:
rm -f /usr/local/include/packet.h
rm -rf /usr/local/include/packet/
rm -f /usr/local/lib/libpacket.so.*
rm -f /usr/local/lib/libpacket.so

# Makefile rules to build the libpacket development environment.
#
# If you have a working Docker environment, you can use and contribute to this
# code base.
IMAGE_NAME=wtfbbqhax/libpacket
CONTAINER_NAME=wtfbbqhax-libpacket-0

.PHONY: container
container:
docker build . -f Containerfile -t $(IMAGE_NAME)

.PHONY: start
start:
docker run \
--name $(CONTAINER_NAME) \
--rm -td \
-v "$(PWD)":/volume/libpacket \
$(IMAGE_NAME)

.PHONY: kill
kill:
docker kill $(CONTAINER_NAME)

.PHONY: attach
attach:
docker exec -ti $(CONTAINER_NAME) sh

Loading