1// Copyright 2014 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5package ipv4 6 7func (f *icmpFilter) accept(typ ICMPType) { 8 f.Data &^= 1 << (uint32(typ) & 31) 9} 10 11func (f *icmpFilter) block(typ ICMPType) { 12 f.Data |= 1 << (uint32(typ) & 31) 13} 14 15func (f *icmpFilter) setAll(block bool) { 16 if block { 17 f.Data = 1<<32 - 1 18 } else { 19 f.Data = 0 20 } 21} 22 23func (f *icmpFilter) willBlock(typ ICMPType) bool { 24 return f.Data&(1<<(uint32(typ)&31)) != 0 25} 26