Home Units Hierarchy Routines All identifiers

Class TunaConfRTPserver

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TunaConfRTPserver = class(unavclInOutPipe)

Description

RTP Conference server

Hierarchy

Overview

Methods

Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy(); override;
Public function roomAdd(const roomName: string; roomID: tRoomID = -1; ro: bool = true): unaConfRTProom;
Public function roomByIDAcquire(roomID: tRoomID; ro: bool = true; timeout: tTimeout = 100): unaConfRTProom;
Public function roomByIndexAcquire(index: int; ro: bool = true; timeout: tTimeout = 100): unaConfRTProom;
Public function roomByUserIDAcquire(userID: u_int32; ro: bool = true; timeout: tTimeout = 100): unaConfRTProom;
Public function roomDrop(roomID: tRoomID): HRESULT;
Public function roomGetName(roomID: tRoomID): wString;
Public function roomGetNumUsers(roomID: tRoomID): int;
Public function roomShutdown(roomID: tRoomID): HRESULT; overload;
Public function roomStartup(roomID: tRoomID): HRESULT;
Public function userAddAcquire(userID: u_int32; ro: bool = true): unaConfRTProomUser;
Public function userByIDAcquire(userID: u_int32; ro: bool = true; timeout: tTimeout = 100): unaConfRTProomUser;
Public function userByIndexAcquire(index: int; ro: bool = true; timeout: tTimeout = 100): unaConfRTProomUser;
Public function userDrop(userID: u_int32): HRESULT; overload;
Public function userDrop(user: unaConfRTProomUser): HRESULT; overload;
Public function userGetName(userID: u_int32; out cname: wString): bool;
Protected function doOpen(): bool; override;
Protected function doRead(data: pointer; len: uint): uint; override;
Protected function doUserVerify(userID: u_int32; roomID: tRoomID; const IP, port: string): HRESULT; virtual;
Protected function doWrite(data: pointer; len: uint; provider: pointer = nil): uint; override;
Protected function getAvailableDataLen(index: integer): uint; override;
Protected function isActive(): bool; override;
Protected function roomResolveName(const roomName: wString): int; virtual;
Protected function roomShutdown(room: unaConfRTProom; markClosed: bool = true): HRESULT; overload;
Protected procedure doClose(); override;
Protected procedure doConn(userID: u_int32; roomID: tRoomID; const IP, port: string; isConnected: bool); virtual;
Protected procedure doRoomAddRemove(roomID: tRoomID; doAdd: bool); virtual;
Protected procedure idle(); virtual;
Protected procedure sendSrvCmd(addr: PSockAddrIn; const cmd: aString; idata: int32; dataBuf: pointer = nil; dataBufSize: unsigned = 0);
Protected procedure transPacket(userID: u_int32; data: pointer; len: uint; const addr: sockaddr_in; isRTCP: bool);

Properties

Published property autoCreateRooms: boolean read f_acr write f_acr default true;
Published property autoRemoveRooms: boolean read f_arr write f_arr default true;
Published property bind2ip: string read f_bind2ip write f_bind2ip;
Public property errorCode: int read getErrorCode;
Public property lostTrans: int64 read f_lostTrans;
Public property masterKey: string write setMasterKey;
Published property onRoomAddRemove: evonRoomAddRemove read f_onRoomAddRemove write f_onRoomAddRemove;
Published property onUserConnect: evonUserConnect read f_onUC write f_onUC;
Published property onUserVerify: evonUserVerify read f_onUserVerify write f_onUserVerify;
Published property port: string read f_port write f_port;
Public property roomCount: int read getRoomCount2;
Public property rtcp: unaRTCPstack read getRTCP;
Published property serverName: string read f_srvName write f_srvName;
Public property SSRC: u_int32 read getSSRC;
Public property userAllow[ID:u_int32;isIn:bool]: bool read getUserAllow write setUserAllow;
Public property userCount: int read getUserCount2;
Published property userStrictlyInOneRoom: boolean read f_userSInOneRoom write f_userSInOneRoom default true;

Description

Methods

Public constructor Create(AOwner: TComponent); override;

Creates server component.

Public destructor Destroy(); override;

Destroys server component.

Public function roomAdd(const roomName: string; roomID: tRoomID = -1; ro: bool = true): unaConfRTProom;

Adds new room.

Public function roomByIDAcquire(roomID: tRoomID; ro: bool = true; timeout: tTimeout = 100): unaConfRTProom;
 
Public function roomByIndexAcquire(index: int; ro: bool = true; timeout: tTimeout = 100): unaConfRTProom;

Locks room by index.

Public function roomByUserIDAcquire(userID: u_int32; ro: bool = true; timeout: tTimeout = 100): unaConfRTProom;
 
Public function roomDrop(roomID: tRoomID): HRESULT;

Removes a room. All users from this room will be disconnected from server.

Public function roomGetName(roomID: tRoomID): wString;

Returns room name.

Parameters
roomID
room ID
Returns

room name

Public function roomGetNumUsers(roomID: tRoomID): int;
 
Public function roomShutdown(roomID: tRoomID): HRESULT; overload;

Closes a room. All users from this room will be disconnected from server.

Public function roomStartup(roomID: tRoomID): HRESULT;

Re-opens a room.

Public function userAddAcquire(userID: u_int32; ro: bool = true): unaConfRTProomUser;

Adds a new user and acquires a lock on user object. If object is acquired, make sure to call .releaseRO()/releaseWO() when done with it.

Returns

User object or nil if it cannot be acquired now.

Public function userByIDAcquire(userID: u_int32; ro: bool = true; timeout: tTimeout = 100): unaConfRTProomUser;

Acquires a lock on user object. If object is acquired, make sure to call .releaseRO()/releaseWO() when done with it.

Returns

User object or nil if it cannot be acquired now.

Public function userByIndexAcquire(index: int; ro: bool = true; timeout: tTimeout = 100): unaConfRTProomUser;

Acquires a lock on user object. If object is acquired, make sure to call .releaseRO()/releaseWO() when done with it.

Returns

User object or nil if it cannot be acquired now.

Public function userDrop(userID: u_int32): HRESULT; overload;

Removes user from server, user is disconnected.

Public function userDrop(user: unaConfRTProomUser): HRESULT; overload;

Removes user from server, user is disconnected.

Public function userGetName(userID: u_int32; out cname: wString): bool;

Returns user name.

Protected function doOpen(): bool; override;

Stratups the server.

Protected function doRead(data: pointer; len: uint): uint; override;

Does nothing.

Returns

0

Protected function doUserVerify(userID: u_int32; roomID: tRoomID; const IP, port: string): HRESULT; virtual;

Virifies if user is granted to join the room.

Protected function doWrite(data: pointer; len: uint; provider: pointer = nil): uint; override;

Does nothing.

Returns

0

Protected function getAvailableDataLen(index: integer): uint; override;

Does nothing.

Returns

0

Protected function isActive(): bool; override;
 
Returns

True if server is active (listening on ports)

Protected function roomResolveName(const roomName: wString): int; virtual;

Internal. Returns index.

Protected function roomShutdown(room: unaConfRTProom; markClosed: bool = true): HRESULT; overload;

Closes the room and disconnects all users joined to it.

Protected procedure doClose(); override;

Closes the server.

Protected procedure doConn(userID: u_int32; roomID: tRoomID; const IP, port: string; isConnected: bool); virtual;

Fired when new user is connected or old user is disconnected.

Protected procedure doRoomAddRemove(roomID: tRoomID; doAdd: bool); virtual;

Fired when new room is created or old room is removed.

Protected procedure idle(); virtual;

Fired from context of idle thread.

Protected procedure sendSrvCmd(addr: PSockAddrIn; const cmd: aString; idata: int32; dataBuf: pointer = nil; dataBufSize: unsigned = 0);

Sends a command to client.

Parameters
addr
Client address
cmd
Command to send
idata
Integer parameter
dataBuf
Optional data
dataBufSize
Size in bytes of data in dataBuf
Protected procedure transPacket(userID: u_int32; data: pointer; len: uint; const addr: sockaddr_in; isRTCP: bool);

Sends a packet to all users in a room.

Parameters
userID
Original sender
data
Packet data
len
Packet length
addr
Source address of sender
isRTCP
True for RTCP packet, false for RTP

Properties

Published property autoCreateRooms: boolean read f_acr write f_acr default true;

Automatically create rooms of users' request.

Published property autoRemoveRooms: boolean read f_arr write f_arr default true;

When set to true, causes server to remove rooms being abandoned for some time.

Published property bind2ip: string read f_bind2ip write f_bind2ip;

Bind to this IP. Use 0.0.0.0 to bind to all interfaces.

Public property errorCode: int read getErrorCode;

Last error code.

Public property lostTrans: int64 read f_lostTrans;

Number of audio/RTCP transmits being lost due to timeouts or other reasons

Public property masterKey: string write setMasterKey;

Server's master key. Not stored.

Published property onRoomAddRemove: evonRoomAddRemove read f_onRoomAddRemove write f_onRoomAddRemove;

Fired when new room is added or old room is removed

Published property onUserConnect: evonUserConnect read f_onUC write f_onUC;

Fired when new used is connected.

Published property onUserVerify: evonUserVerify read f_onUserVerify write f_onUserVerify;

Fired when new user is about to join the server

Published property port: string read f_port write f_port;

Listen on this UDP port. Port + 1 will be used for RTCP.

Public property roomCount: int read getRoomCount2;

Number of rooms.

Public property rtcp: unaRTCPstack read getRTCP;

Internal RTCP stack.

Published property serverName: string read f_srvName write f_srvName;

Name of server.

Public property SSRC: u_int32 read getSSRC;

Servers' SSRC

Public property userAllow[ID:u_int32;isIn:bool]: bool read getUserAllow write setUserAllow;

Controls users I/O.

Public property userCount: int read getUserCount2;

Number of users (in all rooms).

Published property userStrictlyInOneRoom: boolean read f_userSInOneRoom write f_userSInOneRoom default true;

When true one user can join one room at a time only. When false one user can participate in many rooms.

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09