TeamTalk 5 C-API DLL Version 5.18A

Functions
TeamTalk Server API

Instantiate and run a TeamTalk server. More...

## Functions

TEAMTALKDLL_API TTBOOL | TTS_SetEncryptionContext (IN TTSInstance *lpTTSInstance, IN const TTCHAR *szCertificateFile, IN const TTCHAR *szPrivateKeyFile)
| Set certificate and private key for encrypted server. More...
TEAMTALKDLL_API TTBOOL | TTS_SetEncryptionContextEx (IN TTSInstance *lpTTSInstance, const EncryptionContext *lpEncryptionContext)
| Set up encryption context for encrypted server. More...
TEAMTALKDLL_API TTSInstance * | TTS_InitTeamTalk ()
| Create new TeamTalk server instance. More...
TEAMTALKDLL_API TTBOOL | TTS_CloseTeamTalk (IN TTSInstance *lpTTSInstance)
| Close TeamTalk server instance. More...
TEAMTALKDLL_API TTBOOL | TTS_RunEventLoop (IN TTSInstance *lpTTSInstance, IN INT32 *pnWaitMs)
| Run the server's event loop. More...
TEAMTALKDLL_API INT32 | TTS_SetChannelFilesRoot (IN TTSInstance *lpTTSInstance, IN const TTCHAR *szFilesRoot, IN INT64 nMaxDiskUsage, IN INT64 nDefaultChannelQuota)
| The root folder of where users should upload files to. More...
TEAMTALKDLL_API INT32 | TTS_UpdateServer (IN TTSInstance *lpTTSInstance, IN const ServerProperties *lpServerProperties)
| Set server properties. More...
TEAMTALKDLL_API INT32 | TTS_MakeChannel (IN TTSInstance *lpTTSInstance, IN const Channel *lpChannel)
| Make new channel. More...
TEAMTALKDLL_API INT32 | TTS_UpdateChannel (IN TTSInstance *lpTTSInstance, IN const Channel *lpChannel)
| Update an existing channel. More...
TEAMTALKDLL_API INT32 | TTS_RemoveChannel (IN TTSInstance *lpTTSInstance, IN INT32 nChannelID)
| Remove a channel. More...
TEAMTALKDLL_API INT32 | TTS_AddFileToChannel (IN TTSInstance *lpTTSInstance, IN const TTCHAR *szLocalFilePath, IN const RemoteFile *lpRemoteFile)
| Add a file to an existing channel. More...
TEAMTALKDLL_API INT32 | TTS_RemoveFileFromChannel (IN TTSInstance *lpTTSInstance, IN const RemoteFile *lpRemoteFile)
| Remove a file from a channel. More...
TEAMTALKDLL_API INT32 | TTS_MoveUser (IN TTSInstance *lpTTSInstance, IN INT32 nUserID, IN const Channel *lpChannel)
| Move a user from one channel to another. More...
TEAMTALKDLL_API INT32 | TTS_SendTextMessage (IN TTSInstance *lpTTSInstance, const TextMessage *lpTextMessage)
| Send text message from server to clients. More...
TEAMTALKDLL_API TTBOOL | TTS_StartServer (IN TTSInstance *lpTTSInstance, IN const TTCHAR *szBindIPAddr, IN UINT16 nTcpPort, IN UINT16 nUdpPort, IN TTBOOL bEncrypted)
| Start server on specified IP-address and ports. More...
TEAMTALKDLL_API TTBOOL | TTS_StartServerSysID (IN TTSInstance *lpTTSInstance, IN const TTCHAR *szBindIPAddr, IN UINT16 nTcpPort, IN UINT16 nUdpPort, IN TTBOOL bEncrypted, IN const TTCHAR *szSystemID)
| Same as TTS_StartServer() but with the option of specifying a system-ID. More...
TEAMTALKDLL_API TTBOOL | TTS_StopServer (IN TTSInstance *lpTTSInstance)
| Stop server and drop all users. More...

## Detailed Description

Instantiate and run a TeamTalk server.

The Professional Edition of the TeamTalk SDK includes a header file called `TeamTalkSrv.h` which exposes the TeamTalk server API.

To create a TeamTalk server instance first call TTS_InitTeamTalk(). If the server should be encrypted then call TTS_SetEncryptionContext() prior to the instantiation, since the SSL context must be available before instantiation of the server.

Next configure the server instance by calling TTS_UpdateServer(). Remember to set all properties of ServerProperties. Also create a root channel by calling TTS_MakeChannel(). If there is no root channel then the server will not start. Finally call TTS_StartServer() to start the server. Now you must continuesly call TTS_RunEventLoop() to run the server event loop.

The TeamTalk server API is able to do callbacks when users perform certain events. There are two types of callbacks, one is Server Notification Callbacks and the other is Server Request Callbacks where the server is asking the server application on what to return to the user (a ClientErrorMsg is provided by the server API which will be returned to the user).

To see a simple example application of a TeamTalk server check out TeamTalk C++ Server Example (TeamTalkServer).

## Function Documentation

## ◆ TTS_SetEncryptionContext()

TEAMTALKDLL_API TTBOOL TTS_SetEncryptionContext | ( | IN TTSInstance * | lpTTSInstance,
|  | IN const TTCHAR * | szCertificateFile,
|  | IN const TTCHAR * | szPrivateKeyFile
| ) |  |

Set certificate and private key for encrypted server.

The encrypted server's certificate and private key must be set prior to starting the server using TTS_StartServer().

Look in TeamTalk Server Setup Guide on how to generate the certificate and private key file using OpenSSL.

Note that this encryption option doesn't set up a certificate authority for verifying peers connecting to the server. To verify this use TTS_SetEncryptionContextEx().

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  szCertificateFile | Path to server's certificate file.
  szPrivateKeyFile | Path to server's private key file.

See also
  TTS_SetEncryptionContextEx()

## ◆ TTS_SetEncryptionContextEx()

TEAMTALKDLL_API TTBOOL TTS_SetEncryptionContextEx | ( | IN TTSInstance * | lpTTSInstance,
|  | const EncryptionContext * | lpEncryptionContext
| ) |  |

Set up encryption context for encrypted server.

The encryption context for the server must be set prior to starting the server using TTS_StartServer().

Minimal requirements for the encryption context is to set certificate and private key.

Look in TeamTalk Server Setup Guide on how to generate the certificate and private key file using OpenSSL.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  lpEncryptionContext | The encryption context for the server, i.e. server certificate, private key and optionally certificate authority.

See also
  TTS_SetEncryptionContextEx()

## ◆ TTS_InitTeamTalk()

TEAMTALKDLL_API TTSInstance* TTS_InitTeamTalk | ( |  | ) |

Create new TeamTalk server instance.

Once server instance is created call TTS_UpdateServer() to set the server's properties followed by TTS_MakeChannel() to create the root channel.

    * NOTE: AT THE MOMENT CALL TTS_SetEncryptionContext() BEFORE
    * CREATING THE SERVER INSTANCE, TTS_InitTeamTalk(). JUST PASS 0
    * AS lpTTSInstance. IN OTHER WORDS ONLY ONE ENCRYPTION CONTEXT IS
    * SUPPORTED AT THE MOMENT.
    *

See also
  TTS_StartServer()

## ◆ TTS_CloseTeamTalk()

TEAMTALKDLL_API TTBOOL TTS_CloseTeamTalk | ( | IN TTSInstance * | lpTTSInstance | ) |

Close TeamTalk server instance.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().

See also
  TTS_InitTeamTalk()
  TTS_StartServer()

## ◆ TTS_RunEventLoop()

TEAMTALKDLL_API TTBOOL TTS_RunEventLoop | ( | IN TTSInstance * | lpTTSInstance,
|  | IN INT32 * | pnWaitMs
| ) |  |

Run the server's event loop.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  pnWaitMs | The amount of time to wait for the event. If NULL or -1 the function will block forever or until the next event occurs.

Returns
  Returns TRUE if an event has occured otherwise FALSE.

See also
  TTS_InitTeamTalk()

## ◆ TTS_SetChannelFilesRoot()

TEAMTALKDLL_API INT32 TTS_SetChannelFilesRoot | ( | IN TTSInstance * | lpTTSInstance,
|  | IN const TTCHAR * | szFilesRoot,
|  | IN INT64 | nMaxDiskUsage,
|  | IN INT64 | nDefaultChannelQuota
| ) |  |

The root folder of where users should upload files to.

The root file folder cannot be changed after the server has been started.

Ensure to set USERRIGHT_UPLOAD_FILES and USERRIGHT_DOWNLOAD_FILES in user's UserAccount.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  szFilesRoot | Directory where to store uploaded files.
  nMaxDiskUsage | The maximum number of bytes which can be used for file storage.
  nDefaultChannelQuota | The number of bytes available to temporary channels (not CHANNEL_PERMANENT). This will be the value in Channel `nDiskQuota`.

Returns
  Error code from ClientError.

## ◆ TTS_UpdateServer()

TEAMTALKDLL_API INT32 TTS_UpdateServer | ( | IN TTSInstance * | lpTTSInstance,
|  | IN const ServerProperties * | lpServerProperties
| ) |  |

Set server properties.

Set server's properties, like e.g. maximum number of users, server name, etc.

Server properties must be set prior to starting a server.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  lpServerProperties | The server's properties which will be see by all users who log on to the server.

Returns
  Returns a ClientError.

See also
  TTS_StartServer()

## ◆ TTS_MakeChannel()

TEAMTALKDLL_API INT32 TTS_MakeChannel | ( | IN TTSInstance * | lpTTSInstance,
|  | IN const Channel * | lpChannel
| ) |  |

Make new channel.

Create a new channel on the server. Before starting a server using TTS_StartServer() the server MUST have a root channel. I.e. a Channel where `nParentID` is 0.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  lpChannel | The new channel to create.

Returns
  Returns a ClientError.

See also
  TTS_UpdateChannel()
  TTS_RemoveChannel()

## ◆ TTS_UpdateChannel()

TEAMTALKDLL_API INT32 TTS_UpdateChannel | ( | IN TTSInstance * | lpTTSInstance,
|  | IN const Channel * | lpChannel
| ) |  |

Update an existing channel.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  lpChannel | The updated channel properties. `nChannelID` and `nParentID` must remain the same.

Returns
  Returns a ClientError.

See also
  TTS_MakeChannel()
  TTS_RemoveChannel()

## ◆ TTS_RemoveChannel()

TEAMTALKDLL_API INT32 TTS_RemoveChannel | ( | IN TTSInstance * | lpTTSInstance,
|  | IN INT32 | nChannelID
| ) |  |

Remove a channel.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  nChannelID | The ID of the channel to remove.

Returns
  Returns a ClientError.

See also
  TTS_MakeChannel()
  TTS_UpdateChannel()

## ◆ TTS_AddFileToChannel()

TEAMTALKDLL_API INT32 TTS_AddFileToChannel | ( | IN TTSInstance * | lpTTSInstance,
|  | IN const TTCHAR * | szLocalFilePath,
|  | IN const RemoteFile * | lpRemoteFile
| ) |  |

Add a file to an existing channel.

Ensure to have set up file storage first using TTS_SetChannelFilesRoot(). Also ensure Channel's `nDiskQuota` is specified.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  szLocalFilePath | Path to file.
  lpRemoteFile | Properties of file to add.

Returns
  Command error code from ClientError.

See also
  TTS_SetChannelFilesRoot().
  TTS_MakeChannel()

## ◆ TTS_RemoveFileFromChannel()

TEAMTALKDLL_API INT32 TTS_RemoveFileFromChannel | ( | IN TTSInstance * | lpTTSInstance,
|  | IN const RemoteFile * | lpRemoteFile
| ) |  |

Remove a file from a channel.

Ensure to have set up file storage first using TTS_SetChannelFilesRoot(). Also ensure Channel's `nDiskQuota` is specified.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  lpRemoteFile | Properties of file to remove. Channel ID and file name is enough.

Returns
  Command error code from ClientError.

See also
  TTS_SetChannelFilesRoot().
  TTS_MakeChannel()

## ◆ TTS_MoveUser()

TEAMTALKDLL_API INT32 TTS_MoveUser | ( | IN TTSInstance * | lpTTSInstance,
|  | IN INT32 | nUserID,
|  | IN const Channel * | lpChannel
| ) |  |

Move a user from one channel to another.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  nUserID | The ID of the user to move.
  lpChannel | The channel the user should move to. If the channel already exists then simply set `nChannelID`. To make a user leave a channel set `nChannelID` to 0.

Returns
  Returns a ClientError.

See also
  TT_DoMoveUser()

## ◆ TTS_SendTextMessage()

TEAMTALKDLL_API INT32 TTS_SendTextMessage | ( | IN TTSInstance * | lpTTSInstance,
|  | const TextMessage * | lpTextMessage
| ) |  |

Send text message from server to clients.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  lpTextMessage | Text message to send. The message type determines how the message will be sent.

Returns
  Returns a ClientError.

See also
  TT_DoTextMessage()

## ◆ TTS_StartServer()

TEAMTALKDLL_API TTBOOL TTS_StartServer | ( | IN TTSInstance * | lpTTSInstance,
|  | IN const TTCHAR * | szBindIPAddr,
|  | IN UINT16 | nTcpPort,
|  | IN UINT16 | nUdpPort,
|  | IN TTBOOL | bEncrypted
| ) |  |

Start server on specified IP-address and ports.

Before starting a server the root channel must be created using TTS_MakeChannel().

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  szBindIPAddr | The IP-address to bind to.
  nTcpPort | The TCP port to bind to.
  nUdpPort | The UDP port to bind to.
  bEncrypted | If encryption is enabled then encryption context must be set prior to this call using TTS_SetEncryptionContext().

See also
  TTS_SetEncryptionContext()
  TTS_MakeChannel()

## ◆ TTS_StartServerSysID()

TEAMTALKDLL_API TTBOOL TTS_StartServerSysID | ( | IN TTSInstance * | lpTTSInstance,
|  | IN const TTCHAR * | szBindIPAddr,
|  | IN UINT16 | nTcpPort,
|  | IN UINT16 | nUdpPort,
|  | IN TTBOOL | bEncrypted,
|  | IN const TTCHAR * | szSystemID
| ) |  |

Same as TTS_StartServer() but with the option of specifying a system-ID.

Requires TeamTalk version 5.1.3.4506.

Parameters

  lpTTSInstance | Pointer to the server instance created by TTS_InitTeamTalk().
  szBindIPAddr | The IP-address to bind to.
  nTcpPort | The TCP port to bind to.
  nUdpPort | The UDP port to bind to.
  bEncrypted | If encryption is enabled then encryption context must be set prior to this call using TTS_SetEncryptionContext().
  szSystemID | The identification of the conferencing system. The default value is "teamtalk". See TT_ConnectSysID().

## ◆ TTS_StopServer()

TEAMTALKDLL_API TTBOOL TTS_StopServer | ( | IN TTSInstance * | lpTTSInstance | ) |

Stop server and drop all users.

See also
  TTS_StartServer()