aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-08-14 09:24:11 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-08-14 09:24:11 +0200
commita611da8407a609a3a426c61e7fb10230a9320122 (patch)
tree87cf97d021a84432e1baa382f1b6cf655e89d068 /openbsc/include
parent0eaad4f216637804458eacf31b0a1b10cff19e7b (diff)
mgcp: Move the SDP handling into a separate file/module
The SDP file handling will get more complicated in terms of codec selection so let's remove it from the protocol handling before we start blowing it up in size.
Diffstat (limited to 'openbsc/include')
-rw-r--r--openbsc/include/openbsc/mgcp_internal.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/mgcp_internal.h b/openbsc/include/openbsc/mgcp_internal.h
index 570d96395..763d83b0d 100644
--- a/openbsc/include/openbsc/mgcp_internal.h
+++ b/openbsc/include/openbsc/mgcp_internal.h
@@ -22,6 +22,8 @@
#pragma once
+#include <string.h>
+
#include <osmocom/core/select.h>
#define CI_UNUSED 0
@@ -203,8 +205,51 @@ struct mgcp_endpoint {
} osmux;
};
+#define for_each_line(line, save) \
+ for (line = strline_r(NULL, &save); line;\
+ line = strline_r(NULL, &save))
+
+static inline char *strline_r(char *str, char **saveptr)
+{
+ char *result;
+
+ if (str)
+ *saveptr = str;
+
+ result = *saveptr;
+
+ if (*saveptr != NULL) {
+ *saveptr = strpbrk(*saveptr, "\r\n");
+
+ if (*saveptr != NULL) {
+ char *eos = *saveptr;
+
+ if ((*saveptr)[0] == '\r' && (*saveptr)[1] == '\n')
+ (*saveptr)++;
+ (*saveptr)++;
+ if ((*saveptr)[0] == '\0')
+ *saveptr = NULL;
+
+ *eos = '\0';
+ }
+ }
+
+ return result;
+}
+
+
+
#define ENDPOINT_NUMBER(endp) abs((int)(endp - endp->tcfg->endpoints))
+/**
+ * Internal structure while parsing a request
+ */
+struct mgcp_parse_data {
+ struct mgcp_config *cfg;
+ struct mgcp_endpoint *endp;
+ char *trans;
+ char *save;
+ int found;
};
int mgcp_send_dummy(struct mgcp_endpoint *endp);
@@ -257,5 +302,21 @@ enum {
MGCP_DEST_BTS,
};
+
#define MGCP_DUMMY_LOAD 0x23
+
+/**
+ * SDP related information
+ */
+/* Assume audio frame length of 20ms */
+#define DEFAULT_RTP_AUDIO_FRAME_DUR_NUM 20
+#define DEFAULT_RTP_AUDIO_FRAME_DUR_DEN 1000
+#define DEFAULT_RTP_AUDIO_PACKET_DURATION_MS 20
+#define DEFAULT_RTP_AUDIO_DEFAULT_RATE 8000
+#define DEFAULT_RTP_AUDIO_DEFAULT_CHANNELS 1
+
+#define PTYPE_UNDEFINED (-1)
+int mgcp_parse_sdp_data(struct mgcp_rtp_end *rtp, struct mgcp_parse_data *p);
+int mgcp_set_audio_info(void *ctx, struct mgcp_rtp_codec *codec,
+ int payload_type, const char *audio_name);