##-- EBNF --##

#Interface Test Config File
#==========================
#Comment
disable; #the mcporxy quits if it sees this command. 


#choose a protocol
protocol IGMPv3; #MLDv1 | MLDv2 | IGMPv1 | IGMPv2 | IGMPv3

#configure a proxy instance
#upstream interface name:= uif_name
#downstream interface name:= dif_name
#pinstance <proxy instance name>: <uif_name 1> <uif_name 2> ... <uif_name N> ==> <dif_name 1> <dif_name 2> ... <dif_name N>;
pinstance 1:                 eth0 eth1 eth3 ==> eth4 eth5 eth10; #first upstream has the highest priority
pinstance MyLocalInstance:      wlan0 wlan1 ==> dummy0 eth6 dummy1;
pinstance testLocal:                     lo ==> eth7;
pinstance quierer_only:                     ==> eth8;
pinstance split(10):                tunU1 tunU2 ==> tunD1 tunD2; #proxy instance of the name split gets the multicast routing table number 10

#define forwarding rules for an interfaces
# table [<table name>] {(group | source) (group | source) ... };
table 1 {
  (239.99.99.99 | *)
  (* |  1.1.1.1/12)            
};

table local {
  (240.0.0.0 - 241.0.0.0 | 192.168.123.0/24) 
  (240.0.0.0 - 241.0.0.0 | 192.168.2.0 - 192.168.2.55) 
};

table allow_PC_1 {
  (* | 3.3.3.3)
};

table xxx {
  (table allow_PC_1)
  (table {(* | *) ( table allow_PC_1)})
};

table allways {
  (* | *)
};

#pinstance  <proxy instance name> (upstream | downstream) <uif_name> [in | out] [whitelist | blacklist] table <table name>;
pinstance 1 upstream eth0 out whitelist table 1; #forward traffic of a few sources and the entire traffic of the group 239.99.99.99 from to the upstream interface eth0 (an subscribe groups)
#pinstance 1 upstream eth0 in whitelist table {* | *}; #default behaviour, receive all multicast traffic
pinstance 1 upstream eth1 out whitelist table local; #forward traffic of a few sources how are sending to the range of groups 240.0.0.0 - 241.0.0.0
pinstance 1 upstream eth3 out whitelist table allways; #defined as default interface, this rule will always be true 
pinstance 1 downstream eth5 out whitelist table allow_PC_1; #only PC 1 with IP 1.1.1.1 can subscribe groups (all subscribed groups will be maintained but not forwarded)
pinstance 1 downstream eth4 out whitelist table {(* | 192.168.5.0/24)}; #all interfaces of the subnet 192.168.5.0/24 are allowed to use the proxy 
pinstance 1 downstream eth4 in blacklist table allways; #the interface eth4 will ignore all sources from the downstream side

pinstance MyLocalInstance upstream wlan0 out blacklist table xxx; #ignore 1.1.1.1 and allow all other sources pinstance MyLocalInstance upstream wlan1 out blacklist all; #interface is unused
pinstance MyLocalInstance upstream wlan1 in blacklist table allways; #interface is unused

pinstance split upstream tunU1 out whitelist table {tunD1(* | *)};
pinstance split upstream tunU2 out whitelist table {tunD2(* | *)};
#pinstance split upstream tunU1 in whitelist table {(* | *)}; #default
#pinstance split upstream tunU2 in whitelist table {(* | *)}; #default
pinstance split downstream tunD1 out whitelist table {tunU1(* | *)};
pinstance split downstream tunD2 out whitelist table {tunU2(* | *)};
#pinstance split downstream tunD1 in whitelist table {(* | *)}; #default
#pinstance split downstream tunD2 in whitelist table {(* | *)};

#
#       (a)    |            
#        ^  |  v            # | action                                                                           | rule type
#        |  | (b)          ---+----------------------------------------------------------------------------------+-----------
#           |               a | forward data to the upstream x                                                   | out
#      +----+----+          b | subscribe merged groups at the upstream x and receive data                       | in
#      |    x    |          c | receive data at the downstream z                                                 | in
#      | y     z |          d | forward data to the downstream z and use its querier state for group aggregation | out
#      +---------+            |                                                                                  |
#       /       \          
#      /         \  (c)<--      
#     /           \  -->(d)      
#
#


#Multiple Upstream rule matching
#===============================
#pinstance  <proxy instance name> (upstream | downstream) * [in | out] rulematching [all, first, mutex];
#the interface name is unimportant (this rule is global for all upstream per proxy instance)
#pinstance A upstream * out rulematching all; #default 
#pinstance A upstream * in rulematching first; #default 
#
#    rule matching | type            | action
#    --------------+-----------------+-------------
#     upstream out | all (default)   | forward data to all upstreams with appropriate rules
#                  |                 |    
#                  | first           | forward data only to the first upstream with an appropriate rule
#    --------------+-----------------+-------------              
#     upstream in  | first (default) | subscribe merged groups only at the first upstream with an appropriate rule, 
#                  |                 | like a reverse path filter corresponding multicast data will be received only at this interface
#                  |                 |
#                  | mutex <timeout> | subscribe merged groups at all upstreams with an appropriate rule, if the mcproxy receives this data
#                  |                 | from one interfaces all other upstream interfaces unsubscribes this group.
#                  |                 | After a timeout of X milliseconds the checks if data sill arrive at this interface if not the mcproxy
#                  |                 | subscribes this group at all upstream again 
#                  
