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
#![allow(dead_code)]

//! This file contains the definitions of public_definitions.h and public_rare_definitions.h

use std;
use std::os::raw::*;

/// Limited length, measured in characters
pub const MAX_SIZE_CHANNEL_NAME:                     usize = 40;
pub const MAX_SIZE_VIRTUALSERVER_NAME:               usize = 40;
pub const MAX_SIZE_CLIENT_NICKNAME:                  usize = 40;
pub const MIN_SIZE_CLIENT_NICKNAME:                  usize =  3;
pub const MAX_SIZE_REASON_MESSAGE:                   usize = 80;
pub const MAX_SIZE_CLIENT_NICKNAME_NONSDK:           usize = 30;
pub const MIN_SIZE_CLIENT_NICKNAME_NONSDK:           usize =  3;
pub const MAX_SIZE_AWAY_MESSAGE:                     usize = 80;
pub const MAX_SIZE_GROUP_NAME:                       usize = 30;
pub const MAX_SIZE_TALK_REQUEST_MESSAGE:             usize = 50;
pub const MAX_SIZE_COMPLAIN_MESSAGE:                 usize = 200;
pub const MAX_SIZE_CLIENT_DESCRIPTION:               usize = 200;
pub const MAX_SIZE_HOST_MESSAGE:                     usize = 200;
pub const MAX_SIZE_HOSTBUTTON_TOOLTIP:               usize = 50;
pub const MAX_SIZE_POKE_MESSAGE:                     usize = 100;
pub const MAX_SIZE_OFFLINE_MESSAGE:                  usize = 4096;
pub const MAX_SIZE_OFFLINE_MESSAGE_SUBJECT:          usize = 200;

/// Limited length, measured in bytes (UTF-8 encoded)
pub const MAX_SIZE_TEXTMESSAGE:                      usize = 1024;
pub const MAX_SIZE_CHANNEL_TOPIC:                    usize =  255;
pub const MAX_SIZE_CHANNEL_DESCRIPTION:              usize = 8192;
pub const MAX_SIZE_VIRTUALSERVER_WELCOMEMESSAGE:     usize = 1024;
pub const MAX_SIZE_PLUGIN_COMMAND:                   usize = 1024 * 8;
pub const MAX_SIZE_VIRTUALSERVER_HOSTBANNER_GFX_URL: usize = 2000;

/// Minimum amount of seconds before a clientID that was in use can be assigned to a new client
pub const MIN_SECONDS_CLIENTID_REUSE:                usize = 300;
pub const MAX_VARIABLES_EXPORT_COUNT:                usize = 64;

/// Speaker locations used by some sound callbacks
bitflags! {
pub flags Speaker: c_uint {
	const SPEAKER_FRONT_LEFT            = 0x00001,
	const SPEAKER_FRONT_RIGHT           = 0x00002,
	const SPEAKER_FRONT_CENTER          = 0x00004,
	const SPEAKER_LOW_FREQUENCY         = 0x00008,
	const SPEAKER_BACK_LEFT             = 0x00010,
	const SPEAKER_BACK_RIGHT            = 0x00020,
	const SPEAKER_FRONT_LEFT_OF_CENTER  = 0x00040,
	const SPEAKER_FRONT_RIGHT_OF_CENTER = 0x00080,
	const SPEAKER_BACK_CENTER           = 0x00100,
	const SPEAKER_SIDE_LEFT             = 0x00200,
	const SPEAKER_SIDE_RIGHT            = 0x00400,
	const SPEAKER_TOP_CENTER            = 0x00800,
	const SPEAKER_TOP_FRONT_LEFT        = 0x01000,
	const SPEAKER_TOP_FRONT_CENTER      = 0x02000,
	const SPEAKER_TOP_FRONT_RIGHT       = 0x04000,
	const SPEAKER_TOP_BACK_LEFT         = 0x08000,
	const SPEAKER_TOP_BACK_CENTER       = 0x10000,
	const SPEAKER_TOP_BACK_RIGHT        = 0x20000,
	const SPEAKER_HEADPHONES_LEFT       = 0x10000000,
	const SPEAKER_HEADPHONES_RIGHT      = 0x20000000,
	const SPEAKER_MONO                  = 0x40000000,
}}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum TalkStatus {
	NotTalking           = 0,
	Talking              = 1,
	TalkingWhileDisabled = 2,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum CodecType {
	/// Mono,   16bit,  8kHz, bitrate dependent on the quality setting
	SpeexNarrowband = 0,
	/// Mono,   16bit, 16kHz, bitrate dependent on the quality setting
	SpeexWideband,
	/// Mono,   16bit, 32kHz, bitrate dependent on the quality setting
	SpeexUltrawideband,
	/// Mono,   16bit, 48kHz, bitrate dependent on the quality setting
	CeltMono,
	/// Mono,   16bit, 48kHz, bitrate dependent on the quality setting, optimized for voice
	OpusVoice,
	/// Stereo, 16bit, 48kHz, bitrate dependent on the quality setting, optimized for music
	OpusMusic,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum CodecEncryptionMode {
	PerChannel = 0,
	ForcedOff,
	ForcedOn,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum TextMessageTargetMode {
	Client = 1,
	Channel,
	Server,
	Max,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum MuteInputStatus {
	None = 0,
	Muted,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum MuteOutputStatus {
	None = 0,
	Muted,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum HardwareInputStatus {
	Disabled = 0,
	Enabled,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum HardwareOutputStatus {
	Disabled = 0,
	Enabled,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum InputDeactivationStatus {
	Active      = 0,
	Deactivated = 1,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum ReasonIdentifier {
	/// No reason data
	None                              = 0,
	/// {SectionInvoker}
	Moved                             = 1,
	/// No reason data
	Subscription                      = 2,
	/// reasonmsg = reason
	LostConnection                    = 3,
	/// {SectionInvoker} reasonmsg=reason; {SectionInvoker} is only added server->client
	KickChannel                       = 4,
	/// {SectionInvoker} reasonmsg=reason; {SectionInvoker} is only added server->client
	KickServer                        = 5,
	/// {SectionInvoker} reasonmsg=reason bantime=time; {SectionInvoker} is only added server->client
	KickServerBan                     = 6,
	/// reasonmsg = reason
	Serverstop                        = 7,
	/// reasonmsg = reason
	Clientdisconnect                  = 8,
	/// No reason data
	Channelupdate                     = 9,
	/// {SectionInvoker}
	Channeledit                       = 10,
	/// reasonmsg = reason
	ClientdisconnectServerShutdown    = 11,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum ChannelProperties {
	/// Available for all channels that are "in view", always up-to-date
	Name = 0,
	/// Available for all channels that are "in view", always up-to-date
	Topic,
	/// Must be requested (=> requestChannelDescription)
	Description,
	/// Not available client side
	Password,
	/// Available for all channels that are "in view", always up-to-date
	Codec,
	/// Available for all channels that are "in view", always up-to-date
	CodecQuality,
	/// Available for all channels that are "in view", always up-to-date
	MaxClients,
	/// Available for all channels that are "in view", always up-to-date
	MaxFamilyClients,
	/// Available for all channels that are "in view", always up-to-date
	Order,
	/// Available for all channels that are "in view", always up-to-date
	FlagPermanent,
	/// Available for all channels that are "in view", always up-to-date
	FlagSemiPermanent,
	/// Available for all channels that are "in view", always up-to-date
	FlagDefault,
	/// Available for all channels that are "in view", always up-to-date
	FlagPassword,
	/// Available for all channels that are "in view", always up-to-date
	CodecLatencyFactor,
	/// Available for all channels that are "in view", always up-to-date
	CodecIsUnencrypted,
	/// Not available client side, not used in teamspeak, only SDK. Sets the options+salt for security hash.
	SecuritySalt,
	/// How many seconds to wait before deleting this channel
	DeleteDelay,

	/// Rare properties
	Dummy2,
	Dummy3,
	Dummy4,
	Dummy5,
	Dummy6,
	Dummy7,
	/// Available for all channels that are "in view", always up-to-date
	FlagMaxClientsUnlimited,
	/// Available for all channels that are "in view", always up-to-date
	FlagMaxFamilyClientsUnlimited,
	/// Available for all channels that are "in view", always up-to-date
	FlagMaxFamilyClientsInherited,
	/// Only available client side, stores whether we are subscribed to this channel
	FlagAreSubscribed,
	/// Not available client side, the folder used for file-transfers for this channel
	Filepath,
	/// Available for all channels that are "in view", always up-to-date
	NeededTalkPower,
	/// Available for all channels that are "in view", always up-to-date
	ForcedSilence,
	/// Available for all channels that are "in view", always up-to-date
	NamePhonetic,
	/// Available for all channels that are "in view", always up-to-date
	IconId,
	/// Available for all channels that are "in view", always up-to-date
	FlagPrivate,
	Endmarker,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum ClientProperties {
	/// Automatically up-to-date for any client "in view", can be used to identify this particular client installation
	UniqueIdentifier = 0,
	/// Automatically up-to-date for any client "in view"
	Nickname,
	/// For other clients than ourself, this needs to be requested (=> requestClientVariables)
	Version,
	/// For other clients than ourself, this needs to be requested (=> requestClientVariables)
	Platform,
	/// Automatically up-to-date for any client that can be heard (in room / whisper)
	FlagTalking,
	/// Automatically up-to-date for any client "in view", this clients microphone mute status
	InputMuted,
	/// Automatically up-to-date for any client "in view", this clients headphones/speakers/mic combined mute status
	OutputMuted,
	/// Automatically up-to-date for any client "in view", this clients headphones/speakers only mute status
	OutputOnlyMuted,
	/// Automatically up-to-date for any client "in view", this clients microphone hardware status (is the capture device opened?)
	InputHardware,
	/// Automatically up-to-date for any client "in view", this clients headphone/speakers hardware status (is the playback device opened?)
	OutputHardware,
	/// Only usable for ourself, not propagated to the network
	InputDeactivated,
	/// Internal use
	IdleTime,
	/// Only usable for ourself, the default channel we used to connect on our last connection attempt
	DefaultChannel,
	/// Internal use
	DefaultChannelPassword,
	/// Internal use
	ServerPassword,
	/// Automatically up-to-date for any client "in view", not used by TeamSpeak, free storage for sdk users
	MetaData,
	/// Only make sense on the client side locally, "1" if this client is currently muted by us, "0" if he is not
	IsMuted,
	/// Automatically up-to-date for any client "in view"
	IsRecording,
	/// Internal use
	VolumeModificator,
	/// Sign
	VersionSign,
	/// SDK use, not used by teamspeak. Hash is provided by an outside source. A channel will use the security salt + other client data to calculate a hash, which must be the same as the one provided here.
	SecurityHash,

	/// Rare properties
	Dummy3,
	Dummy4,
	Dummy5,
	Dummy6,
	Dummy7,
	Dummy8,
	Dummy9,
	/// Internal use
	KeyOffset,
	/// Internal use
	LastVarRequest,
	/// Used for serverquery clients, makes no sense on normal clients currently
	LoginName,
	/// Used for serverquery clients, makes no sense on normal clients currently
	LoginPassword,
	/// Automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds database client id
	DatabaseId,
	/// Automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds database client id
	ChannelGroupId,
	/// Automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds all servergroups client belongs too
	Servergroups,
	/// This needs to be requested (=> requestClientVariables), first time this client connected to this server
	Created,
	/// This needs to be requested (=> requestClientVariables), last time this client connected to this server
	Lastconnected,
	/// This needs to be requested (=> requestClientVariables), how many times this client connected to this server
	Totalconnections,
	/// Automatically up-to-date for any client "in view", this clients away status
	Away,
	/// Automatically up-to-date for any client "in view", this clients away status
	AwayMessage,
	/// Automatically up-to-date for any client "in view", determines if this is a real client or a server-query connection
	Type,
	/// Automatically up-to-date for any client "in view", this client got an avatar
	FlagAvatar,
	/// Automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds database client id
	TalkPower,
	/// Automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds timestamp where client requested to talk
	TalkRequest,
	/// Automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds matter for the request
	TalkRequestMsg,
	/// Automatically up-to-date for any client "in view"
	Description,
	/// Automatically up-to-date for any client "in view"
	IsTalker,
	/// This needs to be requested (=> requestClientVariables)
	MonthBytesUploaded,
	/// This needs to be requested (=> requestClientVariables)
	MonthBytesDownloaded,
	/// This needs to be requested (=> requestClientVariables)
	TotalBytesUploaded,
	/// This needs to be requested (=> requestClientVariables)
	TotalBytesDownloaded,
	/// Automatically up-to-date for any client "in view"
	IsPrioritySpeaker,
	/// Automatically up-to-date for any client "in view"
	UnreadMessages,
	/// Automatically up-to-date for any client "in view"
	NicknamePhonetic,
	/// Automatically up-to-date for any client "in view"
	NeededServerqueryViewPower,
	/// Only usable for ourself, the default token we used to connect on our last connection attempt
	DefaultToken,
	/// Automatically up-to-date for any client "in view"
	IconId,
	/// Automatically up-to-date for any client "in view"
	IsChannelCommander,
	/// Automatically up-to-date for any client "in view"
	Country,
	/// Automatically up-to-date for any client "in view", only valid with PERMISSION feature, contains channel_id where the channel_group_id is set from
	ChannelGroupInheritedChannelId,
	/// Automatically up-to-date for any client "in view", stores icons for partner badges
	Badges,
	Endmarker,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum VirtualServerProperties {
	/// Available when connected, can be used to identify this particular server installation
	UniqueIdentifier = 0,
	/// Available and always up-to-date when connected
	Name,
	/// Available when connected, (=> requestServerVariables)
	Welcomemessage,
	/// Available when connected
	Platform,
	/// Available when connected
	Version,
	/// Only available on request (=> requestServerVariables), stores the maximum number of clients that may currently join the server
	MaxClients,
	/// Not available to clients, the server password
	Password,
	/// Only available on request (=> requestServerVariables)
	ClientsOnline,
	/// Only available on request (=> requestServerVariables)
	ChannelsOnline,
	/// Available when connected, stores the time when the server was created
	Created,
	/// Only available on request (=> requestServerVariables), the time since the server was started
	Uptime,
	/// Available and always up-to-date when connected
	CodecEncryptionMode,

	/// Rare properties
	Dummy0,
	Dummy1,
	Dummy2,
	Dummy3,
	Dummy4,
	Dummy5,
	Dummy6,
	Dummy7,
	Dummy8,
	/// Internal use
	Keypair,
	/// Available when connected, not updated while connected
	Hostmessage,
	/// Available when connected, not updated while connected
	HostmessageMode,
	/// Not available to clients, stores the folder used for file transfers
	Filebase,
	/// The client permissions server group that a new client gets assigned
	DefaultServerGroup,
	/// The channel permissions group that a new client gets assigned when joining a channel
	DefaultChannelGroup,
	/// Only available on request (=> requestServerVariables)
	FlagPassword,
	/// The channel permissions group that a client gets assigned when creating a channel
	DefaultChannelAdminGroup,
	/// Only available on request (=> requestServerVariables)
	MaxDownloadTotalBandwidth,
	/// Only available on request (=> requestServerVariables)
	MaxUploadTotalBandwidth,
	/// Available when connected, always up-to-date
	HostbannerUrl,
	/// Available when connected, always up-to-date
	HostbannerGfxUrl,
	/// Available when connected, always up-to-date
	HostbannerGfxInterval,
	/// Only available on request (=> requestServerVariables)
	ComplainAutobanCount,
	/// Only available on request (=> requestServerVariables)
	ComplainAutobanTime,
	/// Only available on request (=> requestServerVariables)
	ComplainRemoveTime,
	/// Only available on request (=> requestServerVariables)
	MinClientsInChannelBeforeForcedSilence,
	/// Available when connected, always up-to-date
	PrioritySpeakerDimmModificator,
	/// Available when connected
	Id,
	/// Only available on request (=> requestServerVariables)
	AntifloodPointsTickReduce,
	/// Only available on request (=> requestServerVariables)
	AntifloodPointsNeededCommandBlock,
	/// Only available on request (=> requestServerVariables)
	AntifloodPointsNeededIpBlock,
	/// Only available on request (=> requestServerVariables)
	ClientConnections,
	/// Only available on request (=> requestServerVariables)
	QueryClientConnections,
	/// Available when connected, always up-to-date
	HostbuttonTooltip,
	/// Available when connected, always up-to-date
	HostbuttonUrl,
	/// Available when connected, always up-to-date
	HostbuttonGfxUrl,
	/// Only available on request (=> requestServerVariables)
	QueryclientsOnline,
	/// Only available on request (=> requestServerVariables)
	DownloadQuota,
	/// Only available on request (=> requestServerVariables)
	UploadQuota,
	/// Only available on request (=> requestServerVariables)
	MonthBytesDownloaded,
	/// Only available on request (=> requestServerVariables)
	MonthBytesUploaded,
	/// Only available on request (=> requestServerVariables)
	TotalBytesDownloaded,
	/// Only available on request (=> requestServerVariables)
	TotalBytesUploaded,
	/// Only available on request (=> requestServerVariables)
	Port,
	/// Only available on request (=> requestServerVariables)
	Autostart,
	/// Only available on request (=> requestServerVariables)
	MachineId,
	/// Only available on request (=> requestServerVariables)
	NeededIdentitySecurityLevel,
	/// Only available on request (=> requestServerVariables)
	LogClient,
	/// Only available on request (=> requestServerVariables)
	LogQuery,
	/// Only available on request (=> requestServerVariables)
	LogChannel,
	/// Only available on request (=> requestServerVariables)
	LogPermissions,
	/// Only available on request (=> requestServerVariables)
	LogServer,
	/// Only available on request (=> requestServerVariables)
	LogFiletransfer,
	/// Only available on request (=> requestServerVariables)
	MinClientVersion,
	/// Available when connected, always up-to-date
	NamePhonetic,
	/// Available when connected, always up-to-date
	IconId,
	/// Available when connected, always up-to-date
	ReservedSlots,
	/// Only available on request (=> requestServerVariables)
	TotalPacketlossSpeech,
	/// Only available on request (=> requestServerVariables)
	TotalPacketlossKeepalive,
	/// Only available on request (=> requestServerVariables)
	TotalPacketlossControl,
	/// Only available on request (=> requestServerVariables)
	TotalPacketlossTotal,
	/// Only available on request (=> requestServerVariables)
	TotalPing,
	/// Internal use | contains only ONE binded ip
	Ip,
	/// Only available on request (=> requestServerVariables)
	WeblistEnabled,
	/// Internal use
	AutogeneratedPrivilegekey,
	/// Available when connected
	AskForPrivilegekey,
	/// Available when connected, always up-to-date
	HostbannerMode,
	/// Available when connected, always up-to-date
	ChannelTempDeleteDelayDefault,
	/// Only available on request (=> requestServerVariables)
	MinAndroidVersion,
	/// Only available on request (=> requestServerVariables)
	MinIosVersion,
	/// Only available on request (=> requestServerVariables)
	MinWinphoneVersion,
	Endmarker,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum ConnectionProperties {
	/// Average latency for a round trip through and back this connection
	Ping = 0,
	/// Standard deviation of the above average latency
	PingDeviation,
	/// How long the connection exists already
	ConnectedTime,
	/// How long since the last action of this client
	IdleTime,
	/// IP of this client (as seen from the server side)
	ClientIp,
	/// Port of this client (as seen from the server side)
	ClientPort,
	/// IP of the server (seen from the client side) - only available on yourself, not for remote clients, not available server side
	ServerIp,
	/// Port of the server (seen from the client side) - only available on yourself, not for remote clients, not available server side
	ServerPort,
	/// How many Speech packets were sent through this connection
	PacketsSentSpeech,
	PacketsSentKeepalive,
	PacketsSentControl,
	/// How many packets were sent totally (this is PACKETS_SENT_SPEECH + PACKETS_SENT_KEEPALIVE + PACKETS_SENT_CONTROL)
	PacketsSentTotal,
	BytesSentSpeech,
	BytesSentKeepalive,
	BytesSentControl,
	BytesSentTotal,
	PacketsReceivedSpeech,
	PacketsReceivedKeepalive,
	PacketsReceivedControl,
	PacketsReceivedTotal,
	BytesReceivedSpeech,
	BytesReceivedKeepalive,
	BytesReceivedControl,
	BytesReceivedTotal,
	PacketlossSpeech,
	PacketlossKeepalive,
	PacketlossControl,
	/// The probability with which a packet round trip failed because a packet was lost
	PacketlossTotal,
	/// The probability with which a speech packet failed from the server to the client
	Server2ClientPacketlossSpeech,
	Server2ClientPacketlossKeepalive,
	Server2ClientPacketlossControl,
	Server2ClientPacketlossTotal,
	Client2ServerPacketlossSpeech,
	Client2ServerPacketlossKeepalive,
	Client2ServerPacketlossControl,
	Client2ServerPacketlossTotal,
	/// Howmany bytes of speech packets we sent during the last second
	BandwidthSentLastSecondSpeech,
	BandwidthSentLastSecondKeepalive,
	BandwidthSentLastSecondControl,
	BandwidthSentLastSecondTotal,
	/// Howmany bytes/s of speech packets we sent in average during the last minute
	BandwidthSentLastMinuteSpeech,
	BandwidthSentLastMinuteKeepalive,
	BandwidthSentLastMinuteControl,
	BandwidthSentLastMinuteTotal,
	BandwidthReceivedLastSecondSpeech,
	BandwidthReceivedLastSecondKeepalive,
	BandwidthReceivedLastSecondControl,
	BandwidthReceivedLastSecondTotal,
	BandwidthReceivedLastMinuteSpeech,
	BandwidthReceivedLastMinuteKeepalive,
	BandwidthReceivedLastMinuteControl,
	BandwidthReceivedLastMinuteTotal,

	/// Rare properties
	Dummy0,
	Dummy1,
	Dummy2,
	Dummy3,
	Dummy4,
	Dummy5,
	Dummy6,
	Dummy7,
	Dummy8,
	Dummy9,
	/// How many bytes per second are currently being sent by file transfers
	FileTransferBandwidthSent,
	/// Bow many bytes per second are currently being received by file transfers
	FiletransferBandwidthReceived,
	/// How many bytes we received in total through file transfers
	FiletransferBytesReceivedTotal,
	/// How many bytes we sent in total through file transfers
	FiletransferBytesSentTotal,
	Endmarker,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum LogTypes {
	None         =  0,
	File         =  1,
	Console      =  2,
	Userlogging  =  4,
	NoNetlogging =  8,
	Database     = 16,
	Syslog       = 32,
}

#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub enum LogLevel {
	/// These messages stop the program
	Critical = 0,
	/// Everything that is really bad, but not so bad we need to shut down
	Error,
	/// Everything that *might* be bad
	Warning,
	/// Output that might help find a problem
	Debug,
	/// Informational output, like "starting database version x.y.z"
	Info,
	/// Developer only output (will not be displayed in release mode)
	Devel,
}

#[repr(C)]
pub struct Ts3Vector {
	/// X co-ordinate in 3D space
	pub x: c_float,
	/// Y co-ordinate in 3D space
	pub y: c_float,
	/// Z co-ordinate in 3D space
	pub z: c_float,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum GroupWhisperType {
	Servergroup      = 0,
	Channelgroup     = 1,
	Channelcommander = 2,
	Allclients       = 3,
	Endmarker,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum GroupWhisperTargetMode {
	All                   = 0,
	Currentchannel        = 1,
	Parentchannel         = 2,
	Allparentchannel      = 3,
	Channelfamily         = 4,
	Ancestorchannelfamily = 5,
	Subchannels           = 6,
	Endmarker,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum MonoSoundDestination {
	/// Send mono sound to all available speakers
	All               = 0,
	/// Send mono sound to front center speaker if available
	FrontCenter       = 1,
	/// Send mono sound to front left/right speakers if available
	FrontLeftAndRight = 2,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum SecuritySaltOptions {
	/// Put nickname into security hash
	CheckNickname = 1,
	/// Put (game)meta data into security hash
	CheckMetaData = 2,
}

/// This enum is used to disable client commands on the server
#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum ClientCommand {
	RequestConnectionInfo       = 0,
	RequestClientMove           = 1,
	RequestXXMuteClients        = 2,
	RequestClientKickFromXXX    = 3,
	FlushChannelCreation        = 4,
	FlushChannelUpdate          = 5,
	RequestChannelMove          = 6,
	RequestChannelDelete        = 7,
	RequestChannelDescription   = 8,
	RequestChannelXXSubscripeXX = 9,
	RequestServerConnectionInfo = 10,
	RequestSendXXXTextMsg       = 11,
	FileTransfer                = 12,
	Endmarker,
}

/// Access Control List
#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum ACLType {
	None      = 0,
	WhiteList = 1,
	BlackList = 2,
}

/// File transfer actions
#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum FileTransferAction {
	InitServer  = 0,
	InitChannel = 1,
	Upload      = 2,
	Download    = 3,
	Delete      = 4,
	CreateDir   = 5,
	Rename      = 6,
	FileList    = 7,
	FileInfo    = 8,
}

/// File transfer status
#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum FileTransferState {
	Initialising = 0,
	Active,
	Finished,
}

/// File transfer type
#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum FileListType {
	Directory = 0,
	File,
}

/// Some structs to handle variables in callbacks
#[repr(C)]
pub struct VariablesExportItem {
	/// This item has valid values. ignore this item if 0
	pub item_is_valid:   u8,
	/// The value in proposed is set. if 0 ignore proposed
	pub proposed_is_set: u8,
	/// Current value (stored in memory)
	pub current:         *const c_char,
	/// New value to change to (const, so no updates please)
	pub proposed:        *const c_char,
}

#[repr(C)]
pub struct VariablesExport {
	pub items: [VariablesExportItem; MAX_VARIABLES_EXPORT_COUNT],
}

#[repr(C)]
pub struct ClientMiniExport {
	pub id:       u16,
	pub channel:  u64,
	pub ident:    *const c_char,
	pub nickname: *const c_char,
}

#[repr(C)]
pub struct TransformFilePathExport {
	pub channel:                        u64,
	pub filename:                       *const c_char,
	pub action:                         c_int,
	pub transformed_file_name_max_size: c_int,
	pub channel_path_max_size:          c_int,
}

#[repr(C)]
pub struct TransformFilePathExportReturns {
	pub transformed_file_name: *mut c_char,
	pub channel_path:          *mut c_char,
	pub log_file_action:       c_int,
}

#[repr(C)]
pub struct FileTransferCallbackExport {
	pub client_id:          u16,
	pub transfer_id:        u16,
	pub remote_transfer_id: u16,
	pub status:             c_uint,
	pub status_message:     *const c_char,
	pub remote_file_size:   u64,
	pub bytes:              u64,
	pub is_sender:          c_int,
}

pub const BANDWIDTH_LIMIT_UNLIMITED: u64 = std::u64::MAX;

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum GroupShowNameTreeMode {
	/// Dont group show name
	None = 0,
	/// Show group name before client name
	Before,
	/// Show group name behind client name
	Behind,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum PluginTargetMode {
	/// Send plugincmd to all clients in current channel
	CurrentChannel = 0,
	/// Send plugincmd to all clients on server
	Server,
	/// Send plugincmd to all given client ids
	Client,
	/// Send plugincmd to all subscribed clients in current channel
	CurrentChannelSubscribedClients,
	Max,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum ServerBinding {
	Virtualserver = 0,
	Serverquery   = 1,
	Filetransfer  = 2,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum HostmessageMode {
	/// Dont display anything
	None = 0,
	/// Display message inside log
	Log,
	/// Display message inside a modal dialog
	Modal,
	/// Display message inside a modal dialog and quit/close server/connection
	Modalquit,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum HostbannerMode {
	/// Do not adjust
	NoAdjust = 0,
	/// Do not adjust
	AdjustIgnoreAspect,
	/// Do not adjust
	AdjustKeepAspect,
}


#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum ClientType {
	Normal = 0,
	Serverquery,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum AwayStatus {
	None = 0,
	Zzz,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum CommandLinePropertiesRare {
	Nothing = 0,
	Endmarker,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum ServerInstancePropertiesRare {
	DatabaseVersion = 0,
	FiletransferPort,
	ServerEntropy,
	MonthlyTimestamp,
	MaxDownloadTotalBandwidth,
	MaxUploadTotalBandwidth,
	GuestServerqueryGroup,
	/// How many commands we can issue while in the SERVERINSTANCE_SERVERQUERY_FLOOD_TIME window
	ServerqueryFloodCommands,
	/// Time window in seconds for max command execution check
	ServerqueryFloodTime,
	/// How many seconds someone get banned if he floods
	ServerqueryBanTime,
	TemplateServeradminGroup,
	TemplateServerdefaultGroup,
	TemplateChanneladminGroup,
	TemplateChannelDefaultGroup,
	PermissionsVersion,
	PendingConnectionsPerIp,
	Endmarker,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum LicenseViolationType {
	No = 0,
	Slot,
	SlotSuspicion,
}

bitflags! {
pub flags BBCodeTags: u32 {
	const BBCODE_B           = 0x00000001,
	const BBCODE_I           = 0x00000002,
	const BBCODE_U           = 0x00000004,
	const BBCODE_S           = 0x00000008,
	const BBCODE_SUP         = 0x00000010,
	const BBCODE_SUB         = 0x00000020,
	const BBCODE_COLOR       = 0x00000040,
	const BBCODE_SIZE        = 0x00000080,
	const BBCODE_GROUP_TEXT  = 0x000000FF,

	const BBCODE_LEFT        = 0x00001000,
	const BBCODE_RIGHT       = 0x00002000,
	const BBCODE_CENTER      = 0x00004000,
	const BBCODE_GROUP_ALIGN = 0x00007000,

	const BBCODE_URL         = 0x00010000,
	const BBCODE_IMAGE       = 0x00020000,
	const BBCODE_HR          = 0x00040000,

	const BBCODE_LIST        = 0x00100000,
	const BBCODE_LISTITEM    = 0x00200000,
	const BBCODE_GROUP_LIST  = 0x00300000,

	const BBCODE_TABLE       = 0x00400000,
	const BBCODE_TR          = 0x00800000,
	const BBCODE_TH          = 0x01000000,
	const BBCODE_TD          = 0x02000000,
	const BBCODE_GROUP_TABLE = 0x03C00000,

	const BBCODE_DEF_SIMPLE     = BBCODE_B.bits | BBCODE_I.bits | BBCODE_U.bits |
		BBCODE_S.bits | BBCODE_SUP.bits | BBCODE_SUB.bits | BBCODE_COLOR.bits |
		BBCODE_URL.bits,
	const BBCODE_DEF_SIMPLE_IMG = BBCODE_DEF_SIMPLE.bits | BBCODE_IMAGE.bits,
	const BBCODE_DEF_EXTENDED   = BBCODE_GROUP_TEXT.bits | BBCODE_GROUP_ALIGN.bits |
		BBCODE_URL.bits | BBCODE_IMAGE.bits | BBCODE_HR.bits | BBCODE_GROUP_LIST.bits |
		BBCODE_GROUP_TABLE.bits,
}}

// As they are only typedefs and I didn't found any usage, I'll just leave them here for now
//typedef int(*ExtraBBCodeValidator)(void* userparam, const char* tag, const char* paramValue, int paramValueSize, const char* childValue, int childValueSize);
//typedef const char* (*ExtraBBCodeParamTransform)(void* userparam, const char* tag, const char* paramValue);