summaryrefslogtreecommitdiffstats
path: root/tinyMEDIA/include/tinymedia/tmedia_qos.h
blob: 7ff8e97ed7918dbd45382de86e74d207bea77493 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]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 tmedia_qos.h
 * @brief RFC 3312 (Preconditions) implementation.
 *
 * @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
 *

 */
#ifndef TINYMEDIA_QOS_H
#define TINYMEDIA_QOS_H

#include "tinymedia_config.h"

#include "tinysdp/tsdp_message.h"

#include "tsk_object.h"

TMEDIA_BEGIN_DECLS

#define TMEDIA_QOS_TLINE(self) ((tmedia_qos_tline_t*)(self))

/** List of all supported statues*/
typedef enum tmedia_qos_status_e
{
	//! current-status
	tmedia_qos_status_curr,
	//! desired-status
	tmedia_qos_status_des,
	//! confirm-status
	tmedia_qos_status_conf
}
tmedia_qos_status_t;

/** List of all supported precondition types */
typedef enum tmedia_qos_ptype_e
{
	tmedia_qos_ptype_qos
}
tmedia_qos_ptype_t;

/** List of all supported status types */
typedef enum tmedia_qos_stype_e
{
	tmedia_qos_stype_none,/* not part of the RFC */

	tmedia_qos_stype_segmented,
	tmedia_qos_stype_e2e,
}
tmedia_qos_stype_t;

/** strengths */
typedef enum tmedia_qos_strength_e
{
	/* do no change the order (none -> optional -> manadatory) */
	tmedia_qos_strength_none,	
	tmedia_qos_strength_failure,
	tmedia_qos_strength_unknown,
	tmedia_qos_strength_optional,
	tmedia_qos_strength_mandatory
}
tmedia_qos_strength_t;

/** directions */
typedef enum tmedia_qos_direction_e
{
	tmedia_qos_direction_none = 0x01,
	tmedia_qos_direction_send = (0x01 << 1),
	tmedia_qos_direction_recv = (0x01 << 2),
	tmedia_qos_direction_sendrecv = (tmedia_qos_direction_send | tmedia_qos_direction_recv)
}
tmedia_qos_direction_t;

/* QoS table-line */
typedef struct tmedia_qos_tline_s
{
	TSK_DECLARE_OBJECT;
	tmedia_qos_stype_t type;
}
tmedia_qos_tline_t;
#define TMEDIA_DECLARE_QOS_TLINE tmedia_qos_tline_t __tline__

TINYMEDIA_API tmedia_qos_tline_t* tmedia_qos_tline_create(tmedia_qos_stype_t type, tmedia_qos_strength_t strength);
TINYMEDIA_API tmedia_qos_stype_t tmedia_qos_get_type(const tsdp_header_M_t* m);
TINYMEDIA_API tmedia_qos_tline_t* tmedia_qos_tline_from_sdp(const tsdp_header_M_t* m);
TINYMEDIA_API int tmedia_qos_tline_to_sdp(const tmedia_qos_tline_t* self, tsdp_header_M_t* m);
TINYMEDIA_API int tmedia_qos_tline_set_ro(tmedia_qos_tline_t* self, const tmedia_qos_tline_t* ro);
TINYMEDIA_API tsk_bool_t tmedia_qos_tline_canresume(const tmedia_qos_tline_t* self);

/* QoS table-line for E2E type*/
typedef struct tmedia_qos_tline_e2e_s
{
	TMEDIA_DECLARE_QOS_TLINE;

	/* RFC 3312 - 5.1 Generating an offer

		Direction  Current  Desired Strength
		____________________________________
		send       no        mandatory
		recv       no        mandatory
	*/
	struct{
		unsigned current:1;
		unsigned confirm:1;
		tmedia_qos_strength_t strength;
	} send;

	struct{
		unsigned current:1;
		unsigned confirm:1;
		tmedia_qos_strength_t strength;
	} recv;
}
tmedia_qos_tline_e2e_t;

TINYMEDIA_API tmedia_qos_tline_e2e_t* tmedia_qos_tline_e2e_create(tmedia_qos_strength_t strength);
TINYMEDIA_API tmedia_qos_tline_e2e_t* tmedia_qos_tline_e2e_from_sdp(const tsdp_header_M_t* m);
TINYMEDIA_API int tmedia_qos_tline_e2e_to_sdp(const tmedia_qos_tline_e2e_t* self, tsdp_header_M_t* m);
TINYMEDIA_API int tmedia_qos_tline_e2e_set_ro(tmedia_qos_tline_e2e_t* self, const tmedia_qos_tline_e2e_t* ro);
TINYMEDIA_API tsk_bool_t tmedia_qos_tline_e2e_canresume(const tmedia_qos_tline_e2e_t* self);

/* QoS table-line for Segented type*/
typedef struct tmedia_qos_tline_segmented_s
{
	TMEDIA_DECLARE_QOS_TLINE;

	/* RFC 3312 - 5.1 Generating an offer
		Direction   Current  Desired Strength
		______________________________________
		local send     no           none
		local recv     no           none
		remote send    no         optional
		remote recv    no           none
	*/
	/* can be done in two lines but I prefer doing it like this (easier) */
	struct{
		unsigned current:1;
		unsigned confirm:1;
		tmedia_qos_strength_t strength;
	} local_send;

	struct{
		unsigned current:1;
		unsigned confirm:1;
		tmedia_qos_strength_t strength;
	} local_recv;

	struct{
		unsigned current:1;
		unsigned confirm:1;
		tmedia_qos_strength_t strength;
	} remote_send;

	struct{
		unsigned current:1;
		unsigned confirm:1;
		tmedia_qos_strength_t strength;
	} remote_recv;
}
tmedia_qos_tline_segmented_t;


TINYMEDIA_API tmedia_qos_tline_segmented_t* tmedia_qos_tline_segmented_create(tmedia_qos_strength_t strength);
TINYMEDIA_API tmedia_qos_tline_segmented_t* tmedia_qos_tline_segmented_from_sdp(const tsdp_header_M_t* m);
TINYMEDIA_API int tmedia_qos_tline_segmented_to_sdp(const tmedia_qos_tline_segmented_t* self, tsdp_header_M_t* m);
TINYMEDIA_API int tmedia_qos_tline_segmented_set_ro(tmedia_qos_tline_segmented_t* self, const tmedia_qos_tline_segmented_t* ro);
TINYMEDIA_API tsk_bool_t tmedia_qos_tline_segmented_canresume(const tmedia_qos_tline_segmented_t* self);

TINYMEDIA_GEXTERN const tsk_object_def_t *tmedia_qos_tline_segmented_def_t;
TINYMEDIA_GEXTERN const tsk_object_def_t *tmedia_qos_tline_e2e_def_t;

TMEDIA_END_DECLS

#endif /* TINYMEDIA_QOS_H */
OpenPOWER on IntegriCloud