summaryrefslogtreecommitdiffstats
path: root/tinyRTP/include
diff options
context:
space:
mode:
authorbossiel <bossiel@yahoo.fr>2011-08-10 22:59:15 +0000
committerbossiel <bossiel@yahoo.fr>2011-08-10 22:59:15 +0000
commit1ebf5a5fcda0c9154e22ed02404fd46525a7fd9f (patch)
tree4b6214a7142ab1035cb0e47444e88af38e712421 /tinyRTP/include
downloaddoubango-1.0.zip
doubango-1.0.tar.gz
Move deprecated v1.0 from trunk to branches1.0
Diffstat (limited to 'tinyRTP/include')
-rw-r--r--tinyRTP/include/tinyrtp.h43
-rw-r--r--tinyRTP/include/tinyrtp/rtcp/trtp_rtcp_session.h38
-rw-r--r--tinyRTP/include/tinyrtp/rtp/trtp_rtp_header.h80
-rw-r--r--tinyRTP/include/tinyrtp/rtp/trtp_rtp_packet.h70
-rw-r--r--tinyRTP/include/tinyrtp/rtp/trtp_rtp_session.h38
-rw-r--r--tinyRTP/include/tinyrtp/trtp.h38
-rw-r--r--tinyRTP/include/tinyrtp/trtp_manager.h106
-rw-r--r--tinyRTP/include/tinyrtp_config.h84
8 files changed, 497 insertions, 0 deletions
diff --git a/tinyRTP/include/tinyrtp.h b/tinyRTP/include/tinyrtp.h
new file mode 100644
index 0000000..4a64340
--- /dev/null
+++ b/tinyRTP/include/tinyrtp.h
@@ -0,0 +1,43 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+
+/**@file tinyrtp.h
+ * @brief tinyRTP (Real-time Transport Protocol) API.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYRTP_TINYRTP_H
+#define TINYRTP_TINYRTP_H
+
+/* === tinyNET (tinyNET/src) === */
+#include "tnet.h"
+
+/* === tinySAK (tinySAK/src)=== */
+#include "tsk.h"
+
+#include "tinyrtp/rtp/trtp_rtp_header.h"
+#include "tinyrtp/rtp/trtp_rtp_packet.h"
+#include "tinyrtp/trtp_manager.h"
+
+#endif /* TINYRTP_TINYRTP_H */
diff --git a/tinyRTP/include/tinyrtp/rtcp/trtp_rtcp_session.h b/tinyRTP/include/tinyrtp/rtcp/trtp_rtcp_session.h
new file mode 100644
index 0000000..82919a0
--- /dev/null
+++ b/tinyRTP/include/tinyrtp/rtcp/trtp_rtcp_session.h
@@ -0,0 +1,38 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file trtp_rtcp_session.h
+ * @brief RTCP session.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYMEDIA_RTCP_SESSION_H
+#define TINYMEDIA_RTCP_SESSION_H
+
+#include "tinyrtp_config.h"
+
+TRTP_BEGIN_DECLS
+
+TRTP_END_DECLS
+
+#endif /* TINYMEDIA_RTCP_SESSION_H */
diff --git a/tinyRTP/include/tinyrtp/rtp/trtp_rtp_header.h b/tinyRTP/include/tinyrtp/rtp/trtp_rtp_header.h
new file mode 100644
index 0000000..5b6a995
--- /dev/null
+++ b/tinyRTP/include/tinyrtp/rtp/trtp_rtp_header.h
@@ -0,0 +1,80 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file trtp_rtp_header.h
+ * @brief RTP header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYMEDIA_RTP_HEADER_H
+#define TINYMEDIA_RTP_HEADER_H
+
+#include "tinyrtp_config.h"
+
+#include "tsk_buffer.h"
+
+TRTP_BEGIN_DECLS
+
+#define TRTP_RTP_HEADER_MIN_SIZE 12
+
+typedef struct trtp_rtp_header_s
+{
+ TSK_DECLARE_OBJECT;
+ /* RFC 3550 section 5.1 - RTP Fixed Header Fields
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ |V=2|P|X| CC |M| PT | sequence number |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | timestamp |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | synchronization source (SSRC) identifier |
+ +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+ | contributing source (CSRC) identifiers |
+ | .... |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+ unsigned version:2;
+ unsigned padding:1;
+ unsigned extension:1;
+ unsigned csrc_count:4;
+ unsigned marker:1;
+ unsigned payload_type:7;
+ uint16_t seq_num;
+ uint32_t timestamp;
+ uint32_t ssrc;
+ uint32_t csrc[15];
+}
+trtp_rtp_header_t;
+
+TINYRTP_API trtp_rtp_header_t* trtp_rtp_header_create_null();
+TINYRTP_API trtp_rtp_header_t* trtp_rtp_header_create(uint32_t ssrc, uint16_t seq_num, uint32_t timestamp, uint8_t payload_type, tsk_bool_t marker);
+TINYRTP_API tsk_buffer_t* trtp_rtp_header_serialize(const trtp_rtp_header_t *self);
+TINYRTP_API trtp_rtp_header_t* trtp_rtp_header_deserialize(const void *data, tsk_size_t size);
+
+
+TINYRTP_GEXTERN const tsk_object_def_t *trtp_rtp_header_def_t;
+
+TRTP_END_DECLS
+
+#endif /* TINYMEDIA_RTP_HEADER_H */
diff --git a/tinyRTP/include/tinyrtp/rtp/trtp_rtp_packet.h b/tinyRTP/include/tinyrtp/rtp/trtp_rtp_packet.h
new file mode 100644
index 0000000..20b7b85
--- /dev/null
+++ b/tinyRTP/include/tinyrtp/rtp/trtp_rtp_packet.h
@@ -0,0 +1,70 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file trtp_rtp_packet.h
+ * @brief RTP packet.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ */
+#ifndef TINYRTP_RTP_PACKET_H
+#define TINYRTP_RTP_PACKET_H
+
+#include "tinyrtp_config.h"
+
+#include "tinyrtp/rtp/trtp_rtp_header.h"
+
+#include "tsk_object.h"
+
+TRTP_BEGIN_DECLS
+
+
+typedef struct trtp_rtp_packet_s
+{
+ TSK_DECLARE_OBJECT;
+
+ trtp_rtp_header_t* header;
+
+ struct{
+ void* data;
+ const void* data_const;
+ tsk_size_t size;
+ } payload;
+
+ /* extension header as per RFC 3550 section 5.3.1 */
+ struct{
+ void* data;
+ tsk_size_t size; /* contains the first two 16-bit fields */
+ } extension;
+}
+trtp_rtp_packet_t;
+
+TINYRTP_API trtp_rtp_packet_t* trtp_rtp_packet_create_null();
+TINYRTP_API trtp_rtp_packet_t* trtp_rtp_packet_create(uint32_t ssrc, uint16_t seq_num, uint32_t timestamp, uint8_t payload_type, tsk_bool_t marker);
+TINYRTP_API tsk_buffer_t* trtp_rtp_packet_serialize(const trtp_rtp_packet_t *self);
+TINYRTP_API trtp_rtp_packet_t* trtp_rtp_packet_deserialize(const void *data, tsk_size_t size);
+
+
+TINYRTP_GEXTERN const tsk_object_def_t *trtp_rtp_packet_def_t;
+
+TRTP_END_DECLS
+
+#endif /* TINYRTP_RTP_PACKET_H */
diff --git a/tinyRTP/include/tinyrtp/rtp/trtp_rtp_session.h b/tinyRTP/include/tinyrtp/rtp/trtp_rtp_session.h
new file mode 100644
index 0000000..4a266ea
--- /dev/null
+++ b/tinyRTP/include/tinyrtp/rtp/trtp_rtp_session.h
@@ -0,0 +1,38 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file trtp_rtp_session.h
+ * @brief RTP session.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYMEDIA_RTP_SESSION_H
+#define TINYMEDIA_RTP_SESSION_H
+
+#include "tinyrtp_config.h"
+
+TRTP_BEGIN_DECLS
+
+TRTP_END_DECLS
+
+#endif /* TINYMEDIA_RTP_SESSION_H */
diff --git a/tinyRTP/include/tinyrtp/trtp.h b/tinyRTP/include/tinyrtp/trtp.h
new file mode 100644
index 0000000..e9156f3
--- /dev/null
+++ b/tinyRTP/include/tinyrtp/trtp.h
@@ -0,0 +1,38 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file trtp.h
+ * @brief tinyRTP (Real-time Transport Protocol) as per RFC 3550.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYMEDIA_TRTP_H
+#define TINYMEDIA_TRTP_H
+
+#include "tinyrtp_config.h"
+
+TRTP_BEGIN_DECLS
+
+TRTP_END_DECLS
+
+#endif /* TINYMEDIA_TRTP_H */
diff --git a/tinyRTP/include/tinyrtp/trtp_manager.h b/tinyRTP/include/tinyrtp/trtp_manager.h
new file mode 100644
index 0000000..6e37659
--- /dev/null
+++ b/tinyRTP/include/tinyrtp/trtp_manager.h
@@ -0,0 +1,106 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file trtp_manager.h
+ * @brief RTP/RTCP manager.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYMEDIA_MANAGER_H
+#define TINYMEDIA_MANAGER_H
+
+#include "tinyrtp_config.h"
+
+#include "tinynet.h"
+
+TRTP_BEGIN_DECLS
+
+/* Forward declarations */
+struct trtp_rtp_packet_s;
+struct trtp_rtcp_packet_s;
+
+typedef int (*trtp_manager_rtp_cb_f)(const void* callback_data, const struct trtp_rtp_packet_s* packet);
+typedef int (*trtp_manager_rtcp_cb_f)(const void* callback_data, const struct trtp_rtcp_packet_s* packet);
+
+/** RTP/RTCP manager */
+typedef struct trtp_manager_s
+{
+ TSK_DECLARE_OBJECT;
+
+ struct{
+ uint16_t seq_num;
+ uint32_t timestamp;
+ uint32_t ssrc;
+ uint8_t payload_type;
+
+ char* remote_ip;
+ tnet_port_t remote_port;
+ struct sockaddr_storage remote_addr;
+
+ char* public_ip;
+ tnet_port_t public_port;
+
+ const void* callback_data;
+ trtp_manager_rtp_cb_f callback;
+ } rtp;
+
+ struct{
+ char* remote_ip;
+ tnet_port_t remote_port;
+ struct sockaddr_storage remote_addr;
+ tnet_socket_t* local_socket;
+
+ char* public_ip;
+ tnet_port_t public_port;
+
+ const void* callback_data;
+ trtp_manager_rtcp_cb_f callback;
+ } rtcp;
+
+ char* local_ip;
+ tsk_bool_t ipv6;
+ tsk_bool_t started;
+ tsk_bool_t enable_rtcp;
+ tnet_transport_t* transport;
+}
+trtp_manager_t;
+
+TINYRTP_API trtp_manager_t* trtp_manager_create(tsk_bool_t enable_rtcp, const char* local_ip, tsk_bool_t ipv6);
+TINYRTP_API int trtp_manager_prepare(trtp_manager_t*self);
+TINYRTP_API tsk_bool_t trtp_manager_is_prepared(trtp_manager_t* self);
+TINYRTP_API int trtp_manager_set_natt_ctx(trtp_manager_t* self, tnet_nat_context_handle_t* natt_ctx);
+TINYRTP_API int trtp_manager_set_rtp_callback(trtp_manager_t* self, trtp_manager_rtp_cb_f callback, const void* callback_data);
+TINYRTP_API int trtp_manager_set_payload_type(trtp_manager_t* self, uint8_t payload_type);
+TINYRTP_API int trtp_manager_set_rtp_remote(trtp_manager_t* self, const char* remote_ip, tnet_port_t remote_port);
+TINYRTP_API int trtp_manager_set_rtp_remote(trtp_manager_t* self, const char* remote_ip, tnet_port_t remote_port);
+TINYRTP_API int trtp_manager_set_rtcp_remote(trtp_manager_t* self, const char* remote_ip, tnet_port_t remote_port);
+TINYRTP_API int trtp_manager_start(trtp_manager_t* self);
+TINYRTP_API int trtp_manager_send_rtp(trtp_manager_t* self, const void* data, tsk_size_t size, uint32_t duration, tsk_bool_t marker, tsk_bool_t last_packet);
+TINYRTP_API int trtp_manager_send_rtp_2(trtp_manager_t* self, const struct trtp_rtp_packet_s* packet);
+TINYRTP_API int trtp_manager_stop(trtp_manager_t* self);
+
+TINYRTP_GEXTERN const tsk_object_def_t *trtp_manager_def_t;
+
+TRTP_END_DECLS
+
+#endif /* TINYMEDIA_MANAGER_H */
diff --git a/tinyRTP/include/tinyrtp_config.h b/tinyRTP/include/tinyrtp_config.h
new file mode 100644
index 0000000..584f0fc
--- /dev/null
+++ b/tinyRTP/include/tinyrtp_config.h
@@ -0,0 +1,84 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+
+#ifndef TINYRTP_CONFIG_H
+#define TINYRTP_CONFIG_H
+
+#if HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#ifdef __SYMBIAN32__
+#undef _WIN32 /* Because of WINSCW */
+#endif
+
+/* Windows (XP/Vista/7/CE and Windows Mobile) macro definition.
+*/
+#if defined(WIN32)|| defined(_WIN32) || defined(_WIN32_WCE)
+# define TRTP_UNDER_WINDOWS 1
+#endif
+
+#if (TRTP_UNDER_WINDOWS || defined(__SYMBIAN32__)) && defined(TINYRTP_EXPORTS)
+# define TINYRTP_API __declspec(dllexport)
+# define TINYRTP_GEXTERN __declspec(dllexport)
+#elif (TRTP_UNDER_WINDOWS || defined(__SYMBIAN32__)) /*&& defined(TINYRTP_IMPORTS)*/
+# define TINYRTP_API __declspec(dllimport)
+# define TINYRTP_GEXTERN __declspec(dllimport)
+#else
+# define TINYRTP_API
+# define TINYRTP_GEXTERN extern
+#endif
+
+/* Guards against C++ name mangling
+*/
+#ifdef __cplusplus
+# define TRTP_BEGIN_DECLS extern "C" {
+# define TRTP_END_DECLS }
+#else
+# define TRTP_BEGIN_DECLS
+# define TRTP_END_DECLS
+#endif
+
+/* Disable some well-known warnings
+*/
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_WARNINGS
+#endif
+
+/* Detecting C99 compilers
+ */
+#if (__STDC_VERSION__ == 199901L) && !defined(__C99__)
+# define __C99__
+#endif
+
+#define TRTP_RTP_VERSION 2
+
+#include <stdint.h>
+#ifdef __SYMBIAN32__
+#include <stdlib.h>
+#endif
+
+#if HAVE_CONFIG_H
+ #include "../config.h"
+#endif
+
+#endif // TINYRTP_CONFIG_H
OpenPOWER on IntegriCloud