TeamSpeak Server Functions

Enums

enum VirtualServerCreateFlags

Values:

enumerator VIRTUALSERVER_CREATE_FLAG_NONE

Server password is stored plaintext and will be encrypted by the server library before stored.

enumerator VIRTUALSERVER_CREATE_FLAG_PASSWORDS_ENCRYPTED

Server password is already encrypted in the creation parameters. Will be stored as is.

enum ChannelCreateFlags

Values:

enumerator CHANNEL_CREATE_FLAG_NONE

Channel password is stored plaintext and will be encrypted by the server library before stored.

enumerator CHANNEL_CREATE_FLAG_PASSWORDS_ENCRYPTED

Channel passwords are already encrypted in the creation parameters. Will be stored as is.

Functions

unsigned int ts3server_freeMemory(void *pointer)

Releases memory allocated by the server library.

For every function that has output parameters which take pointers to memory (e.g. char**) the server library will allocate sufficient memory for you, however you need to take care of releasing the memory by passing the variable to this function.

Parameters:
  • pointer – pointer to memory allocated by server library

unsigned int ts3server_initServerLib(const struct ServerLibFunctions *functionPointers, int usedLogTypes, const char *logFileFolder)

initializes the server library and defines callback functions

This is the first function you need to call, before this all calls to the server library will fail. In this call you will also set the functions you would like to have called when certain changes or events happen. This function must not be called multiple times.

Parameters:
  • functionPointers – defines which functions in your code are to be called on specific events. Zero initialize it and assign the desired function to call to the respective members of the ServerLibFunctions struct

  • usedLogTypes – a combination of values from the LogTypes enum. Specifies which type(s) of logging you would like to use.

  • logFileFolder – path in which to create log files. Pass 0 to use the default of using a folder called logs in the working directory.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_enableFileManager(const char *filebase, const char **ips, int port, uint64 downloadBandwidth, uint64 uploadBandwidth)

Initialize the file transfer subsystem. Allows clients to store files on the machine the server is running on and download them.

If you want to support file transfer functionality, then call this function after calling ts3server_initServerLib If you don’t call this function file transfer features will not be available. The server library will create the directories necessary for storing files as needed, however directories will not be cleaned up by the server library. Instead it is the responsibility of the application to clean up these directories when they’re no longer needed (e.g. after a virtual server was deleted)

Parameters:
  • filebase – path to where the server library will create necessary directories and store files uploaded by clients.

  • ips – zero terminated array of IP addresses to listen on for file transfer connections. IPv4 and IPv6 addresses are supported, do NOT pass host names. If set to 0, it will be treated as if you passed { “0.0.0.0”, “::”, 0 }

  • port – the TCP port to listen on for file transfer connections.

  • downloadBandwidth – limit in bytes per second which is available for downloading files from the server. Speed across all transfers will be limited to this number. Specify BANDWIDTH_LIMIT_UNLIMITED for no limit.

  • uploadBandwidth – limit in bytes per second which is available for uploading files to the server. Speed across all transfers will be limited to this number. Specify BANDWIDTH_LIMIT_UNLIMITED for no limit.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_destroyServerLib()

Destroys the server lib. Must not be called from within a callback.

All clients will lose connection and timeout, all servers will terminate. This is the last function to call. After this call you will no longer be able to use any server library functions.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_disableClientCommand(int clientCommand)

Prevents clients from performing certain actions. SDK only.

Use this to disable certain features for clients, e.g. deleting channels or moving clients so that the server has authority over these matters and is the only entity who can do so. To disable multiple commands, call this function once for each command you would like to disable for clients.

Parameters:
  • clientCommand – the command to disable. One of the values from the ClientCommand enum

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getServerLibVersion(char **result)

Retrieve the server version string.

Parameters:
  • result – address of a variable to receive the server version. Memory is allocated by the server library and must be freed by caller using ts3server_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getServerLibVersionNumber(uint64 *result)

Retrieve the server version number.

Parameters:
  • result – address of a variable to receive the server version number.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setLogVerbosity(enum LogLevel logVerbosity)

Specify which log messages to send to the ServerLibFunctions::onUserLoggingMessageEvent callback.

Parameters:
  • logVerbosity – Minimum verbosity of a log message to pass to the callback. One of the values from the LogLevel enum.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getGlobalErrorMessage(unsigned int globalErrorCode, char **result)

get a human readable error description string for an error code

Parameters:
  • globalErrorCode – the error code to retrieve the description for. One of the values from the Ts3ErrorType enum.

  • result – address of a variable to receive the error description as a utf8 encoded c string. Memory is allocated by the server library and must be freed by caller using ts3server_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getClientVariableAsInt(uint64 serverID, anyID clientID, enum ClientProperties flag, int *result)

get the value of a client variable as integer.

Not all variables are available as integer, some are only available as string or unsigned 64 bit integer.

Parameters:
  • serverID – specifies the server the client is on

  • clientID – which client to query

  • flag – specifies which variable to retrieve. One of the values from the ClientProperties enum.

  • result – address of a variable to receive the value of the variable queried.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getClientVariableAsUInt64(uint64 serverID, anyID clientID, enum ClientProperties flag, uint64 *result)

get the value of a client variable as unsigned 64 bit integer.

Not all variables are available as unsigned 64 bit integer, some are only available as string or integer.

Parameters:
  • serverID – specifies the server the client is on

  • clientID – which client to query

  • flag – specifies which variable to retrieve. One of the values from the ClientProperties enum.

  • result – address of a variable to receive the value of the variable queried.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getClientVariableAsString(uint64 serverID, anyID clientID, enum ClientProperties flag, char **result)

get the value of the client variable as string

Not all variables are available as string, some are only available as unsigned 64 bit integer or integer.

Parameters:
  • serverID – specifies the server the client is on

  • clientID – which client to query

  • flag – specifies which variable to retrieve. One of the values from the ClientProperties enum.

  • result – address of a variable to receive the value of the variable queried.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setClientVariableAsInt(uint64 serverID, anyID clientID, enum ClientProperties flag, int value)

set the value of a client variable.

Not all variables can be set as integer.

Parameters:
  • serverID – specifies the server the client is on

  • clientID – which client to query

  • flag – specifies which variable to retrieve. One of the values from the ClientProperties enum.

  • value – the new value to set

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setClientVariableAsUInt64(uint64 serverID, anyID clientID, enum ClientProperties flag, uint64 value)

set the value of a client variable.

Not all variables can be set as unsigned 64 bit integer.

Parameters:
  • serverID – specifies the server the client is on

  • clientID – which client to query

  • flag – specifies which variable to retrieve. One of the values from the ClientProperties enum.

  • value – the new value to set

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setClientVariableAsString(uint64 serverID, anyID clientID, enum ClientProperties flag, const char *value)

set the value of a client variable.

Not all variables can be set as string.

Parameters:
  • serverID – specifies the server the client is on

  • clientID – which client to query

  • flag – specifies which variable to retrieve. One of the values from the ClientProperties enum.

  • value – the new value to set

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_flushClientVariable(uint64 serverID, anyID clientID)

Apply and publish client changes after setting client variables.

Parameters:
  • serverID – specifies the server the client is on

  • clientID – the client which we have changed variables for.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setClientWhisperList(uint64 serverID, anyID clID, const uint64 *channelID, const anyID *clientID)

set a clients whisper list. Will stop transmitting that clients voice to their current channel.

The client will still receive voice from their current channel, however their voice will not be transmitted to their current channel anymore. The voice data of the specified client will be transmitted to all specified channels and all the specified clients. Pass 0 to both channelID and clientID to restore default behavior of transmitting voice to current channel.

Parameters:
  • serverID – the server on which to set the whisper list

  • clID – the client for which to set the whisper list

  • channelID – zero terminated array of channel ids to add to the whisper list. Pass nullptr to reset. Like { 3, 94, 84, …, 0 }

  • clientID – zero terminated array of client ids to add to the whisper list. Pass nullptr to reset. Like { 1, 4, …, 0 }

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getClientList(uint64 serverID, anyID **result)

get a list of all clients connected to a server

Parameters:
  • serverID – specifies the server on which to get the list of clients

  • result – address of a variable to receive the zero terminated list of clients, like {1, 2, 50, …, 0} Memory is allocated by the server library and caller must free the array using ts3server_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getChannelOfClient(uint64 serverID, anyID clientID, uint64 *result)

get the id of the clients current channel

Parameters:
  • serverID – specifies the server the client is on

  • clientID – the client to get the channel of

  • result – address of a variable to receive the channel id

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_clientMove(uint64 serverID, uint64 newChannelID, const anyID *clientIDArray)

Move one or more clients to a different channel.

Parameters:
  • serverID – specifies the server the client is connected to

  • newChannelID – the id of the channel to move the client(s) to

  • clientIDArray – zero terminated array of client ids to move. Like {4, 9, …, 0}

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_clientsKickFromServer(uint64 serverID, const anyID *clientIDArray, const char *kickReason, int failOnClientError)

kick one or more clients from the server, terminating their connection.

Parameters:
  • serverID – the server the client(s) are connected to

  • clientIDArray – zero terminated array of client ids to kick. Like {4, 3, 12, …, 0}

  • kickReason – utf8 encoded c string describing the reason for the kick. Pass an empty string if unused.

  • failOnClientError – boolean flag. If 1 the function will fail if clients to be kicked are not on the server.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getClientIDSfromUIDS(uint64 serverID, const char **clientUIDs, anyID **result)

get a list of clients that are using one of the specified public identities

Parameters:
  • serverID – the server to check for clients on

  • clientUIDs – address of a zero terminated array containing the client unique identifiers to find client ids for. Like { “uid1”, “uid2”, …, ‘@0’ }

  • result – address of a variable to receive the client ids using any of the supplied unique identifiers. Memory is allocated by the server library and caller must free the array using ts3server_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getChannelVariableAsInt(uint64 serverID, uint64 channelID, enum ChannelProperties flag, int *result)

get value of a channel variable as integer.

Not all variables are available as integer, some are only available as string or unsigned 64 bit integer.

Parameters:
  • serverID – specifies the server the channel is located on

  • channelID – the id of the channel to get the variable for

  • flag – specifies which variable to retrieve. One of the values from the ChannelProperties enum

  • result – address of a variable to receive the value of the queried variable.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getChannelVariableAsUInt64(uint64 serverID, uint64 channelID, enum ChannelProperties flag, uint64 *result)

get value of a channel variable as unsigned 64 bit integer.

Not all variables are available as unsigned 64 bit integer, some are only available as string or integer.

Parameters:
  • serverID – specifies the server the channel is located on

  • channelID – the id of the channel to get the variable for

  • flag – specifies which variable to retrieve. One of the values from the ChannelProperties enum

  • result – address of a variable to receive the value of the queried variable.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getChannelVariableAsString(uint64 serverID, uint64 channelID, enum ChannelProperties flag, char **result)

get value of a channel variable as string.

Not all variables are available as string, some are only available as integer or unsigned 64 bit integer.

Parameters:
  • serverID – specifies the server the channel is located on

  • channelID – the id of the channel to get the variable for

  • flag – specifies which variable to retrieve. One of the values from the ChannelProperties enum

  • result – address of a variable to receive the value of the queried variable. Memory is allocated by the server library and caller must free it using ts3server_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setChannelVariableAsInt(uint64 serverID, uint64 channelID, enum ChannelProperties flag, int value)

set the variable of a channel to a new value.

Call ts3server_flushChannelVariable after having set all variables you need to change.

Parameters:
  • serverID – specifies the server the channel is located on

  • channelID – specifies the channel on which to change the variable

  • flag – specifies which variable to change. One of the values from the ChannelProperties enum

  • value – the new value to set

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setChannelVariableAsUInt64(uint64 serverID, uint64 channelID, enum ChannelProperties flag, uint64 value)

set a channel variable

Call ts3server_flushChannelVariable after having set all variables you need to change.

Parameters:
  • serverID – the server on which the channel is located

  • channelID – the id of the channel to set the variable for

  • flag – specifies which variable to set. One of the values from the ChannelProperties enum

  • value – the new value to set

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setChannelVariableAsString(uint64 serverID, uint64 channelID, enum ChannelProperties flag, const char *value)

Call ts3server_flushChannelVariable after having set all variables you need to change.

Parameters:
  • serverID – the server on which the channel is located

  • channelID – the id of the channel to set the variable for

  • flag – specifies which variable to set. One of the values from the ChannelProperties enum

  • value – the new value to set

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_flushChannelVariable(uint64 serverID, uint64 channelID)

After changing channel variables call this function to publish the changes to connected clients.

Parameters:
  • serverID – the server on which channels were edited

  • channelID – the channel which variables were changed

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_flushChannelCreation(uint64 serverID, uint64 channelParentID, uint64 *result)

After setting the channel properties on a new channel, call this function to publish the channel to clients.

Parameters:
  • serverID – the server on which to create the channel

  • channelParentID – the id of the parent channel for the new channel

  • result – address of a variable to receive the channel id of the newly created channel

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_makeChannelCreationParams(struct TS3ChannelCreationParams **result)

Create a structure that defines channel properties for use with ts3server_createChannel.

Parameters:
  • result – address of a variable to receive a pointer to the structure. Pointer must not be freed! After receiving the structure pointer, it must be filled using ts3server_setChannelCreationParams

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setChannelCreationParams(struct TS3ChannelCreationParams *channelCreationParams, uint64 channelParentID, uint64 channelID)

Specify mandatory details of a channel to be created at server creation using ts3server_createVirtualServer2.

Must be called after ts3server_getVirtualServerCreationParamsChannelCreationParams to set basic properties of a channel. After this call you may set additional channel properties by calling ts3server_getChannelCreationParamsVariables and ts3server_setVariableAsInt, ts3server_setVariableAsUInt64 or ts3server_setVariableAsString

Parameters:
  • channelCreationParams – defines the channel for which we set basic properties. Obtained by calling ts3server_getVirtualServerCreationParamsChannelCreationParams

  • channelParentID – the id of the channel that this channel is a sub channel of. Pass 0 to make this channel a root channel.

  • channelID – the id this channel should have. Pass 0 to have the server lib assign a free ID. This is used to identify the channel in other calls to the client and server library. Must be unique across all virtual servers during the lifetime of the server library.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getChannelCreationParamsVariables(struct TS3ChannelCreationParams *channelCreationParams, struct TS3Variables **result)

Allows settings optional channel properties for channels to be created either at server creation using ts3server_createVirtualServer2 or using ts3server_createChannel.

Parameters:
Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_createChannel(uint64 serverID, struct TS3ChannelCreationParams *channelCreationParams, enum ChannelCreateFlags flags, uint64 *result)

create a new channel on an existing virtual server.

Parameters:
  • serverID – the server on which to create the channel.

  • channelCreationParams – defines channel properties. Address of the structure obtained by calling ts3server_makeChannelCreationParams Must have been filled using ts3server_setChannelCreationParams before this call.

  • flags – defines how certain information is presented in the channelCreationParams. Combination of the values from the ChannelCreateFlags enum

  • result – address of a variable to receive the channel id of the newly created channel.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getChannelList(uint64 serverID, uint64 **result)

list all channels on the server

Parameters:
  • serverID – the server to get the list of channels on

  • result – address of a variable to receive a zero terminted array of channel ids. Like {4, 65, 23, …, 0} Memory is allocated by the server library and caller must free the array using ts3server_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getChannelClientList(uint64 serverID, uint64 channelID, anyID **result)

get list of clients in a channel

Parameters:
  • serverID – the server on which the channel is located

  • channelID – the channel of which to get the list of clients

  • result – address of a variable to receive a zero terminated array of client ids in the channel. Like {3, 5, 39, …, 0} Memory is allocated by the server library and caller must free the array using ts3server_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getParentChannelOfChannel(uint64 serverID, uint64 channelID, uint64 *result)

get the parent channel of a channel

Parameters:
  • serverID – the server on which the channel is located

  • channelID – the channel of which to get the parent channel

  • result – address of a variable to receive the parent channel id

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_channelDelete(uint64 serverID, uint64 channelID, int force)

delete a channel

Parameters:
  • serverID – the server on which the channel is located

  • channelID – the id of the channel to delete

  • force – boolean flag, 1 = delete even if there are clients or sub channels in the channel. 0 = fail if there are sub channels or clients in the channel or sub channels.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_channelMove(uint64 serverID, uint64 channelID, uint64 newChannelParentID, uint64 newOrder)

move a channel within the tree, make it a sub channel or root channel.

Parameters:
  • serverID – the server on which to move a channel

  • channelID – the channel to move

  • newChannelParentID – id of the parent channel to move this channel into. Set to 0 to make this channel a root channel.

  • newOrder – id of the channel below which this channel is to be sorted.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getVirtualServerVariableAsInt(uint64 serverID, enum VirtualServerProperties flag, int *result)

get the value of a server variable

Parameters:
  • serverID – the server of which to get a variable value

  • flag – specifies for which variable to get the value. One of the values from the VirtualServerProperties enum

  • result – address of a variable to receive the result

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getVirtualServerVariableAsUInt64(uint64 serverID, enum VirtualServerProperties flag, uint64 *result)

get the value of a server variable

Parameters:
  • serverID – the server of which to get a variable value

  • flag – specifies for which variable to get the value. One of the values from the VirtualServerProperties enum

  • result – address of a variable to receive the result.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getVirtualServerVariableAsString(uint64 serverID, enum VirtualServerProperties flag, char **result)

get the value of a server variable

Parameters:
  • serverID – the server of which to get a variable value

  • flag – specifies for which variable to get the value. One of the values from the VirtualServerProperties enum

  • result – address of a variable to receive a utf8 encoded c string containing the value. Memory is allocated by the server library and must be freed by the caller using ts3server_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setVirtualServerVariableAsInt(uint64 serverID, enum VirtualServerProperties flag, int value)

set a new value for a server variable

After you’re done setting all the variables you need to change, a call to ts3server_flushVirtualServerVariable is necessary to publish the changes

Parameters:
  • serverID – specifies which server to set the variable on

  • flag – specifies which server variable to set. One of the values from the VirtualServerProperties enum

  • value – the new value to set

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setVirtualServerVariableAsUInt64(uint64 serverID, enum VirtualServerProperties flag, uint64 value)

set a new value for a server variable

After you’re done setting all the variables you need to change, a call to ts3server_flushVirtualServerVariable is necessary to publish the changes

Parameters:
  • serverID – specifies which server to set the variable on

  • flag – specifies which server variable to set. One of the values from the VirtualServerProperties enum

  • value – the new value to set

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setVirtualServerVariableAsString(uint64 serverID, enum VirtualServerProperties flag, const char *value)

set a new value for a server variable

After you’re done setting all the variables you need to change, a call to ts3server_flushVirtualServerVariable is necessary to publish the changes

Parameters:
  • serverID – specifies which server to set the variable on

  • flag – specifies which server variable to set. One of the values from the VirtualServerProperties enum

  • value – the new value to set

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_flushVirtualServerVariable(uint64 serverID)

Publish server changes done through previous calls to ts3server_setVirtualServerVariableAsInt, ts3server_setVirtualServerVariableAsString, ts3server_setVirtualServerVariableAsUInt64.

Parameters:
  • serverID – the server you previously called setVirtualServerVariableAs functions

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_makeVirtualServerCreationParams(struct TS3VirtualServerCreationParams **result)

Creates a structure to define an entire virtual server including the channel layout for server creation for use with ts3server_createVirtualServer2.

This is the first function to call when using the ts3server_createVirtualServer2 meachanism of creating virtual servers in one go, including all of their channels. After receiving the structure using this function, you need to call ts3server_setVirtualServerCreationParams to set basic configuration for this virtual server. Once that is done you can set additional parameters using ts3server_getVirtualServerCreationParamsVariables and ts3server_setVariableAsInt, ts3server_setVariableAsUInt64 or ts3server_setVariableAsString

Parameters:
  • result – address of a variable to receive a pointer to a structure defining the virtual server. This must be filled using ts3server_setVirtualServerCreationParams after this. Pointer must not be freed by caller.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setVirtualServerCreationParams(struct TS3VirtualServerCreationParams *virtualServerCreationParams, unsigned int serverPort, const char *serverIp, const char *serverKeyPair, unsigned int serverMaxClients, unsigned int channelCount, uint64 serverID)

Set mandatory server creation properties for server creation using ts3server_createVirtualServer2.

This call is mandatory after calling ts3server_makeVirtualServerCreationParams when using ts3server_createVirtualServer2 and sets the basic information to create a virtual server. After this call you can optionally set other variables by calling ts3server_getVirtualServerCreationParamsVariables after this.

Parameters:
  • virtualServerCreationParams – pointer to a struct of creation parameters obtained by calling ts3server_makeVirtualServerCreationParams

  • serverPort – the UDP port to listen for client connections on

  • serverIp – comma separated list of IP address(es) to listen for client connections on. IPv4 and IPv6 addresses are supported.

  • serverKeyPair – unique key for encryption. Pass an empty string when originally creating a new server, query the generated encryption key with ts3server_getVirtualServerKeyPair, store it and use it on subsequent start ups.

  • serverMaxClients – maximum number of clients that can be connected simultaneously at any given time

  • channelCount – the amount of channels this server will have after creation. You must call ts3server_getVirtualServerCreationParamsChannelCreationParams with this virtualServerCreationParams exactly this many times.

  • serverID – the id this virtual server will have when created. server id must be unique during life time of the server library.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getVirtualServerCreationParamsVariables(struct TS3VirtualServerCreationParams *virtualServerCreationParams, struct TS3Variables **result)

create struct to define optional server settings for server creation with ts3server_createVirtualServer2

Parameters:
Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getVirtualServerCreationParamsChannelCreationParams(struct TS3VirtualServerCreationParams *virtualServerCreationParams, unsigned int channelIdx, struct TS3ChannelCreationParams **result)

Used to specify channels to create during advanced server creation using ts3server_createVirtualServer2.

Call this function exactly as often as you indicated channels to be created in the ts3server_setVirtualServerCreationParams call. Once you have received the struct you must set the details using ts3server_setChannelCreationParams and can optionally set additional parameters using ts3server_getChannelCreationParamsVariables to get a structure to fill using ts3server_setVariableAsInt, ts3server_setVariableAsString, ts3server_setVariableAsUInt64

Parameters:
Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_createVirtualServer2(struct TS3VirtualServerCreationParams *virtualServerCreationParams, enum VirtualServerCreateFlags flags, uint64 *result)

Create an entire server structure in a single call. Useful for restoring an entire virtual server including channels including their ids after storing them on shutdown. See the SDK documentation for more in depth information.

This requires a few other calls to be made in advance. First you need to call ts3server_makeVirtualServerCreationParams to get a TS3VirtualServerCreationParams struct that then needs to be filled via ts3server_setVirtualServerCreationParams. You can then use ts3server_getVirtualServerCreationParamsVariables to set other server settings and use ts3server_getVirtualServerCreationParamsChannelCreationParams to specify channels to create using ts3server_setChannelCreationParams.

Parameters:
  • virtualServerCreationParams – pointer to the server parameters obtained by calling ts3server_makeVirtualServerCreationParams. These must have been filled using ts3server_setVirtualServerCreationParams before calling this function.

  • flags – defines how certain information is present in the virtualServerCreationParams. Combination of the values from the VirtualServerCreateFlags enum

  • result – address of a variable to receive the created servers id. This is used in other calls to the server library to identify this server.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getVirtualServerConnectionVariableAsUInt64(uint64 serverID, enum ConnectionProperties flag, uint64 *result)

get value of server connection properties as unsigned integer.

Parameters:
  • serverID – which server to get connection properties of

  • flag – specifies which property to get the value of. One of the values from the ConnectionProperties enum

  • result – address of a variable to receive the value of the connection property

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getVirtualServerConnectionVariableAsDouble(uint64 serverID, enum ConnectionProperties flag, double *result)

get value of server connection properties as double

Parameters:
  • serverID – which server to get connection properties of

  • flag – specifies which value to get. One of the values from the ConnectionProperties enum

  • result – address of a variable to receive the value of the connection property.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getVirtualServerList(uint64 **result)

get a list of virtual servers in this instance

Parameters:
  • result – address of a variable to receive a zero terminated array of virtual server ids. Like {4, 8, …, 0} Memory is allocated by the server library and caller must free the array using ts3server_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_stopVirtualServer(uint64 serverID)

deletes a virtual server. All clients will be disconnected and no more connections are accepted. You need to recreate the server using ts3server_createVirtualServer or ts3server_createVirtualServer2 to make it available again.

You may want to save the state of the virtual server if you need persistence.

Parameters:
  • serverID – specifies which server to stop

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_createVirtualServer(unsigned int serverPort, const char *serverIp, const char *serverName, const char *serverKeyPair, unsigned int serverMaxClients, uint64 *result)

create a new virtual server. The server is started automatically after being created.

Parameters:
  • serverPort – the UDP port to listen for client connections on

  • serverIp – comma separated list of IP address(es) to listen for client connections on. IPv4 and IPv6 addresses are supported.

  • serverName – display name of the server.

  • serverKeyPair – Key pair for encryption. Must be unique for each virtual server. Pass an empty string when originally creating a new server, query the generated encryption key with ts3server_getVirtualServerKeyPair, store it and use it on subsequent start ups.

  • serverMaxClients – maximum number of clients that can be connected simultaneously at any given time

  • result – address of a variable that will receive the virtual server ID that can be used to specify this server in future calls to server library functions.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getVirtualServerKeyPair(uint64 serverID, char **result)

retrieve the encryption keys used by the virtual server.

Store these and use them on subsequent process startup to recreate this server when calling ts3server_createVirtualServer

Parameters:
  • serverID – the server for which to get the key pair.

  • result – address of a variable to receive a utf8 encoded c string containing the key pair. Memory is allocated by the server library and must be freed by caller using ts3server_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_createSecuritySalt(int options, void *salt, int saltByteSize, char **securitySalt)

Create a security salt to lock channel to identities. See the :ref:SDK Documentation<channel_security_salt> on the topic for more in depth explanation.

Parameters:
  • options – specifies which parameters to include in the security salt. A combination of values from the SecuritySaltOptions enum.

  • salt – pointer to random data of cryptographic quality.

  • saltByteSize – number of bytes of random data to use. Larger is better but slower.

  • securitySalt – address of a variable to receive the security salt. Memory is allocated by the server library and needs to be freed by caller using ts3server_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_calculateSecurityHash(const char *securitySalt, const char *clientUniqueIdentifier, const char *clientNickName, const char *clientMetaData, char **securityHash)

create a hash for a specific client from a security salt to lock an identity to a channel. See the :ref:SDK Documentation<channel_security_salt> on the topic for more in depth explanation.

Parameters:
  • securitySalt – the security salt of a channel as generated by ts3server_createSecuritySalt

  • clientUniqueIdentifier – public identity of a client to generate a security hash for

  • clientNickName – nickname of the client to include in the hash if specified by the salt.

  • clientMetaData – meta data of the client to include in the hash if specified by the salt.

  • securityHash – address of a variable to receive the security hash. Memory is allocated by the server library and must be freed by caller using ts3server_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getVariableAsInt(struct TS3Variables *var, int flag, int *result)

get the value of a property of a server or channel when using ts3server_createVirtualServer2 or ts3server_createChannel

Not all properties are available as integer. Some are only available as string or unsigned 64 bit integer.

Parameters:
Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getVariableAsUInt64(struct TS3Variables *var, int flag, uint64 *result)

get the value of a property of a server or channel when using ts3server_createVirtualServer2 or ts3server_createChannel

Not all properties are available as unsigned 64 bit integer. Some are only available as string or integer.

Parameters:
Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_getVariableAsString(struct TS3Variables *var, int flag, char **result)

get the value of a property of a server or channel when using ts3server_createVirtualServer2 or ts3server_createChannel

Not all properties are available as string. Some are only available as unsigned 64 bit integer or integer.

Parameters:
Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setVariableAsInt(struct TS3Variables *var, int flag, int value)

set the value of a property of a server or channel when using ts3server_createVirtualServer2 or ts3server_createChannel

Not all properties are available as integer. Some are only available as string or unsigned 64 bit integer.

Parameters:
Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setVariableAsUInt64(struct TS3Variables *var, int flag, uint64 value)

set the value of a property of a server or channel when using ts3server_createVirtualServer2 or ts3server_createChannel

Not all properties are available as unsigned 64 bit integer. Some are only available as string or integer.

Parameters:
Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3server_setVariableAsString(struct TS3Variables *var, int flag, const char *value)

set the value of a property of a server or channel when using ts3server_createVirtualServer2 or ts3server_createChannel

Not all properties are available as string. Some are only available as unsigned 64 bit integer or integer.

Parameters:
Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

struct ServerLibFunctions
#include <serverlib.h>

Server callbacks. Zero initialize and set members to functions that are to be called when the event in question happens. Every callback you use should exit quickly to avoid stalling the server. If you need any expensive activity upon receiving callbacks, consider starting the activity in a new thread and allow the callback to exit quickly.

Public Members

void (*onVoiceDataEvent)(uint64 serverID, anyID clientID, unsigned char *voiceData, unsigned int voiceDataSize, unsigned int frequency)

called when audio data is received from any client. Allows access to audio data from any client.

Can be used to implement server side voice recording. Do not implement if you don’t need server side recording. Callback will be called for every client sending audio data, even if nobody can hear said client (e.g. alone in a channel).

Param serverID:

the server for which the callback was called

Param clientID:

the client which is sending audio data

Param voiceData:

pointer to the voice buffer. Must not be invalidated or otherwise tampered with.

Param voiceDataSize:

number of audio frames available in the buffer

Param frequency:

audio data sample rate

void (*onClientStartTalkingEvent)(uint64 serverID, anyID clientID)

called when a client starts talking

Param serverID:

the server for which the callback was called

Param clientID:

the client that started talking

void (*onClientStopTalkingEvent)(uint64 serverID, anyID clientID)

called when a client stops talking

Param serverID:

the server for which the callback was called

Param clientID:

the client that stopped talking

void (*onClientConnected)(uint64 serverID, anyID clientID, uint64 channelID, unsigned int *removeClientError)

called when a client connects

Param serverID:

the server for which the callback was called

Param clientID:

the client that connected

Param channelID:

the channel that the client connected to

Param removeClientError:

whether to allow the client on the server. Set the value to one of the values from the Ts3ErrorType enum if you want to reject the client.

void (*onClientDisconnected)(uint64 serverID, anyID clientID, uint64 channelID)

called when a client disconnects

Param serverID:

the server for which the callback was called

Param clientID:

the client that disconnected. The client is already gone by the time this callback is called. The client id cannot be used to query information.

Param channelID:

the channel that the client was in before disconnecting.

void (*onClientMoved)(uint64 serverID, anyID clientID, uint64 oldChannelID, uint64 newChannelID)

called when a client changed to a different channel by any means, including switching the channel themselves.

Param serverID:

the server for which the callback was called

Param clientID:

the client that switched to a different channel.

Param oldChannelID:

the previous channel the client was in.

Param newChannelID:

the current channel the client is in now.

void (*onChannelCreated)(uint64 serverID, anyID invokerClientID, uint64 channelID)

called when a channel has been created

Param serverID:

the server for which the callback was called

Param invokerClientID:

the id of the client that created the channel. 0 if the server created the channel.

Param channelID:

the id of the newly created channel.

void (*onChannelEdited)(uint64 serverID, anyID invokerClientID, uint64 channelID)

called when a channel has been edited

Param serverID:

the server for which the callback was called

Param invokerClientID:

the client that edited the channel. 0 if the server edited the channel.

Param channelID:

the channel that was edited

void (*onChannelDeleted)(uint64 serverID, anyID invokerClientID, uint64 channelID)

called when a channel was deleted

Param serverID:

the server for which the callback was called

Param invokerClientID:

client that deleted the channel. 0 if the server deleted the channel

Param channelID:

the id of the channel that was deleted. The channel is gone already by the time this callback is called and information about the channel is no longer available

void (*onServerTextMessageEvent)(uint64 serverID, anyID invokerClientID, const char *textMessage)

called when a server wide text message was sent

Param serverID:

the server for which the callback was called

Param invokerClientID:

the client that is sending the message

Param textMessage:

utf8 encoded c string containing the text of the message sent

void (*onChannelTextMessageEvent)(uint64 serverID, anyID invokerClientID, uint64 targetChannelID, const char *textMessage)

called when a channel text message was sent

Param serverID:

the server for which the callback was called

Param invokerClientID:

the client that is sending the message

Param targetChannelID:

the channel in which the message is sent

Param textMessage:

utf8 encoded c string containing the message sent

void (*onUserLoggingMessageEvent)(const char *logmessage, int logLevel, const char *logChannel, uint64 logID, const char *logTime, const char *completeLogString)

when user logging was enabled when calling ts3server_initServerLib this callback is called whenever a message with at least the severity specified through ts3server_setLogVerbosity is supposed to be logged. Allows to customize logging and handle errors or critical log events.

Param logmessage:

utf8 encoded c string containing the message to be logged

Param logLevel:

the severity of the message that the callback is called for. One of the values from the LogLevel enum

Param logChannel:

utf8 encoded c string containing the arbitrary text used for grouping messages.

Param logID:

the server on which the message was logged

Param logTime:

utf8 encoded c string containing the time and date in system format the message was logged

Param completeLogString:

utf8 encoded c string containing all the previous parameters in a complete text string ready for logging.

void (*onAccountingErrorEvent)(uint64 serverID, unsigned int errorCode)

called when an error occurs with license checking.

Allows you to gracefully handle errors like a missing or expired license for example, while keeping the rest of your application running.

Param serverID:

the server on which the error occured. This server has been shut down automatically, other servers keep running. If this is 0 then all servers are affected by the error and have been shut down. In this case you may want to call ts3server_destroyServerLib to clean up resources.

Param errorCode:

the error that appeared. One of the values from the Ts3ErrorType enum. You can use ts3server_getGlobalErrorMessage to get a string representation for the error code.

void (*onCustomPacketEncryptEvent)(char **dataToSend, unsigned int *sizeOfData)

called when a packet needs to be encrypted to be sent over the wire.

Used to implement custom encryption of server communication. This needs to be implemented the same in the client and server, otherwise clients cannot communicate with the server. Only implement this callback when you need custom encryption.

Param dataToSend:

pointer to an array of bytes that need to be encrypted. Must not be freed. Encrypt the data in place in this array if the size of your encrypted data is smaller than indicated in the sizeOfData parameter. Otherwise allocate your own memory and replace the pointer to point to your own allocated memory. In this case you need to take care of freeing the memory.

Param sizeOfData:

size in byte of the dataToSend array.

void (*onCustomPacketDecryptEvent)(char **dataReceived, unsigned int *dataReceivedSize)

called when a packet needs to be decrypted after it has been received.

Used to implement custom encryption of server communication. This needs to be implemented the same in the client and server, otherwise clients cannot communicate with the server. Only implement this callback when you need custom encryption.

Param dataReceived:

pointer to an array of bytes that need to be decrypted. Must not be freed. Decrypt the data in place in this array if the size of your decrypted data is smaller than indicated by the dataReceivedSize parameter. Otherwise allocate your own memory and replace the pointer to point to your own allocated memory. In this case you need to take care of freeing the memory

Param dataReceivedSize:

size in byte of the dataReceived array.

void (*onFileTransferEvent)(const struct FileTransferCallbackExport *data)

called whenever a file transfer is done

Param data:

pointer to a structure describing the file transfer that completed. See FileTransferCallbackExport for details.

unsigned int (*permClientCanConnect)(uint64 serverID, const struct ClientMiniExport *client)

called when a client is about to connect. Can be used to deny clients from connecting.

Return ERROR_ok to allow the client on the server, or ERROR_permissions to reject the client.

Param serverID:

the server the client wants to connect to

Param client:

pointer to a ClientMiniExport describing the client trying to connect

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permClientCanGetChannelDescription)(uint64 serverID, const struct ClientMiniExport *client)

called when a client requests channel description of a channel using ts3client_requestChannelDescription. Can be used to deny access to channel descriptions.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server on which the request was received

Param client:

pointer to a ClientMiniExport describing the client requesting the channel description

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permClientUpdate)(uint64 serverID, anyID clientID, const struct VariablesExport *variables)

called when a client wants to update a clients variables. Used to deny or allow updating certain client variables

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param clientID:

the client for which the variables are attempted to be changed.

Param variables:

pointer to a VariablesExport containing the variables, new and old values of the client.

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permClientKickFromChannel)(uint64 serverID, const struct ClientMiniExport *client, int toKickCount, const struct ClientMiniExport *toKickClients, const char *reasonText)

called before a client is kicked from the channel. Allows you to control whether clients are allowed to kick another client

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

pointer to a ClientMiniExport describing the client attempting to kick another client.

Param toKickCount:

number of clients that are supposed to be kicked

Param toKickClients:

array of ClientMiniExport describing the clients to be kicked

Param reasonText:

utf8 encoded c string containing the reason for the kick provided.

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permClientKickFromServer)(uint64 serverID, const struct ClientMiniExport *client, int toKickCount, const struct ClientMiniExport *toKickClients, const char *reasonText)

called before a client is kicked from the server. Allows you to control whether clients are allowed to kick another client

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

pointer to a ClientMiniExport describing the client attempting to kick another client.

Param toKickCount:

number of clients that are supposed to be kicked

Param toKickClients:

array of ClientMiniExport describing the clients to be kicked

Param reasonText:

utf8 encoded c string containing the provided reason for the kick.

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permClientMove)(uint64 serverID, const struct ClientMiniExport *client, int toMoveCount, const struct ClientMiniExport *toMoveClients, uint64 newChannel, const char *reasonText)

called when a client requests to move one or more other clients. Allows you to control whether a client can move the clients.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server on which the move is attempted.

Param client:

pointer to a ClientMiniExport describing the client attempting to move the client(s).

Param toMoveCount:

number of clients that are being moved.

Param toMoveClients:

array of ClientMiniExport describing which clients are being moved.

Param newChannel:

id of the channel the clients are to be moved in to.

Param reasonText:

utf8 encoded c string containing the reason provided for the move.

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permChannelMove)(uint64 serverID, const struct ClientMiniExport *client, uint64 channelID, uint64 newParentChannelID)

called when a client attempts to move a channel. Allows you to control whether the client is allowed to move the channel.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

a ClientMiniExport describing the client attempting to move the channel.

Param channelID:

the channel to be moved.

Param newParentChannelID:

the new parent channel of the channel

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permSendTextMessage)(uint64 serverID, const struct ClientMiniExport *client, anyID targetMode, uint64 targetClientOrChannel, const char *textMessage)

called when a client tries to send a message. Allows you to control whether the client is allowed to send the message.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

a ClientMiniExport describing the client attempting to send the message

Param targetMode:

describing the type of message attempting to be sent. One of the values from the TextMessageTargetMode enum

Param targetClientOrChannel:

id of the channel or client (depending of the targetMode) that the message is sent to.

Param textMessage:

utf8 encoded c string containing the message to be sent.

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permServerRequestConnectionInfo)(uint64 serverID, const struct ClientMiniExport *client)

called when server connection information is requested using ts3client_requestServerConnectionInfo. Can be used to deny access.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

a ClientMiniExport describing the client requesting the action

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permSendConnectionInfo)(uint64 serverID, const struct ClientMiniExport *client, int *mayViewIpPort, const struct ClientMiniExport *targetClient)

called when a client attempts to request another clients connection variables using ts3client_requestConnectionInfo

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

describes the client requesting the other clients information

Param mayViewIpPort:

pointer to a variable that controls whether the IP and port of the target client may be seen by the client. Set to 1 to allow the requesting client to see the IP and port. Set to 0 to deny IP and port.

Param targetClient:

describes the client that the connection information is requested for.

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permChannelCreate)(uint64 serverID, const struct ClientMiniExport *client, uint64 parentChannelID, const struct VariablesExport *variables)

called when a client attempts to create a channel. Allows you to control whether or not the client may create the desired channel.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server on which the client attempts to create the channel

Param client:

a ClientMiniExport describing the client trying to create a channel

Param parentChannelID:

the channel that is the parent channel of the channel to be created. 0 if the channel to be created will be a root channel.

Param variables:

a VariablesExport struct that describes the channel to be created.

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permChannelEdit)(uint64 serverID, const struct ClientMiniExport *client, uint64 channelID, const struct VariablesExport *variables)

called when a channel is about to be edited by a client. Allows you to prevent channel edits.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

a ClientMiniExport describing the client trying to edit the channel

Param parentChannelID:

the channel that is to be edited.

Param variables:

a VariablesExport struct that describes the channel after the edit.

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permChannelDelete)(uint64 serverID, const struct ClientMiniExport *client, uint64 channelID)

called before a channel is deleted by a client. Allows you to deny a client deleting channels.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server on which the channel is to be deleted

Param client:

a ClientMiniExport describing the client trying to delete the channel

Param channelID:

the channel that is to be deleted

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permChannelSubscribe)(uint64 serverID, const struct ClientMiniExport *client, uint64 channelID)

called when a client requests to subscribe a channel. Allows you to deny subscribing to a channel.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server on which the client attempts to subscribe to the channel.

Param client:

a ClientMiniExport describing the client trying to subscribe the channel

Param channelID:

the channel that is to be subscribed

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permFileTransferInitUpload)(uint64 serverID, const struct ClientMiniExport *client, const struct ts3sc_ftinitupload *params)

called when a file is to be uploaded. Allows you to deny a client from uploading files, files above a certain size, etc.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

describes the client that attempts to upload the file.

Param params:

describes the file to be uploaded.

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permFileTransferInitDownload)(uint64 serverID, const struct ClientMiniExport *client, const struct ts3sc_ftinitdownload *params)

called when a file is to be downloaded. Allows you to deny a client from downloading files, files above a certain size, etc.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

describes the client that attempts to download the file

Param params:

describes the file to be downloaded.

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permFileTransferGetFileInfo)(uint64 serverID, const struct ClientMiniExport *client, const struct ts3sc_ftgetfileinfo *params)

called when a client requests file information using ts3client_requestFileInfo. Allows to deny clients from getting file information.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

describes the client attempting to get information of the file.

Param params:

describes the file that information is requested for.

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permFileTransferGetFileList)(uint64 serverID, const struct ClientMiniExport *client, const struct ts3sc_ftgetfilelist *params)

called when a client requests a directory listing using ts3client_requestFileList. Allows to deny listing files and directories in channels / directories.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permFileTransferDeleteFile)(uint64 serverID, const struct ClientMiniExport *client, const struct ts3sc_ftdeletefile *params)

called when a client attempts to delete one or more files using ts3client_requestDeleteFile. Allows denying clients deleting files.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

describes the client attempting to delete the file

Param params:

describes the file to be deleted

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permFileTransferCreateDirectory)(uint64 serverID, const struct ClientMiniExport *client, const struct ts3sc_ftcreatedir *params)

called when a directory is to be created using ts3client_requestCreateDirectory. Allows to deny creating certain directories.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

describes the client attempting to create the directory

Param params:

describes the directory to create.

Return:

ERROR_ok to allow, ERROR_permissions to deny

unsigned int (*permFileTransferRenameFile)(uint64 serverID, const struct ClientMiniExport *client, const struct ts3sc_ftrenamefile *params)

called when a file is to be renamed or moved using ts3client_requestRenameFile. Allows to deny moving files or even renaming files.

Return ERROR_ok to allow the action, or ERROR_permissions to reject it.

Param serverID:

the server for which the callback was called

Param client:

describes the client attempting to rename or move the file.

Param params:

describes the file to be renamed or moved, and where the file should be moved to if it’s being moved.

Return:

ERROR_ok to allow, ERROR_permissions to deny

void (*onClientPasswordEncrypt)(uint64 serverID, const char *plaintext, char *encryptedText, int encryptedTextByteSize)

called when a server or channel password is set.

Used to hash the password or encrypt it for check with outside sources.

Param serverID:

the server for which the callback was called

Param plaintext:

the plaintext password to be encrypted.

Param encryptedText:

the encrypted/hashed password. Fill with your encrypted password. Must be an utf8 encoded c string not larger than specified by encryptedTextByteSize

Param encryptedTextByteSize:

the maximum number of bytes you may write to encryptedText

unsigned int (*onTransformFilePath)(uint64 serverID, anyID invokerClientID, const struct TransformFilePathExport *original, struct TransformFilePathExportReturns *result)

Allows to rewrite the file path and name of the file to be transfered. Called when a transfer starts.

If you don’t need to control server side file name and path then don’t implement this callback. The parameters are already filled with the default values intended by the client starting the transfer. These can be changed as required. When the callback exits with ERROR_ok the transfer is started with the values present in the result struct.

See the SDK documentation for further details.

Param serverID:

the server for which the callback was called

Param invokerClientID:

the client which started the file transfer

Param original:

the original file path and name desired by the client

Param result:

the values from this struct will be used by the server when the callback exits. Already filled with a copy of original. Change the values in this struct as needed.

Return:

a value from the Ts3ErrorType enum. Return ERROR_ok to start the transfer with the values in the result struct. When returning an error code the file transfer is not started.

unsigned int (*onCustomServerPasswordCheck)(uint64 serverID, const struct ClientMiniExport *client, const char *password)

called when a client connects to the server. Used to verify the server password when using custom password encryption.

Param serverID:

the server for which the callback was called

Param client:

describes the client that connects to the server

Param password:

utf8 encoded c string containing the password provided by the client.

Return:

a value from the Ts3ErrorType enum. ERROR_ok if the password is valid, ERROR_server_invalid_password if the password is not valid, ERROR_parameter_invalid if the password is in invalid format.

unsigned int (*onCustomChannelPasswordCheck)(uint64 serverID, const struct ClientMiniExport *client, uint64 channelID, const char *password)

called when a client attempts to enter a password protected channel. Used to verify the channel password when using custom password encryption.

Param serverID:

the server for which the callback was called

Param client:

describes the client that enters a channel

Param channelID:

the channel the client attempts to join

Param password:

utf8 encoded c string containing the password provided by the client.

Return:

a value from the Ts3ErrorType enum. ERROR_ok if the password is valid, ERROR_server_invalid_password if the password is not valid, ERROR_parameter_invalid if the password is in invalid format.