/
Admin.h
1505 lines (1406 loc) · 54.5 KB
/
Admin.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
// SoftEther VPN Source Code
// Cedar Communication Module
//
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
//
// Copyright (c) 2012-2014 Daiyuu Nobori.
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
// Copyright (c) 2012-2014 SoftEther Corporation.
//
// All Rights Reserved.
//
// http://www.softether.org/
//
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License version 2
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
//
//
// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
//
// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
// COUNTRIES MIGHT BE RESTRICTED.
//
//
// DEAR SECURITY EXPERTS
// ---------------------
//
// If you find a bug or a security vulnerability please kindly inform us
// about the problem immediately so that we can fix the security problem
// to protect a lot of users around the world as soon as possible.
//
// Our e-mail address for security reports is:
// softether-vpn-security [at] softether.org
//
// Please note that the above e-mail address is not a technical support
// inquiry address. If you need technical assistance, please visit
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
// Admin.h
// Header of Admin.c
#ifndef ADMIN_H
#define ADMIN_H
// Windows version
struct RPC_WINVER
{
bool IsWindows;
bool IsNT;
bool IsServer;
bool IsBeta;
UINT VerMajor;
UINT VerMinor;
UINT Build;
UINT ServicePack;
char Title[128];
};
// Server-side structure
struct ADMIN
{
SERVER *Server; // Server
bool ServerAdmin; // Server Administrator
char *HubName; // HUB name that can be managed
RPC *Rpc; // RPC
LIST *LogFileList; // Accessible log file list
UINT ClientBuild; // Build number of the client
RPC_WINVER ClientWinVer; // Windows version of client
};
// Test
struct RPC_TEST
{
UINT IntValue;
UINT64 Int64Value;
char StrValue[1024];
wchar_t UniStrValue[1024];
};
// Server Information *
struct RPC_SERVER_INFO
{
char ServerProductName[128]; // Server product name
char ServerVersionString[128]; // Server version string
char ServerBuildInfoString[128]; // Server build information string
UINT ServerVerInt; // Server version integer value
UINT ServerBuildInt; // Server build number integer value
char ServerHostName[MAX_HOST_NAME_LEN + 1]; // Server host name
UINT ServerType; // Type of server
UINT64 ServerBuildDate; // Build date and time of the server
char ServerFamilyName[128]; // Family name
OS_INFO OsInfo; // OS information
};
// Server status
struct RPC_SERVER_STATUS
{
UINT ServerType; // Type of server
UINT NumTcpConnections; // Total number of TCP connections
UINT NumTcpConnectionsLocal; // Number of Local TCP connections
UINT NumTcpConnectionsRemote; // Number of remote TCP connections
UINT NumHubTotal; // Total number of HUBs
UINT NumHubStandalone; // Nymber of stand-alone HUB
UINT NumHubStatic; // Number of static HUBs
UINT NumHubDynamic; // Number of Dynamic HUBs
UINT NumSessionsTotal; // Total number of sessions
UINT NumSessionsLocal; // Number of Local sessions (only controller)
UINT NumSessionsRemote; // The number of remote sessions (other than the controller)
UINT NumMacTables; // Number of MAC table entries
UINT NumIpTables; // Number of IP table entries
UINT NumUsers; // Number of users
UINT NumGroups; // Number of groups
UINT AssignedBridgeLicenses; // Number of assigned bridge licenses
UINT AssignedClientLicenses; // Number of assigned client licenses
UINT AssignedBridgeLicensesTotal; // Number of Assigned bridge license (cluster-wide)
UINT AssignedClientLicensesTotal; // Number of assigned client licenses (cluster-wide)
TRAFFIC Traffic; // Traffic information
UINT64 CurrentTime; // Current time
UINT64 CurrentTick; // Current tick
UINT64 StartTime; // Start-up time
MEMINFO MemInfo; // Memory information
};
// Listener
struct RPC_LISTENER
{
UINT Port; // Port number
bool Enable; // Active state
};
// List of listeners *
struct RPC_LISTENER_LIST
{
UINT NumPort; // Number of ports
UINT *Ports; // Port List
bool *Enables; // Effective state
bool *Errors; // An error occurred
};
// String *
struct RPC_STR
{
char *String; // String
};
// Integer
struct RPC_INT
{
UINT IntValue; // Integer
};
// Set Password
struct RPC_SET_PASSWORD
{
UCHAR HashedPassword[SHA1_SIZE]; // Hashed password
};
// Server farm configuration *
struct RPC_FARM
{
UINT ServerType; // Type of server
UINT NumPort; // Number of public ports
UINT *Ports; // Public port list
UINT PublicIp; // Public IP
char ControllerName[MAX_HOST_NAME_LEN + 1]; // Controller name
UINT ControllerPort; // Controller port
UCHAR MemberPassword[SHA1_SIZE]; // Member password
UINT Weight; // Performance ratio
bool ControllerOnly; // Only controller function
};
// HUB item of each farm member
struct RPC_FARM_HUB
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
bool DynamicHub; // Dynamic HUB
};
// Server farm member information acquisition *
struct RPC_FARM_INFO
{
UINT Id; // ID
bool Controller; // Controller
UINT64 ConnectedTime; // Connection time
UINT Ip; // IP address
char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name
UINT Point; // Point
UINT NumPort; // Number of ports
UINT *Ports; // Port
X *ServerCert; // Server certificate
UINT NumFarmHub; // Number of farm HUB
RPC_FARM_HUB *FarmHubs; // Farm HUB
UINT NumSessions; // Number of sessions
UINT NumTcpConnections; // Number of TCP connections
UINT Weight; // Performance ratio
};
// Server farm members enumeration items
struct RPC_ENUM_FARM_ITEM
{
UINT Id; // ID
bool Controller; // Controller
UINT64 ConnectedTime; // Connection time
UINT Ip; // IP address
char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name
UINT Point; // Point
UINT NumSessions; // Number of sessions
UINT NumTcpConnections; // Number of TCP connections
UINT NumHubs; // Number of HUBs
UINT AssignedClientLicense; // Number of assigned client licenses
UINT AssignedBridgeLicense; // Number of assigned bridge licenses
};
// Server farm member enumeration *
struct RPC_ENUM_FARM
{
UINT NumFarm; // Number of farm members
RPC_ENUM_FARM_ITEM *Farms; // Farm member list
};
// Connection state to the controller
struct RPC_FARM_CONNECTION_STATUS
{
UINT Ip; // IP address
UINT Port; // Port number
bool Online; // Online state
UINT LastError; // Last error
UINT64 StartedTime; // Connection start time
UINT64 FirstConnectedTime; // First connection time
UINT64 CurrentConnectedTime; // Connection time of this time
UINT NumTry; // Number of trials
UINT NumConnected; // Number of connection count
UINT NumFailed; // Connection failure count
};
// Key pair
struct RPC_KEY_PAIR
{
X *Cert; // Certificate
K *Key; // Secret key
};
// HUB option
struct RPC_HUB_OPTION
{
UINT MaxSession; // Maximum number of sessions
bool NoEnum; // Not listed
};
// Radius server options
struct RPC_RADIUS
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
char RadiusServerName[MAX_HOST_NAME_LEN + 1]; // Radius server name
UINT RadiusPort; // Radius port number
char RadiusSecret[MAX_PASSWORD_LEN + 1]; // Secret key
UINT RadiusRetryInterval; // Radius retry interval
};
// Specify the HUB
struct RPC_HUB
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
};
// Create a HUB
struct RPC_CREATE_HUB
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UCHAR HashedPassword[SHA1_SIZE]; // Administrative password
UCHAR SecurePassword[SHA1_SIZE]; // Administrator password
bool Online; // Online flag
RPC_HUB_OPTION HubOption; // HUB options
UINT HubType; // Type of HUB
};
// Enumeration items of HUB
struct RPC_ENUM_HUB_ITEM
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
bool Online; // Online
UINT HubType; // Type of HUB
UINT NumUsers; // Number of users
UINT NumGroups; // Number of groups
UINT NumSessions; // Number of sessions
UINT NumMacTables; // Number of MAC table entries
UINT NumIpTables; // Number of IP table entries
UINT64 LastCommTime; // Last communication date and time
UINT64 LastLoginTime; // Last login date and time
UINT64 CreatedTime; // Creation date and time
UINT NumLogin; // Number of logins
bool IsTrafficFilled; // Whether the traffic information exists
TRAFFIC Traffic; // Traffic
};
// Enumeration of HUB
struct RPC_ENUM_HUB
{
UINT NumHub; // Number of HUBs
RPC_ENUM_HUB_ITEM *Hubs; // HUB
};
// Delete the HUB
struct RPC_DELETE_HUB
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
};
// Connection enumeration items
struct RPC_ENUM_CONNECTION_ITEM
{
char Name[MAX_SIZE]; // Connection name
char Hostname[MAX_SIZE]; // Host name
UINT Ip; // IP address
UINT Port; // Port number
UINT64 ConnectedTime; // Connected time
UINT Type; // Type
};
// Connection enumeration
struct RPC_ENUM_CONNECTION
{
UINT NumConnection; // Number of connections
RPC_ENUM_CONNECTION_ITEM *Connections; // Connection list
};
// Disconnection
struct RPC_DISCONNECT_CONNECTION
{
char Name[MAX_SIZE]; // Connection name
};
// Connection information
struct RPC_CONNECTION_INFO
{
char Name[MAX_SIZE]; // Connection name
UINT Type; // Type
char Hostname[MAX_SIZE]; // Host name
UINT Ip; // IP address
UINT Port; // Port number
UINT64 ConnectedTime; // Connected time
char ServerStr[MAX_SERVER_STR_LEN + 1]; // Server string
UINT ServerVer; // Server version
UINT ServerBuild; // Server build number
char ClientStr[MAX_CLIENT_STR_LEN + 1]; // Client string
UINT ClientVer; // Client version
UINT ClientBuild; // Client build number
};
// Online or offline the HUB
struct RPC_SET_HUB_ONLINE
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
bool Online; // Online / offline flag
};
// Get the state HUB
struct RPC_HUB_STATUS
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
bool Online; // Online
UINT HubType; // Type of HUB
UINT NumSessions; // Number of sessions
UINT NumSessionsClient; // Number of sessions (client)
UINT NumSessionsBridge; // Number of sessions (bridge)
UINT NumAccessLists; // Number of Access list entries
UINT NumUsers; // Number of users
UINT NumGroups; // Number of groups
UINT NumMacTables; // Number of MAC table entries
UINT NumIpTables; // Number of IP table entries
TRAFFIC Traffic; // Traffic
bool SecureNATEnabled; // Whether SecureNAT is enabled
UINT64 LastCommTime; // Last communication date and time
UINT64 LastLoginTime; // Last login date and time
UINT64 CreatedTime; // Creation date and time
UINT NumLogin; // Number of logins
};
// HUB log settings
struct RPC_HUB_LOG
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
HUB_LOG LogSetting; // Log Settings
};
// Add CA to HUB *
struct RPC_HUB_ADD_CA
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
X *Cert; // Certificate
};
// CA enumeration items of HUB
struct RPC_HUB_ENUM_CA_ITEM
{
UINT Key; // Certificate key
wchar_t SubjectName[MAX_SIZE]; // Issued to
wchar_t IssuerName[MAX_SIZE]; // Issuer
UINT64 Expires; // Expiration date
};
// CA enumeration of HUB *
struct RPC_HUB_ENUM_CA
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT NumCa; // CA number
RPC_HUB_ENUM_CA_ITEM *Ca; // CA
};
// Get the CA of HUB *
struct RPC_HUB_GET_CA
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT Key; // Certificate key
X *Cert; // Certificate
};
// Delete the CA of HUB
struct RPC_HUB_DELETE_CA
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT Key; // Certificate key to be deleted
};
// Create and set of link *
struct RPC_CREATE_LINK
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
bool Online; // Online flag
CLIENT_OPTION *ClientOption; // Client Option
CLIENT_AUTH *ClientAuth; // Client authentication data
POLICY Policy; // Policy
bool CheckServerCert; // Validate the server certificate
X *ServerCert; // Server certificate
};
// Enumeration items of link
struct RPC_ENUM_LINK_ITEM
{
wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name
bool Online; // Online flag
bool Connected; // Connection completion flag
UINT LastError; // The error that last occurred
UINT64 ConnectedTime; // Connection completion time
char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
};
// Enumeration of the link *
struct RPC_ENUM_LINK
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT NumLink; // Number of links
RPC_ENUM_LINK_ITEM *Links; // Link List
};
// Get the link state *
struct RPC_LINK_STATUS
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name
RPC_CLIENT_GET_CONNECTION_STATUS Status; // Status
};
// Specify the Link
struct RPC_LINK
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name
};
// Rename link
struct RPC_RENAME_LINK
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
wchar_t OldAccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Old account name
wchar_t NewAccountName[MAX_ACCOUNT_NAME_LEN + 1]; // New account name
};
// Enumeration of the access list *
struct RPC_ENUM_ACCESS_LIST
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT NumAccess; // Number of Access list entries
ACCESS *Accesses; // Access list
};
// Add to Access List
struct RPC_ADD_ACCESS
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
ACCESS Access; // Access list
};
// Delete the access list
struct RPC_DELETE_ACCESS
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT Id; // ID
};
// Create, configure, and get the user *
struct RPC_SET_USER
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
char Name[MAX_USERNAME_LEN + 1]; // User name
char GroupName[MAX_USERNAME_LEN + 1]; // Group name
wchar_t Realname[MAX_SIZE]; // Real name
wchar_t Note[MAX_SIZE]; // Note
UINT64 CreatedTime; // Creation date and time
UINT64 UpdatedTime; // Updating date
UINT64 ExpireTime; // Expiration date
UINT AuthType; // Authentication method
void *AuthData; // Authentication data
UINT NumLogin; // Number of logins
TRAFFIC Traffic; // Traffic data
POLICY *Policy; // Policy
};
// Enumeration item of user
struct RPC_ENUM_USER_ITEM
{
char Name[MAX_USERNAME_LEN + 1]; // User name
char GroupName[MAX_USERNAME_LEN + 1]; // Group name
wchar_t Realname[MAX_SIZE]; // Real name
wchar_t Note[MAX_SIZE]; // Note
UINT AuthType; // Authentication method
UINT NumLogin; // Number of logins
UINT64 LastLoginTime; // Last login date and time
bool DenyAccess; // Access denied
bool IsTrafficFilled; // Flag of whether the traffic variable is set
TRAFFIC Traffic; // Traffic
bool IsExpiresFilled; // Flag of whether expiration date variable is set
UINT64 Expires; // Expiration date
};
// Enumeration of user
struct RPC_ENUM_USER
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT NumUser; // Number of users
RPC_ENUM_USER_ITEM *Users; // User
};
// Create, configure, and get the group *
struct RPC_SET_GROUP
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
char Name[MAX_USERNAME_LEN + 1]; // User name
wchar_t Realname[MAX_SIZE]; // Real name
wchar_t Note[MAX_SIZE]; // Note
TRAFFIC Traffic; // Traffic data
POLICY *Policy; // Policy
};
// Enumeration items in the group
struct RPC_ENUM_GROUP_ITEM
{
char Name[MAX_USERNAME_LEN + 1]; // User name
wchar_t Realname[MAX_SIZE]; // Real name
wchar_t Note[MAX_SIZE]; // Note
UINT NumUsers; // Number of users
bool DenyAccess; // Access denied
};
// Group enumeration
struct RPC_ENUM_GROUP
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT NumGroup; // Number of groups
RPC_ENUM_GROUP_ITEM *Groups; // Group
};
// Deleting a user or group
struct RPC_DELETE_USER
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
char Name[MAX_USERNAME_LEN + 1]; // User or group name
};
// Enumeration items of session
struct RPC_ENUM_SESSION_ITEM
{
char Name[MAX_SESSION_NAME_LEN + 1]; // Session name
bool RemoteSession; // Remote session
char RemoteHostname[MAX_HOST_NAME_LEN + 1]; // Remote server name
char Username[MAX_USERNAME_LEN + 1]; // User name
UINT Ip; // IP address (IPv4)
char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name
UINT MaxNumTcp; // Maximum number of TCP connections
UINT CurrentNumTcp; // Number of currentl TCP connections
UINT64 PacketSize; // Packet size
UINT64 PacketNum; // Number of packets
bool LinkMode; // Link mode
bool SecureNATMode; // SecureNAT mode
bool BridgeMode; // Bridge mode
bool Layer3Mode; // Layer 3 mode
bool Client_BridgeMode; // Client is bridge mode
bool Client_MonitorMode; // Client is monitoring mode
UINT VLanId; // VLAN ID
UCHAR UniqueId[16]; // Unique ID
};
// Disconnect the session
struct RPC_DELETE_SESSION
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
char Name[MAX_SESSION_NAME_LEN + 1]; // Session name
};
// Enumeration items of the MAC table
struct RPC_ENUM_MAC_TABLE_ITEM
{
UINT Key; // Key
char SessionName[MAX_SESSION_NAME_LEN + 1]; // Session name
UCHAR MacAddress[6]; // MAC address
UCHAR Padding[2];
UINT64 CreatedTime; // Creation date and time
UINT64 UpdatedTime; // Updating date
bool RemoteItem; // Remote items
char RemoteHostname[MAX_HOST_NAME_LEN + 1]; // Remote host name
UINT VlanId; // VLAN ID
};
// Enumeration of the MAC table
struct RPC_ENUM_MAC_TABLE
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT NumMacTable; // Number of tables
RPC_ENUM_MAC_TABLE_ITEM *MacTables; // MAC table
};
// Enumeration items of IP table
struct RPC_ENUM_IP_TABLE_ITEM
{
UINT Key; // Key
char SessionName[MAX_SESSION_NAME_LEN + 1]; // Session name
UINT Ip; // IP address
IP IpV6; // IPv6 address
bool DhcpAllocated; // Assigned by the DHCP
UINT64 CreatedTime; // Creation date and time
UINT64 UpdatedTime; // Updating date
bool RemoteItem; // Remote items
char RemoteHostname[MAX_HOST_NAME_LEN + 1]; // Remote host name
};
// Enumeration of IP table
struct RPC_ENUM_IP_TABLE
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT NumIpTable; // Number of tables
RPC_ENUM_IP_TABLE_ITEM *IpTables; // MAC table
};
// Delete the table
struct RPC_DELETE_TABLE
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT Key; // Key
};
// KEEP setting
struct RPC_KEEP
{
bool UseKeepConnect; // Keep connected to the Internet
char KeepConnectHost[MAX_HOST_NAME_LEN + 1]; // Host name
UINT KeepConnectPort; // Port number
UINT KeepConnectProtocol; // Protocol
UINT KeepConnectInterval; // Interval
};
// Ethernet enumeration item
struct RPC_ENUM_ETH_ITEM
{
char DeviceName[MAX_SIZE]; // Device name
wchar_t NetworkConnectionName[MAX_SIZE];// Network connection name
};
// Ethernet enumeration
struct RPC_ENUM_ETH
{
UINT NumItem; // Number of items
RPC_ENUM_ETH_ITEM *Items; // Item
};
// Bridge item
struct RPC_LOCALBRIDGE
{
char DeviceName[MAX_SIZE]; // Device name
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
bool Online; // Online flag
bool Active; // Running flag
bool TapMode; // Tap mode
};
// Bridge enumeration
struct RPC_ENUM_LOCALBRIDGE
{
UINT NumItem; // Number of items
RPC_LOCALBRIDGE *Items; // Item
};
// Bridge support information
struct RPC_BRIDGE_SUPPORT
{
bool IsBridgeSupportedOs; // Whether the OS supports the bridge
bool IsWinPcapNeeded; // Whether WinPcap is necessary
};
// Config operation
struct RPC_CONFIG
{
char FileName[MAX_PATH]; // File name
char *FileData; // File data
};
// Administration options list
struct RPC_ADMIN_OPTION
{
char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name
UINT NumItem; // Count
ADMIN_OPTION *Items; // Data
};
// Layer-3 switch
struct RPC_L3SW
{
char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name
};
// Layer-3 switch enumeration
struct RPC_ENUM_L3SW_ITEM
{
char Name[MAX_HUBNAME_LEN + 1]; // Name
UINT NumInterfaces; // Number of interfaces
UINT NumTables; // Routing table number
bool Active; // In operation
bool Online; // Online
};
struct RPC_ENUM_L3SW
{
UINT NumItem;
RPC_ENUM_L3SW_ITEM *Items;
};
// Layer-3 interface
struct RPC_L3IF
{
char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name
char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name
UINT IpAddress; // IP address
UINT SubnetMask; // Subnet mask
};
// Layer-3 interface enumeration
struct RPC_ENUM_L3IF
{
char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name
UINT NumItem;
RPC_L3IF *Items;
};
// Routing table
struct RPC_L3TABLE
{
char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name
UINT NetworkAddress; // Network address
UINT SubnetMask; // Subnet mask
UINT GatewayAddress; // Gateway address
UINT Metric; // Metric
};
// Routing table enumeration
struct RPC_ENUM_L3TABLE
{
char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name
UINT NumItem;
RPC_L3TABLE *Items;
};
// CRL entry
struct RPC_CRL
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT Key; // Key
CRL *Crl; // CRL body
};
// CRL enumeration
struct RPC_ENUM_CRL_ITEM
{
UINT Key; // Key
wchar_t CrlInfo[MAX_SIZE]; // Information
};
struct RPC_ENUM_CRL
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
UINT NumItem; // Number of items
RPC_ENUM_CRL_ITEM *Items; // List
};
// AC list
struct RPC_AC_LIST
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
LIST *o; // List body
bool InternalFlag1;
};
// Log file enumeration
struct RPC_ENUM_LOG_FILE_ITEM
{
char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name
char FilePath[MAX_PATH]; // File Path
UINT FileSize; // File size
UINT64 UpdatedTime; // Updating date
};
struct RPC_ENUM_LOG_FILE
{
UINT NumItem; // Number of items
RPC_ENUM_LOG_FILE_ITEM *Items; // List
};
// Read a Log file
struct RPC_READ_LOG_FILE
{
char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name
char FilePath[MAX_PATH]; // File Path
UINT Offset; // Offset
BUF *Buffer; // Buffer
};
// Download information
struct DOWNLOAD_PROGRESS
{
void *Param; // User define data
UINT TotalSize; // The total file size
UINT CurrentSize; // Size which has loaded
UINT ProgressPercent; // Percent Complete
};
// Enumerate the license keys
struct RPC_ENUM_LICENSE_KEY_ITEM
{
UINT Id; // ID
char LicenseKey[LICENSE_KEYSTR_LEN + 1]; // License key
char LicenseId[LICENSE_LICENSEID_STR_LEN + 1]; // License ID
char LicenseName[LICENSE_MAX_PRODUCT_NAME_LEN + 1]; // License name
UINT64 Expires; // Expiration date
UINT Status; // Situation
UINT ProductId; // Product ID
UINT64 SystemId; // System ID
UINT SerialId; // Serial ID
};
struct RPC_ENUM_LICENSE_KEY
{
UINT NumItem; // Number of items
RPC_ENUM_LICENSE_KEY_ITEM *Items; // List
};
// License status of the server
struct RPC_LICENSE_STATUS
{
UINT EditionId; // Edition ID
char EditionStr[LICENSE_MAX_PRODUCT_NAME_LEN + 1]; // Edition name
UINT64 SystemId; // System ID
UINT64 SystemExpires; // System expiration date
UINT NumClientConnectLicense; // Maximum number of concurrent client connections
UINT NumBridgeConnectLicense; // Available number of concurrent bridge connections
// v3.0
bool NeedSubscription; // Subscription system is enabled
UINT64 SubscriptionExpires; // Subscription expiration date
bool IsSubscriptionExpired; // Whether the subscription is expired
UINT NumUserCreationLicense; // Maximum number of users
bool AllowEnterpriseFunction; // Operation of the enterprise function
UINT64 ReleaseDate; // Release date
};
// Enumeration of VLAN support status of physical LAN card
struct RPC_ENUM_ETH_VLAN_ITEM
{
char DeviceName[MAX_SIZE]; // Device name
char Guid[MAX_SIZE]; // GUID
char DeviceInstanceId[MAX_SIZE]; // Device Instance ID
char DriverName[MAX_SIZE]; // Driver file name
char DriverType[MAX_SIZE]; // Type of driver
bool Support; // Check whether it is supported
bool Enabled; // Whether it is enabled
};
struct RPC_ENUM_ETH_VLAN
{
UINT NumItem; // Number of items
RPC_ENUM_ETH_VLAN_ITEM *Items; // List
};
// Message
struct RPC_MSG
{
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
wchar_t *Msg; // Message
};
// EtherIP setting list
struct RPC_ENUM_ETHERIP_ID
{
UINT NumItem;
ETHERIP_ID *IdList;
};
// Set the special listener
struct RPC_SPECIAL_LISTENER
{
bool VpnOverIcmpListener; // VPN over ICMP
bool VpnOverDnsListener; // VPN over DNS
};
// Get / Set the Azure state
struct RPC_AZURE_STATUS
{
bool IsEnabled; // Whether enabled
bool IsConnected; // Whether it's connected
};
// Function prototype
UINT AdminAccept(CONNECTION *c, PACK *p);
void HashAdminPassword(void *hash, char *password);
SESSION *AdminConnectMain(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name, void *hWnd, bool *empty_password);
RPC *AdminConnect(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err);
RPC *AdminConnectEx(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name);
RPC *AdminConnectEx2(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name, void *hWnd);
void AdminDisconnect(RPC *rpc);
UINT AdminReconnect(RPC *rpc);
UINT AdminCheckPassword(CEDAR *c, void *random, void *secure_password, char *hubname, bool accept_empty_password, bool *is_password_empty);
PACK *AdminDispatch(RPC *rpc, char *name, PACK *p);
PACK *AdminCall(RPC *rpc, char *function_name, PACK *p);
void SiEnumLocalSession(SERVER *s, char *hubname, RPC_ENUM_SESSION *t);
void CopyOsInfo(OS_INFO *dst, OS_INFO *info);
CAPSLIST *ScGetCapsEx(RPC *rpc);
UINT SiEnumMacTable(SERVER *s, char *hubname, RPC_ENUM_MAC_TABLE *t);
UINT SiEnumIpTable(SERVER *s, char *hubname, RPC_ENUM_IP_TABLE *t);
void SiEnumLocalLogFileList(SERVER *s, char *hubname, RPC_ENUM_LOG_FILE *t);
void SiReadLocalLogFile(SERVER *s, char *filepath, UINT offset, RPC_READ_LOG_FILE *t);
typedef bool (DOWNLOAD_PROC)(DOWNLOAD_PROGRESS *progress);
BUF *DownloadFileFromServer(RPC *r, char *server_name, char *filepath, UINT total_size, DOWNLOAD_PROC *proc, void *param);
bool CheckAdminSourceAddress(SOCK *sock, char *hubname);
void SiEnumSessionMain(SERVER *s, RPC_ENUM_SESSION *t);
bool SiIsEmptyPassword(void *hash_password);
UINT StTest(ADMIN *a, RPC_TEST *t);
UINT StGetServerInfo(ADMIN *a, RPC_SERVER_INFO *t);
UINT StGetServerStatus(ADMIN *a, RPC_SERVER_STATUS *t);
UINT StCreateListener(ADMIN *a, RPC_LISTENER *t);
UINT StEnumListener(ADMIN *a, RPC_LISTENER_LIST *t);
UINT StDeleteListener(ADMIN *a, RPC_LISTENER *t);
UINT StEnableListener(ADMIN *a, RPC_LISTENER *t);
UINT StSetServerPassword(ADMIN *a, RPC_SET_PASSWORD *t);