summaryrefslogtreecommitdiff
path: root/decoders/rtp/rtp_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'decoders/rtp/rtp_internal.h')
-rw-r--r--decoders/rtp/rtp_internal.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/decoders/rtp/rtp_internal.h b/decoders/rtp/rtp_internal.h
new file mode 100644
index 0000000..5d8983d
--- /dev/null
+++ b/decoders/rtp/rtp_internal.h
@@ -0,0 +1,73 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef UNUSED
+#define UNUSED(x) (void)(x)
+#endif
+
+#define RTP_MODULE_NAME "RTP_MODULE"
+#define RTP_EXDATA_NAME "RTP_EXDATA"
+#define RTP_TOPIC_NAME "RTP_TOPIC"
+#define RTP_IDENTIFY_TIMES_MAX 128
+#define RTP_HEADER_LEN 12
+#define STUN_HEADER_LEN 20
+
+enum rtp_identify_state {
+ RTP_IDENTIFY_STATE_UNKNOWN,
+ RTP_IDENTIFY_STATE_HALF_TRUE,
+ RTP_IDENTIFY_STATE_TRUE,
+ RTP_IDENTIFY_STATE_FALSE,
+};
+
+enum stun_type {
+ STUN_BINDING_REQUEST = 0x0001,
+ STUN_BINDING_INDECATION = 0x0011,
+ STUN_BINDING_RESPONSE = 0x0101,
+ STUN_BINDING_ERROR_RESPONSE = 0x0111,
+};
+
+struct stun_header {
+ /* little-endian */
+ /* byte 0-1 */
+ unsigned short type;
+ /* byte 2-3 */
+ unsigned short len;
+ /* bytes 4-7 */
+ unsigned int magic_cookie;
+} __attribute__ ((packed));
+
+struct rtp_message {
+ struct session *sess;
+
+ struct rtp_header *hdr;
+ const char *payload;
+ size_t payload_len;
+};
+
+struct rtp_exdata {
+ enum rtp_identify_state identify_state;
+ int identify_times;
+
+ enum packet_direction first_pkt_dir;
+ unsigned short last_client_seq;
+ unsigned short last_server_seq;
+ unsigned int last_client_ssrc;
+ unsigned int last_server_ssrc;
+
+ int sess_ignore;
+};
+
+struct rtp_module_ctx {
+ int topic_id;
+ int exdata_id;
+
+ struct stellar_module_manager *mod_mgr;
+};
+
+#ifdef __cplusplus
+}
+#endif