summaryrefslogtreecommitdiff
path: root/toxrtp/toxrtp_message.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxrtp/toxrtp_message.h')
-rw-r--r--toxrtp/toxrtp_message.h111
1 files changed, 0 insertions, 111 deletions
diff --git a/toxrtp/toxrtp_message.h b/toxrtp/toxrtp_message.h
deleted file mode 100644
index 8feea5d9..00000000
--- a/toxrtp/toxrtp_message.h
+++ /dev/null
@@ -1,111 +0,0 @@
1/* rtp_message.h
2 *
3 * Rtp Message handler. It handles message/header parsing.
4 * Refer to RTP: A Transport Protocol for Real-Time Applications ( RFC 3550 ) for more info. !Red!
5 *
6 *
7 * Copyright (C) 2013 Tox project All Rights Reserved.
8 *
9 * This file is part of Tox.
10 *
11 * Tox is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * Tox is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
23 *
24 */
25
26#ifndef _RTP__MESSAGE_H_
27#define _RTP__MESSAGE_H_
28
29#include "../toxcore/network.h"
30#include "toxrtp_helper.h"
31#include "../toxcore/tox.h"
32/* Defines */
33
34#define _MAX_SEQU_NUM 65535
35
36/* Minimum size */
37#define _MIN_HEADER_LENGTH 12
38#define _MIN_EXT_HEADER_LENGTH 4
39
40/* End of defines */
41
42
43typedef struct rtp_dest_list_s {
44 tox_IP_Port _dest;
45 struct rtp_dest_list_s* next;
46
47} rtp_dest_list_t;
48
49typedef struct rtp_header_s {
50 uint8_t _flags; /* Version(2),Padding(1), Ext(1), Cc(4) */
51 uint8_t _marker_payload_t; /* Marker(1), PlayLoad Type(7) */
52 uint16_t _sequence_number; /* Sequence Number */
53 uint32_t _timestamp; /* Timestamp */
54 uint32_t _ssrc; /* SSRC */
55 uint32_t* _csrc; /* CSRC's table */
56
57 uint32_t _length; /* A little something for allocation */
58
59} rtp_header_t;
60
61typedef struct rtp_ext_header_s {
62 uint16_t _ext_type; /* Extension profile */
63 uint16_t _ext_len; /* Number of extensions */
64 uint32_t* _hd_ext; /* Extension's table */
65
66
67} rtp_ext_header_t;
68
69typedef struct rtp_msg_s {
70 struct rtp_header_s* _header;
71 struct rtp_ext_header_s* _ext_header;
72 uint32_t _header_lenght;
73
74 uint8_t* _data;
75 uint32_t _length;
76 tox_IP_Port _from;
77
78 struct rtp_msg_s* _next;
79} rtp_msg_t;
80
81/* Extracts the header from the payload starting at _from */
82rtp_header_t* rtp_extract_header ( const uint8_t* _payload, size_t _bytes );
83rtp_ext_header_t* rtp_extract_ext_header ( const uint8_t* _payload, size_t _bytes );
84
85
86uint8_t* rtp_add_header ( rtp_header_t* _header, uint8_t* _payload );
87uint8_t* rtp_add_extention_header ( rtp_ext_header_t* _header, uint8_t* _payload );
88
89/* Gets the size of the header _header in bytes */
90size_t rtp_header_get_size ( const rtp_header_t* _header );
91
92void rtp_header_print (const rtp_header_t* _header);
93
94/* Adding flags and settings */
95void rtp_header_add_flag_version ( rtp_header_t* _header, uint32_t value );
96void rtp_header_add_flag_padding ( rtp_header_t* _header, uint32_t value );
97void rtp_header_add_flag_extension ( rtp_header_t* _header, uint32_t value );
98void rtp_header_add_flag_CSRC_count ( rtp_header_t* _header, uint32_t value );
99void rtp_header_add_setting_marker ( rtp_header_t* _header, uint32_t value );
100void rtp_header_add_setting_payload ( rtp_header_t* _header, uint32_t value );
101
102
103/* Getting values from flags and settings */
104uint8_t rtp_header_get_flag_version ( const rtp_header_t* _header );
105uint8_t rtp_header_get_flag_padding ( const rtp_header_t* _header );
106uint8_t rtp_header_get_flag_extension ( const rtp_header_t* _header );
107uint8_t rtp_header_get_flag_CSRC_count ( const rtp_header_t* _header );
108uint8_t rtp_header_get_setting_marker ( const rtp_header_t* _header );
109uint8_t rtp_header_get_setting_payload_type ( const rtp_header_t* _header );
110
111#endif /* _RTP__MESSAGE_H_ */