TeamTalk 5 Java DLL Version 5.15A
Loading...
Searching...
No Matches
TeamTalkSrvBase.cs
1/*
2 * Copyright (c) 2005-2018, BearWare.dk
3 *
4 * Contact Information:
5 *
6 * Bjoern D. Rasmussen
7 * Kirketoften 5
8 * DK-8260 Viby J
9 * Denmark
10 * Email: contact@bearware.dk
11 * Phone: +45 20 20 54 59
12 * Web: http://www.bearware.dk
13 *
14 * This source code is part of the TeamTalk SDK owned by
15 * BearWare.dk. Use of this file, or its compiled unit, requires a
16 * TeamTalk SDK License Key issued by BearWare.dk.
17 *
18 * The TeamTalk SDK License Agreement along with its Terms and
19 * Conditions are outlined in the file License.txt included with the
20 * TeamTalk SDK distribution.
21 *
22 */
23
24using System;
25using System.Collections.Generic;
26using System.Linq;
27using System.Text;
28using System.Runtime.InteropServices;
29using c_tt;
30using System.Collections;
31using System.Reflection;
32
33namespace BearWare
34{
37 public abstract class TeamTalkSrvBase : IDisposable
38 {
39 static IntPtr m_ttsInst;
40 public void Dispose()
41 {
42 deleteMe();
43 }
44
45 private void deleteMe()
46 {
47 if (m_ttsInst != IntPtr.Zero)
48 {
49 TTProDLL.TTS_CloseTeamTalk(m_ttsInst);
50 m_ttsInst = IntPtr.Zero;
51 }
52 }
53 ~TeamTalkSrvBase()
54 {
55 deleteMe();
56 }
57
78 public bool SetEncryptionContext(string szCertificateFile, string szPrivateKeyFile)
79 {
80 return TTProDLL.TTS_SetEncryptionContext(m_ttsInst, ref szCertificateFile, ref szPrivateKeyFile);
81 }
82
100 public bool SetEncryptionContext(EncryptionContext lpEncryptionContext)
101 {
102 return TTProDLL.TTS_SetEncryptionContextEx(m_ttsInst, ref lpEncryptionContext);
103 }
104
120 protected TeamTalkSrvBase()
121 {
122 m_ttsInst = TTProDLL.TTS_InitTeamTalk();
123 }
124 protected TeamTalkSrvBase(Channel lpChannel)
125 : this()
126 {
127 MakeChannel(lpChannel);
128 }
129 protected TeamTalkSrvBase(Channel lpChannel, ServerProperties lpServerProperties)
130 : this()
131 {
132 UpdateServer(lpServerProperties);
133 MakeChannel(lpChannel);
134 }
138 public void Close()
139 {
140 deleteMe();
141 }
148 public bool RunEventLoop(int pnWaitMs)
149 {
150 return TTProDLL.TTS_RunEventLoop(m_ttsInst, pnWaitMs);
151 }
169 public ClientError SetChannelFilesRoot(string szFilesRoot, Int64 nMaxDiskUsage, Int64 nDefaultChannelQuota)
170 {
171 return TTProDLL.TTS_SetChannelFilesRoot(m_ttsInst, szFilesRoot, nMaxDiskUsage, nDefaultChannelQuota);
172 }
186 public ClientError UpdateServer([In] BearWare.ServerProperties lpServerProperties)
187 {
188 return TTProDLL.TTS_UpdateServer(m_ttsInst, ref lpServerProperties);
189 }
202 public virtual ClientError MakeChannel(BearWare.Channel lpChannel)
203 {
204 return TTProDLL.TTS_MakeChannel(m_ttsInst, ref lpChannel);
205 }
216 {
217 return TTProDLL.TTS_UpdateChannel(m_ttsInst, ref lpChannel);
218 }
227 public ClientError RemoveChannel(int nChannelID)
228 {
229 return TTProDLL.TTS_RemoveChannel(m_ttsInst, nChannelID);
230 }
243 public ClientError AddFileToChannel(string szLocalFilePath, BearWare.RemoteFile lpRemoteFile)
244 {
245 return TTProDLL.TTS_AddFileToChannel(m_ttsInst, ref szLocalFilePath, ref lpRemoteFile);
246 }
260 {
261 return TTProDLL.TTS_RemoveFileFromChannel(m_ttsInst, ref lpRemoteFile);
262 }
271 public ClientError MoveUser(int nUserID, BearWare.Channel lpChannel)
272 {
273 return TTProDLL.TTS_MoveUser(m_ttsInst, nUserID, ref lpChannel);
274 }
284 {
285 return TTProDLL.TTS_SendTextMessage(m_ttsInst, ref lpTextMessage);
286 }
301 public bool StartServer(string szBindIPAddr, int nTcpPort, int nUdpPort, bool bEncrypted)
302 {
303 return TTProDLL.TTS_StartServer(m_ttsInst, szBindIPAddr, nTcpPort, nUdpPort, bEncrypted);
304 }
318 public bool StartServerSysID(string szBindIPAddr, int nTcpPort, int nUdpPort, bool bEncrypted,
319 string szSystemID)
320 {
321 return TTProDLL.TTS_StartServerSysID(m_ttsInst, szBindIPAddr, nTcpPort, nUdpPort, bEncrypted, szSystemID);
322 }
327 public bool StopServer()
328 {
329 return TTProDLL.TTS_StopServer(m_ttsInst);
330 }
331
332 public static string GetVersion() { return Marshal.PtrToStringAuto(TTProDLL.TT_GetVersion()); }
333 class CallBack : IDisposable
334 {
335 private GCHandle hCallBack;
336 private IntPtr pCallFuncPointer;
337 Delegate lpCallback;
338 public CallBack(Delegate lpCallback)
339 {
340 this.lpCallback = lpCallback;
341 hCallBack = GCHandle.Alloc(lpCallback);
342 pCallFuncPointer = Marshal.GetFunctionPointerForDelegate(lpCallback);
343 GC.KeepAlive(lpCallback);
344 GC.Collect();
345 }
346 ~CallBack()
347 {
348 Dispose(true);
349 }
350
351 public IntPtr GetFuncPointer()
352 {
353 return pCallFuncPointer;
354 }
355 public void Dispose()
356 {
357 GC.SuppressFinalize(this);
358 Dispose(true);
359 }
360 protected void Dispose(bool disposing)
361 {
362 if (disposing)
363 {
364 // Do Something
365 }
366 // free ressource
367 if (hCallBack.IsAllocated)
368 hCallBack.Free();
369 pCallFuncPointer = IntPtr.Zero;
370 }
371
372 public bool Compare(Delegate x)
373 {
374 return Object.Equals(lpCallback, x);
375 }
376 }
377 private delegate bool DLL(IntPtr lpTTSInstance, IntPtr lpCallback, int lpUserData, bool bEnable);
378 private Dictionary<CallBack, DLL> Delegate2DLL = new Dictionary<CallBack, DLL>();
379 private bool RegisterServerCallback(Delegate lpCallback, int lpUserData, bool bEnable)
380 {
381 CallBack callBack = null;
382 bool b = false;
383 string TTProDLL_Method = "TTS_Register" + lpCallback.GetType().ToString().Split('+')[1];
384 MethodInfo method = typeof(TTProDLL).GetMethod(TTProDLL_Method);
385 DLL dg = (DLL)Delegate.CreateDelegate(typeof(DLL), method);
386
387 foreach (KeyValuePair<CallBack, DLL> cb in Delegate2DLL)
388 {
389 if (cb.Key.Compare(lpCallback))
390 {
391 if (bEnable == true) return true;
392 callBack = cb.Key;
393 b = Delegate2DLL[callBack](m_ttsInst, callBack.GetFuncPointer(), 0, bEnable);
394 callBack.Dispose();
395 Delegate2DLL.Remove(callBack);
396 callBack = null;
397 return b;
398 }
399 }
400 if (callBack == null && bEnable)
401 {
402 callBack = new CallBack(lpCallback);
403 Delegate2DLL.Add(callBack, dg);
404 b = Delegate2DLL[callBack](m_ttsInst, callBack.GetFuncPointer(), 0, bEnable);
405 }
406 return b;
407 }
408 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
409 internal delegate void UserLoggedInCallback(IntPtr lpTTSInstance, [In] IntPtr lpUserData, [In] ref User lpUser);
410 private event UserLoggedInCallback onUserLoggedInCallback;
411 internal event UserLoggedInCallback OnUserLoggedInCallBack
412 {
413 add
414 {
415 lock (objectLock)
416 {
417 onUserLoggedInCallback += value;
418 RegisterServerCallback(value, 0, true);
419 }
420 }
421 remove
422 {
423 lock (objectLock)
424 {
425 onUserLoggedInCallback -= value;
426 RegisterServerCallback(value, 0, false);
427 }
428 }
429
430 }
431
432 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
433 internal delegate void UserChangeNicknameCallback(IntPtr lpTTSInstance, IntPtr lpUserData, [In, Out] ref ClientErrorMsg lpClientErrorMsg, ref User lpUser, [In] [MarshalAs(UnmanagedType.LPWStr)] string szNewNickname);
434 private event UserChangeNicknameCallback onUserChangeNicknameCallback;
435 internal event UserChangeNicknameCallback OnUserChangeNicknameCallback
436 {
437 add
438 {
439 lock(objectLock)
440 {
441 onUserChangeNicknameCallback += value;
442 RegisterServerCallback(value, 0, true);
443 }
444 }
445 remove
446 {
447 lock(objectLock)
448 {
449 onUserChangeNicknameCallback -= value;
450 RegisterServerCallback(value, 0, false);
451 }
452 }
453 }
454 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
455 internal delegate void UserChangeStatusCallback(IntPtr lpTTSInstance, IntPtr lpUserData, [In,Out] ref ClientErrorMsg lpClientErrorMsg, [In] ref User lpUser, [In] ref int nNewStatusMode, [In] [MarshalAs(UnmanagedType.LPWStr)] string szNewStatusMsg);
456 private event UserChangeStatusCallback onUserChangeStatusCallback;
457 internal event UserChangeStatusCallback OnUserChangeStatusCallback
458 {
459 add
460 {
461 lock(objectLock)
462 {
463 onUserChangeStatusCallback += value;
464 RegisterServerCallback(value, 0, true);
465 }
466 }
467 remove
468 {
469 lock (objectLock)
470 {
471 onUserChangeStatusCallback -= value;
472 RegisterServerCallback(value, 0, false);
473 }
474 }
475 }
476
477 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
478 internal delegate void UserLoginCallback(IntPtr lpTTSInstance, IntPtr lpUserData, [In, Out] ref ClientErrorMsg lpClientErrorMsg, ref User lpUser, [In, Out]ref UserAccount lpUserAccount);
479 object objectLock = new Object();
480 private event UserLoginCallback onUserLoginCallback;
481 internal event UserLoginCallback OnUserLoginCallback
482 {
483 add
484 {
485 lock (objectLock)
486 {
487 onUserLoginCallback += value;
488 RegisterServerCallback(value, 0, true);
489 }
490 }
491 remove
492 {
493 lock (objectLock)
494 {
495 onUserLoginCallback -= value;
496 RegisterServerCallback(value, 0, false);
497 }
498 }
499 }
500 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
501 internal delegate void UserCreateUserAccountCallback(IntPtr lpTTSInstance, IntPtr lpUserData, [In, Out] ref ClientErrorMsg lpClientErrorMsg, ref User lpUser, [In, Out]ref UserAccount lpUserAccount);
502 private event UserCreateUserAccountCallback onUserCreateUserAccountCallback;
503 internal event UserCreateUserAccountCallback OnUserCreateUserAccountCallback
504 {
505 add
506 {
507 onUserCreateUserAccountCallback += value;
508 RegisterServerCallback(value, 0, true);
509 }
510 remove
511 {
512 onUserCreateUserAccountCallback -= value;
513 RegisterServerCallback(value, 0, false);
514 }
515 }
516 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
517 internal delegate void UserDeleteUserAccountCallback(IntPtr lpTTSInstance, IntPtr lpUserData, [In, Out] ref ClientErrorMsg lpClientErrorMsg, ref User lpUser, [In] [MarshalAs(UnmanagedType.LPWStr)] string szUsername);
518 private event UserDeleteUserAccountCallback onUserDeleteUserAccountCallback;
519 internal event UserDeleteUserAccountCallback OnUserDeleteUserAccountCallback
520 {
521 add
522 {
523 onUserDeleteUserAccountCallback += value;
524 RegisterServerCallback(value, 0, true);
525 }
526 remove
527 {
528 onUserDeleteUserAccountCallback -= value;
529 RegisterServerCallback(value, 0, false);
530 }
531 }
532 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
533 internal delegate void UserAddServerBanCallback(IntPtr lpTTSInstance, IntPtr lpUserData, [In, Out] ref ClientErrorMsg lpClientErrorMsg, [In,Out] ref User lpBanner, [In,Out] ref User lpBanee);
534 private event UserAddServerBanCallback onUserAddServerBanCallback;
535 internal event UserAddServerBanCallback OnUserAddServerBanCallback
536 {
537 add
538 {
539 onUserAddServerBanCallback += value;
540 RegisterServerCallback(value, 0, true);
541 }
542 remove
543 {
544 onUserAddServerBanCallback -= value;
545 RegisterServerCallback(value, 0, false);
546 }
547 }
548 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
549 internal delegate void UserAddServerBanIPAddressCallback(IntPtr lpTTSInstance,
550 IntPtr lpUserData,
551 [In, Out] ref ClientErrorMsg lpClientErrorMsg,
552 [In] ref User lpBanner,
553 [In,Out] [MarshalAs(UnmanagedType.LPWStr)] string szIPAddress);
554 private event UserAddServerBanIPAddressCallback onUserAddServerBanIPAddressCallback;
555 internal event UserAddServerBanIPAddressCallback OnUserAddServerBanIPAddressCallback
556 {
557 add
558 {
559 onUserAddServerBanIPAddressCallback += value;
560 RegisterServerCallback(value, 0, true);
561 }
562 remove
563 {
564 onUserAddServerBanIPAddressCallback -= value;
565 RegisterServerCallback(value, 0, false);
566 }
567 }
568 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
569 internal delegate void UserDeleteServerBanCallback(IntPtr lpTTSInstance,
570 IntPtr lpUserData,
571 [In, Out] ref ClientErrorMsg lpClientErrorMsg,
572 [In] ref User lpUser,
573 [In] [MarshalAs(UnmanagedType.LPWStr)] string szIPAddress);
574 private event UserDeleteServerBanCallback onUserDeleteServerBanCallback;
575 internal event UserDeleteServerBanCallback OnUserDeleteServerBanCallback
576 {
577 add
578 {
579 onUserDeleteServerBanCallback += value;
580 RegisterServerCallback(value, 0, true);
581 }
582 remove
583 {
584 onUserDeleteServerBanCallback -= value;
585 RegisterServerCallback(value, 0, false);
586 }
587 }
588 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
589 internal delegate void UserConnectedCallback(IntPtr lpTTSInstance,
590 IntPtr lpUserData, [In] ref User lpUser);
591 private event UserConnectedCallback onUserConnectedCallback;
592 internal event UserConnectedCallback OnUserConnectedCallback
593 {
594 add
595 {
596 onUserConnectedCallback += value;
597 RegisterServerCallback(value, 0, true);
598 }
599 remove
600 {
601 onUserConnectedCallback -= value;
602 RegisterServerCallback(value, 0, false);
603 }
604 }
605 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
606 internal delegate void UserLoggedOutCallback(IntPtr lpTTSInstance,
607 IntPtr lpUserData, [In] ref User lpUser);
608 private event UserLoggedOutCallback onUserLoggedOutCallback;
609 internal event UserLoggedOutCallback OnUserLoggedOutCallback
610 {
611 add
612 {
613 onUserLoggedOutCallback += value;
614 RegisterServerCallback(value, 0, true);
615 }
616 remove
617 {
618 onUserLoggedOutCallback -= value;
619 RegisterServerCallback(value, 0, false);
620 }
621 }
622 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
623 internal delegate void UserDisconnectedCallback(IntPtr lpTTSInstance,
624 IntPtr lpUserData, [In] ref User lpUser);
625 private event UserDisconnectedCallback onUserDisconnectedCallback;
626 internal event UserDisconnectedCallback OnUserDisconnectedCallback
627 {
628 add
629 {
630 onUserDisconnectedCallback += value;
631 RegisterServerCallback(value, 0, true);
632 }
633 remove
634 {
635 onUserDisconnectedCallback -= value;
636 RegisterServerCallback(value, 0, false);
637 }
638 }
639 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
640 internal delegate void UserTimedoutCallback(IntPtr lpTTSInstance,
641 IntPtr lpUserData, [In] ref User lpUser);
642 private event UserTimedoutCallback onUserTimedoutCallback;
643 internal event UserTimedoutCallback OnUserTimedoutCallback
644 {
645 add
646 {
647 onUserTimedoutCallback += value;
648 RegisterServerCallback(value, 0, true);
649 }
650 remove
651 {
652 onUserTimedoutCallback -= value;
653 RegisterServerCallback(value, 0, false);
654 }
655 }
656 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
657 internal delegate void UserKickedCallback(IntPtr lpTTSInstance,
658 IntPtr lpUserData, IntPtr lpKicker,
659 [In] ref User lpKickee, [In] IntPtr lpChannel);
660 private event UserKickedCallback onUserKickedCallback;
661 internal event UserKickedCallback OnUserKickedCallback
662 {
663 add
664 {
665 onUserKickedCallback += value;
666 RegisterServerCallback(value, 0, true);
667 }
668 remove
669 {
670 onUserKickedCallback -= value;
671 RegisterServerCallback(value, 0, false);
672 }
673 }
674 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
675 internal delegate void UserBannedCallback(IntPtr lpTTSInstance,IntPtr lpUserData, [In,Out] ref User lpBanner,[In,Out] ref User lpBanee, IntPtr lpChannel);
676 private event UserBannedCallback onUserBannedCallback;
677 internal event UserBannedCallback OnUserBannedCallback
678 {
679 add
680 {
681 onUserBannedCallback += value;
682 RegisterServerCallback(value, 0, true);
683 }
684 remove
685 {
686 onUserBannedCallback -= value;
687 RegisterServerCallback(value, 0, false);
688 }
689 }
690 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
691 internal delegate void UserUnbannedCallback(IntPtr lpTTSInstance,
692 IntPtr lpUserData, [In] ref User lpUnbanner,
693 [In] [MarshalAs(UnmanagedType.LPWStr)] string szIPAddress);
694 private event UserUnbannedCallback onUserUnbannedCallback;
695 internal event UserUnbannedCallback OnUserUnbannedCallback
696 {
697 add
698 {
699 onUserUnbannedCallback += value;
700 RegisterServerCallback(value, 0, true);
701 }
702 remove
703 {
704 onUserUnbannedCallback -= value;
705 RegisterServerCallback(value, 0, false);
706 }
707 }
708 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
709 internal delegate void UserUpdatedCallback(IntPtr lpTTSInstance,
710 IntPtr lpUserData, [In] ref User lpUser);
711 private event UserUpdatedCallback onUserUpdatedCallback;
712 internal event UserUpdatedCallback OnUserUpdatedCallback
713 {
714 add
715 {
716 onUserUpdatedCallback += value;
717 RegisterServerCallback(value, 0, true);
718 }
719 remove
720 {
721 onUserUpdatedCallback -= value;
722 RegisterServerCallback(value, 0, false);
723 }
724 }
725 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
726 internal delegate void UserJoinedChannelCallback(IntPtr lpTTSInstance,
727 IntPtr lpUserData, [In, Out] ref User lpUser,
728 [In,Out] ref Channel lpChannel);
729 private event UserJoinedChannelCallback onUserJoinedChannelCallback;
730 internal event UserJoinedChannelCallback OnUserJoinedChannelCallback
731 {
732 add
733 {
734 onUserJoinedChannelCallback += value;
735 RegisterServerCallback(value, 0, true);
736 }
737 remove
738 {
739 onUserJoinedChannelCallback -= value;
740 RegisterServerCallback(value, 0, false);
741 }
742 }
743 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
744 internal delegate void UserLeftChannelCallback(IntPtr lpTTSInstance,
745 IntPtr lpUserData, [In,Out] ref User lpUser,
746 [In,Out] ref Channel lpChannel);
747 private event UserLeftChannelCallback onUserLeftChannelCallback;
748 internal event UserLeftChannelCallback OnUserLeftChannelCallback
749 {
750 add
751 {
752 onUserLeftChannelCallback += value;
753 RegisterServerCallback(value, 0, true);
754 }
755 remove
756 {
757 onUserLeftChannelCallback -= value;
758 RegisterServerCallback(value, 0, false);
759 }
760 }
761 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
762 internal delegate void UserMovedCallback(IntPtr lpTTSInstance,
763 IntPtr lpUserData, [In,Out] ref User lpMover,
764 [In,Out] ref User lpMovee);
765 private event UserMovedCallback onUserMovedCallback;
766 internal event UserMovedCallback OnUserMovedCallback
767 {
768 add
769 {
770 onUserMovedCallback += value;
771 RegisterServerCallback(value, 0, true);
772 }
773 remove
774 {
775 onUserMovedCallback -= value;
776 RegisterServerCallback(value, 0, false);
777 }
778 }
779 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
780 internal delegate void UserTextMessageCallback(IntPtr lpTTSInstance,
781 IntPtr lpUserData, [In] ref User lpUser,
782 [In] ref TextMessage lpTextMessage);
783 private event UserTextMessageCallback onUserTextMessageCallback;
784 internal event UserTextMessageCallback OnUserTextMessageCallback
785 {
786 add
787 {
788 onUserTextMessageCallback += value;
789 RegisterServerCallback(value, 0, true);
790 }
791 remove
792 {
793 onUserTextMessageCallback -= value;
794 RegisterServerCallback(value, 0, false);
795 }
796 }
797 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
798 internal delegate void ChannelCreatedCallback(IntPtr lpTTSInstance,
799 IntPtr lpUserData,[In] ref Channel lpChannel,
800 IntPtr lpUser);
801 private event ChannelCreatedCallback onChannelCreatedCallback;
802 internal event ChannelCreatedCallback OnChannelCreatedCallback
803 {
804 add
805 {
806 onChannelCreatedCallback += value;
807 RegisterServerCallback(value, 0, true);
808 }
809 remove
810 {
811 onChannelCreatedCallback -= value;
812 RegisterServerCallback(value, 0, false);
813 }
814 }
815 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
816 internal delegate void ChannelUpdatedCallback(IntPtr lpTTSInstance,
817 IntPtr lpUserData, [In] ref Channel lpChannel,
818 IntPtr lpUser);
819 private event ChannelUpdatedCallback onChannelUpdatedCallback;
820 internal event ChannelUpdatedCallback OnChannelUpdatedCallback
821 {
822 add
823 {
824 onChannelUpdatedCallback += value;
825 RegisterServerCallback(value, 0, true);
826 }
827 remove
828 {
829 onChannelUpdatedCallback -= value;
830 RegisterServerCallback(value, 0, false);
831 }
832 }
833 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
834 internal delegate void ChannelRemovedCallback(IntPtr lpTTSInstance,
835 IntPtr lpUserData, [In] ref Channel lpChannel,
836 IntPtr lpUser);
837 private event ChannelRemovedCallback onChannelRemovedCallback;
838 internal event ChannelRemovedCallback OnChannelRemovedCallback
839 {
840 add
841 {
842 onChannelRemovedCallback += value;
843 RegisterServerCallback(value, 0, true);
844 }
845 remove
846 {
847 onChannelRemovedCallback -= value;
848 RegisterServerCallback(value, 0, false);
849 }
850 }
851 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
852 internal delegate void FileUploadedCallback(IntPtr lpTTSInstance,
853 IntPtr lpUserData,
854 [In] ref RemoteFile lpRemoteFile,
855 [In] ref User lpUser);
856 private event FileUploadedCallback onFileUploadedCallback;
857 internal event FileUploadedCallback OnFileUploadedCallback
858 {
859 add
860 {
861 onFileUploadedCallback += value;
862 RegisterServerCallback(value, 0, true);
863 }
864 remove
865 {
866 onFileUploadedCallback -= value;
867 RegisterServerCallback(value, 0, false);
868 }
869 }
870 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
871 internal delegate void FileDownloadedCallback(IntPtr lpTTSInstance,
872 IntPtr lpUserData,
873 [In] ref RemoteFile lpRemoteFile,
874 [In] ref User lpUser);
875 private event FileDownloadedCallback onFileDownloadedCallback;
876 internal event FileDownloadedCallback OnFileDownloadedCallback
877 {
878 add
879 {
880 onFileDownloadedCallback += value;
881 RegisterServerCallback(value, 0, true);
882 }
883 remove
884 {
885 onFileDownloadedCallback -= value;
886 RegisterServerCallback(value, 0, false);
887 }
888 }
889 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
890 internal delegate void FileDeletedCallback(IntPtr lpTTSInstance,
891 IntPtr lpUserData,
892 [In] ref RemoteFile lpRemoteFile,
893 [In] ref User lpUser);
894 private event FileDeletedCallback onFileDeletedCallback;
895 internal event FileDeletedCallback OnFileDeletedCallback
896 {
897 add
898 {
899 onFileDeletedCallback += value;
900 RegisterServerCallback(value, 0, true);
901 }
902 remove
903 {
904 onFileDeletedCallback -= value;
905 RegisterServerCallback(value, 0, false);
906 }
907 }
908 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
909 internal delegate void ServerUpdatedCallback(IntPtr lpTTSInstance,
910 IntPtr lpUserData,
911 [In] ref ServerProperties lpServerProperties,
912 [In] ref User lpUser);
913 private event ServerUpdatedCallback onServerUpdatedCallback;
914 internal event ServerUpdatedCallback OnServerUpdatedCallback
915 {
916 add
917 {
918 onServerUpdatedCallback += value;
919 RegisterServerCallback(value, 0, true);
920 }
921 remove
922 {
923 onServerUpdatedCallback -= value;
924 RegisterServerCallback(value, 0, false);
925 }
926 }
927 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
928 internal delegate void SaveServerConfigCallback(IntPtr lpTTSInstance,
929 IntPtr lpUserData,
930 IntPtr lpUser);
931 private event SaveServerConfigCallback onSaveServerConfigCallback;
932 internal event SaveServerConfigCallback OnSaveServerConfigCallback
933 {
934 add
935 {
936 onSaveServerConfigCallback += value;
937 RegisterServerCallback(value, 0, true);
938 }
939 remove
940 {
941 onSaveServerConfigCallback -= value;
942 RegisterServerCallback(value, 0, false);
943 }
944 }
945
946 }
947
948}
Base class for BearWare.TeamTalk5Srv.
ClientError
Errors which can occur either as a result of client commands or as a result of internal errors.
Definition TeamTalk.cs:3054
void Close()
Close TeamTalk server instance.
bool SetEncryptionContext(EncryptionContext lpEncryptionContext)
Set up encryption context for encrypted server.
ClientError UpdateServer([In] BearWare.ServerProperties lpServerProperties)
Set server properties.
TeamTalkSrvBase(Channel lpChannel)
bool RunEventLoop(int pnWaitMs)
Run the server's event loop.
virtual ClientError MakeChannel(BearWare.Channel lpChannel)
Make new channel.
ClientError SetChannelFilesRoot(string szFilesRoot, Int64 nMaxDiskUsage, Int64 nDefaultChannelQuota)
The root folder of where users should upload files to.
ClientError SendTextMessage(BearWare.TextMessage lpTextMessage)
Send text message from server to clients.
bool StartServerSysID(string szBindIPAddr, int nTcpPort, int nUdpPort, bool bEncrypted, string szSystemID)
Same as StartServer() but with the option of specifying a system-ID.
TeamTalkSrvBase(Channel lpChannel, ServerProperties lpServerProperties)
ClientError RemoveChannel(int nChannelID)
Remove a channel.
ClientError AddFileToChannel(string szLocalFilePath, BearWare.RemoteFile lpRemoteFile)
Add a file to an existing channel.
ClientError RemoveFileFromChannel(RemoteFile lpRemoteFile)
Remove a file from a channel.
bool StopServer()
Stop server and drop all users.
ClientError MoveUser(int nUserID, BearWare.Channel lpChannel)
Move a user from one channel to another.
TeamTalkSrvBase()
Create new TeamTalk server instance.
bool StartServer(string szBindIPAddr, int nTcpPort, int nUdpPort, bool bEncrypted)
Start server on specified IP-address and ports.
ClientError UpdateChannel(Channel lpChannel)
Update an existing channel.
bool SetEncryptionContext(string szCertificateFile, string szPrivateKeyFile)
Set certificate and private key for encrypted server.
A struct containing the properties of a channel.
Definition TeamTalk.cs:2594
Configure peer verification for encrypted connection.
Definition TeamTalk.cs:2857
A struct containing the properties of a file in a BearWare.Channel.
Definition TeamTalk.cs:2827
A struct containing the properties of the server's settings.
Definition TeamTalk.cs:1889
A struct containing the properties of a text message sent by a user.
Definition TeamTalk.cs:2516