From a6c41fbaeb2aac9bf2f7125af48e13a5e9211aa8 Mon Sep 17 00:00:00 2001 From: Tiago Medicci Serrano Date: Fri, 24 Feb 2023 12:14:22 -0300 Subject: [PATCH] apps/netutils: Add RTP tools --- netutils/rtptools/.gitignore | 2 + netutils/rtptools/Kconfig | 131 +++++++++++++++++++++++++++++++++++ netutils/rtptools/Make.defs | 27 ++++++++ netutils/rtptools/Makefile | 116 +++++++++++++++++++++++++++++++ netutils/rtptools/config.h | 37 ++++++++++ 5 files changed, 313 insertions(+) create mode 100644 netutils/rtptools/.gitignore create mode 100644 netutils/rtptools/Kconfig create mode 100644 netutils/rtptools/Make.defs create mode 100644 netutils/rtptools/Makefile create mode 100644 netutils/rtptools/config.h diff --git a/netutils/rtptools/.gitignore b/netutils/rtptools/.gitignore new file mode 100644 index 000000000..b86e52048 --- /dev/null +++ b/netutils/rtptools/.gitignore @@ -0,0 +1,2 @@ +/rtptools +/*.tar.gz diff --git a/netutils/rtptools/Kconfig b/netutils/rtptools/Kconfig new file mode 100644 index 000000000..a753ef67a --- /dev/null +++ b/netutils/rtptools/Kconfig @@ -0,0 +1,131 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config NETUTILS_RTPTOOLS + bool "Enable RTP Tools" + default n + ---help--- + RTP Tools is a set of small applications + that can be used for processing RTP data. + +if NETUTILS_RTPTOOLS + +config NETUTILS_RTPTOOLS_VERSION + string "RTP Tools version" + default "9356740cb0c264577e0f9505e682e53a1e0996d5" + +menuconfig RTPTOOLS_APPS + tristate "RTP Tools Applications" + default y + ---help--- + Enable RTP Tools Applications + +if RTPTOOLS_APPS + +config NETUTILS_RTPTOOLS_DEFAULT_TASK_STACKSIZE + int "RTP Tools apps default stack size" + default 12288 + +config NETUTILS_RTPTOOLS_RTPPLAY + bool "Enable rtpplay" + default n + ---help--- + Play back RTP sessions recorded by rtpdump. + +if NETUTILS_RTPTOOLS_RTPPLAY + +config NETUTILS_RTPTOOLS_RTPPLAY_PROGNAME + string "Program name" + default "rtpplay" + ---help--- + This is the name of the program that will be used. + +config NETUTILS_RTPTOOLS_RTPPLAY_PRIORITY + int "rtpplay task priority" + default 100 + +config NETUTILS_RTPTOOLS_RTPPLAY_STACKSIZE + int "rtpplay stack size" + default NETUTILS_RTPTOOLS_DEFAULT_TASK_STACKSIZE + +endif # NETUTILS_RTPTOOLS_RTPPLAY + +config NETUTILS_RTPTOOLS_RTPSEND + bool "Enable rtpsend" + default n + ---help--- + Generate RTP packets from textual description, + generated by hand or rtpdump. + +if NETUTILS_RTPTOOLS_RTPSEND + +config NETUTILS_RTPTOOLS_RTPSEND_PROGNAME + string "Program name" + default "rtpsend" + ---help--- + This is the name of the program that will be used. + +config NETUTILS_RTPTOOLS_RTPSEND_PRIORITY + int "rtpsend task priority" + default 100 + +config NETUTILS_RTPTOOLS_RTPSEND_STACKSIZE + int "rtpsend stack size" + default NETUTILS_RTPTOOLS_DEFAULT_TASK_STACKSIZE + +endif # NETUTILS_RTPTOOLS_RTPSEND + +config NETUTILS_RTPTOOLS_RTPDUMP + bool "Enable rtpdump" + default y + ---help--- + Parse and print RTP packets, generating output + files suitable for rtpplay and rtpsend. + +if NETUTILS_RTPTOOLS_RTPDUMP + +config NETUTILS_RTPTOOLS_RTPDUMP_PROGNAME + string "Program name" + default "rtpdump" + ---help--- + This is the name of the program that will be used. + +config NETUTILS_RTPTOOLS_RTPDUMP_PRIORITY + int "rtpdump task priority" + default 100 + +config NETUTILS_RTPTOOLS_RTPDUMP_STACKSIZE + int "rtpdump stack size" + default NETUTILS_RTPTOOLS_DEFAULT_TASK_STACKSIZE + +endif # NETUTILS_RTPTOOLS_RTPDUMP + +config NETUTILS_RTPTOOLS_RTPTRANS + bool "Enable rtptrans" + default n + ---help--- + RTP translator between unicast and multicast networks. + +if NETUTILS_RTPTOOLS_RTPTRANS + +config NETUTILS_RTPTOOLS_RTPTRANS_PROGNAME + string "Program name" + default "rtptrans" + ---help--- + This is the name of the program that will be used. + +config NETUTILS_RTPTOOLS_RTPTRANS_PRIORITY + int "rtptrans task priority" + default 100 + +config NETUTILS_RTPTOOLS_RTPTRANS_STACKSIZE + int "rtptrans stack size" + default NETUTILS_RTPTOOLS_DEFAULT_TASK_STACKSIZE + +endif # NETUTILS_RTPTOOLS_RTPTRANS + +endif # RTPTOOLS_APPS + +endif # NETUTILS_RTPTOOLS diff --git a/netutils/rtptools/Make.defs b/netutils/rtptools/Make.defs new file mode 100644 index 000000000..0c4cf3840 --- /dev/null +++ b/netutils/rtptools/Make.defs @@ -0,0 +1,27 @@ +############################################################################ +# apps/netutils/rtptools/Make.defs +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +ifneq ($(CONFIG_NETUTILS_RTPTOOLS),) +CONFIGURED_APPS += $(APPDIR)/netutils/rtptools + +CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/netutils/rtptools/rtptools/include +CXXFLAGS += ${INCDIR_PREFIX}$(APPDIR)/netutils/rtptools/rtptools/include + +endif diff --git a/netutils/rtptools/Makefile b/netutils/rtptools/Makefile new file mode 100644 index 000000000..4f3b36bc5 --- /dev/null +++ b/netutils/rtptools/Makefile @@ -0,0 +1,116 @@ +############################################################################ +# apps/netutils/rtptools/Makefile +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +include $(APPDIR)/Make.defs + +RTPTOOLS_VERSION := $(patsubst "%",%,$(CONFIG_NETUTILS_RTPTOOLS_VERSION)) +RTPTOOLS_TARBALL = $(RTPTOOLS_VERSION).tar.gz +RTPTOOLS_UNPACK = rtptools +RTPTOOLS_SRCDIR = $(RTPTOOLS_UNPACK) + +DEPPATH += --dep-path $(RTPTOOLS_SRCDIR) +VPATH += :$(RTPTOOLS_SRCDIR) + +CFLAGS += -Wno-maybe-uninitialized -Wno-strict-prototypes +CFLAGS += -Wno-unused-function -Wno-format -Wno-shadow + +CSRCS += multimer.c +CSRCS += notify.c +CSRCS += payload.c +CSRCS += rd.c +CSRCS += utils.c + +ifeq ($(CONFIG_ENDIAN_BIG),y) +RTP_BIG_ENDIAN = 1 +else +RTP_BIG_ENDIAN = 0 +endif + +ifneq ($(CONFIG_RTPTOOLS_APPS),) + +MODULE = $(CONFIG_RTPTOOLS_APPS) + +ifeq ($(CONFIG_NETUTILS_RTPTOOLS_RTPPLAY),y) + +PROGNAME += $(CONFIG_NETUTILS_RTPTOOLS_RTPPLAY_PROGNAME) +PRIORITY += $(CONFIG_NETUTILS_RTPTOOLS_RTPPLAY_PRIORITY) +STACKSIZE += $(CONFIG_NETUTILS_RTPTOOLS_RTPPLAY_STACKSIZE) + +MAINSRC += $(RTPTOOLS_UNPACK)/rtpplay.c +endif + +ifeq ($(CONFIG_NETUTILS_RTPTOOLS_RTPSEND),y) + +PROGNAME += $(CONFIG_NETUTILS_RTPTOOLS_RTPSEND_PROGNAME) +PRIORITY += $(CONFIG_NETUTILS_RTPTOOLS_RTPSEND_PRIORITY) +STACKSIZE += $(CONFIG_NETUTILS_RTPTOOLS_RTPSEND_STACKSIZE) + +MAINSRC += $(RTPTOOLS_UNPACK)/rtpsend.c +endif + +ifeq ($(CONFIG_NETUTILS_RTPTOOLS_RTPDUMP),y) + +PROGNAME += $(CONFIG_NETUTILS_RTPTOOLS_RTPDUMP_PROGNAME) +PRIORITY += $(CONFIG_NETUTILS_RTPTOOLS_RTPDUMP_PRIORITY) +STACKSIZE += $(CONFIG_NETUTILS_RTPTOOLS_RTPDUMP_STACKSIZE) + +MAINSRC += $(RTPTOOLS_UNPACK)/rtpdump.c +endif + +ifeq ($(CONFIG_NETUTILS_RTPTOOLS_RTPTRANS),y) + +PROGNAME += $(CONFIG_NETUTILS_RTPTOOLS_RTPTRANS_PROGNAME) +PRIORITY += $(CONFIG_NETUTILS_RTPTOOLS_RTPTRANS_PRIORITY) +STACKSIZE += $(CONFIG_NETUTILS_RTPTOOLS_RTPTRANS_STACKSIZE) + +MAINSRC += $(RTPTOOLS_UNPACK)/rtptrans.c +endif + +endif + +# Download and unpack tarball if no git repo found +ifeq ($(wildcard $(RTPTOOLS_UNPACK)/.git),) +$(RTPTOOLS_UNPACK)$(DELIM)config.h: $(RTPTOOLS_UNPACK) + $(Q) cp config.h $@ +else +$(RTPTOOLS_UNPACK)$(DELIM)config.h: + $(Q) cp config.h $@ +endif + +$(RTPTOOLS_TARBALL): + @echo "Downloading: $(RTPTOOLS_TARBALL)" + $(Q) curl -O -L https://github.com/irtlab/rtptools/archive/$(RTPTOOLS_TARBALL) + +$(RTPTOOLS_UNPACK): $(RTPTOOLS_TARBALL) + $(Q) echo "Unpacking: $(RTPTOOLS_TARBALL) -> $(RTPTOOLS_UNPACK)" + $(Q) tar zxf $(RTPTOOLS_TARBALL) + $(Q) mv $(RTPTOOLS_UNPACK)-$(RTPTOOLS_VERSION) $(RTPTOOLS_UNPACK) + $(Q) touch $(RTPTOOLS_UNPACK) + +context:: $(RTPTOOLS_UNPACK)$(DELIM)config.h + +# Download and unpack tarball if no git repo found +ifeq ($(wildcard $(RTPTOOLS_UNPACK)/.git),) +distclean:: + $(call DELFILE, $(RTPTOOLS_TARBALL)) + $(call DELDIR, $(RTPTOOLS_UNPACK)) +endif + +include $(APPDIR)/Application.mk diff --git a/netutils/rtptools/config.h b/netutils/rtptools/config.h new file mode 100644 index 000000000..dd077ee99 --- /dev/null +++ b/netutils/rtptools/config.h @@ -0,0 +1,37 @@ +/**************************************************************************** + * apps/netutils/rtptools/config.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifdef CONFIG_ENDIAN_BIG +#define RTP_BIG_ENDIAN 1 +#else +#define RTP_BIG_ENDIAN 0 +#endif + +#define HAVE_MSGCONTROL 1