3Com 2200 Switch User Manual


 
Creating Packet Filters 12-13
The pseudocode translates into the following packet filter:
Name “IP XNS ticker bcast filter”
# Assign this filter in the multicast path
# of a port only--this is very important
#
# XNS FILTERING SECTION
#
pushField.w 12 # get the type field of the packet and
# place it on top of the stack.
pushLiteral.w 0x0600 # put the type value for XNS on top of
# the stack.
eq # if the two values on the top of the
# stack are equal, then return a non-zero
# value.
pushLiteral.w 0x76c # put the lowest socket value on top of
# the stack.
pushField.w 30 # put the value of the socket from the
# packet on top of the stack.
ge # compare if the value of the socket is
# greater than or equal to lower bound.
pushLiteral.w 0x0898 # put the highest socket value on top of
# the stack.
pushField.w 30 # put the value of the socket from the
# packet on top of the stack.
lt # compare if the value of the socket is
# less than the upper bound
and # “and” together with “ge” and “lt” test
# to determine if the socket value is
# “within” the range. If it is, a “one”
# will be placed on the stack.
and # compare if XNS & in range
#
# IP FILTERING SECTION
#
pushField.w 12 # get the type field of the packet and
# place it on top of the stack.
pushLiteral.w 0x0800 # put the type value for IP on top of
# the stack.
eq # if the two values on the top of the
# stack are equal, then return a non-zero
# value.
pushLiteral.w 0x76c # put the lowest socket value on top of
# the stack (1900).
pushField.w 24 # put the value of the socket from the
# packet on top of the stack.
ge # compare if the value of the socket is
# greater than or equal to lower bound.
pushLiteral.w 0x0898 # put the highest socket value on top of
# the stack (2200).
pushField.w 24 # put the value of the socket from the
# packet on top of the stack.
lt # compare if the value of the socket is
# less than the upper bound
and # “and” together with “ge” and “lt”.
# test to determine if the socket value is
# “within” the range. If it is in range, a
# “one” will be placed on the stack.
and # compare if IP and in range.
or # determine if the type field is either
# XNS or IP.
not # discard if (IP & in range) and (XNS & in
# range).