-
Notifications
You must be signed in to change notification settings - Fork 172
/
Copy pathTeamTalkSrv.h
1157 lines (1086 loc) · 56.5 KB
/
TeamTalkSrv.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#if !defined(TEAMTALKSRVDLL_H)
#define TEAMTALKSRVDLL_H
/*
* BearWare.dk TeamTalk 5 SDK.
*
* Copyright 2005-2018, BearWare.dk.
*
* Read the License.txt file included with the TeamTalk 5 SDK for
* terms of use.
*/
#include "TeamTalk.h"
/**
* @brief Ensure the header and DLL are exactly the same version. To
* get the version of the loaded DLL call TT_GetVersion(). A remote
* client's version can be seen in the @a szVersion member of the
* #User-struct. */
#define TEAMTALK_SERVER_VERSION "5.18.0.5153"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief A server instance.
*
* @see TTS_InitTeamTalk() */
typedef VOID TTSInstance;
/** @addtogroup servercallbacks
* @{ */
/**
* @brief Callback when a user is requesting to log on to the
* server.
*
* This callback occurs in the context of TT_DoLogin().
*
* Register using TTS_RegisterUserLoginCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpClientErrorMsg Error message which should be sent back to
* user. Set @c nErrorNo to #CMDERR_SUCCESS if user is authorized.
* @param lpUser The user properties gathered so far.
* @param lpUserAccount The user account information which should
* be set for this user. */
typedef void UserLoginCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
OUT ClientErrorMsg* lpClientErrorMsg,
IN const User* lpUser,
IN OUT UserAccount* lpUserAccount);
/**
* @brief Callback when a user is requesting to change nickname.
*
* This callback occurs in the context of TT_DoChangeNickname().
*
* Register using TTS_RegisterUserChangeNickname().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpClientErrorMsg Error message which should be sent back to
* user. Set @c nErrorNo to #CMDERR_SUCCESS if user is authorized.
* @param lpUser The user properties.
* @param szNewNickname The requested nickname. */
typedef void UserChangeNicknameCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
OUT ClientErrorMsg* lpClientErrorMsg,
IN const User* lpUser,
IN const TTCHAR* szNewNickname);
/**
* @brief Callback when a user is requesting to change status.
*
* This callback occurs in the context of TT_DoChangeStatus().
*
* Register using TTS_RegisterUserChangeStatus().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpClientErrorMsg Error message which should be sent back to
* user. Set @c nErrorNo to #CMDERR_SUCCESS if user is authorized.
* @param lpUser The user properties.
* @param nNewStatusMode The requested status mode.
* @param szNewStatusMsg The requested nickname. */
typedef void UserChangeStatusCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
OUT ClientErrorMsg* lpClientErrorMsg,
IN const User* lpUser,
IN INT32 nNewStatusMode,
IN const TTCHAR* szNewStatusMsg);
/**
* @brief Callback when a user is requesting to create a new user
* account.
*
* This callback occurs in the context of TT_DoNewUserAccount().
*
* Register using TTS_RegisterUserCreateUserAccountCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpClientErrorMsg Error message which should be sent back to
* user. Set @c nErrorNo to #CMDERR_SUCCESS if user is authorized.
* @param lpUser The user's properties.
* @param lpUserAccount The properties of the user account to be created. */
typedef void UserCreateUserAccountCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
OUT ClientErrorMsg* lpClientErrorMsg,
IN const User* lpUser,
IN const UserAccount* lpUserAccount);
/**
* @brief Callback when a user is requesting to delete a user
* account.
*
* This callback occurs in the context of TT_DoDeleteUserAccount().
*
* Register using TTS_RegisterUserDeleteUserAccountCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpClientErrorMsg Error message which should be sent back to
* user. Set @c nErrorNo to #CMDERR_SUCCESS if user is authorized.
* @param lpUser The properties of the user requesting.
* @param szUsername The username of the account to delete. */
typedef void UserDeleteUserAccountCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
OUT ClientErrorMsg* lpClientErrorMsg,
IN const User* lpUser,
IN const TTCHAR* szUsername);
/**
* @brief Callback when a user is requesting to ban a user.
*
* This callback occurs in the context of TT_DoBanUser().
*
* Register using TTS_RegisterUserAddServerBanCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpClientErrorMsg Error message which should be sent back to
* user. Set @c nErrorNo to #CMDERR_SUCCESS if user is authorized.
* @param lpBanner The properties of the user requesting the ban.
* @param lpBanee The properties of the user who should be banned. */
typedef void UserAddServerBanCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
OUT ClientErrorMsg* lpClientErrorMsg,
IN const User* lpBanner,
IN const User* lpBanee);
/**
* @brief Callback when a user is requesting to ban an IP-address.
*
* This callback occurs in the context of TT_DoBanIPAddress().
*
* Register using TTS_RegisterUserAddServerBanIPAddressCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpClientErrorMsg Error message which should be sent back to
* user. Set @c nErrorNo to #CMDERR_SUCCESS if user is authorized.
* @param lpBanner The properties of the user requesting the ban. This value
* can be NULL if #ServerProperties @c nMaxLoginAttempts is enabled.
* @param szIPAddress The IP-address to be banned. */
typedef void UserAddServerBanIPAddressCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
OUT ClientErrorMsg* lpClientErrorMsg,
IN const User* lpBanner,
IN const TTCHAR* szIPAddress);
/**
* @brief Callback when a user is requesting to remove a ban.
*
* This callback occurs in the context of TT_DoUnBanUser().
*
* Register using TTS_RegisterUserDeleteServerBanCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpClientErrorMsg Error message which should be sent back to
* user. Set @c nErrorNo to #CMDERR_SUCCESS if user is authorized.
* @param lpUser The properties of the user doing the request.
* @param szIPAddress The IP-address to be unbanned. */
typedef void UserDeleteServerBanCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
OUT ClientErrorMsg* lpClientErrorMsg,
IN const User* lpUser,
IN const TTCHAR* szIPAddress);
/** @} */
/** @addtogroup serverlogevents
* @{ */
/**
* @brief Callback when a new user is connecting to the server.
*
* Register using TTS_RegisterUserConnectedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpUser The user properties gathered so far. */
typedef void UserConnectedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpUser);
/**
* @brief Callback when a user has logged in.
*
* This callback occurs in the context of TT_DoLogin() and if
* #UserLoginCallback returned #CMDERR_SUCCESS.
*
* Register using TTS_RegisterUserLoggedInCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpUser The user properties of the user who logged in. */
typedef void UserLoggedInCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpUser);
/**
* @brief Callback when a user has logged out.
*
* Register using TTS_RegisterUserLoggedInCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpUser The properties of the user. */
typedef void UserLoggedOutCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpUser);
/**
* @brief Callback when user has disconnected.
*
* Register using TTS_RegisterUserDisconnectedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpUser The properties of the user. */
typedef void UserDisconnectedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpUser);
/**
* @brief Callback when a user's connection has timed out.
*
* Register using TTS_RegisterUserTimedoutCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpUser The properties of the user. */
typedef void UserTimedoutCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpUser);
/**
* @brief Callback when a user has been kicked.
*
* Register using TTS_RegisterUserKickedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpKicker The user who had initiated the kick. This can be 0.
* @param lpKickee The user who has been kicked.
* @param lpChannel The channel where the user is kicked from. The can be 0. */
typedef void UserKickedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpKicker,
IN const User* lpKickee, IN const Channel* lpChannel);
/**
* @brief Callback when a user has been banned.
*
* Register using TTS_RegisterUserBannedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpBanner The user who had initiated the ban. This can be 0.
* @param lpBanee The user who has been banned. This may only
* contain an IP-address.
* @param lpChannel The channel where the user is banned from. The can be 0. */
typedef void UserBannedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpBanner,
IN const User* lpBanee, IN const Channel* lpChannel);
/**
* @brief Callback when a ban is removed.
*
* This callback occurs in the contect of TT_DoUnBanUser().
*
* Register using TTS_RegisterUserUnbannedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpUnbanner The user removing the ban.
* @param szIPAddress The IP-address which is unbanned. */
typedef void UserUnbannedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpUnbanner,
IN const TTCHAR* szIPAddress);
/**
* @brief Callback when a user's properties are being updated.
*
* Register using TTS_RegisterUserUpdatedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpUser The properties of the user. */
typedef void UserUpdatedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpUser);
/**
* @brief Callback when a user has joined a channel.
*
* Register using TTS_RegisterUserJoinedChannelCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpUser The properties of the user.
* @param lpChannel The properties of the channel being joined. */
typedef void UserJoinedChannelCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpUser,
IN const Channel* lpChannel);
/**
* @brief Callback when a user has left a channel.
*
* Register using TTS_RegisterUserLeftChannelCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpUser The properties of the user.
* @param lpChannel The properties of the channel being left. */
typedef void UserLeftChannelCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpUser,
IN const Channel* lpChannel);
/**
* @brief Callback when a user has been moved.
*
* This callback occurs in the context of TT_DoMoveUser().
*
* Register using TTS_RegisterUserMovedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpMover The user who initiated the move.
* @param lpMovee The user who has been moved. */
typedef void UserMovedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpMover,
IN const User* lpMovee);
/**
* @brief Callback when a user is sending a text message.
*
* This callback occurs in the context of TT_DoTextMessage().
*
* Register using TTS_RegisterUserTextMessageCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpUser The properties of the user.
* @param lpTextMessage The text message being sent. */
typedef void UserTextMessageCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const User* lpUser,
IN const TextMessage* lpTextMessage);
/**
* @brief Callback when a new channel has been created.
*
* This callback occurs in the context of TT_DoMakeChannel() or
* TT_DoJoinChannel().
*
* Register using TTS_RegisterChannelCreatedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpChannel The channel which has been created.
* @param lpUser The user who created the channel. This can be 0. */
typedef void ChannelCreatedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const Channel* lpChannel,
IN const User* lpUser);
/**
* @brief Callback when a channel has been updated.
*
* This callback occurs in the context of TT_DoUpdateChannel().
*
* Register using TTS_RegisterChannelUpdatedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpChannel The new properties of the channel.
* @param lpUser The user who initiated the update. This can be 0. */
typedef void ChannelUpdatedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const Channel* lpChannel,
IN const User* lpUser);
/**
* @brief Callback when channel has been removed.
*
* Register using TTS_RegisterChannelRemovedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpChannel The properties of the channel which has been removed.
* @param lpUser The properties of the who initiated the
* removal. This can be 0. */
typedef void ChannelRemovedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData, IN const Channel* lpChannel,
IN const User* lpUser);
/**
* @brief Callback when a new file has been uploaded to a channel.
*
* Register using TTS_RegisterFileUploadedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpRemoteFile The properties of the file.
* @param lpUser The properties of the user who uploaded the file. */
typedef void FileUploadedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
IN const RemoteFile* lpRemoteFile,
IN const User* lpUser);
/**
* @brief Callback when a user has downloaded a file.
*
* Register using TTS_RegisterFileDownloadedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpRemoteFile The properties of the file.
* @param lpUser The properties of the user who downloaded the file. */
typedef void FileDownloadedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
IN const RemoteFile* lpRemoteFile,
IN const User* lpUser);
/**
* @brief Callback when a user has deleted a file.
*
* Register using TTS_RegisterFileDeletedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpRemoteFile The properties of the file.
* @param lpUser The properties of the user who deleted the file. */
typedef void FileDeletedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
IN const RemoteFile* lpRemoteFile,
IN const User* lpUser);
/**
* @brief Callback when a user has updated the server properties.
*
* This callback occurs in the context of TT_DoUpdateServer().
*
* Register using TTS_RegisterServerUpdatedCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpServerProperties The properties of the server.
* @param lpUser The user who initiated the server update. */
typedef void ServerUpdatedCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
IN const ServerProperties* lpServerProperties,
IN const User* lpUser);
/**
* @brief Callback when a user has reguested to save the server
* configuration.
*
* Register using TTS_RegisterSaveServerConfigCallback().
*
* @param lpTTSInstance The server instance where the event is occurring.
* @param lpUserData The user data supplied to register-callback function.
* @param lpUser The properties of the user who requested to save
* the server configuration. This can be 0. */
typedef void SaveServerConfigCallback(IN TTSInstance* lpTTSInstance,
IN VOID* lpUserData,
IN const User* lpUser);
/** @} */
/** @addtogroup serverapi
* @{ */
/**
* @brief 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 @ref serversetup 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().
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param szCertificateFile Path to server's certificate file.
* @param szPrivateKeyFile Path to server's private key file.
* @see TTS_SetEncryptionContextEx() */
TEAMTALKDLL_API TTBOOL TTS_SetEncryptionContext(IN TTSInstance* lpTTSInstance,
IN const TTCHAR* szCertificateFile,
IN const TTCHAR* szPrivateKeyFile);
/**
* @brief 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 @ref serversetup on how to generate the certificate and
* private key file using OpenSSL.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpEncryptionContext The encryption context for the server,
* i.e. server certificate, private key and optionally certificate
* authority.
*
* @see TTS_SetEncryptionContextEx() */
TEAMTALKDLL_API TTBOOL TTS_SetEncryptionContextEx(IN TTSInstance* lpTTSInstance,
const EncryptionContext* lpEncryptionContext);
/**
* @brief 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.
*
* @verbatim
* 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.
* @endverbatim
*
* @see TTS_StartServer() */
TEAMTALKDLL_API TTSInstance* TTS_InitTeamTalk();
/**
* @brief Close TeamTalk server instance.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
*
* @see TTS_InitTeamTalk()
* @see TTS_StartServer() */
TEAMTALKDLL_API TTBOOL TTS_CloseTeamTalk(IN TTSInstance* lpTTSInstance);
/**
* @brief Run the server's event loop.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param 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.
* @return Returns TRUE if an event has occured otherwise FALSE.
* @see TTS_InitTeamTalk() */
TEAMTALKDLL_API TTBOOL TTS_RunEventLoop(IN TTSInstance* lpTTSInstance,
IN INT32* pnWaitMs);
/**
* @brief 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.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param szFilesRoot Directory where to store uploaded files.
* @param nMaxDiskUsage The maximum number of bytes which can be used for
* file storage.
* @param nDefaultChannelQuota The number of bytes available to temporary
* channels (not #CHANNEL_PERMANENT). This will be the value in #Channel
* @c nDiskQuota.
*
* @return Error code from #ClientError. */
TEAMTALKDLL_API INT32 TTS_SetChannelFilesRoot(IN TTSInstance* lpTTSInstance,
IN const TTCHAR* szFilesRoot,
IN INT64 nMaxDiskUsage,
IN INT64 nDefaultChannelQuota);
/**
* @brief 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.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpServerProperties The server's properties which will be
* see by all users who log on to the server.
* @return Returns a #ClientError.
*
* @see TTS_StartServer() */
TEAMTALKDLL_API INT32 TTS_UpdateServer(IN TTSInstance* lpTTSInstance,
IN const ServerProperties* lpServerProperties);
/**
* @brief 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 @c nParentID is 0.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpChannel The new channel to create.
* @return Returns a #ClientError.
*
* @see TTS_UpdateChannel()
* @see TTS_RemoveChannel() */
TEAMTALKDLL_API INT32 TTS_MakeChannel(IN TTSInstance* lpTTSInstance,
IN const Channel* lpChannel);
/**
* @brief Update an existing channel.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpChannel The updated channel properties. @c nChannelID
* and @c nParentID must remain the same.
* @return Returns a #ClientError.
*
* @see TTS_MakeChannel()
* @see TTS_RemoveChannel() */
TEAMTALKDLL_API INT32 TTS_UpdateChannel(IN TTSInstance* lpTTSInstance,
IN const Channel* lpChannel);
/**
* @brief Remove a channel.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param nChannelID The ID of the channel to remove.
* @return Returns a #ClientError.
*
* @see TTS_MakeChannel()
* @see TTS_UpdateChannel() */
TEAMTALKDLL_API INT32 TTS_RemoveChannel(IN TTSInstance* lpTTSInstance,
IN INT32 nChannelID);
/**
* @brief Add a file to an existing channel.
*
* Ensure to have set up file storage first using TTS_SetChannelFilesRoot().
* Also ensure #Channel's @c nDiskQuota is specified.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param szLocalFilePath Path to file.
* @param lpRemoteFile Properties of file to add.
* @return Command error code from #ClientError.
*
* @see TTS_SetChannelFilesRoot().
* @see TTS_MakeChannel() */
TEAMTALKDLL_API INT32 TTS_AddFileToChannel(IN TTSInstance* lpTTSInstance,
IN const TTCHAR* szLocalFilePath,
IN const RemoteFile* lpRemoteFile);
/**
* @brief Remove a file from a channel.
*
* Ensure to have set up file storage first using TTS_SetChannelFilesRoot().
* Also ensure #Channel's @c nDiskQuota is specified.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpRemoteFile Properties of file to remove. Channel ID and
* file name is enough.
* @return Command error code from #ClientError.
*
* @see TTS_SetChannelFilesRoot().
* @see TTS_MakeChannel() */
TEAMTALKDLL_API INT32 TTS_RemoveFileFromChannel(IN TTSInstance* lpTTSInstance,
IN const RemoteFile* lpRemoteFile);
/**
* @brief Move a user from one channel to another.
*
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param nUserID The ID of the user to move.
* @param lpChannel The channel the user should move to. If the
* channel already exists then simply set @c nChannelID. To make
* a user leave a channel set @c nChannelID to 0.
* @return Returns a #ClientError.
* @see TT_DoMoveUser() */
TEAMTALKDLL_API INT32 TTS_MoveUser(IN TTSInstance* lpTTSInstance,
IN INT32 nUserID, IN const Channel* lpChannel);
/**
* @brief Send text message from server to clients.
*
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpTextMessage Text message to send. The message type determines
* how the message will be sent.
* @return Returns a #ClientError.
* @see TT_DoTextMessage() */
TEAMTALKDLL_API INT32 TTS_SendTextMessage(IN TTSInstance* lpTTSInstance,
const TextMessage* lpTextMessage);
/**
* @brief Start server on specified IP-address and ports.
*
* Before starting a server the root channel must be created using
* TTS_MakeChannel().
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param szBindIPAddr The IP-address to bind to.
* @param nTcpPort The TCP port to bind to.
* @param nUdpPort The UDP port to bind to.
* @param bEncrypted If encryption is enabled then encryption context
* must be set prior to this call using TTS_SetEncryptionContext().
*
* @see TTS_SetEncryptionContext()
* @see TTS_MakeChannel() */
TEAMTALKDLL_API TTBOOL TTS_StartServer(IN TTSInstance* lpTTSInstance,
IN const TTCHAR* szBindIPAddr,
IN UINT16 nTcpPort,
IN UINT16 nUdpPort,
IN TTBOOL bEncrypted);
/**
* @brief Same as TTS_StartServer() but with the option of
* specifying a system-ID.
*
* Requires TeamTalk version 5.1.3.4506.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param szBindIPAddr The IP-address to bind to.
* @param nTcpPort The TCP port to bind to.
* @param nUdpPort The UDP port to bind to.
* @param bEncrypted If encryption is enabled then encryption context
* must be set prior to this call using TTS_SetEncryptionContext().
* @param szSystemID The identification of the conferencing system.
* The default value is "teamtalk". See TT_ConnectSysID(). */
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);
/**
* @brief Stop server and drop all users.
*
* @see TTS_StartServer() */
TEAMTALKDLL_API TTBOOL TTS_StopServer(IN TTSInstance* lpTTSInstance);
/** @} */
/** @addtogroup servercallbacks
* @{ */
/**
* @brief Register a callback when a user is requesting to log on
* to the server.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserLoginCallback(IN TTSInstance* lpTTSInstance,
IN UserLoginCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback to when user is changing nickname.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful.
* @see TT_DoChangeNickname() */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserChangeNicknameCallback(IN TTSInstance* lpTTSInstance,
IN UserChangeNicknameCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback to when user is changing status.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful.
* @see TT_DoChangeStatus() */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserChangeStatusCallback(IN TTSInstance* lpTTSInstance,
IN UserChangeStatusCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when a user is requesting to create a
* new user account on the server.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserCreateUserAccountCallback(IN TTSInstance* lpTTSInstance,
IN UserCreateUserAccountCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when a user is requesting to delete
* a user account on the server.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserDeleteUserAccountCallback(IN TTSInstance* lpTTSInstance,
IN UserDeleteUserAccountCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when a user is requesting to add a
* server ban requested by a user.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserAddServerBanCallback(IN TTSInstance* lpTTSInstance,
IN UserAddServerBanCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when a user is requesting to add a
* server IP-address ban requested by a user.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserAddServerBanIPAddressCallback(IN TTSInstance* lpTTSInstance,
IN UserAddServerBanIPAddressCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when a user is requesting to delete
* a server IP-address ban requested by a user.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserDeleteServerBanCallback(IN TTSInstance* lpTTSInstance,
IN UserDeleteServerBanCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/** @} */
/** @addtogroup serverlogevents
* @{ */
/**
* @brief Register a callback when a user connects to the server.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserConnectedCallback(IN TTSInstance* lpTTSInstance,
IN UserConnectedCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when a user logs on to the server.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserLoggedInCallback(IN TTSInstance* lpTTSInstance,
IN UserLoggedInCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when a user logs out of the server.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserLoggedOutCallback(IN TTSInstance* lpTTSInstance,
IN UserLoggedOutCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when a user disconnects from the server.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserDisconnectedCallback(IN TTSInstance* lpTTSInstance,
IN UserDisconnectedCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when a user is dropped because of
* inactivity.
*
* See @c nUserTimeout in #ServerProperties.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserTimedoutCallback(IN TTSInstance* lpTTSInstance,
IN UserTimedoutCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when a user is kicked from the server.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserKickedCallback(IN TTSInstance* lpTTSInstance,
IN UserKickedCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when a user is banned from the server.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserBannedCallback(IN TTSInstance* lpTTSInstance,
IN UserBannedCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when an IP-address is unbanned from
* the server.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserUnbannedCallback(IN TTSInstance* lpTTSInstance,
IN UserUnbannedCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when an user's properties are updated.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.
* @param bEnable Whether to register or unregister the callback.
* @return Returns TRUE if the call was successful. */
TEAMTALKDLL_API TTBOOL TTS_RegisterUserUpdatedCallback(IN TTSInstance* lpTTSInstance,
IN UserUpdatedCallback* lpCallback,
IN VOID* lpUserData, IN TTBOOL bEnable);
/**
* @brief Register a callback when an user joins a channel.
*
* @param lpTTSInstance Pointer to the server instance created by
* TTS_InitTeamTalk().
* @param lpCallback Pointer to a function which will handle the callback.
* @param lpUserData A pointer which will be passed to the callback function.