From 05c37baad3ec03e99582470e881b6361d2807db9 Mon Sep 17 00:00:00 2001
From: phil <me@filou.se>
Date: Fri, 16 Apr 2021 09:37:15 +0200
Subject: [PATCH] utility refactoring and include fix

---
 src/include/aes67/rtsp.h                      | 66 +++++++++++++++++++
 src/include/aes67/utils/mdns.h                |  2 +-
 .../aes67/utils/{rtsp.h => rtsp-dsc.h}        |  8 +--
 src/utils/rtsp-describe/CMakeLists.txt        |  4 +-
 src/utils/rtsp-describe/rtsp-describe.c       |  2 +-
 src/utils/{rtsp.c => rtsp-dsc.c}              |  2 +-
 src/utils/sapd/CMakeLists.txt                 |  4 +-
 src/utils/sapd/sapd.c                         |  1 +
 8 files changed, 77 insertions(+), 12 deletions(-)
 create mode 100644 src/include/aes67/rtsp.h
 rename src/include/aes67/utils/{rtsp.h => rtsp-dsc.h} (95%)
 rename src/utils/{rtsp.c => rtsp-dsc.c} (99%)

diff --git a/src/include/aes67/rtsp.h b/src/include/aes67/rtsp.h
new file mode 100644
index 0000000..7c5149b
--- /dev/null
+++ b/src/include/aes67/rtsp.h
@@ -0,0 +1,66 @@
+/**
+ * @file rtsp.h
+ * Real-Time Session Protocol utilities
+ *
+ * References:
+ * Real Time Streaming Protocol (RTSP) https://tools.ietf.org/html/rfc2326
+ * Real-Time Streaming Protocol Version 2.0 https://tools.ietf.org/html/rfc7826
+ */
+
+/**
+ * AES67 Framework
+ * Copyright (C) 2021  Philip Tschiemer, https://github.com/tschiemer/aes67
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AES67_RTSP_H
+#define AES67_RTSP_H
+
+#include "aes67/arch.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define AES67_RTSP_DEFAULT_PORT     554
+#define AES67_RTSP_SCHEME           "rtsp"
+
+#define AES67_RTSP_STATUS_OK        200
+
+//struct aes67_rtsp {
+//    u32_t cseq;
+//
+//    u16_t buflen;
+//    u8_t * buf;
+//};
+//
+//enum aes67_rtsp_rx_status {
+//    aes67_rtsp_rx_status_pending,
+//    aes67_rtsp_rx_status_server
+//};
+//
+//void aes67_rtsp_init(struct aes67_rtsp * rtsp);
+//void aes67_rtsp_deinit(struct aes67_rtsp * rtsp);
+//
+//void aes67_rtsp_received(struct aes67_rtsp * rtsp, u8_t * buf, u16_t len);
+//
+//s32_t aes67_rtsp_describe(struct aes67_rtsp * rtsp, u8_t * buf, u16_t maxlen);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //AES67_RTSP_H
diff --git a/src/include/aes67/utils/mdns.h b/src/include/aes67/utils/mdns.h
index a0fdaa2..ac7cfe2 100644
--- a/src/include/aes67/utils/mdns.h
+++ b/src/include/aes67/utils/mdns.h
@@ -25,7 +25,7 @@
 #define AES67_UTILS_MDNS_H
 
 #include "aes67/arch.h"
-#include "rtsp.h"
+#include "aes67/net.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/src/include/aes67/utils/rtsp.h b/src/include/aes67/utils/rtsp-dsc.h
similarity index 95%
rename from src/include/aes67/utils/rtsp.h
rename to src/include/aes67/utils/rtsp-dsc.h
index 6188a0e..26a3dcf 100644
--- a/src/include/aes67/utils/rtsp.h
+++ b/src/include/aes67/utils/rtsp-dsc.h
@@ -27,18 +27,16 @@
 #ifndef AES67_UTILS_RTSP_H
 #define AES67_UTILS_RTSP_H
 
-#include <stdbool.h>
 #include "aes67/arch.h"
 #include "aes67/net.h"
+#include "aes67/rtsp.h"
+
+#include <stdbool.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#define AES67_RTSP_DEFAULT_PORT     554
-#define AES67_RTSP_SCHEME           "rtsp"
-
-#define AES67_RTSP_STATUS_OK        200
 
 #define AES67_RTSP_BUFSIZE          1500
     
diff --git a/src/utils/rtsp-describe/CMakeLists.txt b/src/utils/rtsp-describe/CMakeLists.txt
index 314ac97..81f46f7 100644
--- a/src/utils/rtsp-describe/CMakeLists.txt
+++ b/src/utils/rtsp-describe/CMakeLists.txt
@@ -7,8 +7,8 @@ project(rtsp-describe)
 add_executable(rtsp-describe
         rtsp-describe.c
         aes67opts.h
-        ${AES67_DIR}/src/include/aes67/utils/rtsp.h
-        ${AES67_DIR}/src/utils/rtsp.c
+        ${AES67_DIR}/src/include/aes67/utils/rtsp-dsc.h
+        ${AES67_DIR}/src/utils/rtsp-dsc.c
         ${AES67_INCLUDES}
         ${AES67_SOURCE_FILES}
         )
diff --git a/src/utils/rtsp-describe/rtsp-describe.c b/src/utils/rtsp-describe/rtsp-describe.c
index af11dd5..06cdc53 100644
--- a/src/utils/rtsp-describe/rtsp-describe.c
+++ b/src/utils/rtsp-describe/rtsp-describe.c
@@ -16,7 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "aes67/utils/rtsp.h"
+#include "aes67/utils/rtsp-dsc.h"
 
 #include <getopt.h>
 #include <stdio.h>
diff --git a/src/utils/rtsp.c b/src/utils/rtsp-dsc.c
similarity index 99%
rename from src/utils/rtsp.c
rename to src/utils/rtsp-dsc.c
index 0c8219d..ecac35d 100644
--- a/src/utils/rtsp.c
+++ b/src/utils/rtsp-dsc.c
@@ -16,7 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "aes67/utils/rtsp.h"
+#include "aes67/utils/rtsp-dsc.h"
 
 //#include "aes67/debug.h"
 
diff --git a/src/utils/sapd/CMakeLists.txt b/src/utils/sapd/CMakeLists.txt
index 51cdea3..327e3d5 100644
--- a/src/utils/sapd/CMakeLists.txt
+++ b/src/utils/sapd/CMakeLists.txt
@@ -17,8 +17,8 @@ if (${SAPD_WITH_RAV})
     set(RAV_SOURCE_FILES
             ${AES67_DIR}/src/include/aes67/utils/mdns.h
             ${AES67_MDNS_SOURCE_FILES}
-            ${AES67_DIR}/src/include/aes67/utils/rtsp.h
-            ${AES67_DIR}/src/utils/rtsp.c
+            ${AES67_DIR}/src/include/aes67/utils/rtsp-dsc.h
+            ${AES67_DIR}/src/utils/rtsp-dsc.c
             ${AES67_DIR}/src/third_party/dnmfarrell/URI-Encode-C/src/uri_encode.h
             ${AES67_DIR}/src/third_party/dnmfarrell/URI-Encode-C/src/uri_encode.c
     )
diff --git a/src/utils/sapd/sapd.c b/src/utils/sapd/sapd.c
index a845283..f6aa430 100644
--- a/src/utils/sapd/sapd.c
+++ b/src/utils/sapd/sapd.c
@@ -24,6 +24,7 @@
 
 #if AES67_SAPD_WITH_RAV == 1
 #include "aes67/utils/mdns.h"
+#include "aes67/utils/rtsp-dsc.h"
 #include "aes67/rav.h"
 #include "dnmfarrell/URI-Encode-C/src/uri_encode.h"
 #endif
-- 
GitLab