public static final class Outstation.TcpBuilder
extends java.lang.Object
Modifier and Type | Method | Description |
---|---|---|
Outstation |
build() |
|
Outstation.TcpBuilder |
dataSource(DataSource dataSource) |
|
Outstation.TcpBuilder |
endPointType(TcpEndPointType type) |
Sets the outstation's end point type.
|
Outstation.TcpBuilder |
eventBuffer(EventBuffer eventBuffer) |
Sets the event buffer used to buffer events.
|
Outstation.TcpBuilder |
linkStatusRequestTimeout(java.time.Duration duration) |
Sets the maximum idle duration after which a link status message is requested.
|
Outstation.TcpBuilder |
linkStatusResponseTimeout(java.time.Duration duration) |
Sets the time to wait for a link status after having sent a link status request.
|
Outstation.TcpBuilder |
listeningPort(int port) |
Sets the port to listen for an incoming connection by a master.
|
Outstation.TcpBuilder |
localAddress(java.net.InetAddress localAddress) |
Sets the local IP address.
|
Outstation.TcpBuilder |
masterDlAddress(int address) |
Sets the master data link address.
|
Outstation.TcpBuilder |
masterHost(java.lang.String host) |
Sets the host name or IP address of the master.
|
Outstation.TcpBuilder |
masterPort(int port) |
Sets the port of the master to connect to.
|
Outstation.TcpBuilder |
masterWhitelist(java.util.List<java.lang.String> hosts) |
Sets the list of IPs/domains from which masters may access this outstation.
|
Outstation.TcpBuilder |
maxReceiveMessageFragmentSize(int size) |
Sets the maximum message fragment size that can be received.
|
Outstation.TcpBuilder |
maxSendMessageFragmentSize(int size) |
Sets the maximum message fragment size for sending.
|
Outstation.TcpBuilder |
outstationDlAddress(int address) |
Sets the outstation data link address.
|
Outstation.TcpBuilder |
reconnectInterval(java.time.Duration duration) |
Sets the reconnect interval.
|
Outstation.TcpBuilder |
reset() |
Resets all parameters of this builder to their default value.
|
Outstation.TcpBuilder |
solicitedConfirmTimeout(java.time.Duration duration) |
Sets the maximum time to wait for an application confirmation to a solicited response
message.
|
Outstation.TcpBuilder |
tcpConnectionListener(TcpConnectionListener listener) |
Sets the lister that is notified of TCP connection events.
|
public Outstation.TcpBuilder reset()
public Outstation.TcpBuilder listeningPort(int port)
port
- the port to listen for an incoming connection by a masterpublic Outstation.TcpBuilder localAddress(java.net.InetAddress localAddress)
InetAddress
. Specifying
null
is equivalent to passing the wildcard address. The wildcard address will cause 1) the
system to choose the a valid IP for initiating connections and 2) to listen on all available
interfaces when listening for connections.localAddress
- the local IP address, or null for the wildcard addresspublic Outstation.TcpBuilder masterWhitelist(java.util.List<java.lang.String> hosts)
null
or an empty list will allow anonymous masters. The default is null
.
Two outstations listening on the same interface and port cannot have overlapping master
whitelists. That is because otherwise the incoming connections cannot be uniquely assigned to
an outstation. The build()
method will fail if an outstation with an overlapping
whitelist exists.
The whitelist can be specified in form of domains, IPs, and subnets. A subnet can be specified in the following form: 192.168.1.0/24.
hosts
- the IPs/domains that may access this outstationpublic Outstation.TcpBuilder masterHost(java.lang.String host)
host
- the host name or IP address of the masterpublic Outstation.TcpBuilder masterPort(int port)
port
- the port to connect topublic Outstation.TcpBuilder endPointType(TcpEndPointType type)
LISTENING
.type
- the end point typepublic Outstation.TcpBuilder reconnectInterval(java.time.Duration duration)
A duration equal to Duration.ZERO
disables reconnection. The default is 5 seconds.
duration
- the reconnect intervalpublic Outstation.TcpBuilder tcpConnectionListener(TcpConnectionListener listener)
null
disables
notification.listener
- the listener that is notified of TCP connection eventspublic Outstation.TcpBuilder masterDlAddress(int address)
address
- the master data link addresspublic Outstation.TcpBuilder outstationDlAddress(int address)
address
- the outstation data link addresspublic Outstation.TcpBuilder linkStatusRequestTimeout(java.time.Duration duration)
Link status messages are also called keep-alive or heartbeat messages. DNP3's link layer will send link status requests after the connection was idle (no messages have been exchanged) for the given duration. Any data link message received will reset the timer for sending link status requests.
Set to Duration.ZERO
to disable link status requests. Default is 60s.
duration
- idle duration after which a link status message is requestedpublic Outstation.TcpBuilder linkStatusResponseTimeout(java.time.Duration duration)
A duration equal to Duration.ZERO
disables waiting for link status response
messages. In this case is does not matter if a link status reply is received. The default
timeout is 10s.
If no link status message is received on time, the TCP connection is closed before attempting to reconnect again (through initiation and/or listening).
duration
- the time to wait for a link status responsepublic Outstation.TcpBuilder dataSource(DataSource dataSource)
public Outstation.TcpBuilder eventBuffer(EventBuffer eventBuffer)
QueueEventBuffer.Builder
. Alternatively you can provide your own implementation of EventBuffer
.eventBuffer
- The event buffer to usepublic Outstation.TcpBuilder maxSendMessageFragmentSize(int size)
size
- the maximum message fragment size for sendingpublic Outstation.TcpBuilder maxReceiveMessageFragmentSize(int size)
size
- the maximum message fragment size that can be receivedpublic Outstation.TcpBuilder solicitedConfirmTimeout(java.time.Duration duration)
Set to Duration.ZERO
to disable this timeout. Default is 5s.
duration
- maximum time to wait for a confirmation to a solicited response messagepublic Outstation build() throws ListeningEndPointException
ListeningEndPointException