#
#  Sample configuration file for the APRX-2  -- an APRS iGate and Digipeater
#
# This configuration is structured with Apache HTTPD style tags
# which then contain subsystem parameters.
#
# Define the parameters in following order:
#   1)  <aprsis>     ** zero to many
#   2)  <logging>    ** zero or one
#   3)  <interface>  ** there can be multiple!
#   4)  <beacon>     ** zero to many
#   5)  <telemetry>  ** zero to many
#   5)  <digipeater> ** zero to many (at most one for each Tx)
#


#
# Global macro for simplified callsign definition:
# Usable for 99+% of cases.
#

mycall  N0CALL-1

#
# Global macro for simplified "my location" definition in
# place of explicit "lat nn lon mm" at beacons. Will also
# give "my location" reference for "filter m/100".
#
#myloc lat ddmm.mmN lon dddmm.mmE


#  Define possibly multiple APRSIS servers, they are connected to
#  in Round-Robin fashion.  There also exist DNS RR servers for
#  this use, one of them is "rotate.aprsis.net".
<aprsis>
# The  aprsis-login  parameter: 
# Station callsignSSID used for relaying APRS frames into APRS-IS.
#
#login     $mycall	# login defaults to $mycall macro

#
# Passcode for your callsign
#
passcode -1

# APRS-IS server name and optional portnumber.
#
# WARNING: Do not change from default port number [14580]
#          unless you are absolutely certain you want
#          something else, and you allow that something
#          else also affect your tx-igate behaviour!
#
server    rotate.aprs2.net
#server   euro.aprs2.net
#server   asia.aprs2.net
#server   noam.aprs2.net
#server   soam.aprs2.net
#server   aunz.aprs2.net

# Some APRS-IS servers tell every about 20 seconds to all contact
# ports that they are there and alive. Others are just silent.
# Default value 3*"heartbeat" + some  --> 120 (seconds)
#
#heartbeat-timeout   0    # Disabler in case your server does not do heartbeat
#heartbeat-timeout   1m   # Interval of one minute (60 seconds)

# APRS-IS server may support some filter commands.
# See:  http://www.aprs-is.net/javAPRSFilter.aspx
#
# You can define the filter as single long quoted string, or as
# many short segments with explaining comments following them.
#
# Usability of these filters for a Tx-iGate is dubious, but
# they exist in case you for example want to Tx-iGate packets
# from some source callsigns in all cases even when they are
# not in your local area.
#
#filter "possibly multiple filter specs in quotes"
#
#filter "m/100"	     # My-Range filter: positions within 100 km from my location
#filter "f/OH2XYZ-3/50"  # Friend-Range filter: 50 km of friend's last beacon position
</aprsis>

<logging>

# pidfile is UNIX way to tell that others that this program is
# running with given process-id number.  This has compiled-in
# default value of:  pidfile @VARRUN@/aprx.pid
#
pidfile @VARRUN@/aprx.pid


# rflog defines a rotatable file into which all RF-received packets
# are logged.  The host system can rotate it at any time without
# need to signal the aprx that the file has been moved.
#
rflog @VARLOG@/aprx-rf.log

# aprxlog defines a rotatable file into which most important 
# events on APRS-IS connection are logged, namely connects and
# disconnects.  The host system can rotate it at any time without
# need to signal the aprx that the file has been moved.
#
aprxlog @VARLOG@/aprx.log

# dprslog defines a rotatable file into which most important 
# events on DPRS receiver gateways are logged.
# The host system can rotate it at any time without need to
# signal the aprx that the file has been moved.
#
#dprslog @VARLOG@/dprs.log

# erlangfile defines a mmap():able binary file, which stores
# running sums of interfaces upon which the channel erlang
# estimator runs, and collects data.
# Depending on the system, it may be running on a filesystem
# that actually retains data over reboots, or it may not.
# With this backing store, the system does not loose cumulating
# erlang data over the current period, if the restart is quick,
# and does not stradle any exact minute.
# (Do restarts at 15 seconds over an even minute..)
# This file is around 0.7 MB per each interface talking APRS.
# If this file is not defined or can not be created, internal
# non-persistent in-memory storage will be used.
#
# Built-in default value is: @VARRUN@/aprx.state
#
#erlangfile @VARRUN@/aprx.state

# erlang-loglevel is config file version of the "-l" option
# pushing erlang data to syslog(3).
# Valid values are (possibly) following: NONE, LOG_DAEMON,
# LOG_FTP, LOG_LPR, LOG_MAIL, LOG_NEWS, LOG_USER, LOG_UUCP,
# LOG_LOCAL0, LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4,
# LOG_LOCAL5, LOG_LOCAL6, LOG_LOCAL7.  If the parameter value is
# not acceptable, list of accepted values are printed at startup.
#
#erlang-loglevel NONE

# erlanglog defines a rotatable file into which erlang data
# is written in text form.
#
#erlanglog @VARLOG@/erlang.log

# erlang-log1min option logs to syslog/file also 1 minute
# interval data from the program. (In addition to 10m and 60m.)
#
#erlang-log1min

</logging>


# ***********  Multiple <interface>  definitions follow   *********

# ax25-device  Lists AX.25 ports by their callsigns that in Linux
#              systems receive APRS packets.  If none are defined,
#              or the system is not Linux, the AX.25 network receiver
#              is not enabled.  Used technologies need at least
#              Linux kernel 2.4.x
#
# tx-ok        Boolean telling if this device is able to transmit.
#
#<interface>
#   ax25-device   $mycall
#   tx-ok true    # There be transmitter there!
#  #alias         RELAY,WIDE,TRACE
#  #telem-to-is   true # set to 'false' to disable
#</interface>

# The  radio serial  option.  Parameters are:
#   - /dev/ttyUSB1    -- tty device
#   - 19200           -- baud rate, supported ones are:
#                        1200, 2400, 4800, 9600, 19200, 38400
#   - 8n1             -- 8-bits, no parity, one stop-bit,
#                        no other supported modes
#   - KISS/XORSUM/SMACK -- KISS mode variants
#     TNC2            -- non-KISS text format variant
#     DPRS            -- DPRS (RX) Gateway
#
#

### KISS mode example with KISS TNC using TNCID 0
#<interface>
#   serial-device   /dev/ttyUSB0  19200 8n1    KISS
#  #alias         RELAY,WIDE,TRACE
#   callsign N0CALL-14
#  #telem-to-is   true # set to 'false' to disable
#</interface>

### KISS mode example with multiple sub-interfaces via TNCID multiplexing
#<interface>
#   serial-device   /dev/ttyUSB0  19200 8n1    KISS
#  #alias         RELAY,WIDE,TRACE
#   ## kiss-subif 0 == KISS TNCID 0
#   <kiss-subif 0>
#      callsign N0CALL-14
#      tx-ok    true
#      #telem-to-is   true # set to 'false' to disable
#   </kiss-subif>
#   ## kiss-subif 3 == KISS TNCID 3
#   <kiss-subif 3>
#      callsign N0CALL-15
#      tx-ok    false
#      #telem-to-is   true # set to 'false' to disable
#   </kiss-subif>
#</interface>

#<interface>
#   serial-device   /dev/ttyUSB1  19200 8n1    TNC2
#   callsign N0CALL-13
#   #telem-to-is   true # set to 'false' to disable
#</interface>

#<interface>
#   serial-device /dev/ttyUSB1  19200 8n1    DPRS
#   callsign     dprsgwcallsign  # must define actual callsign
#   #tx-ok       false           # DPRS monitor can not do transmit
#   #telem-to-is   true # set to 'false' to disable
#</interface>

#
#  "KISS"                  - plain basic KISS mode
#  "XORSUM" alias "BPQCRC" - KISS with BPQ "CRC" byte
#  "SMACK"  alias "CRC16"  - KISS with better CRC
#  "FLEXNET"               - KISS with better CRC
#  "TNC2"                  - TNC2 monitor format
#  "DPRS"                  - DPRS (RX) GW
#
# Additional/alternate options for the serial-device
#
# "timeout 15m" sets a timeout monitor (an interval) to make
#    reopen/reconnect if the serial port/connection to radio
#    has failed somehow and nothing is heard. Local serial
#    ports do not in general need this.  At APRS silent sites
#    this may cause repeated reconnects, but it should not
#    harm either.  At busy sites this will handle reconnect
#    gracefully in case of network failures, and timeout
#    value can be shortened.
#
# "<kiss-subif 0>" sets optional multiplexer index on KISS type
#    connections. This id is specific for the multiplexer connection
#    on given port, and can be in range of 0 thru 7 for SMACK type
#    links, and up to 15 for KISS, and BPQ type links. 
#    The kiss-subif is settable only for KISS-type connections.
#    The subif 0 is settable for TNC2 monitor format.
#
# "callsign NAME" sets callsign used in statistics displays,
#    and when the message is sent to APRS-IS.
#    If none are given, then it will use physical port name.
#    There can be multiple callsign parameters, if each are
#    prefixed with their own  tncid  setting.
#
# "tx-ok true" enables transmit. System will then also require
#    that used callsign is valid for AX.25.
#
# "initstring" is of two parts, the keyword, and then a string.
#    initstring "\xC0\xC0\xFF\xC0\r\nMO 0\rKISS $01\r"
#    The initstring is a binary string,  "\x00" is encodable.
#    Of the usual C-style codes only "\r" and "\n" are understood.
#    The initstring is kiss-subif level option.
#
#</interface>


# The  tcp-device  option defines a connection to remote socket
# beyond which is a binary transparent connection to a serial
# port.  The parameter fields:  literal IP address (IPv4 or IPv6),
# then literal port number, and finally protocol mode.
# KISS-protocol parameters are same as with normal serial port.
#
#<interface>
#   tcp-device  12.34.56.78  4001  KISS
#   timeout 15m  # 15 minutes
#  #alias         RELAY,WIDE,TRACE
#   <kiss-subif 0>
#      callsign N0CALL-12
#      tx-ok    false
#   </kiss-subif>
#</interface>
#
#<interface>
#   tcp-device  12.34.56.78  4002  TNC2
#   timeout 5m   # 5 minutes
#  #alias         RELAY,WIDE,TRACE
#   <kiss-subif 0>
#      callsign N0CALL-12
#      tx-ok    false
#   </kiss-subif>
#</interface>


# ***********  Multiple <beacon>  definitions follow   *********

<beacon>
#
#  Beacons are sent out to radio transmitters AND/OR APRSIS.
#  Default is "both", other modes are settable.
#
#beaconmode { aprsis | both | radio }
#
#  Beacons are sent from a circullar transmission queue, total cycle time
#  of that queue is 20 minutes by default, and beacons are "evenly"
#  distributed along it.  Actual intervals are randomized to be anything
#  in between 80% and 100% of the  cycle-size / number-of-beacons.
#  First beacon is sent out 30 seconds after system start.
#  Tune the cycle-size to be suitable to your number of defined beacons.
#
#cycle-size  20m
#
#
# Basic beaconed thing is positional message of type "!":
#
#beacon symbol "R&" lat "0000.00N" lon "00000.00E" comment "Rx-only iGate"
#beacon symbol "R&" $myloc comment "Rx-only iGate"
#
# Following are basic options:
#  'symbol'    no default, must be defined!
#  'lat'       coordinate latitude:   ddmm.mmN  (no default!)
#  'lon'       coordinate longitude: dddmm.mmE  (no default!)
#  '$myloc'    coordinate values taken from global 'myloc' entry,
#              and usable in place of explicit 'lat'+'lon'.
#  'comment'   optional tail part of the item, default is nothing
#
# Sample symbols:
#   R&   is for "Rx-only iGate"
#   I&   is for "Tx-iGate"
#   /#   is for "Digipeater"
#   I#   is for "Tx-iGate + Digipeater""
#
# Additional options are:
#  'srccall'   parameter sets claimed origination address.
#  'dstcall'   sets destination address, default "APRXnn"
#  'interface' parameter picks an interface (must be "tx-ok true" type)
#  'via'       sets radio distribution pattern, default: none.
#  'timefix'   On APRS messages with HMS timestamp (hour:min:sec), the
#              system fixes appropriate field with transmit time timestamp.
#
# Message type is by default '!', which is positional no timestamp format.
# Other possible formats are definable with options:
#  'type'      Single character setting type:  ! = / @, default: !
#  'item'      Defines a name of Item (')') type beacons.
#  'object'    Defines a name of Object (';') type beacons.
#
#  'file' option tells a file at which a _raw_ APRS message content is
#         expected to be found as first line of text. Line ending newline
#         is removed, and no escapes are supported.  The timefix is
#         available, though probably should not be used.
#         No \-processing is done on read text line.
#
# 'exec' option tells a computer program which returns to stdout _raw_ APRS
#        message content without newline. The timefix is
#        available, though probably should not be used.
#        No \-processing is done on read text line.
# 'timeout' defines number of seconds the exec:ed program has to produce
#        a single text line of APRS data + ending newline, until it is
#        considered overdue and will be killed + processing moves to next
#        beacon item.
#
# The parameter sets can vary:
#  a) 'srccall nnn-n dstcall "string" symbol "R&" lat "ddmm.mmN" lon "dddmm.mmE" [comment "any text"]
#  b) 'srccall nnn-n dstcall "string" symbol "R&" $myloc [comment "any text"]
#  c) 'srccall nnn-n dstcall "string" raw "string"'
#
# The a) form flags on some of possible syntax errors in parameters.
# It will also create only "!" type messages.  The dest parameter
# defaults to "APRS", but can be used to give other destinations.
# The via parameter can be used to add other keywords, like "NOGATE".
#
# Writing correct RAW format beacon message is very hard,
# which is evidenced by the frequency of bad syntax texts
# people so often put there...   If you can not be persuaded
# not to do it, then at least VERIFY the beacon result on
# web service like  findu.com,  or  aprs.fi
#
# Do remember that the \ -character has special treatment in the
# Aprx configuration parser.  If you want a '\' on APRS content,
# then you encode it on configuration file as:  '\\'
#
# Stranger combinations with explicite "transmit this to interface X":
#
#
#beacon                     file /tmp/wxbeacon.txt
#beacon interface N0CALL-3 srccall N0CALL-3 \
#                           raw "!0000.00NR00000.00E&aprx - an Rx-only iGate"
#beacon interface $mycall   symbol "R&" lat "0000.00N" lon "00000.00E" \
#                           comment "aprx - an Rx-only iGate"
#beacon interface $mycall   symbol "R&" $myloc \
#                           comment "aprx - an Rx-only iGate"
#beacon interface $mycall   symbol "I&" $myloc \
#                           comment "Tx-iGate"
#
</beacon>

# ***********  <telemetry>  definition(s) follow   *********
#
# The system will always send telemetry for all of its interfaces
# to APRSIS, but there is an option to define telemetry to be sent
# to radio channel by using following sections for each transmitter
# that is wanted to send out the telemetry.
#
#   transmitter   -  callsign referring to <interface>
#   via           -  optional via-path, only 1 callsign!
#   source        -  one or more of <interface> callsigns for which
#                    the telemetry transmission is wanted for
#
#<telemetry>
#	transmitter	$mycall
#	via		TRACE1-1
#	source		$mycall
#</telemetry>


#<rx-igate>  ## FIXME: to be written
# AX.25 filters block selected messages matching on selected regular
# expressions.  The expressions are case sensitive, and AX.25 address
# elements are in all uppercase text.  There can be unlimited number
# of patterns, type fields are four: "source", "destination", "via",
# and "data".  These patterns can be used in addition to built-in
# hard-coded reject rules listed in documentation.
#
#   ax25-reject-filter source      "^NOCALL"
#   ax25-reject-filter destination "^NOCALL"
#   ax25-reject-filter via         "^NOGATE"
#   ax25-reject-filter data        "^\\?"
#
# Source interfaces from which the IGATE functionality feeds the data out
# By default it feeds from all configured <interface>s.
#
#   source   IFCALL-1
#   source   IFCALL-2
#</rx-igate>


# ***********  Multiple <digipeater>  definitions follow   *********

#  The digipeater definitions tell transmitters that receive
#  AX.25 packets from possibly multiple sources, and then what
#  to do on the AX.25 headers of those messages.
#
#  There is one transmitter per digipeater -- and inversely, there
#  can be at most one digipeater for each transmitter.
#
#  In each digipeater there is at least one <source>, usually same
#  as the transmitter.  You may use same <source> on multiple
#  <digipeater>s. Using multiple instances of same <source> on
#  a single <digipeater> does not crash the system, but it can cause
#  packet duplication in case of non-APRS protocols (like AX.25 CONS)
#
#  Use only at most two levels of viscous-delay in your <digipeater>.
#  Immediate sending is by "0", and a delayed sending is any value
#  from 1 to 9.  This system does not correctly support other than
#  immediate sending and one level of delay.
#
#  Note: In order to igate correct when multiple receivers and
#        transmitters are used on single channel, the <interface>
#        definitions of each radio port must have associated
#        "igate-group N" parameter which has N of value 1 to 3.
#        See the aprx-manual.pdf for details.
#        (Default software compilation allows you to have up to
#         three channels of APRS operation.)
#
#
#<digipeater>
#    transmitter  TXCALL-1
#    #ratelimit      60 120      # default: average 60 packets/minute,
#    #                           #          burst max 120 packets/minute
#    #srcratelimit   10 20       # Example: by sourcecall:
#                                #          average 10 packets/minute,
#                                #          burst max 20 packets/minute
#
#    #<trace>
#    #    maxreq     4
#    #    maxdone    4
#    #    keys       TRACE,WIDE,RELAY
#    #</trace>
#    #<wide>
#    #    maxreq     4
#    #    maxdone    4
#    #    keys       WIDE
#    #</wide>
#
#    <source>
#        interface   TXCALL-1
#    #   ratelimit      60 120      # default: average 60 packets/minute,
#    #                              #          burst max 120 packets/minute
#    #   #relay-type    digipeat # default mode is "digipeat"
#    #   viscous-delay    0      # default: no viscous delay
#    #   #regex-filter  source       "RE-pattern" # can define multiple patterns
#    #   #regex-filter  destination  "RE-pattern" # --"--; generic
#    #   #regex-filter  via          "RE-pattern" # --"--; generic VIA
#    #   #regex-filter  data         "RE-pattern" # --"--; APRS payload
#    #	 ##filter      "javAPRSSrvr adjunct filters"
#    </source>
#
#    #<source>                   # Extra receiver(s)
#    #   interface   RXCALL-1
#    #   ratelimit      60 120      # default: average 60 packets/minute,
#    #                              #          burst max 120 packets/minute
#    #   #relay-type    digipeat # default mode is "digipeat"
#    #   #regex-filter  source       "RE-pattern" # can define multiple patterns
#    #   #regex-filter  destination  "RE-pattern" # --"--; generic
#    #   #regex-filter  via          "RE-pattern" # --"--; generic VIA
#    #   #regex-filter  data         "RE-pattern" # --"--; APRS payload
#    #	 ##filter      "javAPRSSrvr adjunct filters"
#    #</source>
#
#    #<source>                  # APRSIS source makes this tx-igate
#    #   interface    APRSIS
#    #   ratelimit      60 120      # default: average 60 packets/minute,
#    #                              #          burst max 120 packets/minute
#    #   relay-type   third-party  # Must define this for APRSIS source!
#    #   viscous-delay 5      # recommendation: 5 seconds delay to give
#    #                        # RF delivery time make itself known.
#    #   #via-path    WIDE2-2 # You can define a via-path for this source
#    #</source>
#
#    #<source>              # DPRS source makes this DPRS->APRS RF gate
#    #   interface    DPRS
#    #   ratelimit    60 120       # default: average 60 packets/minute,
#    #                             #          burst max 120 packets/minute
#    #   relay-type   third-party  # Must define this for DPRS source!
#    #   #viscous-delay 5     # recommendation: 5 seconds delay to give
#    #                        # RF delivery time make itself known.
#    #   #via-path    WIDE2-2 # You can define a via-path for this source
#    #</source>
#
#</digipeater>

