-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathSMBConfigSection.java
More file actions
1538 lines (1279 loc) · 43.5 KB
/
SMBConfigSection.java
File metadata and controls
1538 lines (1279 loc) · 43.5 KB
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
/*
* Copyright (C) 2006-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.filesys.smb.server;
import java.net.InetAddress;
import java.util.EnumSet;
import java.util.List;
import org.filesys.netbios.RFCNetBIOSProtocol;
import org.filesys.server.auth.SMBAuthenticator;
import org.filesys.server.auth.ISMBAuthenticator;
import org.filesys.smb.Dialect;
import org.filesys.smb.DialectSelector;
import org.filesys.smb.ServerType;
import org.filesys.smb.TcpipSMB;
import org.filesys.util.StringList;
import org.springframework.extensions.config.ConfigElement;
import org.filesys.server.config.ConfigId;
import org.filesys.server.config.ConfigSection;
import org.filesys.server.config.ConfigurationListener;
import org.filesys.server.config.InvalidConfigurationException;
import org.filesys.server.config.ServerConfiguration;
/**
* SMB Server Configuration Section Class
*
* @author gkspencer
*/
public class SMBConfigSection extends ConfigSection {
// SMB server configuration section name
public static final String SectionName = "SMB";
// Default client socket timeout
public static final int DefSessionTimeout = 15 * 60 * 1000; // 15 minutes, milliseconds
// Minimum/maximum packets per run
public static final int MinPacketsPerRun = 1;
public static final int MaxPacketsPerRun = 32;
// Server name
private String m_name;
// Server alias name(s)
private StringList m_aliasNames;
// Server type, used by the host announcer
private int m_srvType = ServerType.WorkStation + ServerType.Server;
// Server comment
private String m_comment;
// Server domain
private String m_domain;
// Network broadcast mask string
private String m_broadcast;
// Announce the server to network neighborhood, announcement interval in minutes and announcer port
private boolean m_announce;
private int m_announceInterval;
private int m_announcePort;
// Default SMB dialects to enable
private DialectSelector m_dialects;
// Authenticator, used to authenticate users and share connections.
private ISMBAuthenticator m_authenticator;
private ConfigElement m_authParams;
// Is the authenticator instance owned by this object?
private boolean m_localAuthenticator;
// NetBIOS name server and host announcer debug enable
private boolean m_nbDebug = false;
private boolean m_announceDebug = false;
// Default session debugging setting
private EnumSet<SMBSrvSession.Dbg> m_sessDebug;
// Name server port
private int m_namePort = RFCNetBIOSProtocol.NAMING;
// Session port
private int m_sessPort = RFCNetBIOSProtocol.SESSION;
// Datagram port
private int m_nbDatagramPort = RFCNetBIOSProtocol.DATAGRAM;
// TCP/IP SMB port
private int m_tcpSMBPort = TcpipSMB.PORT;
// Flags to indicate if NetBIOS, native TCP/IP SMB and/or Win32 NetBIOS should be enabled
private boolean m_netBIOSEnable = true;
private boolean m_tcpSMBEnable = false;
private boolean m_win32NBEnable = false;
// Address to bind the SMB server to, if null all local addresses are used
private InetAddress m_smbBindAddress;
// Address to bind the NetBIOS name server to, if null all addresses are used
private InetAddress m_nbBindAddress;
// WINS servers
private InetAddress m_winsPrimary;
private InetAddress m_winsSecondary;
// Enable/disable Macintosh extension SMBs
private boolean m_macExtensions;
// Disable NIO based code
private boolean m_disableNIO;
// Client session socket timeout, in milliseconds
private int m_clientSocketTimeout = DefSessionTimeout;
// Enable TCP socket keep-alive for client connections
private boolean m_clientKeepAlive = true;
// Per session virtual circuit limit
private int m_virtualCircuitLimit = SMBV1VirtualCircuitList.DefMaxCircuits;
// Use ArrayOpenFileMap instead of HashedOpenFileMap
private boolean m_disableHashedOpenFileMap;
//--------------------------------------------------------------------------------
// Win32 NetBIOS configuration
//
// Server name to register under Win32 NetBIOS, if not set the main server name is used
private String m_win32NBName;
// LANA to be used for Win32 NetBIOS, if not specified the first available is used
private int m_win32NBLANA = -1;
// Accept connections from all hosts or a specific host only
private String m_win32NBAccept = "*";
// Send out host announcements via the Win32 NetBIOS interface
private boolean m_win32NBAnnounce = false;
private int m_win32NBAnnounceInterval;
// Use Winsock NetBIOS interface if true, else use the Netbios() API interface
private boolean m_win32NBUseWinsock = true;
// Disable use of native code on Windows, do not use any JNI calls
private boolean m_disableNativeCode = false;
// List of terminal server/load balancer addresses, need special session setup handling
private List<String> m_terminalServerList;
private List<String> m_loadBalancerList;
//--------------------------------------------------------------------------------
// Thread pool configuration
//
// Maximum number of packets to process per thread pool request for a socket before the socket
// events are re-enabled and the thread request exits processing
private int m_maxPacketsPerRun = 4; // original default, based on SMB1
// Values for the Local Security Authority
private String m_dnsName;
private String m_forestName;
/**
* Class constructor
*
* @param config ServerConfiguration
*/
public SMBConfigSection(ServerConfiguration config) {
super(SectionName, config);
// Set the default dialect list
m_dialects = new DialectSelector();
m_dialects.enableUpTo(Dialect.UpToSMBv1);
}
/**
* Sets the terminal server list.
*
* @param terminalServerList List of Strings
* @return int
* @exception InvalidConfigurationException Failed to set the terminal server list
*/
public final int setTerminalServerList(List<String> terminalServerList) throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.SMBTerminalServerList, terminalServerList);
m_terminalServerList = terminalServerList;
// Return the change status
return sts;
}
/**
* Gets the terminal server list address.
*
* @return the terminal server list address
*/
public final List<String> getTerminalServerList() {
return m_terminalServerList;
}
/**
* Sets the load balancer list.
*
* @param loadBalancerList List of Strings
* @return int
* @exception InvalidConfigurationException Failed to set the load balancer list
*/
public final int setLoadBalancerList(List<String> loadBalancerList) throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.SMBLoadBalancerList, loadBalancerList);
m_loadBalancerList = loadBalancerList;
// Return the change status
return sts;
}
/**
* Gets the load balancer list address.
*
* @return the load balancer list address
*/
public final List<String> getLoadBalancerList() {
return m_loadBalancerList;
}
/**
* Get the authenticator object that is used to provide user and share connection authentication.
*
* @return ISMBAuthenticator
*/
public final ISMBAuthenticator getAuthenticator() {
return m_authenticator;
}
/**
* Return the authenticator initialization parameters
*
* @return ConfigElement
*/
public final ConfigElement getAuthenticatorParameters() {
return m_authParams;
}
/**
* Return the local address that the SMB server should bind to.
*
* @return java.net.InetAddress
*/
public final InetAddress getSMBBindAddress() {
return m_smbBindAddress;
}
/**
* Return the local address that the NetBIOS name server should bind to.
*
* @return java.net.InetAddress
*/
public final InetAddress getNetBIOSBindAddress() {
return m_nbBindAddress;
}
/**
* Return the network broadcast mask to be used for broadcast datagrams.
*
* @return String
*/
public final String getBroadcastMask() {
return m_broadcast;
}
/**
* Return the server comment.
*
* @return String
*/
public final String getComment() {
return m_comment != null ? m_comment : "";
}
/**
* Return the domain name.
*
* @return String
*/
public final String getDomainName() {
return m_domain;
}
/**
* Return the enabled SMB dialects that the server will use when negotiating sessions.
*
* @return DialectSelector
*/
public final DialectSelector getEnabledDialects() {
return m_dialects;
}
/**
* Return the name server port to listen on.
*
* @return int
*/
public final int getNameServerPort() {
return m_namePort;
}
/**
* Return the NetBIOS datagram port
*
* @return int
*/
public final int getDatagramPort() {
return m_nbDatagramPort;
}
/**
* Return the server name.
*
* @return String
*/
public final String getServerName() {
return m_name;
}
/**
* Check if the server has any alias names configured
*
* @return boolean
*/
public final boolean hasAliasNames() {
return m_aliasNames != null ? true : false;
}
/**
* Return the number of alias names configured
*
* @return int
*/
public final int getNumberOfAliasNames() {
return m_aliasNames != null ? m_aliasNames.numberOfStrings() : 0;
}
/**
* Return the list of alias names for the server
*
* @return StringList
*/
public final StringList getAliasNames() {
return m_aliasNames;
}
/**
* Return the server type flags.
*
* @return int
*/
public final int getServerType() {
return m_srvType;
}
/**
* Return the server debug flags.
*
* @return EnumSet<SMBSrvSession.Dbg>
*/
public final EnumSet<SMBSrvSession.Dbg> getSessionDebugFlags() {
return m_sessDebug;
}
/**
* Get the session port to listen on.
*
* @return int
*/
public final int getSessionPort() {
return m_sessPort;
}
/**
* Return the Win32 NetBIOS server name, if null the default server name will be used
*
* @return String
*/
public final String getWin32ServerName() {
return m_win32NBName;
}
/**
* Return the Win32 NetBIOS allowed client name, defaults to '*' to allow any client to connect
*
* @return String
*/
public final String getWin32ClientAccept() {
return m_win32NBAccept;
}
/**
* Determine if the server should be announced via Win32 NetBIOS, so that it appears under Network Neighborhood.
*
* @return boolean
*/
public final boolean hasWin32EnableAnnouncer() {
return m_win32NBAnnounce;
}
/**
* Return the Win32 NetBIOS host announcement interval, in minutes
*
* @return int
*/
public final int getWin32HostAnnounceInterval() {
return m_win32NBAnnounceInterval;
}
/**
* Return the Win3 NetBIOS LANA number to use, or -1 for the first available
*
* @return int
*/
public final int getWin32LANA() {
return m_win32NBLANA;
}
/**
* Determine if the Win32 Netbios() API or Winsock Netbios calls should be used
*
* @return boolean
*/
public final boolean useWinsockNetBIOS() {
return m_win32NBUseWinsock;
}
/**
* Determine if NIO based code should be disabled
*
* @return boolean
*/
public final boolean hasDisableNIOCode() {
return m_disableNIO;
}
/**
* Determine if the primary WINS server address has been set
*
* @return boolean
*/
public final boolean hasPrimaryWINSServer() {
return m_winsPrimary != null ? true : false;
}
/**
* Return the primary WINS server address
*
* @return InetAddress
*/
public final InetAddress getPrimaryWINSServer() {
return m_winsPrimary;
}
/**
* Determine if the secondary WINS server address has been set
*
* @return boolean
*/
public final boolean hasSecondaryWINSServer() {
return m_winsSecondary != null ? true : false;
}
/**
* Return the secondary WINS server address
*
* @return InetAddress
*/
public final InetAddress getSecondaryWINSServer() {
return m_winsSecondary;
}
/**
* Determine if the SMB server should bind to a particular local address
*
* @return boolean
*/
public final boolean hasSMBBindAddress() {
return m_smbBindAddress != null ? true : false;
}
/**
* Determine if the NetBIOS name server should bind to a particular local address
*
* @return boolean
*/
public final boolean hasNetBIOSBindAddress() {
return m_nbBindAddress != null ? true : false;
}
/**
* Determine if NetBIOS name server debugging is enabled
*
* @return boolean
*/
public final boolean hasNetBIOSDebug() {
return m_nbDebug;
}
/**
* Determine if host announcement debugging is enabled
*
* @return boolean
*/
public final boolean hasHostAnnounceDebug() {
return m_announceDebug;
}
/**
* Determine if the server should be announced so that it appears under Network Neighborhood.
*
* @return boolean
*/
public final boolean hasEnableAnnouncer() {
return m_announce;
}
/**
* Return the host announcement interval, in minutes
*
* @return int
*/
public final int getHostAnnounceInterval() {
return m_announceInterval;
}
/**
* Return the host announcer port to use, or zero for the default port
*
* @return int
*/
public final int getHostAnnouncerPort() {
return m_announcePort;
}
/**
* Determine if Macintosh extension SMBs are enabled
*
* @return boolean
*/
public final boolean hasMacintoshExtensions() {
return m_macExtensions;
}
/**
* Determine if NetBIOS SMB is enabled
*
* @return boolean
*/
public final boolean hasNetBIOSSMB() {
return m_netBIOSEnable;
}
/**
* Determine if TCP/IP SMB is enabled
*
* @return boolean
*/
public final boolean hasTcpipSMB() {
return m_tcpSMBEnable;
}
/**
* Determine if Win32 NetBIOS is enabled
*
* @return boolean
*/
public final boolean hasWin32NetBIOS() {
return m_win32NBEnable;
}
/**
* Return the TCP/IP SMB port
*
* @return int
*/
public final int getTcpipSMBPort() {
return m_tcpSMBPort;
}
/**
* Return the client socket timeout, in millisconds
*
* @return int
*/
public final int getSocketTimeout() {
return m_clientSocketTimeout;
}
/**
* Check if socket keep-alives should be enabled for client socket connections
*
* @return boolean
*/
public final boolean hasSocketKeepAlive() { return m_clientKeepAlive; }
/**
* Return the maximum virtual circuits per session
*
* @return int
*/
public final int getMaximumVirtualCircuits() {
return m_virtualCircuitLimit;
}
/**
* Return the maximum packets that will be processed per thread pool request run
*
* @return int
*/
public final int getMaximumPacketsPerThreadRun() { return m_maxPacketsPerRun; }
/**
* Return the DNS name of the server
*
* @return String
*/
public final String getDNSName() { return m_dnsName; }
/**
* Return the forest name for the server
*
* @return String
*/
public final String getForestName() { return m_forestName; }
/**
* Check if native code calls are disabled
*
* @return boolean
*/
public final boolean isNativeCodeDisabled() {
return m_disableNativeCode;
}
/**
* Determine if the HashedOpenFileMap should be disabled
*
* @return boolean
*/
public final boolean hasDisableHashedOpenFileMap() {
return m_disableHashedOpenFileMap;
}
/**
* Set the authenticator to be used to authenticate users and share connections.
*
* @param authClass String
* @param params ConfigElement
* @param accessMode AuthMode
* @param allowGuest boolean
* @return int
* @throws InvalidConfigurationException Failed to set the authenticator class
*/
public final int setAuthenticator(String authClass, ConfigElement params, ISMBAuthenticator.AuthMode accessMode, boolean allowGuest)
throws InvalidConfigurationException {
// Validate the authenticator class
int sts = ConfigurationListener.StsIgnored;
SMBAuthenticator auth = null;
try {
// Load the authenticator class
Object authObj = Class.forName(authClass).newInstance();
if (authObj instanceof SMBAuthenticator) {
// Set the server authenticator
auth = (SMBAuthenticator) authObj;
auth.setAccessMode(accessMode);
auth.setAllowGuest(allowGuest);
}
else
throw new InvalidConfigurationException("Authenticator is not derived from required base class");
}
catch (ClassNotFoundException ex) {
throw new InvalidConfigurationException("Authenticator class " + authClass + " not found");
}
catch (Exception ex) {
throw new InvalidConfigurationException("Authenticator class error");
}
// Initialize the authenticator using the parameter values
auth.initialize(getServerConfiguration(), params);
// Inform listeners, validate the configuration change
sts = setAuthenticator(auth);
// Remember that the authenticator instance will need destroying
m_localAuthenticator = true;
// Set initialization parameters
m_authParams = params;
// Return the change status
return sts;
}
/**
* Set the authenticator to be used to authenticate users and share connections.
*
* @param auth the authenticator
* @return int
* @throws InvalidConfigurationException Failed to set the authenticator class
*/
public final int setAuthenticator(ISMBAuthenticator auth)
throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.SMBAuthenticator, auth);
// Set the server authenticator
m_authenticator = auth;
m_localAuthenticator = false;
// Return the change status
return sts;
}
/**
* Set the local address that the SMB server should bind to.
*
* @param addr java.net.InetAddress
* @return int
* @throws InvalidConfigurationException Failed to set the bind address
*/
public final int setSMBBindAddress(InetAddress addr)
throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.SMBBindAddress, addr);
m_smbBindAddress = addr;
// Return the change status
return sts;
}
/**
* Set the local address that the NetBIOS name server should bind to.
*
* @param addr java.net.InetAddress
* @return int
* @throws InvalidConfigurationException Failed to set the NetBIOS bind address
*/
public final int setNetBIOSBindAddress(InetAddress addr)
throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.NetBIOSBindAddress, addr);
m_nbBindAddress = addr;
// Return the change status
return sts;
}
/**
* Set the broadcast mask to be used for broadcast datagrams.
*
* @param mask String
* @return int
* @throws InvalidConfigurationException Failed to set the broadcast mask
*/
public final int setBroadcastMask(String mask)
throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.SMBBroadcastMask, mask);
m_broadcast = mask;
// Return the change status
return sts;
}
/**
* Set the server comment.
*
* @param comment String
* @return int
* @throws InvalidConfigurationException Failed to set the server comment
*/
public final int setComment(String comment)
throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.SMBComment, comment);
m_comment = comment;
// Return the change status
return sts;
}
/**
* Set the domain that the server is to belong to.
*
* @param domain String
* @return int
* @throws InvalidConfigurationException Failed to set the server domain
*/
public final int setDomainName(String domain)
throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.SMBDomain, domain);
m_domain = domain;
// Return the change status
return sts;
}
/**
* Set the SMB dialects that the server may use when negotiating a session with a client.
*
* @param dialects DialectSelector
* @return int
* @throws InvalidConfigurationException Failed to set the enabled SMB dialects
*/
public final int setEnabledDialects(DialectSelector dialects)
throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.SMBDialects, dialects);
m_dialects = new DialectSelector();
m_dialects.copyFrom(dialects);
// Return the change status
return sts;
}
/**
* Enable/disable the host announcer.
*
* @param b boolean
* @return int
* @throws InvalidConfigurationException Failed to enable the host announcer
*/
public final int setHostAnnouncer(boolean b)
throws InvalidConfigurationException {
// Check if the value has changed
int sts = ConfigurationListener.StsIgnored;
if (m_announce != b) {
// Inform listeners, validate the configuration change
sts = fireConfigurationChange(ConfigId.SMBAnnceEnable, new Boolean(b));
m_announce = b;
}
// Return the change status
return sts;
}
/**
* Set the host announcement interval, in minutes
*
* @param ival int
* @return int
* @throws InvalidConfigurationException Failed to set the host announcement interval
*/
public final int setHostAnnounceInterval(int ival)
throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.SMBAnnceInterval, new Integer(ival));
m_announceInterval = ival;
// Return the change status
return sts;
}
/**
* Set the host announcer port
*
* @param port int
* @return int
* @throws InvalidConfigurationException Failed to set the host announcer port
*/
public final int setHostAnnouncerPort(int port)
throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.SMBAnncePort, new Integer(port));
m_announcePort = port;
// Return the change status
return sts;
}
/**
* Set the name server port to listen on.
*
* @param port int
* @return int
* @throws InvalidConfigurationException Failed to set the name server port
*/
public final int setNameServerPort(int port)
throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.NetBIOSNamePort, new Integer(port));
m_namePort = port;
// Return the change status
return sts;
}
/**
* Set the name server datagram port
*
* @param port int
* @return int
* @throws InvalidConfigurationException Failed to set the name server datagram port
*/
public final int setDatagramPort(int port)
throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.NetBIOSDatagramPort, new Integer(port));
m_nbDatagramPort = port;
// Return the change status
return sts;
}
/**
* Enable/disable NetBIOS name server debug output
*
* @param ena boolean
* @return int
* @throws InvalidConfigurationException Failed to set the NetBIOS debug flag
*/
public final int setNetBIOSDebug(boolean ena)
throws InvalidConfigurationException {
// Check if the value has changed
int sts = ConfigurationListener.StsIgnored;
if (m_nbDebug != ena) {
// Inform listeners, validate the configuration change
sts = fireConfigurationChange(ConfigId.NetBIOSDebugEnable, new Boolean(ena));
m_nbDebug = ena;
}
// Return the change status
return sts;
}
/**
* Enable/disable host announcement debug output
*
* @param ena boolean
* @return int
* @throws InvalidConfigurationException Failed to set the host announcer debug flag
*/
public final int setHostAnnounceDebug(boolean ena)
throws InvalidConfigurationException {
// Check if the value has changed
int sts = ConfigurationListener.StsIgnored;
if (m_announceDebug != ena) {
// Inform listeners, validate the configuration change
sts = fireConfigurationChange(ConfigId.SMBAnnceDebug, new Boolean(ena));
m_announceDebug = ena;
}
// Return the change status
return sts;
}
/**