MNRTPdefs.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#ifndef MNRTPDEFS_H
00025
#define MNRTPDEFS_H
00026
#include <assert.h>
00027
#include <sys/time.h>
00028
#include <unistd.h>
00029
#include <errno.h>
00030
#include <string.h>
00031
#include <stdlib.h>
00032
#include <netinet/in.h>
00033
#include <sys/socket.h>
00034
#include <stdio.h>
00035
#include <dlfcn.h>
00036
#include <net/if.h>
00037
00038
#ifdef sun
00039
#include <sys/sockio.h>
00040
#include <arpa/inet.h>
00041
#endif
00042
00043
#include "mnstream.h"
00044
#include "var_type.h"
00045
#include "protected_var_type.h"
00046
00047
#include "MNRTPNetTypes.h"
00048
#include "MNList.h"
00049
#include "MNMutex.h"
00050
00051 class SDESItem
00052 {
00053
u_int8 _type;
00054
u_int8 _length;
00055
char* data;
00056
public:
00057
SDESItem(
const rtcp_sdes_item_t* item );
00058
SDESItem(
u_int8 type,
u_int8 len,
char* d );
00059
SDESItem(
const SDESItem& orig );
00060
00061
virtual ~SDESItem( );
00062
00063
SDESItem&
operator=(
const SDESItem& orig );
00064
00065
void reset(
const rtcp_sdes_item_t* item );
00066
void reset(
u_int8 type,
u_int8 len,
char* d );
00067
void flatten(
rtcp_sdes_item_t* item );
00068
u_int8 type()
const;
00069
u_int8 length()
const;
00070
00071
friend ostream&
operator<<( ostream& ostr,
const SDESItem& item );
00072 };
00073
00074
00075
00076
00077
00078
00079
00080 struct sdes_list_item
00081 {
00082 SDESItem sdes_item;
00083
00087 int prio;
00088
00092 int send;
00093
public:
00094
sdes_list_item(
u_int8 type,
u_int8 len,
char* d );
00095
sdes_list_item(
const sdes_list_item& orig );
00096
00097
virtual ~sdes_list_item( );
00098
00099
sdes_list_item&
operator=(
const sdes_list_item& orig );
00100
00101
void write_item_to_buffer(
u_int8* buffer, size_t len );
00102 };
00103
00104
00111 class SDESSchedule
00112 :
private MNList<sdes_list_item*>
00113 {
00114
MNMutex _lock;
00115
public:
00119
SDESSchedule();
00120
00122
~SDESSchedule();
00123
00124 void*
first() {
00125
return MNList<sdes_list_item*>::first();
00126 }
00127
00128 void next(
void*& pix ) {
00129 pix =
MNList<sdes_list_item*>::succ(pix);
00130 }
00131
00132 sdes_list_item*
operator()(
void* pix ) {
00133
return MNList<sdes_list_item*>::inf(pix);
00134 }
00135
00136 void append(
sdes_list_item* p ) {
00137
MNList<sdes_list_item*>::push_back ( p );
00138 }
00139
00140 void clear() {
00141
MNList<sdes_list_item*>::clear();
00142 }
00143
00144 void del(
void* pix ) {
00145
MNList<sdes_list_item*>::del_item(pix);
00146 }
00147
00149
void lock();
00150
00152
void unlock();
00153
00161
void decrease_send_counters();
00162
00175 size_t
get_sdes_send_number( size_t& bytecount );
00176
00187
void set_default_cname();
00188
00212
void set_sdes( rtcp_sdes_type_t type,
char* text,
int prio );
00213 };
00214
00215
00216
00217
00218
00219 enum RTP_RC
00220 {
00221
RTP_OK = 0,
00222
RTP_ERROR = -1,
00223
RTP_NO_SESSION = -2,
00224
RTP_NO_IP = -3,
00225
RTP_IS_IP = -4,
00226
RTP_NO_NUMBER = -5,
00227
RTP_IS_MC = -6,
00228
RTP_NO_MC = -7,
00229
RTP_ALREADY_CONNECTED = -8,
00230
RTP_RUNNING = -9,
00231
RTP_PORT_INVALID = -10,
00232
RTP_BIND_ERROR = -11,
00233
RTP_MC_AND_DIFF_PORT = -12,
00234
RTP_SHORT_PACKET = -13,
00235
00236
RTCP_ERROR = -50,
00237
RTCP_RUNNING = -51,
00238
RTCP_ALREADY_CONNECTED = -52,
00239
RTCP_BUILD_ERROR = -53,
00240
RTCP_BLD_LEN_ERR = -54
00241 };
00242
00243
#define RTCP_SSRC_NULL 0
00244
00245
00246
00247
00248
00249
00250 enum rtp_math
00251 {
00252
RTP_ABSOLUTE_INC = 0,
00253
RTP_INC = 1
00254 };
00255
00256
00257
00258
00259
00260
00261 enum rtp_sr_state
00262 {
00263
RTP_SR_HEARED = 80,
00264
RTP_SR_INVALID = 81,
00265
RTP_SR_OLD = 82,
00266
RTP_SR_ACTIVE = 83,
00267
RTP_SR_INACTIVE = 84
00268 };
00269
00270
00271
00272
00273
#define RTCP_SOURCE_TIMEOUT 360
00274
00275
00276
00277
00278
#define RTCP_INACTIVE_TIMEOUT 5
00279
00280
#define RTP_CSRC_MAX 15
00281
00282
#define RTP_BUFFERSIZE 8192
00283
#define RTCP_BUFFERSIZE 4096
00284
#define RTCP_MAX_TU 2048
00285
00286
#define SDES_PRIO_MIN 1
00287
#define SDES_PRIO_MAX 20
00288
00289
00290
00291
00292
#define RTCP_MIN_TIME 1
00293
#define RTCP_SENDER_BW_FRACTION 0.25
00294
#define RTCP_RECV_BW_FRACTION (1-RTCP_SENDER_BW_FRACTION)
00295
#define RTCP_SIZE_GAIN (1. / 16.)
00296
#define UDP_OVER_IP_SIZE 28
00297
00298
00299
00300
00301
00302
#undef DEBUGJ
00303
#ifdef DEBUGJ
00304
00305
#define DEBUG_RTPBASE(a) cerr << __FILE__ << " , " << __LINE__ << ": " << a
00306
#define DEBUG_RTP(a) cerr << __FILE__ << ", " << __LINE__ << ": " << a
00307
#define DEBUG_RTP_SEND(a) cerr << __FILE__ << ", " << __LINE__ << ": " << a
00308
#define DEBUG_RTP_RECV(a) cerr << __FILE__ << ", " << __LINE__ << ": " << a
00309
#define DEBUG_RTCP(a) cerr << __FILE__ << ", " << __LINE__ << ": " << a
00310
#define DEBUG_LIST(a) cerr << __FILE__ << ", " << __LINE__ << ": " << a
00311
#define DEBUG_RTCP_SEND(a) cerr << __FILE__ << ", " << __LINE__ << ": " << a
00312
#define DEBUG_RTCP_RECV(a) cerr << __FILE__ << ", " << __LINE__ << ": " << a
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
#else
00340
00341
00342
#define DEBUG_RTPBASE(a)
00343
#define DEBUG_RTP(a)
00344
#define DEBUG_RTP_SEND(a)
00345
#define DEBUG_RTP_RECV(a)
00346
#define DEBUG_RTCP(a)
00347
#define DEBUG_LIST(a)
00348
#define DEBUG_RTCP_SEND(a)
00349
00350
#endif
00351
00352
#define DEBUG_RTCP_RECV(a) cerr << __FILE__ << ", " << __LINE__ << ": " << a
00353
00354
#endif
00355
Generated on Sun Mar 6 13:35:49 2005 for Komssys by
1.3.8