OSDN Git Service

new repo
[bytom/vapor.git] / vendor / golang.org / x / net / ipv4 / icmp_linux.go
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
5 package ipv4
6
7 func (f *icmpFilter) accept(typ ICMPType) {
8         f.Data &^= 1 << (uint32(typ) & 31)
9 }
10
11 func (f *icmpFilter) block(typ ICMPType) {
12         f.Data |= 1 << (uint32(typ) & 31)
13 }
14
15 func (f *icmpFilter) setAll(block bool) {
16         if block {
17                 f.Data = 1<<32 - 1
18         } else {
19                 f.Data = 0
20         }
21 }
22
23 func (f *icmpFilter) willBlock(typ ICMPType) bool {
24         return f.Data&(1<<(uint32(typ)&31)) != 0
25 }