# Example ringserver configuration file.
#
# Default values are in comments where appropriate.
#
# Dynamic parameters: some parameters will be re-read by ringserver
# whenever the configuration file is modified.
#
# Config options can be set on the command line, via environment variables
# and via a configuration file like this one.  The order of precedence is:
# command line, environment variables, configuration file.
# Equivalent variables are listed in the description of each parameter.
#
# A configuration file can be specified on the command line or with
# the environment variable RS_CONFIG_FILE.
#
# Comment lines begin with a '#' character.


# Specify the directory where the ringserver will store
# the packet and stream buffers.  This must be specified.
# Equivalent environment variable: RS_RING_DIRECTORY

RingDirectory /data/home/EWtest/EW/run_working/ring


# Specify the ring packet buffer size in bytes.  A trailing
# 'K', 'M' or 'G' may be added for kibibytes, mebibytes or gibibytes.
# Equivalent environment variable: RS_RING_SIZE

RingSize 1G


# Specify the maximum packet data size in bytes.
# Equivalent environment variable: RS_MAX_PACKET_SIZE

#MaxPacketSize 512


# Listen for connections on a specified port.  By default all supported
# protocols and network protocol families (IPv4 and IPv6) are allowed and
# optional flags can be used to limit to specified protocols/families.
#
# Protocol flags are specified by including "DataLink", "SeedLink"
# and/or "HTTP" after the port.  By default all protocols are allowed.
#
# Network families are specified by including "IPv4" or "IPv6" after
# the port.  Default is any combination supported by the system.
#
# TLS (SSL) can be enabled by including "TLS" after the port.  A
# certificate file must be specified using the TLSCertificateFile
# parameter. By default TLS is not enabled.
#
# For example:
# ListenPort <port> [DataLink] [SeedLink] [HTTP] [IPv4] [IPv6] [TLS]
#
# This parameter can be specified multiple times to listen for connections
# on multiple ports.
# Equivalent environment variable: RS_LISTEN_PORT

#ListenPort 18000

# Port 18500 is the standard port for SeedLink v4 connections over TLS (SSL).
#ListenPort 18500 TLS

# Listen for DataLink connections on a specified port.  This is an alias
# for a ListenPort configured with only DataLink allowed.
# Equivalent environment variable: RS_DATALINK_PORT

DataLinkPort 16100


# Listen for SeedLink connections on a specified port. This is an alias
# for a ListenPort configured with only SeedLink allowed.
# Equivalent environment variable: RS_SEEDLINK_PORT

SeedLinkPort 18000


# Listen for HTTP connections on a specified port. This is an alias
# for a ListenPort configured with only HTTP allowed.
# Equivalent environment variable: RS_HTTP_PORT

#HTTPPort 80


# Certficate file for TLS connections.  This is a dynamic parameter.
# Equivalent environment variable: RS_TLS_CERT_FILE

#TLSCertFile /path/to/certificate.pem

# Private key file for TLS connections.  This is a dynamic parameter.
# Equivalent environment variable: RS_TLS_KEY_FILE

#TLSKeyFile /path/to/private_key.pem

# Enable client certificate verification for TLS connections.  This is
# not a common option, but can be used to require clients to present
# a certificate for authentication.  This is a dynamic parameter.
# Equivalent environment variable: RS_TLS_VERIFY_CLIENT_CERT

#TLSVerifyClientCert 0


# Specify the Server ID as reported to the clients.  The parameter may
# be a quoted string including spaces.  Default is "Ring Server".
# This is a dynamic parameter.
# Equivalent environment variable: RS_SERVER_ID

ServerID "DATA Send Test"


# Specify the level of verbosity for the server log output.  Valid
# verbosity levels are 0 - 3.  This is a dynamic parameter.
# Equivalent environment variable: RS_VERBOSITY

Verbosity 3


# Specify the maximum number of clients per IP address, regardless of
# protocol, allowed to be connected concurrently.  This limit does
# not apply to addresses with write permission.  Set to 0 for unlimited.
# This is a dynamic parameter.
# Equivalent environment variable: RS_MAX_CLIENTS_PER_IP

#MaxClientsPerIP 0


# Specify the maximum number of clients, regardless of protocol,
# allowed to be connected simulataneously, set to 0 for unlimited.
# This is a dynamic parameter.
# Equivalent environment variable: RS_MAX_CLIENTS

#MaxClients 600


# Specify a timeout in seconds after which to drop client connections
# that have exchanged no packets with the server within the timeout
# window, set to 0 to disable.  This is a dynamic parameter.
# Equivalent environment variable: RS_CLIENT_TIMEOUT

#ClientTimeout 3600


# Control the usage of memory mapping of the ring packet buffer.  If
# this parameter is 1 (or not defined) the packet buffer will be
# memory-mapped directly from the packet buffer file, otherwise it
# will be stored in memory during operation and only read/written
# to/from the packet buffer file during startup and shutdown.
# Normally memory mapping the packet buffer is the best option,
# this parameter allows for operation in environments where memory
# mapping is slow or not possible (e.g. NFS storage).
# Equivalent environment variable: RS_MEMORY_MAP_RING

#MemoryMapRing 1


# Control auto-recovery after corruption detection.  Be default if
# corruption is detected in the ring packet buffer file or stream
# index file during initialization the ring and stream files will be
# renamed with .corrupt extensions and initialization will be
# attempted a 2nd time.  If this option is 0 (off) the server will
# exit on these corruption errors.  If this option is 1 (the default)
# the server will move the buffers to .corrupt files.  If this option
# is 2 (delete) the server will delete the corrupt buffer files.
# Equivalent environment variable: RS_AUTO_RECOVERY

#AutoRecovery 1


# Control reverse DNS lookups to resolve hostnames for client IPs.
# By default a reverse lookup is performed whenever a client connects.
# When a reverse DNS lookup fails a small delay will occur, this can
# be avoided by setting this option to 0 (off).
# This is a dynamic parameter.
# Equivalent environment variable: RS_RESOLVE_HOSTNAMES

#ResolveHostnames 1


# Specify a limit, in percent, of the packet buffer to search for time
# windowing requests.  By default the entire packet buffer will be
# searched starting from the earliest packet traversing forward.  If
# this option is set, only the specified percent of the ring will be
# searched starting from the latest packet traversing backward.  To
# turn off time window requsts set this parameter to 0.  This is a
# dynamic parameter, but updated values will only apply to new
# connections.
# Equivalent environment variable: RS_TIME_WINDOW_LIMIT

#TimeWindowLimit 100


# Define the base directory for data transfer logs including both
# data transmission and reception logs.  By default no logs are written.
# This facility will log the number of data packet bytes and packet
# count sent to and/or received from each client during the log interval.
# If this parameter is specified and the directory exists, files will
# be written at a user defined interval with the format:
# "<dir>/[prefix-]txlog-YYYYMMDDTHHMM-YYYYMMDDTHHMM" and
# "<dir>/[prefix-]rxlog-YYYYMMDDTHHMM-YYYYMMDDTHHMM"
# This is a dynamic parameter.
# Equivalent environment variable: RS_TRANSFER_LOG_DIRECTORY

TransferLogDirectory "/data/home/EWtest/EW/run_working/tlog"

# Specify the transfer log interval in hours.  This is a dynamic
# parameter.
# Equivalent environment variable: RS_TRANSFER_LOG_INTERVAL

#TransferLogInterval 24

# Specify a transfer log file prefix, the default is no prefix.
# This is a dynamic parameter.
# Equivalent environment variable: RS_TRANSFER_LOG_PREFIX

#TransferLogPrefix <prefix>

# Control the logging of data transmission and reception independently,
# by default both are logged.  The TransferLogDirectory must be set for
# any transfer logs to be written.  To turn off logging of either
# transmission (TX) or reception (RX) set the appropriate parameter to 0.
# These are dynamic parameters.
# Equivalent environment variables: RS_TRANSFER_LOG_TX, RS_TRANSFER_LOG_RX

#TransferLogTX 1
#TransferLogRX 1


# Specify IP addresses or ranges which are allowed to submit (write)
# data to the ringserver.  This parameter can be specified multiple
# times and should be specified in address/prefix (CIDR) notation, e.g.:
# "WriteIP 192.168.0.1/24".  The prefix may be omitted in which case
# only the specific host is allowed.  If no addresses are explicitly
# granted write permission, permission is granted to clients from
# localhost (local loopback).
# This is a dynamic parameter.
# Equivalent environment variable: RS_WRITE_IP

#WriteIP <address>[/prefix]
#WriteIP <address>[/prefix]


# Specify IP addresses or ranges which are allowed to request and
# receive server connections and detailed status.  This parameter can
# be specified multiple times and should be specified in
# address/prefix (CIDR) notation, e.g.: "TrustedIP 192.168.0.1/24".
# The prefix may be omitted in which case only the specific host is
# trusted. If no addresses are explicitly trusted, trust is granted to
# clients from localhost (local loopback).  This is a dynamic
# parameter.
# Equivalent environment variable: RS_TRUSTED_IP

#TrustedIP <address>[/prefix]
#TrustedIP <address>[/prefix]


# Limit IP addresses or ranges to only specified stream IDs in the
# ringserver.  A regular expression is used to specify which Stream
# IDs the address range is allowed to access (and write), the
# expression may be compound and must not contain spaces.  By default
# clients can access any streams in the buffer, or write any streams
# if write permission is granted.  This parameter can be specified
# multiple times and should be specified in address/prefix (CIDR)
# notation, e.g.: "LimitIP 192.168.0.1/24".  The prefix may be omitted
# in which case only the specific host is limited. This is a dynamic
# parameter.
# Equivalent environment variable: RS_LIMIT_IP

#LimitIP <address>[/prefix] <StreamID Pattern>
#LimitIP <address>[/prefix] <StreamID Pattern>


# Specify IP addresses or ranges which should be specifically allowed
# to connect while all others will be rejected.  By default all IPs
# are allowed to connect.  This parameter can be specified multiple
# times and should be specified in address/prefix (CIDR) notation,
# e.g.: "MatchIP 192.168.0.1/24".  The prefix may be omitted in which
# case only the specific host is matched. This is a dynamic parameter.
# Equivalent environment variable: RS_MATCH_IP

#MatchIP <address>[/prefix]
#MatchIP <address>[/prefix]


# Specify IP addresses or ranges which should be rejected immediately
# after connecting.  This parameter can be specified multiple times
# and should be specified in address/prefix (CIDR) notation, e.g.:
# "RejectIP 192.168.0.1/24".  The prefix may be omitted in which case
# only the specific host is rejected.  This is a dynamic parameter.
# Equivalent environment variable: RS_REJECT_IP

#RejectIP <address>[/prefix]
#RejectIP <address>[/prefix]


# Serve content via HTTP from the specified directory. The HTTP server
# implementation is limited to returning existing files and returning
# "index.html" files when a directory is requested using the HTTP GET
# method. This is a dynamic parameter.
# Equivalent environment variable: RS_WEB_ROOT

#WebRoot <Web content root directory>


# Add custom HTTP headers to HTTP responses.  This can be useful to
# enable Cross-Origin Resource Sharing (CORS) for example.
# This is a dynamic parameter.
# Equivalent environment variable: RS_HTTP_HEADER

#HTTPHeader "Access-Control-Allow-Origin: *"
#HTTPHeader <Custom HTTP header>


# Enable a special mode of operation where all miniSEED records
# received using the DataLink protocol are written to user specified
# directory and file structures.  See the ringserver(1) man page for
# more details.
# Equivalent environment variable: RS_MSEED_WRITE

#MSeedWrite <format>


# Enable a special mode of operation where files containing miniSEED
# are scanned continuously and data records are inserted into the ring.
# By default all sub-directories will be recursively scanned.  Sub-options
# can be used to control the scanning, the StateFile sub-option is highly
# recommended.  Values for sub-options should not be quoted and cannot
# contain spaces.
# Equivalent environment variable: RS_MSEED_SCAN
# See the ringserver(1) man page for more details.

#MSeedScan <directory> [StateFile=scan.state] [Match=pattern] [Reject=pattern] [InitCurrentState=y]
