From 6f725d6da3b488558e78d4ba8dacfecde196f07f Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Fri, 24 Mar 2017 18:03:17 +0100 Subject: gsm0808: Add utils for Speech Codec List and Speech Codec The planned support for true A over IP requires the encoding and decoding of a so called "Speech Codec Element" element. This commt adds parsing functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I0e1e2edf47adaa45b22d4b0bcae3640dba7ca200 --- include/osmocom/gsm/gsm0808_utils.h | 19 +++++++++++++++++++ include/osmocom/gsm/protocol/gsm_08_08.h | 22 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) (limited to 'include/osmocom') diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 5fc1c880..b5ddbdb7 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -21,6 +21,8 @@ #include +#include + /* Encode AoIP transport address element */ uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, const struct sockaddr_storage *ss); @@ -28,3 +30,20 @@ uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, /* Decode AoIP transport address element */ int gsm0808_dec_aoip_trasp_addr(struct sockaddr_storage *ss, const uint8_t *elem, uint8_t len); + +/* Encode Speech Codec element */ +uint8_t gsm0808_enc_speech_codec(struct msgb *msg, + const struct gsm0808_speech_codec *sc); + +/* Decode Speech Codec element */ +int gsm0808_dec_speech_codec(struct gsm0808_speech_codec *sc, + const uint8_t *elem, uint8_t len); + +/* Encode Speech Codec list */ +uint8_t gsm0808_enc_speech_codec_list(struct msgb *msg, + const struct gsm0808_speech_codec_list + *scl); + +/* Decode Speech Codec list */ +int gsm0808_dec_speech_codec_list(struct gsm0808_speech_codec_list *scl, + const uint8_t *elem, uint8_t len); diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h index 6fb4e9e8..3e5514dc 100644 --- a/include/osmocom/gsm/protocol/gsm_08_08.h +++ b/include/osmocom/gsm/protocol/gsm_08_08.h @@ -3,6 +3,9 @@ #pragma once #include +#include +#include +#include /* * this is from GSM 03.03 CGI but is copied in GSM 08.08 @@ -416,3 +419,22 @@ enum gsm0808_paging_info { GSM0808_PAGINF_FOR_SMS = 0x01, GSM0808_PAGINF_FOR_USSD = 0x02, }; + +/* 3GPP TS 48.008 3.2.2.104 Speech Codec */ +struct gsm0808_speech_codec { + bool fi; + bool pi; + bool pt; + bool tf; + uint8_t type; + uint16_t cfg; + bool type_extended; + bool cfg_present; +}; + +/* 3GPP TS 48.008 3.2.2.103 Speech Codec List */ +#define SPEECH_CODEC_MAXLEN 255 +struct gsm0808_speech_codec_list { + struct gsm0808_speech_codec codec[SPEECH_CODEC_MAXLEN]; + uint8_t len; +}; -- cgit v1.2.3