summaryrefslogtreecommitdiff
path: root/toxav/rtp.h
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-11-24 20:24:59 -0500
committerirungentoo <irungentoo@gmail.com>2014-11-24 20:24:59 -0500
commit279c33c01a9ca721b986aabf72fa982936b20c9e (patch)
tree4c0d289c6d74788989024485d44a4f5c7fec6efc /toxav/rtp.h
parentc67bc3399faae541d64309412326ae92262b1282 (diff)
parent386c9748d48d3bb4513e8e5c32e2b30a4d6a00d4 (diff)
Merge branch 'master' of https://github.com/mannol/toxcore
Diffstat (limited to 'toxav/rtp.h')
-rw-r--r--toxav/rtp.h97
1 files changed, 17 insertions, 80 deletions
diff --git a/toxav/rtp.h b/toxav/rtp.h
index d57c5ef7..613fbec8 100644
--- a/toxav/rtp.h
+++ b/toxav/rtp.h
@@ -24,19 +24,15 @@
24 24
25#define RTP_VERSION 2 25#define RTP_VERSION 2
26#include <inttypes.h> 26#include <inttypes.h>
27#include <pthread.h> 27// #include <pthread.h>
28 28
29#include "../toxcore/util.h"
30#include "../toxcore/network.h"
31#include "../toxcore/net_crypto.h"
32#include "../toxcore/Messenger.h" 29#include "../toxcore/Messenger.h"
33 30
34#define MAX_SEQU_NUM 65535 31#define MAX_SEQU_NUM 65535
35#define MAX_RTP_SIZE 65535 32#define MAX_RTP_SIZE 65535
36 33
37/** 34/**
38 * @brief Standard rtp header 35 * Standard rtp header
39 *
40 */ 36 */
41 37
42typedef struct _RTPHeader { 38typedef struct _RTPHeader {
@@ -52,8 +48,7 @@ typedef struct _RTPHeader {
52 48
53 49
54/** 50/**
55 * @brief Standard rtp extension header. 51 * Standard rtp extension header.
56 *
57 */ 52 */
58typedef struct _RTPExtHeader { 53typedef struct _RTPExtHeader {
59 uint16_t type; /* Extension profile */ 54 uint16_t type; /* Extension profile */
@@ -64,8 +59,7 @@ typedef struct _RTPExtHeader {
64 59
65 60
66/** 61/**
67 * @brief Standard rtp message. 62 * Standard rtp message.
68 *
69 */ 63 */
70typedef struct _RTPMessage { 64typedef struct _RTPMessage {
71 RTPHeader *header; 65 RTPHeader *header;
@@ -79,11 +73,11 @@ typedef struct _RTPMessage {
79 73
80 74
81/** 75/**
82 * @brief Our main session descriptor. 76 * Our main session descriptor.
83 * It measures the session variables and controls 77 * It measures the session variables and controls
84 * the entire session. There are functions for manipulating 78 * the entire session. There are functions for manipulating
85 * the session so tend to use those instead of directly modifying 79 * the session so tend to use those instead of directly modifying
86 * session parameters. 80 * session parameters.
87 * 81 *
88 */ 82 */
89typedef struct _RTPSession { 83typedef struct _RTPSession {
@@ -109,88 +103,31 @@ typedef struct _RTPSession {
109 uint8_t prefix; 103 uint8_t prefix;
110 104
111 int dest; 105 int dest;
112 int32_t call_index;
113 struct _ToxAv *av;
114 106
115} RTPSession; 107 struct _CSSession *cs;
116 108
109} RTPSession;
117 110
118/** 111/**
119 * @brief Release all messages held by session. 112 * Must be called before calling any other rtp function.
120 *
121 * @param session The session.
122 * @return int
123 * @retval -1 Error occurred.
124 * @retval 0 Success.
125 */ 113 */
126int rtp_release_session_recv ( RTPSession *session ); 114RTPSession *rtp_new ( int payload_type, Messenger *messenger, int friend_num );
127
128 115
129/** 116/**
130 * @brief Call this to change queue limit 117 * Terminate the session.
131 *
132 * @param session The session
133 * @param limit new limit
134 * @return void
135 */ 118 */
136void rtp_queue_adjust_limit ( RTPSession *session, uint64_t limit ); 119void rtp_kill ( RTPSession *session, Messenger *messenger );
137 120
138/** 121/**
139 * @brief Get's oldest message in the list. 122 * Sends msg to _RTPSession::dest
140 *
141 * @param session Where the list is.
142 * @return RTPMessage* The message. You need to call rtp_msg_free() to free it.
143 * @retval NULL No messages in the list, or no list.
144 */
145RTPMessage *rtp_recv_msg ( RTPSession *session );
146
147
148/**
149 * @brief Sends msg to _RTPSession::dest
150 *
151 * @param session The session.
152 * @param msg The message
153 * @param messenger Tox* object.
154 * @return int
155 * @retval -1 On error.
156 * @retval 0 On success.
157 */ 123 */
158int rtp_send_msg ( RTPSession *session, Messenger *messenger, const uint8_t *data, uint16_t length ); 124int rtp_send_msg ( RTPSession *session, Messenger *messenger, const uint8_t *data, uint16_t length );
159 125
160
161/** 126/**
162 * @brief Speaks for it self. 127 * Dealloc msg.
163 *
164 * @param session The control session msg belongs to. It can be NULL.
165 * @param msg The message.
166 * @return void
167 */ 128 */
168void rtp_free_msg ( RTPSession *session, RTPMessage *msg ); 129void rtp_free_msg ( RTPSession *session, RTPMessage *msg );
169 130
170/**
171 * @brief Must be called before calling any other rtp function. It's used
172 * to initialize RTP control session.
173 *
174 * @param payload_type Type of payload used to send. You can use values in toxmsi.h::MSICallType
175 * @param messenger Tox* object.
176 * @param friend_num Friend id.
177 * @return RTPSession* Created control session.
178 * @retval NULL Error occurred.
179 */
180RTPSession *rtp_init_session ( int payload_type, Messenger *messenger, int friend_num );
181
182
183/**
184 * @brief Terminate the session.
185 *
186 * @param session The session.
187 * @param messenger The messenger who owns the session
188 * @return int
189 * @retval -1 Error occurred.
190 * @retval 0 Success.
191 */
192void rtp_terminate_session ( RTPSession *session, Messenger *messenger );
193
194 131
195 132
196#endif /* __TOXRTP */ 133#endif /* __TOXRTP */