
port_group = {22, 80, 119, 20}

# destination port matches
pass in quick proto tcp from any to self port = 22
pass in quick proto tcp from any to self port 22
pass in quick proto tcp from any to self port != 22
pass in quick proto tcp from any to self port < 1024
pass in quick proto tcp from any to self port <= 1024
pass in quick proto tcp from any to self port > 1024
pass in quick proto tcp from any to self port >= 1024
pass in quick proto tcp from any to self port $port_group

pass in quick proto tcp from any to self port ssh
pass in quick proto tcp from any to self port smtp
pass in quick proto tcp from any to self port www
pass in quick proto tcp from any to self port https
pass in quick proto tcp from any to self port ntp
pass in quick proto tcp from any to self port ftp
pass in quick proto tcp from any to self port ftp-data
pass in quick proto udp from any to self port domain

# source port matches
pass in quick proto tcp from any port = 22         to self 
pass in quick proto tcp from any port 22           to self 
pass in quick proto tcp from any port != 22        to self 
pass in quick proto tcp from any port < 1024       to self 
pass in quick proto tcp from any port <= 1024      to self 
pass in quick proto tcp from any port > 1024       to self 
pass in quick proto tcp from any port >= 1024      to self 
pass in quick proto tcp from any port $port_group  to self 
                                                           
pass in quick proto tcp from any port ssh          to self 
pass in quick proto tcp from any port smtp         to self 
pass in quick proto tcp from any port www          to self 
pass in quick proto tcp from any port https        to self 
pass in quick proto tcp from any port ntp          to self 
pass in quick proto tcp from any port ftp          to self 
pass in quick proto tcp from any port ftp-data     to self 
pass in quick proto udp from any port domain       to self 

# port ranges
pass in quick proto tcp from any to self port 1000:1010
pass in quick proto tcp from any to self port 1000><1010
pass in quick proto tcp from any to self port 1000<>1010

pass in quick proto tcp from any port 1000:1010    to self 
pass in quick proto tcp from any port 1000><1010   to self 
pass in quick proto tcp from any port 1000<>1010   to self 

# that difficult port range match
pass in quick proto tcp from any to self port 1024:65535

# combined source and destination port matches
pass in quick proto tcp from any port 1024:65535 to self port 22
pass in quick proto tcp from any port 1024:65535 to self port != 22
pass in quick proto tcp from any port 1024:65535 to self port < 1024
pass in quick proto tcp from any port 1024:65535 to self port <= 1024
pass in quick proto tcp from any port 1024:65535 to self port > 1024
pass in quick proto tcp from any port 1024:65535 to self port >= 1024
pass in quick proto tcp from any port 1024:65535 to self port 1000:1010
pass in quick proto tcp from any port 1024:65535 to self port 1000><1010
pass in quick proto tcp from any port 1024:65535 to self port 1000<>1010

pass in quick proto tcp from any port > 1024 to self port 22
pass in quick proto tcp from any port > 1024 to self port != 22
pass in quick proto tcp from any port > 1024 to self port < 1024
pass in quick proto tcp from any port > 1024 to self port <= 1024
pass in quick proto tcp from any port > 1024 to self port > 1024
pass in quick proto tcp from any port > 1024 to self port >= 1024
pass in quick proto tcp from any port > 1024 to self port 1000:1010
pass in quick proto tcp from any port > 1024 to self port 1000><1010
pass in quick proto tcp from any port > 1024 to self port 1000<>1010

pass in quick proto tcp from any port > 1024 to self port $port_group


pass in quick proto udp from any port { 10001, 10002, 10003 } to \
                            self port { 20001, 20002, 20003 }

pass in quick proto udp from any port { 10001, 10002, 10003 } to \
                            self port { 20000:20020, 20030:20040 }

pass in quick proto udp from any port { 10000:10010, 10030:10040 } to \
                            self port { 20000:20020, 20030:20040 }

pass in quick proto udp from any port { <1024 , >10030 } to \
                            self port { 20000:20020, 20030:20040 }

