FreeCalypso > hg > themwi-rtp-mgr
changeset 0:9e7e9ba22e42
starting project with public header files
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 27 May 2024 09:10:27 +0000 |
parents | |
children | 560a3765ab30 |
files | .hgignore build-inc/themwi/rtp configure include/Makefile include/pstn_defs.h include/rtp_alloc.h include/rtp_defs.h |
diffstat | 7 files changed, 164 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Mon May 27 09:10:27 2024 +0000 @@ -0,0 +1,4 @@ +syntax: regexp + +\.[oa]$ +^config\.defs$
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build-inc/themwi/rtp Mon May 27 09:10:27 2024 +0000 @@ -0,0 +1,1 @@ +../../include \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/configure Mon May 27 09:10:27 2024 +0000 @@ -0,0 +1,88 @@ +#!/bin/sh +# This configure script is custom and hand-coded; +# it is NOT a product of GNU Autoconf or any other such tools! + +set -e + +if [ ! -f configure ] +then + echo "This script needs to be run from the top of the source tree" 1>&2 + exit 1 +fi + +# defaults that can be overridden +CC=gcc +CFLAGS=-O2 +prefix=/usr/local +exec_prefix= +bindir= +includedir= +libdir= + +while [ $# != 0 ] +do + case "$1" in + --prefix=*) + prefix=`echo $1 | cut -c 10-` + ;; + --exec-prefix=*) + exec_prefix=`echo $1 | cut -c 15-` + ;; + --bindir=*) + bindir=`echo $1 | cut -c 10-` + ;; + --includedir=*) + includedir=`echo $1 | cut -c 14-` + ;; + --libdir=*) + libdir=`echo $1 | cut -c 10-` + ;; + CC=*) + CC=`echo $1 | cut -c 4-` + ;; + CFLAGS=*) + CFLAGS=`echo $1 | cut -c 8-` + ;; + *) + echo "error: non-understood option $1" 1>&2 + exit 1; + ;; + esac + shift +done + +# inheritance rules for install directories + +if [ -z "$exec_prefix" ] +then + exec_prefix="$prefix" +fi +if [ -z "$bindir" ] +then + bindir="$exec_prefix/bin" +fi +if [ -z "$includedir" ] +then + includedir="$prefix/include" +fi +if [ -z "$libdir" ] +then + libdir="$exec_prefix/lib" +fi + +# report the final configuration + +echo "C code will be compiled with:" +echo " CC=$CC" +echo " CFLAGS=$CFLAGS" +echo "Installation directories:" +echo " bindir=$bindir" +echo " includedir=$includedir" +echo " libdir=$libdir" + +# emit the Makefile include fragment +echo "CC=$CC" > config.defs +echo "CFLAGS=$CFLAGS" >> config.defs +echo "bindir=$bindir" >> config.defs +echo "includedir=$includedir" >> config.defs +echo "libdir=$libdir" >> config.defs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/Makefile Mon May 27 09:10:27 2024 +0000 @@ -0,0 +1,13 @@ +FILES= pstn_defs.h rtp_alloc.h rtp_defs.h + +include ../config.defs + +INSTDIR=${DESTDIR}${includedir}/themwi/rtp + +all: + +install: + mkdir -p ${INSTDIR} + install -c -m 644 ${FILES} ${INSTDIR} + +clean:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/pstn_defs.h Mon May 27 09:10:27 2024 +0000 @@ -0,0 +1,8 @@ +/* misc PSTN definitions */ + +#pragma once + +#define PSTN_CODEC_PCMU 0 +#define PSTN_CODEC_PCMA 8 + +#define FRAME_20MS 160 /* samples per RTP packet */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/rtp_alloc.h Mon May 27 09:10:27 2024 +0000 @@ -0,0 +1,31 @@ +/* + * This header file defines the ad hoc control interface + * to themwi-rtp-mgr over a dedicated local socket. + */ + +#pragma once + +struct rtp_alloc_req { + uint32_t transact_ref; + uint32_t ep_type; +}; + +#define RTP_ALLOC_DO_GSM1 1 +#define RTP_ALLOC_DO_PSTN 2 +#define RTP_ALLOC_DO_GSM2 4 + +#define RTP_ALLOC_TYPE_GSM RTP_ALLOC_DO_GSM1 +#define RTP_ALLOC_TYPE_PSTN RTP_ALLOC_DO_PSTN +#define RTP_ALLOC_TYPE_GSM2PSTN (RTP_ALLOC_DO_GSM1 | RTP_ALLOC_DO_PSTN) +#define RTP_ALLOC_TYPE_GSM2GSM (RTP_ALLOC_DO_GSM1 | RTP_ALLOC_DO_GSM2) + +struct rtp_alloc_resp { + uint32_t transact_ref; + uint32_t res; + struct sockaddr_storage gsm_addr; + struct sockaddr_storage pstn_addr; /* also used for 2nd GSM */ +}; + +#define RTP_ALLOC_OK 0 +#define RTP_ALLOC_ERR_PARAM 1 +#define RTP_ALLOC_ERR_RSRC 2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/rtp_defs.h Mon May 27 09:10:27 2024 +0000 @@ -0,0 +1,19 @@ +/* + * This header file holds some definitions for RTP, as this protocol + * functions in our GSM and PSTN environment. + */ + +#pragma once + +#define RTP_PACKET_HDR_SIZE 12 +#define RTP_PACKET_SIZE_PSTN 172 +#define RTP_MAX_PAYLOAD 160 + +struct rtp_packet { + uint8_t v_p_x_cc; + uint8_t m_pt; + uint16_t seq; + uint32_t tstamp; + uint32_t ssrc; + uint8_t payload[RTP_MAX_PAYLOAD]; +};