summaryrefslogtreecommitdiffstats
path: root/tinyBFCP/include/tinybfcp/tbfcp_types.h
blob: 561d7becc0095253d9de45153cd980b02280709a (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
195
196
197
198
199
200
201
202
203
204
205
206
207
/* Copyright (C) 2014 Mamadou DIOP.
*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TBFCP_TYPES_H
#define TBFCP_TYPES_H

#include "tinybfcp_config.h"

TBFCP_BEGIN_DECLS

#if !defined(kBfcpFieldMYes)
#	define kBfcpFieldMYes 1
#endif /* kBfcpFieldMYes */
#if !defined(kBfcpFieldMNo)
#	define kBfcpFieldMNo 0
#endif /* kBfcpFieldMNo */

// draft-ietf-bfcpbis-rfc4582bis-11 - 8.3.3.  Timer Values
#if !defined(kBfcpTimerT1)
#	define kBfcpTimerT1 500
#endif /* kBfcpTimerT1 */
#if !defined(kBfcpTimerT2)
#	define kBfcpTimerT2 10000
#endif /* kBfcpTimerT1 */
#if !defined(kBfcpTimerT1MaxTries)
#	define kBfcpTimerT1MaxTries 4 // draft says #3 but we use #4
#endif /* kBfcpTimerT1MaxTries */
#if !defined(kBfcpTimerT1Max)
#	define kBfcpTimerT1Max (kBfcpTimerT1 * kBfcpTimerT1MaxTries)
#endif /* kBfcpTimerT1 */

#if !defined(kBfcpTcpTimerReconnect)
#	define kBfcpTcpTimerReconnect	5000 // Try to reconnect the TCP/TLS socket every 5seconds if unexpectedly disconnected
#endif /* kBfcpTcpTimerReconnect */

#if !defined(kBfcpTimerKeepAlive)
#	define kBfcpTimerKeepAlive	30000 // Send Hello message every 30 seconds
#endif /* kBfcpTimerKeepAlive */


// RFC4582 - 11.1.  Registration of the 'TCP/BFCP' and 'TCP/TLS/BFCP' SDP 'proto' Values
#if !defined (kBfcpProfileTLS)
#	define kBfcpProfileTLS	"TCP/TLS/BFCP"
#endif /* kBfcpProfileTLS */
#if !defined (kBfcpProfileTCP)
#	define kBfcpProfileTCP	"TCP/BFCP"
#endif /* kBfcpProfileTCP */
// draft-ietf-bfcpbis-rfc4582bis-11 - 5.4.  Registration of SDP 'proto' Values (11.1)
#if !defined (kBfcpProfileUDP)
#	define kBfcpProfileUDP	"UDP/BFCP"
#endif /* kBfcpProfileUDP */
#if !defined (kBfcpProfileDTLS)
#	define kBfcpProfileDTLS	"UDP/TLS/BFCP"
#endif /* kBfcpProfileDTLS */

#if !defined(kBfcpTransportDefault)
#	define kBfcpTransportDefault tnet_socket_type_udp_ipv4
#endif /* kBfcpTransportDefault */

#if !defined(kBfcpTransportFriendlyName)
#	define kBfcpTransportFriendlyName "BFCP Session"
#endif /* kBfcpTransportFriendlyName */

#if !defined(kBfcpBuffMinPad)
#	define kBfcpBuffMinPad	40 // to make the buffer kasher
#endif /* kBfcpBuffMinPad */


// rfc4583 - 4.  Floor Control Server Determination
#if !defined(kBfcpRoleC)
#	define kBfcpRoleC "c-only"
#endif /* kBfcpRoleC */
#if !defined(kBfcpRoleS)
#	define kBfcpRoleS "s-only"
#endif /* kBfcpRoleS */
#if !defined(kBfcpRoleCS)
#	define kBfcpRoleCS "c-s"
#endif /* kBfcpRoleCS */
#if !defined(kBfcpRoleDefault)
#	define kBfcpRoleDefault tbfcp_role_c_only // For know the stack works in client mode only
#endif /* kBfcpRoleDefault */
typedef enum tbfcp_role_e {
    tbfcp_role_c_only = (1 << 0),
    tbfcp_role_s_only = (1 << 1),
    tbfcp_role_c_s = (tbfcp_role_c_only | tbfcp_role_s_only)
} tbfcp_role_t;

typedef enum tbfcp_setup_e {
	tbfcp_setup_active = (1 << 0),
	tbfcp_setup_passive = (1 << 1),
	tbfcp_setup_actpass = (tbfcp_setup_active | tbfcp_setup_passive),
} tbfcp_setup_t;
#if !defined(kBfcpSetupDefault)
#	define kBfcpSetupDefault tbfcp_setup_actpass
#endif /* kBfcpSetupDefault */
#if !defined(kBfcpSetupActPass)
#	define kBfcpSetupActPass "actpass"
#endif /* kBfcpSetupActPass */
#if !defined(kBfcpSetupActive)
#	define kBfcpSetupActive "active"
#endif /* kBfcpSetupActive */
#if !defined(kBfcpSetupPassive)
#	define kBfcpSetupPassive "passive"
#endif /* kBfcpSetupPassive */

// RFC4582 - 5.1.  COMMON-HEADER Format
typedef enum tbfcp_primitive_e {
    tbfcp_primitive_FloorRequest		= 1,  // | P -> S           |
    tbfcp_primitive_FloorRelease		= 2,  // | P -> S           |
    tbfcp_primitive_FloorRequestQuery	= 3,  // | P -> S ; Ch -> S |
    tbfcp_primitive_FloorRequestStatus	= 4,  // | P <- S ; Ch <- S |
    tbfcp_primitive_UserQuery			= 5,  // | P -> S ; Ch -> S |
    tbfcp_primitive_UserStatus			= 6,  // | P <- S ; Ch <- S |
    tbfcp_primitive_FloorQuery			= 7,  // | P -> S ; Ch -> S |
    tbfcp_primitive_FloorStatus			= 8,  // | P <- S ; Ch <- S |
    tbfcp_primitive_ChairAction			= 9,  // | Ch -> S          |
    tbfcp_primitive_ChairActionAck		= 10, // | Ch <- S          |
    tbfcp_primitive_Hello				= 11, // | P -> S ; Ch -> S |
    tbfcp_primitive_HelloAck			= 12, // | P <- S ; Ch <- S |
    tbfcp_primitive_Error				= 13, // | P <- S ; Ch <- S
    //!\ Update tbfcp_pkt_create_HelloAck_2() if an entry is added or remove
} tbfcp_primitive_t;

// RFC4582 - 5.2.  Attribute Format
typedef enum tbfcp_attribute_type_e {
    tbfcp_attribute_type_BENEFICIARY_ID = 1,					// | Unsigned16    |
    tbfcp_attribute_type_FLOOR_ID = 2,						// | Unsigned16    |
    tbfcp_attribute_type_FLOOR_REQUEST_ID = 3,				// | Unsigned16    |
    tbfcp_attribute_type_PRIORITY = 4,						// | OctetString16 |
    tbfcp_attribute_type_REQUEST_STATUS = 5,					// | OctetString16 |
    tbfcp_attribute_type_ERROR_CODE = 6,						// | OctetString   |
    tbfcp_attribute_type_ERROR_INFO = 7,						// | OctetString   |
    tbfcp_attribute_type_PARTICIPANT_PROVIDED_INFO = 8,		// | OctetString   |
    tbfcp_attribute_type_STATUS_INFO = 9,						// | OctetString   |
    tbfcp_attribute_type_SUPPORTED_ATTRIBUTES = 10,			// | OctetString   |
    tbfcp_attribute_type_SUPPORTED_PRIMITIVES = 11,			// | OctetString   |
    tbfcp_attribute_type_USER_DISPLAY_NAME = 12,				// | OctetString   |
    tbfcp_attribute_type_USER_URI = 13,						// | OctetString   |
    tbfcp_attribute_type_BENEFICIARY_INFORMATION = 14,		// | Grouped       |
    tbfcp_attribute_type_FLOOR_REQUEST_INFORMATION = 15,		// | Grouped       |
    tbfcp_attribute_type_REQUESTED_BY_INFORMATION  = 16,		// | Grouped       |
    tbfcp_attribute_type_FLOOR_REQUEST_STATUS = 17,			// | Grouped       |
    tbfcp_attribute_type_OVERALL_REQUEST_STATUS = 18,			// | Grouped
    //!\ Update tbfcp_pkt_create_HelloAck_2() if an entry is added or remove
} tbfcp_attribute_type_t;

// RFC4582 - 5.2.  Attribute Format
typedef enum tbfcp_attribute_format_e {
    tbfcp_attribute_format_Unknown,
    tbfcp_attribute_format_Unsigned16,
    tbfcp_attribute_format_OctetString16,
    tbfcp_attribute_format_OctetString,
    tbfcp_attribute_format_Grouped,
} tbfcp_attribute_format_t;

// RFC4582 - 5.2.4.  PRIORITY
typedef enum tbfcp_prio_e {
    tbfcp_prio_Lowest	= 0,
    tbfcp_prio_Low		= 1,
    tbfcp_prio_Normal	= 2,
    tbfcp_prio_High		= 3,
    tbfcp_prio_Highest	= 4
} tbfcp_prio_t;

// RFC4582 - 5.2.5.  REQUEST-STATUS
typedef enum tbfcp_reqstatus_e {
    tbfcp_reqstatus_Pending		= 1,
    tbfcp_reqstatus_Accepted	= 2,
    tbfcp_reqstatus_Granted		= 3,
    tbfcp_reqstatus_Denied		= 4,
    tbfcp_reqstatus_Cancelled	= 5,
    tbfcp_reqstatus_Released	= 6,
    tbfcp_reqstatus_Revoked		= 7
} tbfcp_reqstatus_t;

// RFC4582 - 5.2.6.  ERROR-CODE
typedef enum tbfcp_err_code_e {
    tbfcp_err_code_Conference_does_not_Exist = 1,
    tbfcp_err_code_User_does_not_Exist = 2,
    tbfcp_err_code_Unknown_Primitive = 3,
    tbfcp_err_code_Unknown_Mandatory_Attribute = 4,
    tbfcp_err_code_Unauthorized_Operation = 5,
    tbfcp_err_code_Invalid_Floor_ID = 6,
    tbfcp_err_code_Floor_Request_ID_Does_Not_Exist = 7,
    tbfcp_err_code_You_have_Already_Reached_the_Maximum_Number_of_OngoingFloor_Requests_for_this_Floor = 9,
    tbfcp_err_code_Use_TLS = 10,
} tbfcp_err_code_t;

TBFCP_END_DECLS

#endif /* TBFCP_TYPES_H */

OpenPOWER on IntegriCloud